ELF adaption.
This commit is contained in:
parent
f433d91346
commit
b2990af499
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: Makefile,v 1.8 1999/03/15 07:46:11 leo Exp $
|
# $NetBSD: Makefile,v 1.9 2001/09/08 11:21:02 thomas Exp $
|
||||||
|
|
||||||
LIB= sa
|
LIB= sa
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ MKPROFILE=no
|
|||||||
OBJMACHINE=
|
OBJMACHINE=
|
||||||
|
|
||||||
CPPFLAGS+= ${DEFS} ${INCL}
|
CPPFLAGS+= ${DEFS} ${INCL}
|
||||||
CFLAGS+= -fomit-frame-pointer -Wall
|
CFLAGS+= -fomit-frame-pointer -Wall -fno-function-cse -fstrength-reduce
|
||||||
NO_NET=
|
NO_NET=
|
||||||
|
|
||||||
DEFS= -D_STANDALONE
|
DEFS= -D_STANDALONE
|
||||||
@ -18,7 +18,7 @@ INCL= -I- -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
|
|||||||
#
|
#
|
||||||
|
|
||||||
# machine dependant routines
|
# machine dependant routines
|
||||||
SRCS= consio.s diskio.c
|
SRCS= consio.S diskio.c
|
||||||
|
|
||||||
# from lib/libkern
|
# from lib/libkern
|
||||||
SRCS+= ashrdi3.c bzero.c strcmp.c strlen.c
|
SRCS+= ashrdi3.c bzero.c strcmp.c strlen.c
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: consio.s,v 1.1.1.1 1996/02/29 11:36:12 leo Exp $ */
|
/* $NetBSD: consio.S,v 1.1 2001/09/08 11:21:02 thomas Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Waldi Ravens.
|
* Copyright (c) 1995 Waldi Ravens.
|
||||||
@ -30,34 +30,30 @@
|
|||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.globl _getchar | int getchar (void);
|
#include <machine/asm.h>
|
||||||
.text
|
|
||||||
.even
|
ENTRY_NOPROFILE(getchar) | int getchar (void);
|
||||||
_getchar:
|
movml %d2/%a2,%sp@-
|
||||||
movml d2/a2,sp@-
|
movw #2,%sp@- | BIOS device 2 => console (VT52)
|
||||||
movw #2,sp@- | BIOS device 2 => console (VT52)
|
movw #2,%sp@- | BIOS opcode 2 => Bconin
|
||||||
movw #2,sp@- | BIOS opcode 2 => Bconin
|
|
||||||
trap #13 | => char in d0.b
|
trap #13 | => char in d0.b
|
||||||
addql #4,sp
|
addql #4,%sp
|
||||||
andl #0xff,d0
|
andl #0xff,%d0
|
||||||
movml sp@+,d2/a2
|
movml %sp@+,%d2/%a2
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.globl _putchar | void putchar (int c);
|
ENTRY_NOPROFILE(putchar) | void putchar (int c);
|
||||||
.text
|
movl %sp@(4),%d0
|
||||||
.even
|
cmpw #10,%d0 | linefeed?
|
||||||
_putchar:
|
|
||||||
movl sp@(4),d0
|
|
||||||
cmpw #10,d0 | linefeed?
|
|
||||||
bnes 0f
|
bnes 0f
|
||||||
movq #13,d0 | yes, put CR and LF.
|
movq #13,%d0 | yes, put CR and LF.
|
||||||
bsrs 0f
|
bsrs 0f
|
||||||
movq #10,d0
|
movq #10,%d0
|
||||||
0: movml d2/a2,sp@-
|
0: movml %d2/%a2,%sp@-
|
||||||
movw d0,sp@- | character
|
movw %d0,%sp@- | character
|
||||||
movw #2,sp@- | BIOS device 2 => console (VT52)
|
movw #2,%sp@- | BIOS device 2 => console (VT52)
|
||||||
movw #3,sp@- | BIOS opcode 3 => Bconout
|
movw #3,%sp@- | BIOS opcode 3 => Bconout
|
||||||
trap #13 | => none
|
trap #13 | => none
|
||||||
addql #6,sp
|
addql #6,%sp
|
||||||
movml sp@+,d2/a2
|
movml %sp@+,%d2/%a2
|
||||||
rts
|
rts
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: bsdstart.s,v 1.5 1997/12/04 07:39:05 leo Exp $ */
|
/* $NetBSD: bsdstart.s,v 1.6 2001/09/08 11:22:26 thomas Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 L. Weppelman
|
* Copyright (c) 1995 L. Weppelman
|
||||||
@ -36,12 +36,11 @@
|
|||||||
*
|
*
|
||||||
* bsd_startup(struct kparamb *)
|
* bsd_startup(struct kparamb *)
|
||||||
*/
|
*/
|
||||||
.text
|
|
||||||
.even
|
|
||||||
.globl _bsd_startup
|
|
||||||
|
|
||||||
_bsd_startup:
|
#include <machine/asm.h>
|
||||||
movw #0x2700,sr
|
|
||||||
|
ENTRY_NOPROFILE(bsd_startup)
|
||||||
|
movw #0x2700,%sr
|
||||||
|
|
||||||
| the BSD kernel wants values into the following registers:
|
| the BSD kernel wants values into the following registers:
|
||||||
| d0: ttmem-size
|
| d0: ttmem-size
|
||||||
@ -54,24 +53,24 @@ _bsd_startup:
|
|||||||
| a1: end of symbols (esym)
|
| a1: end of symbols (esym)
|
||||||
| All other registers zeroed for possible future requirements.
|
| All other registers zeroed for possible future requirements.
|
||||||
|
|
||||||
movl sp@(4),a3 | a3 points to parameter block
|
movl %sp@(4),%a3 | a3 points to parameter block
|
||||||
#ifdef TOSTOOLS
|
#ifdef TOSTOOLS
|
||||||
lea _bsd_startup,sp | make sure we have a good stack ***
|
lea _ASM_LABEL(bsd_startup),%sp | make sure we have a good stack ***
|
||||||
#endif
|
#endif
|
||||||
movl a3@,a0 | loaded kernel
|
movl %a3@,%a0 | loaded kernel
|
||||||
movl a3@(8),d0 | kernel entry point
|
movl %a3@(8),%d0 | kernel entry point
|
||||||
addl a0,d0 | added makes our absolute entry point
|
addl %a0,%d0 | added makes our absolute entry point
|
||||||
movl d0,sp@- | push entry point ***
|
movl %d0,%sp@- | push entry point ***
|
||||||
movl a3@(12),d1 | stmem-size
|
movl %a3@(12),%d1 | stmem-size
|
||||||
movl a3@(16),d0 | ttmem-size
|
movl %a3@(16),%d0 | ttmem-size
|
||||||
movl a3@(20),d2 | bootflags
|
movl %a3@(20),%d2 | bootflags
|
||||||
movl a3@(24),d3 | boothowto
|
movl %a3@(24),%d3 | boothowto
|
||||||
movl a3@(4),d4 | length of loaded kernel
|
movl %a3@(4),%d4 | length of loaded kernel
|
||||||
movl a3@(28),d5 | start of fastram
|
movl %a3@(28),%d5 | start of fastram
|
||||||
movl a3@(32),a1 | end of symbols
|
movl %a3@(32),%a1 | end of symbols
|
||||||
subl a5,a5 | target, load to 0
|
subl %a5,%a5 | target, load to 0
|
||||||
movl d2,d6
|
movl %d2,%d6
|
||||||
andb #0x50,d6 | Is this an 68040/68060?
|
andb #0x50,%d6 | Is this an 68040/68060?
|
||||||
beqs 0f
|
beqs 0f
|
||||||
|
|
||||||
| Turn off 68040 type MMU
|
| Turn off 68040 type MMU
|
||||||
@ -85,25 +84,25 @@ _bsd_startup:
|
|||||||
.word 0xf4f8 | cpusha bc - push and inval caches
|
.word 0xf4f8 | cpusha bc - push and inval caches
|
||||||
bras 1f
|
bras 1f
|
||||||
|
|
||||||
0: lea pc@(zero),a3
|
0: lea %pc@(zero),%a3
|
||||||
pmove a3@,tc | Turn off MMU
|
pmove %a3@,%tc | Turn off MMU
|
||||||
pmove a3@(-4),crp | crp = nullrp
|
pmove %a3@(-4),%crp | crp = nullrp
|
||||||
pmove a3@(-4),srp | srp = nullrp
|
pmove %a3@(-4),%srp | srp = nullrp
|
||||||
btst #3,d2 | Is this an 68030?
|
btst #3,%d2 | Is this an 68030?
|
||||||
beqs 1f
|
beqs 1f
|
||||||
|
|
||||||
| Turn off 68030 TT registers
|
| Turn off 68030 TT registers
|
||||||
.word 0xf013,0x0800 | pmove a3@,tt0
|
.word 0xf013,0x0800 | pmove a3@,tt0
|
||||||
.word 0xf013,0x0c00 | pmove a3@,tt1
|
.word 0xf013,0x0c00 | pmove a3@,tt1
|
||||||
|
|
||||||
1: movq #0,d6 | would have known contents
|
1: movq #0,%d6 | would have known contents
|
||||||
movc d6,cacr | turn off the caches
|
movc %d6,%cacr | turn off the caches
|
||||||
movl d6,d7
|
movl %d6,%d7
|
||||||
movl d6,a2
|
movl %d6,%a2
|
||||||
movl d6,a3
|
movl %d6,%a3
|
||||||
movl d6,a4
|
movl %d6,%a4
|
||||||
movl d6,a5
|
movl %d6,%a5
|
||||||
movl d6,a6
|
movl %d6,%a6
|
||||||
rts | enter kernel at address on stack ***
|
rts | enter kernel at address on stack ***
|
||||||
|
|
||||||
| A do-nothing MMU root pointer (includes the following long as well)
|
| A do-nothing MMU root pointer (includes the following long as well)
|
||||||
|
Loading…
Reference in New Issue
Block a user