mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
* Extend the memory available for the heap from 256k to 512k.
* Embed the stack into the bss section for loader and netboot. This is required for netboot since otherwise the stack would be inside our heap. * Install loader and netboot in /boot by default. * Fix getbootfile so that it searches for a ',' instead of a ';' when terminating the filename.
This commit is contained in:
parent
1f2edded90
commit
06feb69276
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40793
@ -6,5 +6,3 @@ DPADD+= ${DESTDIR}/${LIBDIR}/libstand.a
|
||||
LIBSTANDDIR= ${.CURDIR}/../../../../lib/libstand
|
||||
LIBSTAND= -lstand
|
||||
LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a
|
||||
|
||||
BINDIR= /usr/mdec
|
||||
|
@ -15,6 +15,7 @@ CFLAGS+= -I${.CURDIR}/..
|
||||
CFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS} -DMINIMAL
|
||||
NOMAN=1
|
||||
STRIP=
|
||||
BINDIR?= /usr/mdec
|
||||
|
||||
BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS}
|
||||
|
||||
@ -36,10 +37,9 @@ ${PROG}: ${PROG}.nosym
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
start.o: ${.CURDIR}/../libalpha/start.S
|
||||
${CC} -c -DPRIMARY_BOOTBLOCK $<
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
||||
${PROG}.sym: ${OBJS} ${LIBKERN}
|
||||
${LD} -M -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym ${OBJS} \
|
||||
${LIBSTAND} ${LIBALPHA} ${LIBSTAND} > ${.OBJDIR}/${PROG}.list
|
||||
size ${PROG}.sym
|
||||
|
||||
|
@ -30,6 +30,7 @@ CFLAGS+= -I${LIBSTANDDIR}
|
||||
CFLAGS+= -I${.CURDIR}/..
|
||||
CRT= start.o
|
||||
STRIP=
|
||||
BINDIR?= /boot
|
||||
|
||||
all: ${BASE}
|
||||
|
||||
@ -47,7 +48,7 @@ ${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
|
||||
|
||||
# Other fragments still to be brought in from ../Makfile.booters?
|
||||
start.o: ${.CURDIR}/../libalpha/start.S
|
||||
${CC} -c $<
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
||||
setdef0.o: setdefs.h
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.6 1998/10/19 09:12:41 dfr Exp $
|
||||
* $Id: main.c,v 1.7 1998/10/24 00:31:21 msmith Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -63,6 +63,50 @@ memsize()
|
||||
return total;
|
||||
}
|
||||
|
||||
static void
|
||||
extend_heap()
|
||||
{
|
||||
struct rpb *hwrpb = (struct rpb *)HWRPB_ADDR;
|
||||
struct mddt *mddtp;
|
||||
struct mddt_cluster *memc;
|
||||
int i;
|
||||
unsigned long total = 0;
|
||||
unsigned long startpfn;
|
||||
vm_offset_t startva;
|
||||
vm_offset_t startpte;
|
||||
|
||||
/*
|
||||
* Find the last usable memory cluster and add some of its pages
|
||||
* to our address space. The 256k allowed by the firmware isn't quite
|
||||
* adequate for our needs.
|
||||
*/
|
||||
mddtp = (struct mddt *)(((caddr_t)hwrpb) + hwrpb->rpb_memdat_off);
|
||||
for (i = mddtp->mddt_cluster_cnt - 1; i >= 0; i--) {
|
||||
memc = &mddtp->mddt_clusters[i];
|
||||
if (!(memc->mddt_usage & (MDDT_NONVOLATILE | MDDT_PALCODE)))
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* We want to extend the heap from 256k to 512k. With 8k pages
|
||||
* (assumed), we need 32 pages. We take pages from the end of the
|
||||
* last usable memory region, taking care to avoid the memory used
|
||||
* by the kernel's message buffer. We allow 4 pages for the
|
||||
* message buffer.
|
||||
*/
|
||||
startpfn = memc->mddt_pfn + memc->mddt_pg_cnt - 4 - 32;
|
||||
startva = 0x20040000;
|
||||
startpte = 0x40000000
|
||||
+ (((startva >> 23) & 0x3ff) << PAGE_SHIFT)
|
||||
+ (((startva >> 13) & 0x3ff) << 3);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
u_int64_t pte;
|
||||
pte = ((startpfn + i) << 32) | 0x1101;
|
||||
*(u_int64_t *) (startpte + 8 * i) = pte;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
@ -74,16 +118,16 @@ main(void)
|
||||
* alloc() is usable. The stack is buried inside us, so this is
|
||||
* safe.
|
||||
*/
|
||||
setheap((void *)end, (void *)0x20040000);
|
||||
extend_heap();
|
||||
setheap((void *)end, (void *)0x20080000);
|
||||
|
||||
#ifdef LOADER
|
||||
/*
|
||||
* If this is the two stage disk loader, add the memory used by
|
||||
* the first stage to the heap.
|
||||
*/
|
||||
#define STACK_SIZE 16384
|
||||
free_region((void *)PRIMARY_LOAD_ADDRESS,
|
||||
(void *)SECONDARY_LOAD_ADDRESS - STACK_SIZE);
|
||||
(void *)SECONDARY_LOAD_ADDRESS);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: srmdisk.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -63,6 +63,7 @@ static int bd_init(void);
|
||||
static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize);
|
||||
static int bd_open(struct open_file *f, void *vdev);
|
||||
static int bd_close(struct open_file *f);
|
||||
static void bd_print(int verbose);
|
||||
|
||||
struct open_disk {
|
||||
int od_fd;
|
||||
@ -84,7 +85,8 @@ struct devsw srmdisk = {
|
||||
bd_strategy,
|
||||
bd_open,
|
||||
bd_close,
|
||||
noioctl
|
||||
noioctl,
|
||||
bd_print
|
||||
};
|
||||
|
||||
/*
|
||||
@ -119,6 +121,23 @@ bd_init(void)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print information about disks
|
||||
*/
|
||||
static void
|
||||
bd_print(int verbose)
|
||||
{
|
||||
int i;
|
||||
char line[80];
|
||||
|
||||
for (i = 0; i < nbdinfo; i++) {
|
||||
sprintf(line, " disk%d: SRM drive %s", i, bdinfo[i].bd_name);
|
||||
pager_output(line);
|
||||
/* XXX more detail? */
|
||||
pager_output("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to open the disk described by (dev) for use by (f).
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: start.S,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
|
||||
* From: $NetBSD: start.S,v 1.4 1998/03/28 00:54:15 cgd Exp $
|
||||
*/
|
||||
|
||||
@ -51,16 +51,15 @@ NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
|
||||
Lstartgp:
|
||||
LDGP(pv)
|
||||
|
||||
#ifndef PRIMARY_BOOTBLOCK
|
||||
lda sp,start /* start stack below text */
|
||||
lda sp,-ENTRY_FRAME(sp)
|
||||
#endif
|
||||
|
||||
lda a0,_edata
|
||||
lda a1,_end
|
||||
subq a1,a0,a1
|
||||
CALL(bzero)
|
||||
|
||||
#if defined(NETBOOT) || defined(LOADER)
|
||||
lda sp,stack + 8192 - ENTRY_FRAME
|
||||
#endif
|
||||
|
||||
CALL(main) /* transfer to C */
|
||||
|
||||
XLEAF(_rtt, 0)
|
||||
@ -83,3 +82,7 @@ LEAF(cpu_number, 0)
|
||||
call_pal PAL_VMS_mfpr_whami
|
||||
RET
|
||||
END(cpu_number)
|
||||
|
||||
#if defined(NETBOOT) || defined(LOADER)
|
||||
BSS(stack, 8192)
|
||||
#endif
|
||||
|
@ -28,6 +28,7 @@ CFLAGS+= -I${LIBSTANDDIR}
|
||||
CFLAGS+= -I${.CURDIR}/..
|
||||
CRT= start.o
|
||||
STRIP=
|
||||
BINDIR?= /boot
|
||||
|
||||
all: ${BASE}
|
||||
|
||||
@ -48,7 +49,7 @@ ${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
|
||||
vers.o ${LIBSTAND} ${LIBALPHA} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
|
||||
|
||||
start.o: ${.CURDIR}/../libalpha/start.S
|
||||
${CC} -c -DPRIMARY_BOOTBLOCK $<
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
||||
setdef0.o: setdefs.h
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: boot.c,v 1.7 1998/10/14 00:41:17 peter Exp $
|
||||
* $Id: boot.c,v 1.8 1998/10/31 02:53:09 msmith Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -247,7 +247,7 @@ getbootfile(int try)
|
||||
try--;
|
||||
}
|
||||
if (spec != NULL) {
|
||||
if ((ep = strchr(spec, ';')) != NULL) {
|
||||
if ((ep = strchr(spec, ',')) != NULL) {
|
||||
len = ep - spec;
|
||||
} else {
|
||||
len = strlen(spec);
|
||||
|
Loading…
Reference in New Issue
Block a user