aboutsummaryrefslogtreecommitdiff
path: root/sys/boot
diff options
context:
space:
mode:
authorRobert Nordier <rnordier@FreeBSD.org>2000-11-04 13:03:52 +0000
committerRobert Nordier <rnordier@FreeBSD.org>2000-11-04 13:03:52 +0000
commit9e3377b8b315cb49a63387ce0bef943d73673378 (patch)
tree58da3dc33bbdc228a36e24ebf79cd11fd8b4d3bc /sys/boot
parent35633713e562ca094a44e69b81ee4f9e74d83b21 (diff)
Notes
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/kgzldr/Makefile11
-rw-r--r--sys/boot/i386/kgzldr/crt.s4
-rw-r--r--sys/boot/i386/kgzldr/kgzldr.m418
-rw-r--r--sys/boot/i386/kgzldr/sio.s8
-rw-r--r--sys/boot/i386/kgzldr/start.s4
5 files changed, 34 insertions, 11 deletions
diff --git a/sys/boot/i386/kgzldr/Makefile b/sys/boot/i386/kgzldr/Makefile
index ea4e70174d207..2a4513d4b5687 100644
--- a/sys/boot/i386/kgzldr/Makefile
+++ b/sys/boot/i386/kgzldr/Makefile
@@ -4,7 +4,12 @@ MAINTAINER= rnordier
PROG= kgzldr.o
SRCS= start.s boot.c inflate.c lib.c crt.s sio.s
-CFLAGS= -fno-builtin -Os
+CFLAGS= -fno-builtin
+.if ${OBJFORMAT} == aout
+CFLAGS+=-O2
+.else
+CFLAGS+=-Os
+.endif
CFLAGS+=-DKZIP
LDFLAGS=-nostdlib -static -r
NOMAN=
@@ -14,7 +19,7 @@ STRIP=
.PATH: ${.CURDIR}/../../../kern
M4?= m4
-M4FLAGS=
+M4FLAGS=-DOBJFORMAT=${OBJFORMAT}
BOOT_COMCONSOLE_PORT?= 0x3f8
M4FLAGS+=-DSIOPRT=${BOOT_COMCONSOLE_PORT}
@@ -25,7 +30,7 @@ kgzldr.o: ${OBJS}
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS}
.s.o:
- (cd ${.CURDIR}; ${M4} ${M4FLAGS} ${.IMPSRC}) |\
+ (cd ${.CURDIR}; ${M4} ${M4FLAGS} kgzldr.m4 ${.IMPSRC}) |\
${AS} ${AFLAGS} -o ${.TARGET}
.include <bsd.prog.mk>
diff --git a/sys/boot/i386/kgzldr/crt.s b/sys/boot/i386/kgzldr/crt.s
index cfb479fd2d84f..ac26a20409ed1 100644
--- a/sys/boot/i386/kgzldr/crt.s
+++ b/sys/boot/i386/kgzldr/crt.s
@@ -38,11 +38,11 @@
.set BDA_SCR,0x449 # Video mode
.set BDA_POS,0x450 # Cursor position
- .globl crt_putchr
+ .globl _(crt_putchr)
# void crt_putchr(int c)
-crt_putchr: movb 0x4(%esp,1),%al # Get character
+_(crt_putchr): movb 0x4(%esp,1),%al # Get character
pusha # Save
xorl %ecx,%ecx # Zero for loops
movb $SCR_MAT,%ah # Mode/attribute
diff --git a/sys/boot/i386/kgzldr/kgzldr.m4 b/sys/boot/i386/kgzldr/kgzldr.m4
new file mode 100644
index 0000000000000..1441a4b4a01ca
--- /dev/null
+++ b/sys/boot/i386/kgzldr/kgzldr.m4
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2000 Robert Nordier
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms are freely
+# permitted provided that the above copyright notice and this
+# paragraph and the following disclaimer are duplicated in all
+# such forms.
+#
+# This software is provided "AS IS" and without any express or
+# implied warranties, including, without limitation, the implied
+# warranties of merchantability and fitness for a particular
+# purpose.
+#
+
+# $FreeBSD$
+
+define(_,`ifelse(OBJFORMAT,`aout',`_$1',`$1')')
diff --git a/sys/boot/i386/kgzldr/sio.s b/sys/boot/i386/kgzldr/sio.s
index bb354e297dd06..86b8ccd1d1a42 100644
--- a/sys/boot/i386/kgzldr/sio.s
+++ b/sys/boot/i386/kgzldr/sio.s
@@ -29,18 +29,18 @@
.set SIO_PRT,SIOPRT # Base port
- .globl sio_putchr
+ .globl _(sio_putchr)
# void sio_putchr(int c)
-sio_putchr: movw $SIO_PRT+0x5,%dx # Line status reg
+_(sio_putchr): movw $SIO_PRT+0x5,%dx # Line status reg
xor %ecx,%ecx # Timeout
movb $0x40,%ch # counter
-sio_putchr.1: inb (%dx),%al # Transmitter
+sio_putchr.1: inb %dx,%al # Transmitter
testb $0x20,%al # buffer empty?
loopz sio_putchr.1 # No
jz sio_putchr.2 # If timeout
movb 0x4(%esp,1),%al # Get character
subb $0x5,%dl # Transmitter hold reg
- outb %al,(%dx) # Write character
+ outb %al,%dx # Write character
sio_putchr.2: ret # To caller
diff --git a/sys/boot/i386/kgzldr/start.s b/sys/boot/i386/kgzldr/start.s
index 550fa526d946f..ff43c77b3f2e9 100644
--- a/sys/boot/i386/kgzldr/start.s
+++ b/sys/boot/i386/kgzldr/start.s
@@ -40,6 +40,6 @@ _start: cld # String ops inc
rep # Clear
stosb # bss
pushl 0x4(%esp) # Pass howto flags
- call boot # Call C code
+ call _(boot) # Call C code
popl %ecx # Clear stack
- jmp *kgz+entry # To loaded code
+ jmp *_(kgz)+entry # To loaded code