diff --git a/sys/boot/i386/btx/btx/Makefile b/sys/boot/i386/btx/btx/Makefile index 9784aed..236d269 100644 --- a/sys/boot/i386/btx/btx/Makefile +++ b/sys/boot/i386/btx/btx/Makefile @@ -11,7 +11,7 @@ BOOT_BTX_FLAGS=0x1 BOOT_BTX_FLAGS=0x0 .endif -CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} -DLOCORE +CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} CFLAGS+=-I${.CURDIR}/../../common .if defined(BTX_SERIAL) diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile index 7378e92..b76468b 100644 --- a/sys/boot/i386/btx/btxldr/Makefile +++ b/sys/boot/i386/btx/btxldr/Makefile @@ -5,7 +5,7 @@ INTERNALPROG= NO_MAN= SRCS= btxldr.S -CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} -DLOCORE +CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} CFLAGS+=-I${.CURDIR}/../../common .if defined(BTXLDR_VERBOSE) diff --git a/sys/boot/i386/btx/btxldr/btxldr.S b/sys/boot/i386/btx/btxldr/btxldr.S index 4d00d61..3a58210 100644 --- a/sys/boot/i386/btx/btxldr/btxldr.S +++ b/sys/boot/i386/btx/btxldr/btxldr.S @@ -103,7 +103,7 @@ start.1: movl (%ebx),%eax # Get argument and movl BI_OFF+4(%esp),%esi # Source: bootinfo cmpl $0x0, %esi # If the bootinfo pointer je start_null_bi # is null, don't copy it - movl $BI_SIZE,%ecx # Allocate space + movl BI_SIZE(%esi),%ecx # Allocate space subl %ecx,%ebp # for bootinfo movl %ebp,%edi # Destination rep # Copy diff --git a/sys/boot/i386/btx/lib/Makefile b/sys/boot/i386/btx/lib/Makefile index 08c04d8..856d868 100644 --- a/sys/boot/i386/btx/lib/Makefile +++ b/sys/boot/i386/btx/lib/Makefile @@ -4,7 +4,6 @@ PROG= crt0.o INTERNALPROG= NO_MAN= SRCS= btxcsu.S btxsys.s btxv86.s -CFLAGS+=-DLOCORE CFLAGS+=-I${.CURDIR}/../../common LDFLAGS=-Wl,-r diff --git a/sys/boot/i386/common/bootargs.h b/sys/boot/i386/common/bootargs.h index e90e342..510efdd 100644 --- a/sys/boot/i386/common/bootargs.h +++ b/sys/boot/i386/common/bootargs.h @@ -23,17 +23,17 @@ #define KARGS_FLAGS_ZFS 0x4 #define KARGS_FLAGS_EXTARG 0x8 /* variably sized extended argument */ -#define BI_SIZE 72 /* struct bootinfo fixed size */ -#define BA_SIZE 24 /* struct bootargs fixed size */ -#define HT_OFF 0 /* offset of howto in bootargs */ -#define BF_OFF 8 /* offset of bootflags in bootargs */ -#define BI_OFF 20 /* offset of bootinfo in bootargs */ +#define BI_SIZE 48 /* offsetof(struct bootinfo, bi_size) */ +#define BA_SIZE 24 /* sizeof(struct bootargs) */ +#define HT_OFF 0 /* offsetof(struct bootargs, howto) */ +#define BF_OFF 8 /* offsetof(struct bootargs, bootflags) */ +#define BI_OFF 20 /* offsetof(struct bootargs, bootinfo) */ -#define ARGSPACE 0x1000 /* size of the BTX args area */ -#define ARGOFF 0x800 /* args offset within the args area */ -#define ARGADJ (ARGSPACE - ARGOFF) +#define ARGSPACE 0x1000 /* total size of the BTX args area */ +#define ARGOFF 0x800 /* actual args offset within the args area */ +#define ARGADJ (ARGSPACE - ARGOFF) -#ifndef LOCORE +#ifndef __ASSEMBLER__ struct bootargs { @@ -56,6 +56,6 @@ struct bootargs */ }; -#endif /*LOCORE*/ +#endif /*__ASSEMBLER__*/ #endif /* !_BOOT_I386_ARGS_H_ */ diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c index 451b472..f32ece1 100644 --- a/sys/boot/i386/loader/main.c +++ b/sys/boot/i386/loader/main.c @@ -48,10 +48,13 @@ __FBSDID("$FreeBSD$"); #include "../zfs/libzfs.h" #endif +CTASSERT(sizeof(struct bootargs) == BA_SIZE); +CTASSERT(offsetof(struct bootargs, bootinfo) == BI_OFF); +CTASSERT(offsetof(struct bootargs, bootflags) == BF_OFF); +CTASSERT(offsetof(struct bootinfo, bi_size) == BI_SIZE); + /* Arguments passed in from the boot1/boot2 loader */ static struct bootargs *kargs; -CTASSERT(sizeof(struct bootargs) == BA_SIZE); -/*CTASSERT(sizeof(struct bootinfo) == BI_SIZE);*//*XXX*/ static u_int32_t initial_howto; static u_int32_t initial_bootdev;