summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-08-13 04:03:31 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-08-13 04:03:31 +0000
commit8f1e2faf3b28ce1146c187c22314e213eabafc2e (patch)
tree6d75e7a50687e28224d41f0771a626512338f7bc /sys/arch/i386
parentdc838e4b20aca8fda46e1433689baea44e2e37dc (diff)
split off START into LINKADDR and LOADADDR (we will need reloctable boot)
BOOTREL as a linear address, not segment one more heap (;
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/stand/Makefile.inc15
-rw-r--r--sys/arch/i386/stand/biosboot/Makefile6
-rw-r--r--sys/arch/i386/stand/biosboot/biosboot.S18
-rw-r--r--sys/arch/i386/stand/boot/Makefile12
-rw-r--r--sys/arch/i386/stand/libsa/Makefile10
-rw-r--r--sys/arch/i386/stand/libsa/gidt.S24
6 files changed, 47 insertions, 38 deletions
diff --git a/sys/arch/i386/stand/Makefile.inc b/sys/arch/i386/stand/Makefile.inc
index 326ef22e6d8..9ba16008078 100644
--- a/sys/arch/i386/stand/Makefile.inc
+++ b/sys/arch/i386/stand/Makefile.inc
@@ -1,11 +1,12 @@
-# $OpenBSD: Makefile.inc,v 1.13 1997/07/28 22:03:26 mickey Exp $
+# $OpenBSD: Makefile.inc,v 1.14 1997/08/13 04:03:27 mickey Exp $
-CFLAGS=-O -Wall -Werror
+CFLAGS=-O2 -Wall -Werror
CPPFLAGS=-I${S} -I${SADIR}/libsa -I. -I${.CURDIR}
SACFLAGS=-nostdinc -fpack-struct -fno-builtin -fomit-frame-pointer
SACFLAGS+=-D_STANDALONE
+# SACFLAGS+=-DBOOT_APM
# CPPFLAGS+=-DSAVE_MEMORY
-# DEBUGFLAGS+=-DDEBUG
+# DEBUGFLAGS=-DDEBUG
# DEBUGFLAGS+=-DGIDT_DEBUG
# DEBUGFLAGS+=-DBIOS_DEBUG
# DEBUGFLAGS+=-DEXEC_DEBUG
@@ -14,10 +15,12 @@ SACFLAGS+=-D_STANDALONE
# DEBUGFLAGS+=-DUNIX_DEBUG
# DEBUGFLAGS+=-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG
# DEBUGFLAGS+=-DNFS_DEBUG -DRPC_DEBUG -DRARP_DEBUG
-START=0x10000
-HEAP_LIMIT=0x50000
-BOOTREL=0x3000
+LINKADDR=0x10000
+LOADADDR=0x10000
+HEAP_LIMIT=0x60000
+BOOTREL=0x60000
BOOTMAGIC=0xdeadbeef
+#ROM_SIZE=32768
.if exists(${SADIR}/etc/assym.h)
CPPFLAGS+=-I${SADIR}/etc
diff --git a/sys/arch/i386/stand/biosboot/Makefile b/sys/arch/i386/stand/biosboot/Makefile
index 7d5b9205304..78f87ed9bb2 100644
--- a/sys/arch/i386/stand/biosboot/Makefile
+++ b/sys/arch/i386/stand/biosboot/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 1997/06/23 23:45:15 kstailey Exp $
+# $OpenBSD: Makefile,v 1.9 1997/08/13 04:03:28 mickey Exp $
PROG= biosboot
SRCS= biosboot.S
@@ -21,5 +21,5 @@ ${PROG}: $(OBJS) $(DPADD)
.include <bsd.prog.mk>
-CPPFLAGS+=-DSTART=$(START) -DBOOTMAGIC=$(BOOTMAGIC) -DBOOTREL=$(BOOTREL)
-# AFLAGS+=-Wa,-a
+CPPFLAGS+=-DLOADADDR=$(LOADADDR) -DBOOTMAGIC=$(BOOTMAGIC) -DBOOTREL=$(BOOTREL)
+#AFLAGS+=-Wa,-a
diff --git a/sys/arch/i386/stand/biosboot/biosboot.S b/sys/arch/i386/stand/biosboot/biosboot.S
index 7abb430d10a..aa033a17c18 100644
--- a/sys/arch/i386/stand/biosboot/biosboot.S
+++ b/sys/arch/i386/stand/biosboot/biosboot.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosboot.S,v 1.14 1997/08/07 09:07:54 niklas Exp $ */
+/* $OpenBSD: biosboot.S,v 1.15 1997/08/13 04:03:28 mickey Exp $ */
.file "bootbios.S"
@@ -71,9 +71,9 @@ ebpb: .long 16 /* hidden sectors */
1: /* set up stack (%ss:%esp) */
cli /* disable interrupts w/o stack */
- # movw $BOOTREL, %ax
+ # movw $(BOOTREL >> 4), %ax
.byte 0xb8
- .word BOOTREL
+ .word BOOTREL >> 4
movl %ax, %ss
movl %ax, %es /* relocate there */
data32
@@ -94,7 +94,7 @@ ebpb: .long 16 /* hidden sectors */
/* jump to relocated code */
data32
- ljmp $BOOTREL, $2f
+ ljmp $(BOOTREL >> 4), $2f
1: .asciz "loading /boot"
2: DBGMSG(GO_RELOC)
@@ -105,9 +105,9 @@ ebpb: .long 16 /* hidden sectors */
popl %ds
/* set up %es, (where we will load /boot to) */
- # movw $(START >> 4), %ax
+ # movw $(LOADADDR >> 4), %ax
.byte 0xb8
- .word START >> 4
+ .word LOADADDR >> 4
movl %ax, %es
#ifdef SERIAL
@@ -227,7 +227,7 @@ ebpb: .long 16 /* hidden sectors */
* reload CS register
*/
data32
- ljmp $8, $1f+(BOOTREL << 4)
+ ljmp $8, $1f+BOOTREL
1: /*
* 32bit mode
@@ -248,7 +248,7 @@ ebpb: .long 16 /* hidden sectors */
pushl $BOOTMAGIC /* use some magic */
/* jmp /boot */
- ljmp $8, $(START + 0x20)
+ ljmp $8, $(LOADADDR + 0x20)
/* not reached */
/*
@@ -316,7 +316,7 @@ Lchr:
.byte 0xf | 0 | 0x40 | 0x80 # hilimit, xx, 32bit, 4k granularity
.byte 0 # hibase
Gdtr: .word . - 1b
- .long (BOOTREL << 4) + 1b
+ .long BOOTREL + 1b
.globl _block_table
_block_table:
diff --git a/sys/arch/i386/stand/boot/Makefile b/sys/arch/i386/stand/boot/Makefile
index c236bdbae8e..b38e8e7adc1 100644
--- a/sys/arch/i386/stand/boot/Makefile
+++ b/sys/arch/i386/stand/boot/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.9 1997/08/02 22:23:07 mickey Exp $
+# $OpenBSD: Makefile,v 1.10 1997/08/13 04:03:29 mickey Exp $
PROG= boot
SRCS= srt0.S boot.c cmd.c kentry.c conf.c
#AFLAGS+=-Wa,-R
# AFLAGS+=-Wa,-a
LD=ld
-LDFLAGS+=-nostdlib -Ttext $(START) -z -x -Bstatic
+LDFLAGS+=-nostdlib -Ttext $(LINKADDR) -z -x -Bstatic
INSTALL_STRIP=
MAN= boot.8
S =${.CURDIR}/../../../..
@@ -21,13 +21,19 @@ machine-links:
@ln -fs ${.CURDIR}/../.. i386
@ln -fs ${.CURDIR}/../../include machine
+kentry.o: kentry.c
+ @echo ${COMPILE.c} ${.IMPSRC}
+ @${COMPILE.c} -S -o tmp.s ${.IMPSRC}
+ @sed 's/ret/lret/g' tmp.s | ${AS} -f -o $@
+ @rm tmp.s
+
${PROG}: $(OBJS) $(DPADD)
$(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD)
@size $(PROG)
.include <bsd.prog.mk>
-CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC)
+CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS}
CFLAGS+=$(SACFLAGS)
.ifdef NO_NET
CPPFLAGS+=-DNO_NET
diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile
index 6495768a61d..db3741a1161 100644
--- a/sys/arch/i386/stand/libsa/Makefile
+++ b/sys/arch/i386/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.22 1997/08/13 03:28:11 mickey Exp $
+# $OpenBSD: Makefile,v 1.23 1997/08/13 04:03:30 mickey Exp $
LIB= sa
@@ -13,9 +13,9 @@ DIR_KERN=$S/lib/libkern
#AS+= -a
# i386 stuff (so, it will possibly load in the same 64k)
-SRCS= unixsys.S gidt.S debug_i386.S \
- bioscons.c dev_i386.c exec_i386.c biosdev.c gateA20.c memprobe.c \
- time.c alloca.S machdep.c
+SRCS= gidt.S debug_i386.S alloca.S \
+ machdep.c dev_i386.c exec_i386.c biosdev.c gateA20.c memprobe.c \
+ bioscons.c time.c
# stand routines
SRCS+= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c strlen.c \
@@ -56,5 +56,5 @@ install:
.include <bsd.lib.mk>
-CPPFLAGS+=-DSTART=${START} -DHEAP_LIMIT=${HEAP_LIMIT} ${DEBUGFLAGS}
+CPPFLAGS+=-DLINKADDR=${LINKADDR} -DHEAP_LIMIT=${HEAP_LIMIT} ${DEBUGFLAGS}
CFLAGS+=${SACFLAGS} -D__INTERNAL_LIBSA_CREAD
diff --git a/sys/arch/i386/stand/libsa/gidt.S b/sys/arch/i386/stand/libsa/gidt.S
index ab90cc44b22..daefdf569a1 100644
--- a/sys/arch/i386/stand/libsa/gidt.S
+++ b/sys/arch/i386/stand/libsa/gidt.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: gidt.S,v 1.13 1997/08/02 22:23:09 mickey Exp $ */
+/* $OpenBSD: gidt.S,v 1.14 1997/08/13 04:03:30 mickey Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -59,7 +59,7 @@
movl %ax, %ds ; \
movl %ax, %es ; \
data32 ; \
- movl $(0xb8000 - START), %eax ; \
+ movl $(0xb8000 - LINKADDR), %eax ; \
data32 ; \
addr32 ; \
movl $0x4f314f30, (%eax)
@@ -91,7 +91,7 @@
\
/* ljmp $S16TEXT, $1f */; \
.byte 0xea; /* Change to 16bit mode */ \
- .long 1f - START; \
+ .long 1f - LINKADDR; \
.word S16TEXT; \
1: \
gidt_debug1; \
@@ -101,10 +101,10 @@
andl $~CR0_PE, %eax; \
movl %eax, %cr0; \
\
- /* ljmp (START >> 4), $1f */; \
+ /* ljmp (LINKADDR >> 4), $1f */; \
.byte 0xea; /* load real mode cs:ip */ \
.word 1f; \
- .word (START >> 4); \
+ .word (LINKADDR >> 4); \
1: \
xorl %eax, %eax; /* setup: %ds, %es, %ss */ \
movl %ax, %ds; \
@@ -207,7 +207,7 @@ pmm_init:
.align 3
idt:
#define idte(e) \
- .word IPROC(e), S32TEXT, (0x80|SDT_SYS386TGT) << 8, (START >> 16)
+ .word IPROC(e), S32TEXT, (0x80|SDT_SYS386TGT) << 8, (LINKADDR >> 16)
/* internal (0-31) */
idte(de); idte(db); idte(nmi); idte(bp); idte(of); idte(br)
idte(ud); idte(nm); idte(df); idte(fo); idte(ts); idte(np)
@@ -258,18 +258,18 @@ gdt:
.byte 0 # hibase
/* 0x18 : 16 bit code */
.word 0xFFFF # lolimit
- .word (START & 0xffff) # lobase
- .byte (START >> 16) & 0xff # midbase
+ .word (LINKADDR & 0xffff) # lobase
+ .byte (LINKADDR >> 16) & 0xff # midbase
.byte SDT_MEMERA | 0 | 0x80 # RXAC, dpl = 0, present
.byte 0xf | 0 | 0 | 0 # hilimit, xx, 16bit, byte granularity
- .byte (START >> 20) & 0xff # hibase
+ .byte (LINKADDR >> 20) & 0xff # hibase
/* 0x20 : 16 bit data */
.word 0xFFFF # lolimit
- .word (START & 0xffff) # lobase
- .byte (START >> 16) & 0xff # midbase
+ .word (LINKADDR & 0xffff) # lobase
+ .byte (LINKADDR >> 16) & 0xff # midbase
.byte SDT_MEMRWA | 0 | 0x80 # RXAC, dpl = 0, present
.byte 0xf | 0 | 0 | 0 # hilimit, xx, 16bit, byte granularity
- .byte (START >> 20) & 0xff # hibase
+ .byte (LINKADDR >> 20) & 0xff # hibase
Gdtr: .word . - gdt - 1
.long gdt