summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2012-05-11 09:46:17 +0000
committerAndriy Gapon <avg@FreeBSD.org>2012-05-11 09:46:17 +0000
commit006d25ce1545fce8f433b412f3b86ad4b2778665 (patch)
tree234a271ea6dfc261cad9fad14a175823bc62b986
parent82242c11a6ae5aa01e3810cc5354c13ca1c985b5 (diff)
downloadsrc-test-006d25ce1545fce8f433b412f3b86ad4b2778665.tar.gz
src-test-006d25ce1545fce8f433b412f3b86ad4b2778665.zip
Notes
-rw-r--r--sys/boot/pc98/btx/btx/Makefile1
-rw-r--r--sys/boot/pc98/btx/btx/btx.S4
-rw-r--r--sys/boot/pc98/btx/btxldr/Makefile1
-rw-r--r--sys/boot/pc98/btx/btxldr/btxldr.S22
-rw-r--r--sys/boot/pc98/btx/lib/Makefile3
-rw-r--r--sys/boot/pc98/btx/lib/btxcsu.S (renamed from sys/boot/pc98/btx/lib/btxcsu.s)6
-rw-r--r--sys/boot/pc98/cdboot/Makefile4
-rw-r--r--sys/boot/pc98/cdboot/cdboot.S (renamed from sys/boot/pc98/cdboot/cdboot.s)7
-rw-r--r--sys/boot/pc98/loader/main.c18
9 files changed, 35 insertions, 31 deletions
diff --git a/sys/boot/pc98/btx/btx/Makefile b/sys/boot/pc98/btx/btx/Makefile
index d90e51f172210..22cd5d67866b8 100644
--- a/sys/boot/pc98/btx/btx/Makefile
+++ b/sys/boot/pc98/btx/btx/Makefile
@@ -12,6 +12,7 @@ BOOT_BTX_FLAGS=0x0
.endif
CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS}
+CFLAGS+=-I${.CURDIR}/../../../i386/common
.if defined(BTX_SERIAL)
BOOT_COMCONSOLE_PORT?= 0x238
diff --git a/sys/boot/pc98/btx/btx/btx.S b/sys/boot/pc98/btx/btx/btx.S
index 95788d4f8fae0..ceed5a69e50c0 100644
--- a/sys/boot/pc98/btx/btx/btx.S
+++ b/sys/boot/pc98/btx/btx/btx.S
@@ -15,6 +15,8 @@
* $FreeBSD$
*/
+#include <bootargs.h>
+
/*
* Memory layout.
*/
@@ -205,7 +207,7 @@ init.8: xorl %ecx,%ecx # Zero
andl $0x7,%eax
incl %eax
shll $0x11,%eax # To bytes
- subl $0x1000,%eax # Less arg space
+ subl $ARGSPACE,%eax # Less arg space
subl %edx,%eax # Less base
movb $SEL_UDATA,%cl # User data selector
pushl %ecx # Set SS
diff --git a/sys/boot/pc98/btx/btxldr/Makefile b/sys/boot/pc98/btx/btxldr/Makefile
index 56333e7f35e26..aef1685ebf25a 100644
--- a/sys/boot/pc98/btx/btxldr/Makefile
+++ b/sys/boot/pc98/btx/btxldr/Makefile
@@ -6,6 +6,7 @@ NO_MAN=
SRCS= btxldr.S
CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS}
+CFLAGS+=-I${.CURDIR}/../../../i386/common
.if defined(BTXLDR_VERBOSE)
CFLAGS+=-DBTXLDR_VERBOSE
diff --git a/sys/boot/pc98/btx/btxldr/btxldr.S b/sys/boot/pc98/btx/btxldr/btxldr.S
index 2104605b74362..683d6c8e6e422 100644
--- a/sys/boot/pc98/btx/btxldr/btxldr.S
+++ b/sys/boot/pc98/btx/btxldr/btxldr.S
@@ -20,6 +20,8 @@
* real thing should probably be more flexible, and in C.
*/
+#include <bootargs.h>
+
/*
* Memory locations.
*/
@@ -105,7 +107,7 @@ gdcwait.2: inb $0x60,%al
call hexout # stack
call putstr # pointer
movl $m_args,%esi # Format string
- leal 0x4(%esp,1),%ebx # First argument
+ leal 0x4(%esp),%ebx # First argument
movl $0x6,%ecx # Count
start.1: movl (%ebx),%eax # Get argument and
addl $0x4,%ebx # bump pointer
@@ -113,24 +115,28 @@ start.1: movl (%ebx),%eax # Get argument and
loop start.1 # Till done
call putstr # End message
#endif
- movl $0x48,%ecx # Allocate space
- subl %ecx,%ebp # for bootinfo
- movl 0x18(%esp,1),%esi # Source: bootinfo
+ movl BA_BOOTINFO+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(%esi),%ecx # Allocate space
+ subl %ecx,%ebp # for bootinfo
movl %ebp,%edi # Destination
rep # Copy
movsb # it
- movl %ebp,0x18(%esp,1) # Update pointer
+ movl %ebp,BA_BOOTINFO+4(%esp) # Update pointer
+ movl %edi,%ebp # Restore base pointer
#ifdef BTXLDR_VERBOSE
movl $m_rel_bi,%esi # Display
movl %ebp,%eax # bootinfo
call hexout # relocation
call putstr # message
#endif
-start_null_bi: movl $0x18,%ecx # Allocate space
- subl %ecx,%ebp # for arguments
- leal 0x4(%esp,1),%esi # Source
+start_null_bi: movl $BOOTARGS_SIZE,%ecx # Fixed size of arguments
+ testl $KARGS_FLAGS_EXTARG, BA_BOOTFLAGS+4(%esp) # Check for extra data
+ jz start_fixed # Skip if the flag is not set
+ addl BOOTARGS_SIZE+4(%esp),%ecx # Add size of variable args
+start_fixed: subl $ARGOFF,%ebp # Place args at fixed offset
+ leal 0x4(%esp),%esi # Source
movl %ebp,%edi # Destination
rep # Copy
movsb # them
diff --git a/sys/boot/pc98/btx/lib/Makefile b/sys/boot/pc98/btx/lib/Makefile
index 8fab66a541af0..151fc8fc8a12f 100644
--- a/sys/boot/pc98/btx/lib/Makefile
+++ b/sys/boot/pc98/btx/lib/Makefile
@@ -3,7 +3,8 @@
PROG= crt0.o
INTERNALPROG=
NO_MAN=
-SRCS= btxcsu.s btxsys.s btxv86.s
+SRCS= btxcsu.S btxsys.s btxv86.s
+CFLAGS+=-I${.CURDIR}/../../../i386/common
LDFLAGS=-Wl,-r
.include <bsd.prog.mk>
diff --git a/sys/boot/pc98/btx/lib/btxcsu.s b/sys/boot/pc98/btx/lib/btxcsu.S
index 6a006596295f5..8af6ad626aa6a 100644
--- a/sys/boot/pc98/btx/lib/btxcsu.s
+++ b/sys/boot/pc98/btx/lib/btxcsu.S
@@ -19,15 +19,13 @@
# BTX C startup code (ELF).
#
+#include <bootargs.h>
+
#
# Globals.
#
.global _start
#
-# Constants.
-#
- .set ARGADJ,0xfa0 # Argument adjustment
-#
# Client entry point.
#
_start: cld
diff --git a/sys/boot/pc98/cdboot/Makefile b/sys/boot/pc98/cdboot/Makefile
index ce11d7bb60aa2..eec1328fb3a08 100644
--- a/sys/boot/pc98/cdboot/Makefile
+++ b/sys/boot/pc98/cdboot/Makefile
@@ -4,7 +4,9 @@ PROG= cdboot
STRIP=
BINMODE=${NOBINMODE}
NO_MAN=
-SRCS= ${PROG}.s
+SRCS= ${PROG}.S
+
+CFLAGS+=-I${.CURDIR}/../../i386/common
ORG= 0x0000
diff --git a/sys/boot/pc98/cdboot/cdboot.s b/sys/boot/pc98/cdboot/cdboot.S
index b6efeef646719..a6508e2ffdf4f 100644
--- a/sys/boot/pc98/cdboot/cdboot.s
+++ b/sys/boot/pc98/cdboot/cdboot.S
@@ -30,6 +30,8 @@
# $FreeBSD$
+#include <bootargs.h>
+
#
# Basically, we first create a set of boot arguments to pass to the loaded
# binary. Then we attempt to load /boot/loader from the CD we were booted
@@ -82,11 +84,6 @@
.set AOUT_ENTRY,0x14 # entry point
.set AOUT_HEADER,MEM_PAGE_SIZE # size of the a.out header
#
-# Flags for kargs->bootflags
-#
- .set KARGS_FLAGS_CD,0x1 # flag to indicate booting from
- # CD loader
-#
# Segment selectors.
#
.set SEL_SDATA,0x8 # Supervisor data
diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c
index 15b132f11f4bc..27a8c9752ba85 100644
--- a/sys/boot/pc98/loader/main.c
+++ b/sys/boot/pc98/loader/main.c
@@ -33,29 +33,25 @@ __FBSDID("$FreeBSD$");
*/
#include <stand.h>
+#include <stddef.h>
#include <string.h>
#include <machine/bootinfo.h>
#include <sys/param.h>
#include <sys/reboot.h>
#include "bootstrap.h"
+#include "common/bootargs.h"
#include "libi386/libi386.h"
#include "libpc98/libpc98.h"
#include "btxv86.h"
-#define KARGS_FLAGS_CD 0x1
-#define KARGS_FLAGS_PXE 0x2
+CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE);
+CTASSERT(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO);
+CTASSERT(offsetof(struct bootargs, bootflags) == BA_BOOTFLAGS);
+CTASSERT(offsetof(struct bootinfo, bi_size) == BI_SIZE);
/* Arguments passed in from the boot1/boot2 loader */
-static struct
-{
- u_int32_t howto;
- u_int32_t bootdev;
- u_int32_t bootflags;
- u_int32_t pxeinfo;
- u_int32_t res2;
- u_int32_t bootinfo;
-} *kargs;
+static struct bootargs *kargs;
static u_int32_t initial_howto;
static u_int32_t initial_bootdev;