mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 17:32:43 +00:00
Support a.out: avoid (%dx) in in/out instructions, and use an m4
macro to supply underscores for externals.
This commit is contained in:
parent
35633713e5
commit
9e3377b8b3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=68314
@ -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>
|
||||
|
@ -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
|
||||
|
18
sys/boot/i386/kgzldr/kgzldr.m4
Normal file
18
sys/boot/i386/kgzldr/kgzldr.m4
Normal file
@ -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')')
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user