diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-02-02 13:34:30 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-02-02 13:34:30 +0000 |
commit | 9cee0365257887c73c84b2f0572f4573036d4b25 (patch) | |
tree | 2dd36f67b04ad9e49f6ce6f94144c3530ea5c046 /sys | |
parent | 22cba234393e85cacb460dd6e3f6aadc75278969 (diff) |
hp300 ELF bits. Requires many device and prom related structs to now be declared
as packed due to them containing 32-bit types at 16-bit but not 32-bit aligned
offsets. The boot block updates (especially mkboot) come straight from NetBSD.
Diffstat (limited to 'sys')
23 files changed, 1142 insertions, 1192 deletions
diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300 index 8379c6bdea6..754d2fbc984 100644 --- a/sys/arch/hp300/conf/Makefile.hp300 +++ b/sys/arch/hp300/conf/Makefile.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.hp300,v 1.79 2012/08/22 16:58:26 pascal Exp $ +# $OpenBSD: Makefile.hp300,v 1.80 2013/02/02 13:34:29 miod Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -38,7 +38,7 @@ CMACHFLAGS+= -fno-stack-protector COPTS?= -O2 CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} AFLAGS= -D_LOCORE -x assembler-with-cpp -traditional-cpp ${CMACHFLAGS} -LINKFLAGS= -n -Ttext 0 -e start +LINKFLAGS= -Ttext 0 -e start --warn-common -nopie .if ${IDENT:M-DDDB_STRUCT} DB_STRUCTINFO= db_structinfo.h diff --git a/sys/arch/hp300/dev/ctreg.h b/sys/arch/hp300/dev/ctreg.h index f3b2123b6ef..880818900d3 100644 --- a/sys/arch/hp300/dev/ctreg.h +++ b/sys/arch/hp300/dev/ctreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctreg.h,v 1.7 2005/11/18 00:09:15 miod Exp $ */ +/* $OpenBSD: ctreg.h,v 1.8 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: ctreg.h,v 1.6 1996/02/09 18:00:35 scottr Exp $ */ /* @@ -42,12 +42,12 @@ struct ct_iocmd { long len; char nop3; char cmd; -}; +} __packed; struct ct_rscmd { char unit; char cmd; -}; +} __packed; struct ct_stat { char c_vu; @@ -59,7 +59,7 @@ struct ct_stat { short c_blk0; long c_blk; char c_pad[4]; -}; +} __packed; struct ct_ssmcmd { char unit; @@ -68,36 +68,36 @@ struct ct_ssmcmd { short fefm; short aefm; short iefm; -}; +} __packed; struct ct_srcmd { char unit; char nop; char cmd; char param; -}; +} __packed; struct ct_soptcmd { char unit; char nop; char cmd; char opt; -}; +} __packed; struct ct_ulcmd { char unit; char cmd; -}; +} __packed; struct ct_wfmcmd { char unit; char cmd; -}; +} __packed; struct ct_clearcmd { char unit; char cmd; -}; +} __packed; #define CT7946ID 0x220 #define CT9145ID 0x268 diff --git a/sys/arch/hp300/dev/dmareg.h b/sys/arch/hp300/dev/dmareg.h index 7b8ec38ba48..3a5d68b2a77 100644 --- a/sys/arch/hp300/dev/dmareg.h +++ b/sys/arch/hp300/dev/dmareg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dmareg.h,v 1.9 2005/11/17 23:56:02 miod Exp $ */ +/* $OpenBSD: dmareg.h,v 1.10 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: dmareg.h,v 1.12 1997/05/05 21:02:40 thorpej Exp $ */ /* @@ -46,14 +46,14 @@ struct dmaBdevice { vu_short dmaB_count; vu_short dmaB_cmd; #define dmaB_stat dmaB_cmd -}; +} __packed; struct dmadevice { v_char *dma_addr; vu_int dma_count; vu_short dma_cmd; vu_short dma_stat; -}; +} __packed; struct dmareg { struct dmaBdevice dma_Bchan0; @@ -65,7 +65,7 @@ struct dmareg { struct dmadevice dma_chan0; char dma_pad2[0xF4]; struct dmadevice dma_chan1; -}; +} __packed; /* The hp300 has 2 DMA channels. */ #define NDMACHAN 2 diff --git a/sys/arch/hp300/dev/dvboxreg.h b/sys/arch/hp300/dev/dvboxreg.h index c51a46a2025..910b19bb504 100644 --- a/sys/arch/hp300/dev/dvboxreg.h +++ b/sys/arch/hp300/dev/dvboxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dvboxreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */ +/* $OpenBSD: dvboxreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 cgd Exp $ */ /* @@ -161,4 +161,4 @@ struct dvboxfb { u_int16_t trans; /* Transparency 0xC226 */ u_int8_t f45[0xC23E -0xC226-2]; u_int16_t pstop; /* Pace value control 0xc23e */ -}; +} __packed; diff --git a/sys/arch/hp300/dev/hdreg.h b/sys/arch/hp300/dev/hdreg.h index b289922abec..64c169f7b29 100644 --- a/sys/arch/hp300/dev/hdreg.h +++ b/sys/arch/hp300/dev/hdreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hdreg.h,v 1.6 2007/05/25 20:32:29 krw Exp $ */ +/* $OpenBSD: hdreg.h,v 1.7 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */ /* @@ -51,14 +51,14 @@ struct hd_iocmd { long c_len; char c_cmd; char c_pad2; -}; +} __packed; struct hd_rscmd { char c_unit; char c_sram; char c_ram; char c_cmd; -}; +} __packed; struct hd_stat { char c_vu; @@ -78,7 +78,7 @@ struct hd_stat { short cu_sect; } cu_tva; } c_pf; -}; +} __packed; #define c_raw c_pf.cu_raw #define c_blk c_pf.cu_sva.cu_lsl /* for now */ #define c_tva c_pf.cu_tva @@ -90,19 +90,19 @@ struct hd_ssmcmd { short c_fefm; short c_aefm; short c_iefm; -}; +} __packed; struct hd_srcmd { char c_unit; char c_nop; char c_cmd; char c_param; -}; +} __packed; struct hd_clearcmd { char c_unit; char c_cmd; -}; +} __packed; /* HW ids */ #define HD7946AID 0x220 /* also 7945A */ diff --git a/sys/arch/hp300/dev/rboxreg.h b/sys/arch/hp300/dev/rboxreg.h index 23f6b05cebc..2e5fd3a7974 100644 --- a/sys/arch/hp300/dev/rboxreg.h +++ b/sys/arch/hp300/dev/rboxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rboxreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */ +/* $OpenBSD: rboxreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 cgd Exp $ */ /* @@ -117,4 +117,4 @@ struct rboxfb { u_int8_t filler20[0x8012 - 0x4120]; u_int16_t te_status; /* transform engine status 0x8012 */ u_int8_t filler21[0x1ffff-0x8014]; -}; +} __packed; diff --git a/sys/arch/hp300/dev/topcatreg.h b/sys/arch/hp300/dev/topcatreg.h index 301e135b448..76fd18f3887 100644 --- a/sys/arch/hp300/dev/topcatreg.h +++ b/sys/arch/hp300/dev/topcatreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: topcatreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */ +/* $OpenBSD: topcatreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 cgd Exp $ */ /* @@ -114,4 +114,4 @@ struct tcboxfb { u_int16_t plane_mask; /* plane mask select 0x60ba */ u_int8_t f24[0x60f0-0x60ba-2]; u_int16_t strobe; /* color map trigger 0x60f0 */ -}; +} __packed; diff --git a/sys/arch/hp300/hp300/bus_space.c b/sys/arch/hp300/hp300/bus_space.c index e302f99ac82..194194d175d 100644 --- a/sys/arch/hp300/hp300/bus_space.c +++ b/sys/arch/hp300/hp300/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.7 2010/12/26 15:40:59 miod Exp $ */ +/* $OpenBSD: bus_space.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: bus_space.c,v 1.6 2002/09/27 15:36:02 provos Exp $ */ /*- @@ -272,11 +272,11 @@ hp300_mem_bsrm1(bus_space_handle_t h, bus_size_t offset, u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movb a0@,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movb %%a0@,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -288,11 +288,11 @@ hp300_mem_bsrm2(bus_space_handle_t h, bus_size_t offset, u_int16_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a0@,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a0@,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -304,11 +304,11 @@ hp300_mem_bsrm4(bus_space_handle_t h, bus_size_t offset, u_int32_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,%d0 ;" - "1: movl a0@,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a0@,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -320,11 +320,11 @@ hp300_mem_bsrrm2(bus_space_handle_t h, bus_size_t offset, u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a0@,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a0@,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -336,11 +336,11 @@ hp300_mem_bsrrm4(bus_space_handle_t h, bus_size_t offset, u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,%d0 ;" - "1: movl a0@,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a0@,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -352,11 +352,11 @@ hp300_mem_bsrr1(bus_space_handle_t h, bus_size_t offset, u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movb a0@+,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movb %%a0@+,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -368,11 +368,11 @@ hp300_mem_bsrr2(bus_space_handle_t h, bus_size_t offset, u_int16_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a0@+,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a0@+,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -384,11 +384,11 @@ hp300_mem_bsrr4(bus_space_handle_t h, bus_size_t offset, u_int32_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movl a0@+,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a0@+,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -400,11 +400,11 @@ hp300_mem_bsrrr2(bus_space_handle_t h, bus_size_t offset, u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a0@+,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a0@+,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c / 2) : @@ -416,11 +416,11 @@ hp300_mem_bsrrr4(bus_space_handle_t h, bus_size_t offset, u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movl a0@+,a1@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a0@+,%%a1@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c / 4) : @@ -453,11 +453,11 @@ hp300_mem_bswm1(bus_space_handle_t h, bus_size_t offset, const u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movb a1@+,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movb %%a1@+,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -469,11 +469,11 @@ hp300_mem_bswm2(bus_space_handle_t h, bus_size_t offset, const u_int16_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a1@+,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a1@+,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -485,11 +485,11 @@ hp300_mem_bswm4(bus_space_handle_t h, bus_size_t offset, const u_int32_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movl a1@+,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a1@+,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -501,11 +501,11 @@ hp300_mem_bswrm2(bus_space_handle_t h, bus_size_t offset, const u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a1@+,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a1@+,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -517,11 +517,11 @@ hp300_mem_bswrm4(bus_space_handle_t h, bus_size_t offset, const u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movl a1@+,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a1@+,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -533,11 +533,11 @@ hp300_mem_bswr1(bus_space_handle_t h, bus_size_t offset, const u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movb a1@+,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movb %%a1@+,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -549,11 +549,11 @@ hp300_mem_bswr2(bus_space_handle_t h, bus_size_t offset, const u_int16_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a1@+,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a1@+,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -565,11 +565,11 @@ hp300_mem_bswr4(bus_space_handle_t h, bus_size_t offset, const u_int32_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movl a1@+,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a1@+,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c) : @@ -581,11 +581,11 @@ hp300_mem_bswrr2(bus_space_handle_t h, bus_size_t offset, const u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movw a1@+,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movw %%a1@+,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c / 2) : @@ -597,11 +597,11 @@ hp300_mem_bswrr4(bus_space_handle_t h, bus_size_t offset, const u_int8_t *a, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,a1 ;" - " movl %2,d0 ;" - "1: movl a1@+,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%a1 ;" + " movl %2,%%d0 ;" + "1: movl %%a1@+,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" (a), "g" (c / 4) : @@ -613,11 +613,11 @@ hp300_mem_bssm1(bus_space_handle_t h, bus_size_t offset, u_int8_t v, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,d1 ;" - " movl %2,d0 ;" - "1: movb d1,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%d1 ;" + " movl %2,%%d0 ;" + "1: movb %%d1,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" ((u_long)v), "g" (c) : @@ -629,11 +629,11 @@ hp300_mem_bssm2(bus_space_handle_t h, bus_size_t offset, u_int16_t v, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,d1 ;" - " movl %2,d0 ;" - "1: movw d1,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%d1 ;" + " movl %2,%%d0 ;" + "1: movw %%d1,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" ((u_long)v), "g" (c) : @@ -645,11 +645,11 @@ hp300_mem_bssm4(bus_space_handle_t h, bus_size_t offset, u_int32_t v, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,d1 ;" - " movl %2,d0 ;" - "1: movl d1,a0@ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%d1 ;" + " movl %2,%%d0 ;" + "1: movl %%d1,%%a0@ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" ((u_long)v), "g" (c) : @@ -661,11 +661,11 @@ hp300_mem_bssr1(bus_space_handle_t h, bus_size_t offset, u_int8_t v, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,d1 ;" - " movl %2,d0 ;" - "1: movb d1,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%d1 ;" + " movl %2,%%d0 ;" + "1: movb %%d1,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" ((u_long)v), "g" (c) : @@ -677,11 +677,11 @@ hp300_mem_bssr2(bus_space_handle_t h, bus_size_t offset, u_int16_t v, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,d1 ;" - " movl %2,d0 ;" - "1: movw d1,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%d1 ;" + " movl %2,%%d0 ;" + "1: movw %%d1,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" ((u_long)v), "g" (c) : @@ -693,11 +693,11 @@ hp300_mem_bssr4(bus_space_handle_t h, bus_size_t offset, u_int32_t v, size_t c) { __asm __volatile ( - " movl %0,a0 ;" - " movl %1,d1 ;" - " movl %2,d0 ;" - "1: movl d1,a0@+ ;" - " subql #1,d0 ;" + " movl %0,%%a0 ;" + " movl %1,%%d1 ;" + " movl %2,%%d0 ;" + "1: movl %%d1,%%a0@+ ;" + " subql #1,%%d0 ;" " jne 1b" : : "r" (h + offset), "g" ((u_long)v), "g" (c) : diff --git a/sys/arch/hp300/hp300/intr.c b/sys/arch/hp300/hp300/intr.c index 90cf301ce49..a533b6a70a5 100644 --- a/sys/arch/hp300/hp300/intr.c +++ b/sys/arch/hp300/hp300/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.25 2011/12/21 22:39:10 miod Exp $ */ +/* $OpenBSD: intr.c,v 1.26 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: intr.c,v 1.5 1998/02/16 20:58:30 thorpej Exp $ */ /*- @@ -287,7 +287,7 @@ splassert_check(int wantipl, const char *func) { int oldipl, realwantipl; - __asm __volatile ("movew sr,%0" : "=&d" (oldipl)); + __asm __volatile ("movew %%sr,%0" : "=&d" (oldipl)); realwantipl = PSLTOIPL(hp300_varpsl[wantipl]); oldipl = PSLTOIPL(oldipl); diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s index 871a1a1d0e9..28e56027898 100644 --- a/sys/arch/hp300/hp300/locore.s +++ b/sys/arch/hp300/hp300/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.70 2012/09/08 19:24:28 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.71 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */ /* @@ -89,6 +89,7 @@ * This is for kvm_mkdb, and should be the address of the beginning * of the kernel text segment (not necessarily the same as kernbase). */ + .chip 68020 .text GLOBAL(kernel_text) @@ -112,9 +113,15 @@ ASLOCAL(tmpstk) /* * Macro to relocate a symbol, used before MMU is enabled. */ -#define _RELOC(var, ar) \ - lea var,ar; \ - addl a5,ar +#ifdef __STDC__ +#define _RELOC(var, ar) \ + movel # var,ar; \ + addl %a5,ar +#else +#define _RELOC(var, ar) \ + movel #var,ar; \ + addl %a5,ar +#endif #define RELOC(var, ar) _RELOC(_C_LABEL(var), ar) #define ASRELOC(var, ar) _RELOC(_ASM_LABEL(var), ar) @@ -125,8 +132,8 @@ ASLOCAL(tmpstk) */ #define DOREBOOT \ /* Reset Vector Base Register to what PROM expects. */ \ - movl #0,d0; \ - movc d0,vbr; \ + movl #0,%d0; \ + movc %d0,%vbr; \ /* Jump to REQ_REBOOT */ \ jmp 0x1A4; @@ -144,31 +151,27 @@ BSS(lowram,4) BSS(esym,4) ASENTRY_NOPROFILE(start) - movw #PSL_HIGHIPL,sr | no interrupts - ASRELOC(tmpstk, a0) - movl a0,sp | give ourselves a temporary stack - RELOC(esym, a0) -#if 1 - movl a4,a0@ | store end of symbol table -#else - clrl a0@ | no symbol table, yet -#endif - RELOC(lowram, a0) - movl a5,a0@ | store start of physical memory - movl #CACHE_OFF,d0 - movc d0,cacr | clear and disable on-chip cache(s) + movw #PSL_HIGHIPL,%sr | no interrupts + ASRELOC(tmpstk, %a0) + movl %a0,%sp | give ourselves a temporary stack + RELOC(esym, %a0) + movl %a4,%a0@ | store end of symbol table + RELOC(lowram, %a0) + movl %a5,%a0@ | store start of physical memory + movl #CACHE_OFF,%d0 + movc %d0,%cacr | clear and disable on-chip cache(s) /* check for internal HP-IB in SYSFLAG */ - btst #5,SYSFLAG | internal HP-IB? + btst #5,SYSFLAG | internal HP-IB? jeq Lhaveihpib | yes, have HP-IB just continue - RELOC(internalhpib, a0) - movl #0,a0@ | no, clear associated address + RELOC(internalhpib, %a0) + movl #0,%a0@ | no, clear associated address Lhaveihpib: - RELOC(boothowto, a0) | save reboot flags - movl d7,a0@ - RELOC(bootdev, a0) | and boot device - movl d6,a0@ + RELOC(boothowto, %a0) | save reboot flags + movl %d7,%a0@ + RELOC(bootdev, %a0) | and boot device + movl %d6,%a0@ /* * All data registers are now free. All address registers @@ -177,60 +180,60 @@ Lhaveihpib: */ /* determine our CPU/MMU combo - check for all regardless of kernel config */ - movl #INTIOBASE+MMUBASE,a1 - movl #0x200,d0 | data freeze bit - movc d0,cacr | only exists on 68030 - movc cacr,d0 | read it back - tstl d0 | zero? + movl #INTIOBASE+MMUBASE,%a1 + movl #0x200,%d0 | data freeze bit + movc %d0,%cacr | only exists on 68030 + movc %cacr,%d0 | read it back + tstl %d0 | zero? jeq Lnot68030 | yes, we have 68020/68040 /* * 68030 models */ - RELOC(mmutype, a0) | no, we have 68030 - movl #MMU_68030,a0@ | set to reflect 68030 PMMU - RELOC(cputype, a0) - movl #CPU_68030,a0@ | and 68030 CPU - RELOC(machineid, a0) - movl #0x80,a1@(MMUCMD) | set magic cookie - movl a1@(MMUCMD),d0 | read it back - btst #7,d0 | cookie still on? + RELOC(mmutype, %a0) | no, we have 68030 + movl #MMU_68030,%a0@ | set to reflect 68030 PMMU + RELOC(cputype, %a0) + movl #CPU_68030,%a0@ | and 68030 CPU + RELOC(machineid, %a0) + movl #0x80,%a1@(MMUCMD) | set magic cookie + movl %a1@(MMUCMD),%d0 | read it back + btst #7,%d0 | cookie still on? jeq Lnot370 | no, 360 or 375 - movl #0,a1@(MMUCMD) | clear magic cookie - movl a1@(MMUCMD),d0 | read it back - btst #7,d0 | still on? + movl #0,%a1@(MMUCMD) | clear magic cookie + movl %a1@(MMUCMD),%d0 | read it back + btst #7,%d0 | still on? jeq Lisa370 | no, must be a 370 - movl #HP_340,a0@ | yes, must be a 340 + movl #HP_340,%a0@ | yes, must be a 340 jra Lstart1 Lnot370: - movl #HP_36X,a0@ | type is at least a 360 - movl #0,a1@(MMUCMD) | clear magic cookie2 - movl a1@(MMUCMD),d0 | read it back - btst #16,d0 | still on? + movl #HP_36X,%a0@ | type is at least a 360 + movl #0,%a1@(MMUCMD) | clear magic cookie2 + movl %a1@(MMUCMD),%d0 | read it back + btst #16,%d0 | still on? jeq Lisa36x | no, must be a 360 or a 362 - RELOC(mmuid, a0) | save MMU ID - lsrl #MMUID_SHIFT,d0 - andl #MMUID_MASK,d0 - movl d0,a0@ - RELOC(machineid, a0) - cmpb #MMUID_345,d0 | are we a 345? + RELOC(mmuid, %a0) | save MMU ID + lsrl #MMUID_SHIFT,%d0 + andl #MMUID_MASK,%d0 + movl %d0,%a0@ + RELOC(machineid, %a0) + cmpb #MMUID_345,%d0 | are we a 345? beq Lisa345 - cmpb #MMUID_375,d0 | how about a 375? + cmpb #MMUID_375,%d0 | how about a 375? beq Lisa375 - movl #HP_400,a0@ | must be a 400 + movl #HP_400,%a0@ | must be a 400 jra Lhaspac Lisa345: - movl #HP_345,a0@ + movl #HP_345,%a0@ jra Lhaspac Lisa375: - movl #HP_375,a0@ + movl #HP_375,%a0@ jra Lhaspac Lisa370: - movl #HP_370,a0@ | set to 370 + movl #HP_370,%a0@ | set to 370 Lhaspac: - RELOC(ectype, a0) - movl #EC_PHYS,a0@ | also has a physical address cache + RELOC(ectype, %a0) + movl #EC_PHYS,%a0@ | also has a physical address cache jra Lstart1 /* @@ -238,59 +241,59 @@ Lhaspac: */ Lnot68030: - bset #31,d0 | data cache enable bit - movc d0,cacr | only exists on 68040 - movc cacr,d0 | read it back - tstl d0 | zero? + bset #31,%d0 | data cache enable bit + movc %d0,%cacr | only exists on 68040 + movc %cacr,%d0 | read it back + tstl %d0 | zero? beq Lis68020 | yes, we have 68020 - moveq #CACHE40_OFF,d0 | now turn it back off - movec d0,cacr | before we access any data + moveq #CACHE40_OFF,%d0 | now turn it back off + movc %d0,%cacr | before we access any data /* * 68040 models */ - RELOC(mmutype, a0) - movl #MMU_68040,a0@ | with a 68040 MMU - RELOC(cputype, a0) - movl #CPU_68040,a0@ | and a 68040 CPU - RELOC(fputype, a0) - movl #FPU_68040,a0@ | ...and FPU - RELOC(ectype, a0) - movl #EC_NONE,a0@ | and no cache (for now XXX) - RELOC(mmuid, a0) - movl a1@(MMUCMD),d0 | read MMU register - lsrl #MMUID_SHIFT,d0 - andl #MMUID_MASK,d0 - movl d0,a0@ | save MMU ID - RELOC(machineid, a0) - cmpb #MMUID_425_T,d0 | are we a 425t? + RELOC(mmutype, %a0) + movl #MMU_68040,%a0@ | with a 68040 MMU + RELOC(cputype, %a0) + movl #CPU_68040,%a0@ | and a 68040 CPU + RELOC(fputype, %a0) + movl #FPU_68040,%a0@ | ...and FPU + RELOC(ectype, %a0) + movl #EC_NONE,%a0@ | and no cache (for now XXX) + RELOC(mmuid, %a0) + movl %a1@(MMUCMD),%d0 | read MMU register + lsrl #MMUID_SHIFT,%d0 + andl #MMUID_MASK,%d0 + movl %d0,%a0@ | save MMU ID + RELOC(machineid, %a0) + cmpb #MMUID_425_T,%d0 | are we a 425t? jeq Lisa425 - cmpb #MMUID_425_S,d0 | how about 425s? + cmpb #MMUID_425_S,%d0 | how about 425s? jeq Lisa425 - cmpb #MMUID_425_E,d0 | or maybe a 425e? + cmpb #MMUID_425_E,%d0 | or maybe a 425e? jeq Lisa425 - cmpb #MMUID_433_T,d0 | or a 433t? + cmpb #MMUID_433_T,%d0 | or a 433t? jeq Lisa433 - cmpb #MMUID_433_S,d0 | maybe a 433s? + cmpb #MMUID_433_S,%d0 | maybe a 433s? jeq Lisa433 - cmpb #MMUID_385,d0 | then a 385? + cmpb #MMUID_385,%d0 | then a 385? jeq Lisa385 - cmpb #MMUID_382,d0 | last chance... + cmpb #MMUID_382,%d0 | last chance... jeq Lisa382 - movl #HP_380,a0@ | guess we're a 380 + movl #HP_380,%a0@ | guess we're a 380 jra Lstart1 Lisa425: - movl #HP_425,a0@ + movl #HP_425,%a0@ jra Lstart1 Lisa433: - movl #HP_433,a0@ + movl #HP_433,%a0@ jra Lstart1 Lisa385: - movl #HP_385,a0@ + movl #HP_385,%a0@ jra Lstart1 Lisa382: - movl #HP_382,a0@ + movl #HP_382,%a0@ jra Lstart1 /* @@ -302,16 +305,16 @@ Lisa382: */ Lis68020: - RELOC(fputype, a0) | all of the 68020 systems - movl #FPU_68881,a0@ | have a 68881 FPU - movl #1,a1@(MMUCMD) | a 68020, write HP MMU location - movl a1@(MMUCMD),d0 | read it back - btst #0,d0 | non-zero? + RELOC(fputype, %a0) | all of the 68020 systems + movl #FPU_68881,%a0@ | have a 68881 FPU + movl #1,%a1@(MMUCMD) | a 68020, write HP MMU location + movl %a1@(MMUCMD),%d0 | read it back + btst #0,%d0 | non-zero? jne Lunsupp | yes, we have HP MMU - RELOC(mmutype, a0) - movl #MMU_68851,a0@ | no, we have PMMU - RELOC(machineid, a0) - movl #HP_330,a0@ | and 330 CPU + RELOC(mmutype, %a0) + movl #MMU_68851,%a0@ | no, we have PMMU + RELOC(machineid, %a0) + movl #HP_330,%a0@ | and 330 CPU jra Lstart1 /* @@ -334,47 +337,47 @@ Lstart1: * errors while probing, it is easier to do this before setting up * our own vectors table. */ - clrl d3 + clrl %d3 /* * Don't probe the DIO-I space, simply assume the whole 0-31 * select code range is taken, i.e. 32 boards. */ - addl #(DIO_DEVSIZE * 32), d3 + addl #(DIO_DEVSIZE * 32), %d3 /* * Check the ``internal'' frame buffer address. If there is one, * assume an extra 2MB of frame buffer memory at 0x200000. */ - movl #GRFIADDR, a0 - ASRELOC(phys_badaddr, a3) - jbsr a3@ - tstl d0 | success? + movl #GRFIADDR, %a0 + ASRELOC(phys_badaddr, %a3) + jbsr %a3@ + tstl %d0 | success? jne dioiicheck | no, skip - movl #0x200000, d1 | yes, add the 200000-400000 range - addl d1, d3 + movl #0x200000, %d1 | yes, add the 200000-400000 range + addl %d1, %d3 /* * Probe for DIO-II devices, select codes 132 to 255. */ dioiicheck: - RELOC(machineid,a0) - cmpl #HP_320,a0@ + RELOC(machineid,%a0) + cmpl #HP_320,%a0@ jeq eiodone | HP 320 has nothing more - movl #DIOII_SCBASE, d2 | our select code... - movl #DIOII_BASE, a0 | and first address + movl #DIOII_SCBASE, %d2 | our select code... + movl #DIOII_BASE, %a0 | and first address dioloop: - ASRELOC(phys_badaddr, a3) - jbsr a3@ | probe address (read ID) - movl #DIOII_DEVSIZE, d1 - tstl d0 | success? + ASRELOC(phys_badaddr, %a3) + jbsr %a3@ | probe address (read ID) + movl #DIOII_DEVSIZE, %d1 + tstl %d0 | success? jne 1f | no, skip - addl d1, d3 | yes, count it + addl %d1, %d3 | yes, count it 1: - addl d1, a0 | next slot address... - addql #1, d2 | and slot number - cmpl #256, d2 + addl %d1, %a0 | next slot address... + addql #1, %d2 | and slot number + cmpl #256, %d2 jne dioloop #if NSGC > 0 @@ -382,36 +385,36 @@ dioloop: * Probe for SGC devices, slots 0 to 3. * Only do the probe on machines which might have an SGC bus. */ - RELOC(machineid,a0) - cmpl #HP_400,a0@ + RELOC(machineid,%a0) + cmpl #HP_400,%a0@ jeq sgcprobe - cmpl #HP_425,a0@ + cmpl #HP_425,%a0@ jeq sgcprobe - cmpl #HP_433,a0@ + cmpl #HP_433,%a0@ jne eiodone sgcprobe: - clrl d2 | first slot... - movl #SGC_BASE, a0 | and first address + clrl %d2 | first slot... + movl #SGC_BASE, %a0 | and first address sgcloop: - ASRELOC(phys_badaddr, a3) - jbsr a3@ | probe address - movl #SGC_DEVSIZE, d1 - tstl d0 | success? + ASRELOC(phys_badaddr, %a3) + jbsr %a3@ | probe address + movl #SGC_DEVSIZE, %d1 + tstl %d0 | success? jne 2f | no, skip - addl d1, d3 | yes, count it + addl %d1, %d3 | yes, count it 2: - addl d1, a0 | next slot address... - addql #1, d2 | and slot number - cmpl #SGC_NSLOTS, d2 + addl %d1, %a0 | next slot address... + addql #1, %d2 | and slot number + cmpl #SGC_NSLOTS, %d2 jne sgcloop #endif eiodone: - moveq #PGSHIFT, d2 - lsrl d2, d3 | convert from bytes to pages - RELOC(eiomapsize,a2) - addql #1, d3 | add an extra page for device probes - movl d3,a2@ + moveq #PGSHIFT, %d2 + lsrl %d2, %d3 | convert from bytes to pages + RELOC(eiomapsize,%a2) + addql #1, %d3 | add an extra page for device probes + movl %d3,%a2@ /* * Now that we know what CPU we have, initialize the address error @@ -420,27 +423,21 @@ eiodone: * vectab+8 bus error * vectab+12 address error */ - RELOC(cputype, a0) -#if 0 - /* XXX assembler/linker feature/bug */ - RELOC(vectab, a2) -#else - movl #_C_LABEL(vectab),a2 - addl a5,a2 -#endif + RELOC(cputype, %a0) + RELOC(vectab, %a2) #if defined(M68040) - cmpl #CPU_68040,a0@ | 68040? + cmpl #CPU_68040,%a0@ | 68040? jne 1f | no, skip - movl #_C_LABEL(buserr40),a2@(8) - movl #_C_LABEL(addrerr4060),a2@(12) + movl #_C_LABEL(buserr40),%a2@(8) + movl #_C_LABEL(addrerr4060),%a2@(12) jra Lstart2 1: #endif #if defined(M68020) || defined(M68030) - cmpl #CPU_68040,a0@ | 68040? + cmpl #CPU_68040,%a0@ | 68040? jeq 1f | yes, skip - movl #_C_LABEL(busaddrerr2030),a2@(8) - movl #_C_LABEL(busaddrerr2030),a2@(12) + movl #_C_LABEL(busaddrerr2030),%a2@(8) + movl #_C_LABEL(busaddrerr2030),%a2@(12) jra Lstart2 1: #endif @@ -450,37 +447,37 @@ Lunsupp: Lstart2: /* initialize source/destination control registers for movs */ - moveq #FC_USERD,d0 | user space - movc d0,sfc | as source - movc d0,dfc | and destination of transfers + moveq #FC_USERD,%d0 | user space + movc %d0,%sfc | as source + movc %d0,%dfc | and destination of transfers /* initialize memory size (for pmap_bootstrap) */ - movl #MAXADDR,d1 | last page - movl a5,d0 | lowram value from ROM via boot - moveq #PGSHIFT,d2 - subl d0,d1 | compute amount of RAM present - lsrl d2,d1 | convert to pages - addl #3,d1 | restore the 3 pages lost (2 from + movl #MAXADDR,%d1 | last page + movl %a5,%d0 | lowram value from ROM via boot + moveq #PGSHIFT,%d2 + subl %d0,%d1 | compute amount of RAM present + lsrl %d2,%d1 | convert to pages + addl #3,%d1 | restore the 3 pages lost (2 from | the bootloader and the MAXADDR one) - RELOC(physmem, a0) - movl d1,a0@ | save as physmem + RELOC(physmem, %a0) + movl %d1,%a0@ | save as physmem /* configure kernel and proc0 VA space so we can get going */ #if defined(DDB) || NKSYMS > 0 - RELOC(esym,a0) | end of static kernel test/data/syms - movl a0@,d5 + RELOC(esym,%a0) | end of static kernel test/data/syms + movl %a0@,%d5 jne Lstart3 #endif - movl #_C_LABEL(end),d5 | end of static kernel text/data + movl #_C_LABEL(end),%d5 | end of static kernel text/data Lstart3: - addl #NBPG-1,d5 - andl #PG_FRAME,d5 | round to a page - movl d5,a4 - addl a5,a4 | convert to PA - pea a5@ | firstpa - pea a4@ | nextpa - RELOC(pmap_bootstrap,a0) - jbsr a0@ | pmap_bootstrap(firstpa, nextpa) - addql #8,sp + addl #NBPG-1,%d5 + andl #PG_FRAME,%d5 | round to a page + movl %d5,%a4 + addl %a5,%a4 | convert to PA + pea %a5@ | firstpa + pea %a4@ | nextpa + RELOC(pmap_bootstrap,%a0) + jbsr %a0@ | pmap_bootstrap(firstpa, nextpa) + addql #8,%sp /* * While still running physical, override copypage() with the 68040 @@ -488,15 +485,15 @@ Lstart3: * This relies upon the fact that copypage() immediately follows * copypage040() in memory. */ - RELOC(mmutype, a0) - cmpl #MMU_68040,a0@ + RELOC(mmutype, %a0) + cmpl #MMU_68040,%a0@ jgt Lmmu_enable - RELOC(copypage040, a0) - RELOC(copypage, a1) - movl a1, a2 + RELOC(copypage040, %a0) + RELOC(copypage, %a1) + movl %a1, %a2 1: - movw a0@+, a2@+ - cmpl a0, a1 + movw %a0@+, %a2@+ + cmpl %a0, %a1 jgt 1b /* @@ -510,28 +507,30 @@ Lstart3: * Is this all really necessary, or am I paranoid?? */ Lmmu_enable: - RELOC(Sysseg, a0) | system segment table addr - movl a0@,d1 | read value (a KVA) - addl a5,d1 | convert to PA - RELOC(mmutype, a0) - cmpl #MMU_68040,a0@ | 68040? + RELOC(Sysseg, %a0) | system segment table addr + movl %a0@,%d1 | read value (a KVA) + addl %a5,%d1 | convert to PA + RELOC(mmutype, %a0) + cmpl #MMU_68040,%a0@ | 68040? jne Lmotommu1 | no, skip - .long 0x4e7b1807 | movc d1,srp + .chip 68040 + movc %d1,%srp + .chip 68020 jra Lstploaddone Lmotommu1: - ASRELOC(protorp, a0) - movl #0x80000202,a0@ | nolimit + share global + 4 byte PTEs - movl d1,a0@(4) | + segtable address - pmove a0@,srp | load the supervisor root pointer - movl #0x80000002,a0@ | reinit upper half for CRP loads + ASRELOC(protorp, %a0) + movl #0x80000202,%a0@ | nolimit + share global + 4 byte PTEs + movl %d1,%a0@(4) | + segtable address + pmove %a0@,%srp | load the supervisor root pointer + movl #0x80000002,%a0@ | reinit upper half for CRP loads Lstploaddone: - lea MAXADDR,a2 | PA of last RAM page - ASRELOC(Lhighcode, a1) | addr of high code - ASRELOC(Lehighcode, a3) | end addr + lea MAXADDR,%a2 | PA of last RAM page + ASRELOC(Lhighcode, %a1) | addr of high code + ASRELOC(Lehighcode, %a3) | end addr Lcodecopy: - movw a1@+,a2@+ | copy a word - cmpl a3,a1 | done yet? + movw %a1@+,%a2@+ | copy a word + cmpl %a3,%a1 | done yet? jcs Lcodecopy | no, keep going jmp MAXADDR | go for it! @@ -546,19 +545,20 @@ Lhighcode: * Set up the vector table, and race to get the MMU * enabled. */ - movl #_C_LABEL(vectab),d0 | set Vector Base Register - movc d0,vbr + movl #_C_LABEL(vectab),%d0 | set Vector Base Register + movc %d0,%vbr - RELOC(mmutype, a0) - cmpl #MMU_68040,a0@ | 68040? + RELOC(mmutype, %a0) + cmpl #MMU_68040,%a0@ | 68040? jne Lmotommu2 | no, skip + .chip 68040 movw #0,INTIOBASE+MMUBASE+MMUCMD+2 movw #MMU_IEN+MMU_CEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD+2 | enable FPU and caches - moveq #0,d0 | ensure TT regs are disabled - .long 0x4e7b0004 | movc d0,itt0 - .long 0x4e7b0005 | movc d0,itt1 - .long 0x4e7b0007 | movc d0,dtt1 + moveq #0,%d0 | ensure TT regs are disabled + movc %d0,%itt0 + movc %d0,%itt1 + movc %d0,%dtt1 /* * Set up transparent translation for supervisor data access. @@ -567,33 +567,36 @@ Lhighcode: * of the address space (as long as we don't have more than * 1GB of memory, which will be very unlikely...) */ - movl #0xc03fa020,d0 - .long 0x4e7b0006 | movc d0,dtt0 - - .word 0xf4d8 | cinva bc - .word 0xf518 | pflusha - movl #0x8000,d0 - .long 0x4e7b0003 | movc d0,tc - movl #CACHE40_ON,d0 - movc d0,cacr | turn on both caches - jmp Lenab1 + movl #0xc03fa020,%d0 + movc %d0,%dtt0 + + cinva %bc + pflusha + movl #0x8000,%d0 + movc %d0,%tc + movl #CACHE40_ON,%d0 + movc %d0,%cacr | turn on both caches + jmp Lenab1:l | forced to not be pc-relative + .chip 68020 Lmotommu2: - cmpl #MMU_68030,a0@ | 68030? + cmpl #MMU_68030,%a0@ | 68030? jne Lmotommu2b | no, skip + .chip 68030 /* * Set up transparent translation for supervisor data access * (FC == 5), similar to the 68040 logic above. */ - ASRELOC(mmuscratch, a2) - movl #0xc03f8150,a2@ | build our TT0 value - .long 0xf0120800 | pmove a2@,tt0 + ASRELOC(mmuscratch, %a2) + movl #0xc03f8150,%a2@ | build our TT0 value + pmove %a2@,%tt0 + .chip 68020 Lmotommu2b: movl #MMU_IEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD | enable MMU and i-cache - ASRELOC(mmuscratch, a2) - movl #0x82c0aa00,a2@ | value to load TC with - pmove a2@,tc | load it - jmp Lenab1 + ASRELOC(mmuscratch, %a2) + movl #0x82c0aa00,%a2@ | value to load TC with + pmove %a2@,%tc | load it + jmp Lenab1:l | forced to not be pc-relative Lehighcode: /* @@ -605,34 +608,34 @@ Lehighcode: */ Lenab1: /* select the software page size now */ - lea _ASM_LABEL(tmpstk),sp | temporary stack - jbsr _C_LABEL(uvm_setpagesize) | select software page size + lea _ASM_LABEL(tmpstk),%sp | temporary stack + jbsr _C_LABEL(uvm_setpagesize) | select software page size /* set kernel stack, user SP, and initial pcb */ - movl _C_LABEL(proc0paddr),a1 | get proc0 pcb addr - lea a1@(USPACE-4),sp | set kernel stack to end of area - lea _C_LABEL(proc0),a2 | initialize proc0.p_addr so that - movl a1,a2@(P_ADDR) | we don't deref NULL in trap() - movl #USRSTACK-4,a2 - movl a2,usp | init user SP - movl a1,_C_LABEL(curpcb) | proc0 is running + movl _C_LABEL(proc0paddr),%a1 | get proc0 pcb addr + lea %a1@(USPACE-4),%sp | set kernel stack to end of area + lea _C_LABEL(proc0),%a2 | initialize proc0.p_addr so that + movl %a1,%a2@(P_ADDR) | we don't deref NULL in trap() + movl #USRSTACK-4,%a2 + movl %a2,%usp | init user SP + movl %a1,_C_LABEL(curpcb) | proc0 is running tstl _C_LABEL(fputype) | Have an FPU? jeq Lenab2 | No, skip. - clrl a1@(PCB_FPCTX) | ensure null FP context - movl a1,sp@- + clrl %a1@(PCB_FPCTX) | ensure null FP context + movl %a1,%sp@- jbsr _C_LABEL(m68881_restore) | restore it (does not kill a1) - addql #4,sp + addql #4,%sp Lenab2: /* flush TLB and turn on caches */ jbsr _ASM_LABEL(TBIA) | invalidate TLB cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jeq Lnocache0 | yes, cache already on - movl #CACHE_ON,d0 - movc d0,cacr | clear cache(s) + movl #CACHE_ON,%d0 + movc %d0,%cacr | clear cache(s) tstl _C_LABEL(ectype) jeq Lnocache0 - MMUADDR(a0) - orl #MMU_CEN,a0@(MMUCMD) | turn on external cache + MMUADDR(%a0) + orl #MMU_CEN,%a0@(MMUCMD) | turn on external cache Lnocache0: /* Final setup for call to main(). */ jbsr _C_LABEL(hp300_init) @@ -642,13 +645,13 @@ Lnocache0: * main() never returns; we exit to user mode from a forked process * later on. */ - clrw sp@- | vector offset/frame type - clrl sp@- | PC - filled in by "execve" - movw #PSL_USER,sp@- | in user mode - clrl sp@- | stack adjust count and padding - lea sp@(-64),sp | construct space for D0-D7/A0-A7 - lea _C_LABEL(proc0),a0 | save pointer to frame - movl sp,a0@(P_MD_REGS) | in proc0.p_md.md_regs + clrw %sp@- | vector offset/frame type + clrl %sp@- | PC - filled in by "execve" + movw #PSL_USER,%sp@- | in user mode + clrl %sp@- | stack adjust count and padding + lea %sp@(-64),%sp | construct space for D0-D7/A0-A7 + lea _C_LABEL(proc0),%a0 | save pointer to frame + movl %sp,%a0@(P_MD_REGS) | in proc0.p_md.md_regs jra _C_LABEL(main) | main() PANIC("main() returned") @@ -659,13 +662,13 @@ Lnocache0: * and then rei. */ GLOBAL(proc_trampoline) - movl a3,sp@- | push function arg - jbsr a2@ | call function - addql #4,sp | pop arg - movl sp@(FR_SP),a0 | grab and load - movl a0,usp | user SP - moveml sp@+,#0x7FFF | restore most user regs - addql #8,sp | toss SP and stack adjust + movl %a3,%sp@- | push function arg + jbsr %a2@ | call function + addql #4,%sp | pop arg + movl %sp@(FR_SP),%a0 | grab and load + movl %a0,%usp | user SP + moveml %sp@+,#0x7FFF | restore most user regs + addql #8,%sp | toss SP and stack adjust jra _ASM_LABEL(rei) | and return @@ -678,177 +681,135 @@ GLOBAL(proc_trampoline) GLOBAL(m68k_fault_addr) .long 0 -#if defined(M68040) || defined(M68060) +#if defined(M68040) ENTRY_NOPROFILE(addrerr4060) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | save the user SP - movl a0,sp@(FR_SP) | in the savearea - movl sp@(FR_HW+8),sp@- - clrl sp@- | dummy code - movl #T_ADDRERR,sp@- | mark address error + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save user registers + movl %usp,%a0 | save the user SP + movl %a0,%sp@(FR_SP) | in the savearea + movl %sp@(FR_HW+8),%sp@- + clrl %sp@- | dummy code + movl #T_ADDRERR,%sp@- | mark address error jra _ASM_LABEL(faultstkadj) | and deal with it -#endif -#if defined(M68060) -ENTRY_NOPROFILE(buserr60) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | save the user SP - movl a0,sp@(FR_SP) | in the savearea - movel sp@(FR_HW+12),d0 | FSLW - btst #2,d0 | branch prediction error? - jeq Lnobpe - movc cacr,d2 - orl #IC60_CABC,d2 | clear all branch cache entries - movc d2,cacr - movl d0,d1 - addql #1,L60bpe - andl #0x7ffd,d1 - jeq _ASM_LABEL(faultstkadjnotrap2) -Lnobpe: -| we need to adjust for misaligned addresses - movl sp@(FR_HW+8),d1 | grab VA - btst #27,d0 | check for mis-aligned access - jeq Lberr3 | no, skip - addl #28,d1 | yes, get into next page - | operand case: 3, - | instruction case: 4+12+12 - andl #PG_FRAME,d1 | and truncate -Lberr3: - movl d1,sp@- - movl d0,sp@- | code is FSLW now. - andw #0x1f80,d0 - jeq Lberr60 | it is a bus error - movl #T_MMUFLT,sp@- | show that we are an MMU fault - jra _ASM_LABEL(faultstkadj) | and deal with it -Lberr60: - tstl _C_LABEL(nofault) | catch bus error? - jeq Lisberr | no, handle as usual - movl sp@(FR_HW+8+8),_C_LABEL(m68k_fault_addr) | save fault addr - movl _C_LABEL(nofault),sp@- | yes, - jbsr _C_LABEL(longjmp) | longjmp(nofault) - /* NOTREACHED */ -#endif -#if defined(M68040) ENTRY_NOPROFILE(buserr40) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | save the user SP - movl a0,sp@(FR_SP) | in the savearea - movl sp@(FR_HW+20),d1 | get fault address - moveq #0,d0 - movw sp@(FR_HW+12),d0 | get SSW - btst #11,d0 | check for mis-aligned + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save user registers + movl %usp,%a0 | save the user SP + movl %a0,%sp@(FR_SP) | in the savearea + movl %sp@(FR_HW+20),%d1 | get fault address + moveq #0,%d0 + movw %sp@(FR_HW+12),%d0 | get SSW + btst #11,%d0 | check for mis-aligned jeq Lbe1stpg | no skip - addl #3,d1 | get into next page - andl #PG_FRAME,d1 | and truncate + addl #3,%d1 | get into next page + andl #PG_FRAME,%d1 | and truncate Lbe1stpg: - movl d1,sp@- | pass fault address. - movl d0,sp@- | pass SSW as code - btst #10,d0 | test ATC + movl %d1,%sp@- | pass fault address. + movl %d0,%sp@- | pass SSW as code + btst #10,%d0 | test ATC jeq Lberr40 | it is a bus error - movl #T_MMUFLT,sp@- | show that we are an MMU fault + movl #T_MMUFLT,%sp@- | show that we are an MMU fault jra _ASM_LABEL(faultstkadj) | and deal with it Lberr40: tstl _C_LABEL(nofault) | catch bus error? jeq Lisberr | no, handle as usual - movl sp@(FR_HW+8+20),_C_LABEL(m68k_fault_addr) | save fault addr - movl _C_LABEL(nofault),sp@- | yes, + movl %sp@(FR_HW+8+20),_C_LABEL(m68k_fault_addr) | save fault addr + movl _C_LABEL(nofault),%sp@- | yes, jbsr _C_LABEL(longjmp) | longjmp(nofault) /* NOTREACHED */ #endif #if defined(M68020) || defined(M68030) ENTRY_NOPROFILE(busaddrerr2030) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | save the user SP - movl a0,sp@(FR_SP) | in the savearea - moveq #0,d0 - movw sp@(FR_HW+10),d0 | grab SSW for fault processing - btst #12,d0 | RB set? + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save user registers + movl %usp,%a0 | save the user SP + movl %a0,%sp@(FR_SP) | in the savearea + moveq #0,%d0 + movw %sp@(FR_HW+10),%d0 | grab SSW for fault processing + btst #12,%d0 | RB set? jeq LbeX0 | no, test RC - bset #14,d0 | yes, must set FB - movw d0,sp@(FR_HW+10) | for hardware too + bset #14,%d0 | yes, must set FB + movw %d0,%sp@(FR_HW+10) | for hardware too LbeX0: - btst #13,d0 | RC set? + btst #13,%d0 | RC set? jeq LbeX1 | no, skip - bset #15,d0 | yes, must set FC - movw d0,sp@(FR_HW+10) | for hardware too + bset #15,%d0 | yes, must set FC + movw %d0,%sp@(FR_HW+10) | for hardware too LbeX1: - btst #8,d0 | data fault? + btst #8,%d0 | data fault? jeq Lbe0 | no, check for hard cases - movl sp@(FR_HW+16),d1 | fault address is as given in frame + movl %sp@(FR_HW+16),%d1 | fault address is as given in frame jra Lbe10 | thats it Lbe0: - btst #4,sp@(FR_HW+6) | long (type B) stack frame? + btst #4,%sp@(FR_HW+6) | long (type B) stack frame? jne Lbe4 | yes, go handle - movl sp@(FR_HW+2),d1 | no, can use save PC - btst #14,d0 | FB set? + movl %sp@(FR_HW+2),%d1 | no, can use save PC + btst #14,%d0 | FB set? jeq Lbe3 | no, try FC - addql #4,d1 | yes, adjust address + addql #4,%d1 | yes, adjust address jra Lbe10 | done Lbe3: - btst #15,d0 | FC set? + btst #15,%d0 | FC set? jeq Lbe10 | no, done - addql #2,d1 | yes, adjust address + addql #2,%d1 | yes, adjust address jra Lbe10 | done Lbe4: - movl sp@(FR_HW+36),d1 | long format, use stage B address - btst #15,d0 | FC set? + movl %sp@(FR_HW+36),%d1 | long format, use stage B address + btst #15,%d0 | FC set? jeq Lbe10 | no, all done - subql #2,d1 | yes, adjust address + subql #2,%d1 | yes, adjust address Lbe10: - movl d1,sp@- | push fault VA - movl d0,sp@- | and padded SSW - movw sp@(FR_HW+8+6),d0 | get frame format/vector offset - andw #0x0FFF,d0 | clear out frame format - cmpw #12,d0 | address error vector? + movl %d1,%sp@- | push fault VA + movl %d0,%sp@- | and padded SSW + movw %sp@(FR_HW+8+6),%d0 | get frame format/vector offset + andw #0x0FFF,%d0 | clear out frame format + cmpw #12,%d0 | address error vector? jeq Lisaerr | yes, go to it - movl d1,a0 | fault address - movl sp@,d0 | function code from ssw - btst #8,d0 | data fault? + movl %d1,%a0 | fault address + movl %sp@,%d0 | function code from ssw + btst #8,%d0 | data fault? jne Lbe10a - movql #1,d0 | user program access FC + movql #1,%d0 | user program access FC | (we dont separate data/program) - btst #5,sp@(FR_HW+8) | supervisor mode? + btst #5,%sp@(FR_HW+8) | supervisor mode? jeq Lbe10a | if no, done - movql #5,d0 | else supervisor program access + movql #5,%d0 | else supervisor program access Lbe10a: - ptestr d0,a0@,#7 | do a table search - pmove psr,sp@ | save result - movb sp@,d1 - btst #2,d1 | invalid (incl. limit viol. and berr)? + ptestr %d0,%a0@,#7 | do a table search + pmove %psr,%sp@ | save result + movb %sp@,%d1 + btst #2,%d1 | invalid (incl. limit viol. and berr)? jeq Lmightnotbemerr | no -> wp check - btst #7,d1 | is it MMU table berr? + btst #7,%d1 | is it MMU table berr? jne Lisberr1 | yes, needs not be fast. Lismerr: - movl #T_MMUFLT,sp@- | show that we are an MMU fault + movl #T_MMUFLT,%sp@- | show that we are an MMU fault jra _ASM_LABEL(faultstkadj) | and deal with it Lmightnotbemerr: - btst #3,d1 | write protect bit set? + btst #3,%d1 | write protect bit set? jeq Lisberr1 | no: must be bus error - movl sp@,d0 | ssw into low word of d0 - andw #0xc0,d0 | Write protect is set on page: - cmpw #0x40,d0 | was it read cycle? + movl %sp@,%d0 | ssw into low word of d0 + andw #0xc0,%d0 | Write protect is set on page: + cmpw #0x40,%d0 | was it read cycle? jne Lismerr | no, was not WPE, must be MMU fault jra Lisberr1 | real bus err needs not be fast. Lisaerr: - movl #T_ADDRERR,sp@- | mark address error + movl #T_ADDRERR,%sp@- | mark address error jra _ASM_LABEL(faultstkadj) | and deal with it Lisberr1: - clrw sp@ | re-clear pad word + clrw %sp@ | re-clear pad word tstl _C_LABEL(nofault) | catch bus error? jeq Lisberr | no, handle as usual - movl sp@(FR_HW+8+16),_C_LABEL(m68k_fault_addr) | save fault addr - movl _C_LABEL(nofault),sp@- | yes, + movl %sp@(FR_HW+8+16),_C_LABEL(m68k_fault_addr) | save fault addr + movl _C_LABEL(nofault),%sp@- | yes, jbsr _C_LABEL(longjmp) | longjmp(nofault) /* NOTREACHED */ #endif /* M68020 || M68030 */ Lisberr: | also used by M68040/60 - movl #T_BUSERR,sp@- | mark bus error + movl #T_BUSERR,%sp@- | mark bus error jra _ASM_LABEL(faultstkadj) | and deal with it /* @@ -858,7 +819,7 @@ ENTRY_NOPROFILE(fpfline) #if defined(M68040) cmpl #FPU_68040,_C_LABEL(fputype) | 68040 FPU? jne Lfp_unimp | no, skip FPSP - cmpw #0x202c,sp@(6) | format type 2? + cmpw #0x202c,%sp@(6) | format type 2? jne _C_LABEL(illinst) | no, not an FP emulation Ldofp_unimp: #ifdef FPSP @@ -867,9 +828,9 @@ Ldofp_unimp: Lfp_unimp: #endif /* M68040 */ #ifdef FPU_EMULATE - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save registers - moveq #T_FPEMULI,d0 | denote as FP emulation trap + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save registers + moveq #T_FPEMULI,%d0 | denote as FP emulation trap jra _ASM_LABEL(fault) | do it #else jra _C_LABEL(illinst) @@ -885,9 +846,9 @@ ENTRY_NOPROFILE(fpunsupp) Lfp_unsupp: #endif /* M68040 */ #ifdef FPU_EMULATE - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save registers - moveq #T_FPEMULD,d0 | denote as FP emulation trap + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save registers + moveq #T_FPEMULD,%d0 | denote as FP emulation trap jra _ASM_LABEL(fault) | do it #else jra _C_LABEL(illinst) @@ -900,28 +861,28 @@ Lfp_unsupp: * after the trap call. */ ENTRY_NOPROFILE(fpfault) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | and save - movl a0,sp@(FR_SP) | the user stack pointer - clrl sp@- | no VA arg - movl _C_LABEL(curpcb),a0 | current pcb - lea a0@(PCB_FPCTX),a0 | address of FP savearea - fsave a0@ | save state + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save user registers + movl %usp,%a0 | and save + movl %a0,%sp@(FR_SP) | the user stack pointer + clrl %sp@- | no VA arg + movl _C_LABEL(curpcb),%a0 | current pcb + lea %a0@(PCB_FPCTX),%a0 | address of FP savearea + fsave %a0@ | save state #if defined(M68040) || defined(M68060) /* always null state frame on 68040, 68060 */ cmpl #FPU_68040,_C_LABEL(fputype) jge Lfptnull #endif - tstb a0@ | null state frame? + tstb %a0@ | null state frame? jeq Lfptnull | yes, safe - clrw d0 | no, need to tweak BIU - movb a0@(1),d0 | get frame size - bset #3,a0@(0,d0:w) | set exc_pend bit of BIU + clrw %d0 | no, need to tweak BIU + movb %a0@(1),%d0 | get frame size + bset #3,%a0@(0,%d0:w) | set exc_pend bit of BIU Lfptnull: - fmovem fpsr,sp@- | push fpsr as code argument - frestore a0@ | restore state - movl #T_FPERR,sp@- | push type arg + fmovem %fpsr,%sp@- | push fpsr as code argument + frestore %a0@ | restore state + movl #T_FPERR,%sp@- | push type arg jra _ASM_LABEL(faultstkadj) | call trap and deal with stack cleanup /* @@ -930,35 +891,35 @@ Lfptnull: */ ENTRY_NOPROFILE(badtrap) - moveml #0xC0C0,sp@- | save scratch regs - movw sp@(22),sp@- | push exception vector info - clrw sp@- - movl sp@(22),sp@- | and PC + moveml #0xC0C0,%sp@- | save scratch regs + movw %sp@(22),%sp@- | push exception vector info + clrw %sp@- + movl %sp@(22),%sp@- | and PC jbsr _C_LABEL(straytrap) | report - addql #8,sp | pop args - moveml sp@+,#0x0303 | restore regs + addql #8,%sp | pop args + moveml %sp@+,#0x0303 | restore regs jra _ASM_LABEL(rei) | all done ENTRY_NOPROFILE(trap0) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | save the user SP - movl a0,sp@(FR_SP) | in the savearea - movl d0,sp@- | push syscall number + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- | save user registers + movl %usp,%a0 | save the user SP + movl %a0,%sp@(FR_SP) | in the savearea + movl %d0,%sp@- | push syscall number jbsr _C_LABEL(syscall) | handle it - addql #4,sp | pop syscall arg + addql #4,%sp | pop syscall arg tstl _C_LABEL(astpending) jne Lrei2 tstl _C_LABEL(softpending) jeq Ltrap1 - movw #SPL1,sr + movw #SPL1,%sr tstl _C_LABEL(softpending) jne Lsir1 Ltrap1: - movl sp@(FR_SP),a0 | grab and restore - movl a0,usp | user SP - moveml sp@+,#0x7FFF | restore most registers - addql #8,sp | pop SP and stack adjust + movl %sp@(FR_SP),%a0 | grab and restore + movl %a0,%usp | user SP + moveml %sp@+,#0x7FFF | restore most registers + addql #8,%sp | pop SP and stack adjust rte /* @@ -979,12 +940,12 @@ ENTRY_NOPROFILE(trap2) * command in d0, addr in a1, length in d1 */ ENTRY_NOPROFILE(trap12) - movl d1,sp@- | push length - movl a1,sp@- | push addr - movl d0,sp@- | push command - movl CURPROC,sp@- | push proc pointer + movl %d1,%sp@- | push length + movl %a1,%sp@- | push addr + movl %d0,%sp@- | push command + movl CURPROC,%sp@- | push proc pointer jbsr _C_LABEL(cachectl) | do it - lea sp@(16),sp | pop args + lea %sp@(16),%sp | pop args jra _ASM_LABEL(rei) | all done /* @@ -992,9 +953,9 @@ ENTRY_NOPROFILE(trap12) * User mode traps are simply passed on to trap(). */ ENTRY_NOPROFILE(trace) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- - moveq #T_TRACE,d0 + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- + moveq #T_TRACE,%d0 | Check PSW and see what happened. | T=0 S=0 (should not happen) @@ -1002,9 +963,9 @@ ENTRY_NOPROFILE(trace) | T=0 S=1 trace trap on a trap instruction | T=1 S=1 trace trap from system mode (kernel breakpoint) - movw sp@(FR_HW),d1 | get PSW - notw d1 | XXX no support for T0 on 680[234]0 - andw #PSL_TS,d1 | from system mode (T=1, S=1)? + movw %sp@(FR_HW),%d1 | get PSW + notw %d1 | XXX no support for T0 on 680[234]0 + andw #PSL_TS,%d1 | from system mode (T=1, S=1)? jeq Lkbrkpt | yes, kernel breakpoint jra _ASM_LABEL(fault) | no, user-mode fault @@ -1016,33 +977,33 @@ ENTRY_NOPROFILE(trace) * User mode traps are simply passed to trap(). */ ENTRY_NOPROFILE(trap15) - clrl sp@- | stack adjust count - moveml #0xFFFF,sp@- - moveq #T_TRAP15,d0 - movw sp@(FR_HW),d1 | get PSW - andw #PSL_S,d1 | from system mode? + clrl %sp@- | stack adjust count + moveml #0xFFFF,%sp@- + moveq #T_TRAP15,%d0 + movw %sp@(FR_HW),%d1 | get PSW + andw #PSL_S,%d1 | from system mode? jne Lkbrkpt | yes, kernel breakpoint jra _ASM_LABEL(fault) | no, user-mode fault Lkbrkpt: | Kernel-mode breakpoint or trace trap. (d0=trap_type) | Save the system sp rather than the user sp. - movw #PSL_HIGHIPL,sr | lock out interrupts - lea sp@(FR_SIZE),a6 | Save stack pointer - movl a6,sp@(FR_SP) | from before trap + movw #PSL_HIGHIPL,%sr | lock out interrupts + lea %sp@(FR_SIZE),%a6 | Save stack pointer + movl %a6,%sp@(FR_SP) | from before trap | If we are not on tmpstk switch to it. | (so debugger can change the stack pointer) - movl a6,d1 - cmpl #_ASM_LABEL(tmpstk),d1 + movl %a6,%d1 + cmpl #_ASM_LABEL(tmpstk),%d1 jls Lbrkpt2 | already on tmpstk | Copy frame to the temporary stack - movl sp,a0 | a0=src - lea _ASM_LABEL(tmpstk)-96,a1 | a1=dst - movl a1,sp | sp=new frame - moveq #FR_SIZE,d1 + movl %sp,%a0 | a0=src + lea _ASM_LABEL(tmpstk)-96,%a1 | a1=dst + movl %a1,%sp | sp=new frame + moveq #FR_SIZE,%d1 Lbrkpt1: - movl a0@+,a1@+ - subql #4,d1 + movl %a0@+,%a1@+ + subql #4,%d1 bgt Lbrkpt1 Lbrkpt2: @@ -1053,25 +1014,25 @@ Lbrkpt2: | If we have both DDB and KGDB, let KGDB see it first, | because KGDB will just return 0 if not connected. | Save args in d2, a2 - movl d0,d2 | trap type - movl sp,a2 | frame ptr + movl %d0,%d2 | trap type + movl %sp,%a2 | frame ptr #ifdef KGDB | Let KGDB handle it (if connected) - movl a2,sp@- | push frame ptr - movl d2,sp@- | push trap type + movl %a2,%sp@- | push frame ptr + movl %d2,%sp@- | push trap type jbsr _C_LABEL(kgdb_trap) | handle the trap - addql #8,sp | pop args - cmpl #0,d0 | did kgdb handle it? + addql #8,%sp | pop args + cmpl #0,%d0 | did kgdb handle it? jne Lbrkpt3 | yes, done #endif #ifdef DDB | Let DDB handle it - movl a2,sp@- | push frame ptr - movl d2,sp@- | push trap type + movl %a2,%sp@- | push frame ptr + movl %d2,%sp@- | push trap type jbsr _C_LABEL(kdb_trap) | handle the trap - addql #8,sp | pop args + addql #8,%sp | pop args #if 0 /* not needed on hp300 */ - cmpl #0,d0 | did ddb handle it? + cmpl #0,%d0 | did ddb handle it? jne Lbrkpt3 | yes, done #endif #endif @@ -1082,13 +1043,13 @@ Lbrkpt3: | so push the hardware frame at the current sp | before restoring registers and returning. - movl sp@(FR_SP),a0 | modified sp - lea sp@(FR_SIZE),a1 | end of our frame - movl a1@-,a0@- | copy 2 longs with - movl a1@-,a0@- | ... predecrement - movl a0,sp@(FR_SP) | sp = h/w frame - moveml sp@+,#0x7FFF | restore all but sp - movl sp@,sp | ... and sp + movl %sp@(FR_SP),%a0 | modified sp + lea %sp@(FR_SIZE),%a1 | end of our frame + movl %a1@-,%a0@- | copy 2 longs with + movl %a1@-,%a0@- | ... predecrement + movl %a0,%sp@(FR_SP) | sp = h/w frame + moveml %sp@+,#0x7FFF | restore all but sp + movl %sp@,%sp | ... and sp rte | all done /* @@ -1103,8 +1064,8 @@ Lbrkpt3: * we don't do anything else with them. */ -#define INTERRUPT_SAVEREG moveml #0xC0C0,sp@- -#define INTERRUPT_RESTOREREG moveml sp@+,#0x0303 +#define INTERRUPT_SAVEREG moveml #0xC0C0,%sp@- +#define INTERRUPT_RESTOREREG moveml %sp@+,#0x0303 ENTRY_NOPROFILE(spurintr) /* level 0 */ addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS @@ -1112,94 +1073,94 @@ ENTRY_NOPROFILE(spurintr) /* level 0 */ ENTRY_NOPROFILE(intrhand) /* levels 2 through 5 */ INTERRUPT_SAVEREG - movw sp@(22),sp@- | push exception vector info - clrw sp@- + movw %sp@(22),%sp@- | push exception vector info + clrw %sp@- jbsr _C_LABEL(intr_dispatch) | call dispatch routine - addql #4,sp + addql #4,%sp INTERRUPT_RESTOREREG jra _ASM_LABEL(rei) | all done ENTRY_NOPROFILE(lev6intr) /* level 6: clock */ INTERRUPT_SAVEREG - CLKADDR(a0) - movb a0@(CLKSR),d0 | read clock status + CLKADDR(%a0) + movb %a0@(CLKSR),%d0 | read clock status Lclkagain: - btst #0,d0 | clear timer1 int immediately to + btst #0,%d0 | clear timer1 int immediately to jeq Lnotim1 | minimize chance of losing another - movpw a0@(CLKMSB1),d1 | due to statintr processing delay - movl _C_LABEL(clkint),d1 | clkcounter += clkint - addl d1,_C_LABEL(clkcounter) + movpw %a0@(CLKMSB1),%d1 | due to statintr processing delay + movl _C_LABEL(clkint),%d1 | clkcounter += clkint + addl %d1,_C_LABEL(clkcounter) Lnotim1: - btst #2,d0 | timer3 interrupt? + btst #2,%d0 | timer3 interrupt? jeq Lnotim3 | no, skip statclock - movpw a0@(CLKMSB3),d1 | clear timer3 interrupt - lea sp@(16),a1 | a1 = &clockframe - movl d0,sp@- | save status - movl a1,sp@- + movpw %a0@(CLKMSB3),%d1 | clear timer3 interrupt + lea %sp@(16),%a1 | a1 = &clockframe + movl %d0,%sp@- | save status + movl %a1,%sp@- jbsr _C_LABEL(statintr) | statintr(&frame) - addql #4,sp - movl sp@+,d0 | restore pre-statintr status - CLKADDR(a0) + addql #4,%sp + movl %sp@+,%d0 | restore pre-statintr status + CLKADDR(%a0) Lnotim3: - btst #0,d0 | timer1 interrupt? + btst #0,%d0 | timer1 interrupt? jeq Lrecheck | no, skip hardclock - lea sp@(16),a1 | a1 = &clockframe - movl a1,sp@- + lea %sp@(16),%a1 | a1 = &clockframe + movl %a1,%sp@- #ifdef USELEDS tstl _C_LABEL(ledaddr) | using LEDs? jeq Lnoleds0 | no, skip this code - movl _ASM_LABEL(heartbeat),d0 | get tick count - addql #1,d0 | increment - movl _C_LABEL(hz),d1 - addl #50,d1 | get the timing a little closer + movl _ASM_LABEL(heartbeat),%d0 | get tick count + addql #1,%d0 | increment + movl _C_LABEL(hz),%d1 + addl #50,%d1 | get the timing a little closer cmpl #0,_ASM_LABEL(beatstatus) | time to slow down? jeq Lslowthrob | yes, slow down - lsrl #3,d1 | no, fast throb + lsrl #3,%d1 | no, fast throb Lslowthrob: - lsrl #1,d1 | slow throb - cmpl d0,d1 | are we there yet? + lsrl #1,%d1 | slow throb + cmpl %d0,%d1 | are we there yet? jne Lnoleds1 | no, nothing to do addl #1,_ASM_LABEL(beatstatus) | incr beat status cmpl #3,_ASM_LABEL(beatstatus) | time to reset? ble Ltwinkle | no, twinkle the lights movl #0,_ASM_LABEL(beatstatus) | reset the status indicator Ltwinkle: - movl #LED_PULSE,sp@- - movl #LED_DISK+LED_LANRCV+LED_LANXMT,sp@- - clrl sp@- + movl #LED_PULSE,%sp@- + movl #LED_DISK+LED_LANRCV+LED_LANXMT,%sp@- + clrl %sp@- jbsr _C_LABEL(ledcontrol) | toggle pulse, turn all others off - lea sp@(12),sp - movql #0,d0 + lea %sp@(12),%sp + movql #0,%d0 Lnoleds1: - movl d0,_ASM_LABEL(heartbeat) + movl %d0,_ASM_LABEL(heartbeat) Lnoleds0: #endif /* USELEDS */ jbsr _C_LABEL(clockintr) | clockintr(&frame) - addql #4,sp - CLKADDR(a0) + addql #4,%sp + CLKADDR(%a0) Lrecheck: addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS | chalk up another interrupt - movb a0@(CLKSR),d0 | see if anything happened + movb %a0@(CLKSR),%d0 | see if anything happened jmi Lclkagain | while we were in clockintr/statintr #if NAUDIO >0 - movw sp@(22),sp@- | push exception vector info - clrw sp@- + movw %sp@(22),%sp@- | push exception vector info + clrw %sp@- jbsr _C_LABEL(intr_dispatch) | call dispatch routine - addql #4,sp + addql #4,%sp #endif INTERRUPT_RESTOREREG jra _ASM_LABEL(rei) | all done ENTRY_NOPROFILE(lev7intr) /* level 7: parity errors, reset key */ - clrl sp@- - moveml #0xFFFF,sp@- | save registers - movl usp,a0 | and save - movl a0,sp@(FR_SP) | the user stack pointer + clrl %sp@- + moveml #0xFFFF,%sp@- | save registers + movl %usp,%a0 | and save + movl %a0,%sp@(FR_SP) | the user stack pointer jbsr _C_LABEL(nmihand) | call handler - movl sp@(FR_SP),a0 | restore - movl a0,usp | user SP - moveml sp@+,#0x7FFF | and remaining registers - addql #8,sp | pop SP and stack adjust + movl %sp@(FR_SP),%a0 | restore + movl %a0,%usp | user SP + moveml %sp@+,#0x7FFF | and remaining registers + addql #8,%sp | pop SP and stack adjust jra _ASM_LABEL(rei) | all done /* @@ -1222,66 +1183,66 @@ ASENTRY_NOPROFILE(rei) tstl _C_LABEL(astpending) | AST pending? jeq Lchksir | no, go check for SIR Lrei1: - btst #5,sp@ | yes, are we returning to user mode? + btst #5,%sp@ | yes, are we returning to user mode? jne Lchksir | no, go check for SIR - movw #PSL_LOWIPL,sr | lower SPL - clrl sp@- | stack adjust - moveml #0xFFFF,sp@- | save all registers - movl usp,a1 | including - movl a1,sp@(FR_SP) | the users SP + movw #PSL_LOWIPL,%sr | lower SPL + clrl %sp@- | stack adjust + moveml #0xFFFF,%sp@- | save all registers + movl %usp,%a1 | including + movl %a1,%sp@(FR_SP) | the users SP Lrei2: - clrl sp@- | VA == none - clrl sp@- | code == none - movl #T_ASTFLT,sp@- | type == async system trap + clrl %sp@- | VA == none + clrl %sp@- | code == none + movl #T_ASTFLT,%sp@- | type == async system trap jbsr _C_LABEL(trap) | go handle it - lea sp@(12),sp | pop value args - movl sp@(FR_SP),a0 | restore user SP - movl a0,usp | from save area - movw sp@(FR_ADJ),d0 | need to adjust stack? + lea %sp@(12),%sp | pop value args + movl %sp@(FR_SP),%a0 | restore user SP + movl %a0,%usp | from save area + movw %sp@(FR_ADJ),%d0 | need to adjust stack? jne Laststkadj | yes, go to it - moveml sp@+,#0x7FFF | no, restore most user regs - addql #8,sp | toss SP and stack adjust + moveml %sp@+,#0x7FFF | no, restore most user regs + addql #8,%sp | toss SP and stack adjust rte | and do real RTE Laststkadj: - lea sp@(FR_HW),a1 | pointer to HW frame - addql #8,a1 | source pointer - movl a1,a0 | source - addw d0,a0 | + hole size = dest pointer - movl a1@-,a0@- | copy - movl a1@-,a0@- | 8 bytes - movl a0,sp@(FR_SP) | new SSP - moveml sp@+,#0x7FFF | restore user registers - movl sp@,sp | and our SP + lea %sp@(FR_HW),%a1 | pointer to HW frame + addql #8,%a1 | source pointer + movl %a1,%a0 | source + addw %d0,%a0 | + hole size = dest pointer + movl %a1@-,%a0@- | copy + movl %a1@-,%a0@- | 8 bytes + movl %a0,%sp@(FR_SP) | new SSP + moveml %sp@+,#0x7FFF | restore user registers + movl %sp@,%sp | and our SP rte | and do real RTE Lchksir: tstl _C_LABEL(softpending) | SIR pending? jeq Ldorte | no, all done - movl d0,sp@- | need a scratch register - movw sp@(4),d0 | get SR - andw #PSL_IPL7,d0 | mask all but IPL + movl %d0,%sp@- | need a scratch register + movw %sp@(4),%d0 | get SR + andw #PSL_IPL7,%d0 | mask all but IPL jne Lnosir | came from interrupt, no can do - movl sp@+,d0 | restore scratch register + movl %sp@+,%d0 | restore scratch register Lgotsir: - movw #SPL1,sr | prevent others from servicing int + movw #SPL1,%sr | prevent others from servicing int tstl _C_LABEL(softpending) | too late? jeq Ldorte | yes, oh well... - clrl sp@- | stack adjust - moveml #0xFFFF,sp@- | save all registers - movl usp,a1 | including - movl a1,sp@(FR_SP) | the users SP + clrl %sp@- | stack adjust + moveml #0xFFFF,%sp@- | save all registers + movl %usp,%a1 | including + movl %a1,%sp@(FR_SP) | the users SP Lsir1: - clrl sp@- | VA == none - clrl sp@- | code == none - movl #T_SSIR,sp@- | type == software interrupt + clrl %sp@- | VA == none + clrl %sp@- | code == none + movl #T_SSIR,%sp@- | type == software interrupt jbsr _C_LABEL(trap) | go handle it - lea sp@(12),sp | pop value args - movl sp@(FR_SP),a0 | restore - movl a0,usp | user SP - moveml sp@+,#0x7FFF | and all remaining registers - addql #8,sp | pop SP and stack adjust + lea %sp@(12),%sp | pop value args + movl %sp@(FR_SP),%a0 | restore + movl %a0,%usp | user SP + moveml %sp@+,#0x7FFF | and all remaining registers + addql #8,%sp | pop SP and stack adjust rte Lnosir: - movl sp@+,d0 | restore scratch register + movl %sp@+,%d0 | restore scratch register Ldorte: rte | real return @@ -1300,6 +1261,7 @@ Ldorte: #include <m68k/m68k/support.s> .data + .p2align 2 GLOBAL(curpcb) .long 0 @@ -1321,73 +1283,73 @@ ENTRY_NOPROFILE(cpu_idle_cycle) * bit). For now, we just always flush the full ATC. */ ENTRY(cpu_switchto) - movl sp@(4), d0 | oldproc + movl %sp@(4), %d0 | oldproc beq Lswnofpsave | is NULL, don't save anything /* * Save state of previous process in its pcb. */ - movl _C_LABEL(curpcb),a1 - movw sr, a1@(PCB_PS) | save sr before switching context - moveml #0xFCFC,a1@(PCB_REGS) | save non-scratch registers - movl usp,a2 | grab USP (a2 has been saved) - movl a2,a1@(PCB_USP) | and save it + movl _C_LABEL(curpcb),%a1 + movw %sr, %a1@(PCB_PS) | save sr before switching context + moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers + movl %usp,%a2 | grab USP (a2 has been saved) + movl %a2,%a1@(PCB_USP) | and save it tstl _C_LABEL(fputype) | Do we have an FPU? jeq Lswnofpsave | No Then don't attempt save. - lea a1@(PCB_FPCTX),a2 | pointer to FP save area - fsave a2@ | save FP state - tstb a2@ | null state frame? + lea %a1@(PCB_FPCTX),%a2 | pointer to FP save area + fsave %a2@ | save FP state + tstb %a2@ | null state frame? jeq Lswnofpsave | yes, all done - fmovem fp0-fp7,a2@(FPF_REGS) | save FP general registers - fmovem fpcr/fpsr/fpi,a2@(FPF_FPCR) | save FP control registers + fmovem %fp0-%fp7,%a2@(FPF_REGS) | save FP general registers + fmovem %fpcr/%fpsr/%fpi,%a2@(FPF_FPCR) | save FP control registers Lswnofpsave: - movl sp@(8), a0 | newproc + movl %sp@(8), %a0 | newproc - movl a0, CURPROC - movb #SONPROC,a0@(P_STAT) - movl a0@(P_ADDR),a1 | get p_addr - movl a1,_C_LABEL(curpcb) + movl %a0, CURPROC + movb #SONPROC,%a0@(P_STAT) + movl %a0@(P_ADDR),%a1 | get p_addr + movl %a1,_C_LABEL(curpcb) /* * Activate process's address space. * XXX Should remember the last USTP value loaded, and call this * XXX only if it has changed. */ - pea a0@ | push proc + pea %a0@ | push proc jbsr _C_LABEL(pmap_activate) | pmap_activate(p) - addql #4,sp - movl _C_LABEL(curpcb),a1 | restore p_addr + addql #4,%sp + movl _C_LABEL(curpcb),%a1 | restore p_addr - lea _ASM_LABEL(tmpstk),sp | now goto a tmp stack for NMI + lea _ASM_LABEL(tmpstk),%sp | now goto a tmp stack for NMI - moveml a1@(PCB_REGS),#0xFCFC | and registers - movl a1@(PCB_USP),a0 - movl a0,usp | and USP + moveml %a1@(PCB_REGS),#0xFCFC | and registers + movl %a1@(PCB_USP),%a0 + movl %a0,%usp | and USP tstl _C_LABEL(fputype) | If we don't have an FPU, jeq Lnofprest | don't try to restore it. - lea a1@(PCB_FPCTX),a0 | pointer to FP save area - tstb a0@ | null state frame? + lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area + tstb %a0@ | null state frame? jeq Lresfprest | yes, easy #if defined(M68040) #if defined(M68020) || defined(M68030) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne Lresnot040 | no, skip #endif - clrl sp@- | yes... - frestore sp@+ | ...magic! + clrl %sp@- | yes... + frestore %sp@+ | ...magic! Lresnot040: #endif - fmovem a0@(FPF_FPCR),fpcr/fpsr/fpi | restore FP control registers - fmovem a0@(FPF_REGS),fp0-fp7 | restore FP general registers + fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers + fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers Lresfprest: - frestore a0@ | restore state + frestore %a0@ | restore state Lnofprest: - movw a1@(PCB_PS),sr | no, restore PS - moveq #1,d0 | return 1 (for alternate returns) + movw %a1@(PCB_PS),%sr | no, restore PS + moveq #1,%d0 | return 1 (for alternate returns) rts /* @@ -1395,49 +1357,49 @@ Lnofprest: * Update pcb, saving current processor state. */ ENTRY(savectx) - movl sp@(4),a1 - movw sr,a1@(PCB_PS) - movl usp,a0 | grab USP - movl a0,a1@(PCB_USP) | and save it - moveml #0xFCFC,a1@(PCB_REGS) | save non-scratch registers + movl %sp@(4),%a1 + movw %sr,%a1@(PCB_PS) + movl %usp,%a0 | grab USP + movl %a0,%a1@(PCB_USP) | and save it + moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers tstl _C_LABEL(fputype) | Do we have FPU? jeq Lsvnofpsave | No? Then don't save state. - lea a1@(PCB_FPCTX),a0 | pointer to FP save area - fsave a0@ | save FP state - tstb a0@ | null state frame? + lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area + fsave %a0@ | save FP state + tstb %a0@ | null state frame? jeq Lsvnofpsave | yes, all done - fmovem fp0-fp7,a0@(FPF_REGS) | save FP general registers - fmovem fpcr/fpsr/fpi,a0@(FPF_FPCR) | save FP control registers + fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers + fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers Lsvnofpsave: - moveq #0,d0 | return 0 + moveq #0,%d0 | return 0 rts #if defined(M68040) ENTRY(suline) - movl sp@(4),a0 | address to write - movl _C_LABEL(curpcb),a1 | current pcb - movl #Lslerr,a1@(PCB_ONFAULT) | where to return to on a fault - movl sp@(8),a1 | address of line - movl a1@+,d0 | get lword - movsl d0,a0@+ | put lword + movl %sp@(4),%a0 | address to write + movl _C_LABEL(curpcb),%a1 | current pcb + movl #Lslerr,%a1@(PCB_ONFAULT) | where to return to on a fault + movl %sp@(8),%a1 | address of line + movl %a1@+,%d0 | get lword + movsl %d0,%a0@+ | put lword nop | sync - movl a1@+,d0 | get lword - movsl d0,a0@+ | put lword + movl %a1@+,%d0 | get lword + movsl %d0,%a0@+ | put lword nop | sync - movl a1@+,d0 | get lword - movsl d0,a0@+ | put lword + movl %a1@+,%d0 | get lword + movsl %d0,%a0@+ | put lword nop | sync - movl a1@+,d0 | get lword - movsl d0,a0@+ | put lword + movl %a1@+,%d0 | get lword + movsl %d0,%a0@+ | put lword nop | sync - moveq #0,d0 | indicate no fault + moveq #0,%d0 | indicate no fault jra Lsldone Lslerr: - moveq #-1,d0 + moveq #-1,%d0 Lsldone: - movl _C_LABEL(curpcb),a1 | current pcb - clrl a1@(PCB_ONFAULT) | clear fault address + movl _C_LABEL(curpcb),%a1 | current pcb + clrl %a1@(PCB_ONFAULT) | clear fault address rts #endif @@ -1448,15 +1410,17 @@ ASENTRY_NOPROFILE(TBIA) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne Lmotommu3 | no, skip - .word 0xf518 | yes, pflusha + .chip 68040 + pflusha rts Lmotommu3: + .chip 68020 #endif pflusha | flush entire TLB tstl _C_LABEL(mmutype) jpl Lmc68851a | 68851 implies no d-cache - movl #DC_CLEAR,d0 - movc d0,cacr | invalidate on-chip d-cache + movl #DC_CLEAR,%d0 + movc %d0,%cacr | invalidate on-chip d-cache Lmc68851a: rts @@ -1467,27 +1431,29 @@ ENTRY(TBIS) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne Lmotommu4 | no, skip - movl sp@(4),a0 - movc dfc,d1 - moveq #FC_USERD,d0 | user space - movc d0,dfc - .word 0xf508 | pflush a0@ - moveq #FC_SUPERD,d0 | super space - movc d0,dfc - .word 0xf508 | pflush a0@ - movc d1,dfc + .chip 68040 + movl %sp@(4),%a0 + movc %dfc,%d1 + moveq #FC_USERD,%d0 | user space + movc %d0,%dfc + pflush %a0@ + moveq #FC_SUPERD,%d0 | super space + movc %d0,%dfc + pflush %a0@ + movc %d1,%dfc rts + .chip 68020 Lmotommu4: #endif - movl sp@(4),a0 | get addr to flush + movl %sp@(4),%a0 | get addr to flush tstl _C_LABEL(mmutype) jpl Lmc68851b | is 68851? - pflush #0,#0,a0@ | flush address from both sides - movl #DC_CLEAR,d0 - movc d0,cacr | invalidate on-chip data cache + pflush #0,#0,%a0@ | flush address from both sides + movl #DC_CLEAR,%d0 + movc %d0,%cacr | invalidate on-chip data cache rts Lmc68851b: - pflushs #0,#0,a0@ | flush address from both sides + pflushs #0,#0,%a0@ | flush address from both sides rts /* @@ -1497,12 +1463,14 @@ ENTRY(ICIA) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 jne Lmotommu7 | no, skip - .word 0xf498 | cinva ic + .chip 68040 + cinva %ic rts + .chip 68020 Lmotommu7: #endif - movl #IC_CLEAR,d0 - movc d0,cacr | invalidate i-cache + movl #IC_CLEAR,%d0 + movc %d0,%cacr | invalidate i-cache rts /* @@ -1517,8 +1485,10 @@ ENTRY(DCIA) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 jne Lmotommu8 | no, skip - .word 0xf478 | cpusha dc + .chip 68040 + cpusha %dc rts + .chip 68020 Lmotommu8: #endif rts @@ -1527,8 +1497,10 @@ ENTRY(DCIS) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 jne Lmotommu9 | no, skip - .word 0xf478 | cpusha dc + .chip 68040 + cpusha %dc rts + .chip 68020 Lmotommu9: #endif rts @@ -1537,8 +1509,10 @@ ENTRY(DCIU) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 jne LmotommuA | no, skip - .word 0xf478 | cpusha dc + .chip 68040 + cpusha %dc rts + .chip 68020 LmotommuA: #endif rts @@ -1548,8 +1522,10 @@ ENTRY(PCIA) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 jne LmotommuB | no, skip - .word 0xf478 | cpusha dc + .chip 68040 + cpusha %dc rts + .chip 68020 LmotommuB: #endif #if defined(CACHE_HAVE_PAC) @@ -1557,93 +1533,97 @@ LmotommuB: * On non-68040 machines, PCIA() will only get invoked if * ectype == EC_PHYS, thus we do not need to test anything. */ - movl #DC_CLEAR,d0 - movc d0,cacr | invalidate on-chip d-cache - MMUADDR(a0) - andl #~MMU_CEN,a0@(MMUCMD) | disable cache in MMU control reg - orl #MMU_CEN,a0@(MMUCMD) | reenable cache in MMU control reg + movl #DC_CLEAR,%d0 + movc %d0,%cacr | invalidate on-chip d-cache + MMUADDR(%a0) + andl #~MMU_CEN,%a0@(MMUCMD) | disable cache in MMU control reg + orl #MMU_CEN,%a0@(MMUCMD) | reenable cache in MMU control reg rts #endif #endif #if defined(M68040) + .chip 68040 ENTRY(ICPA) - .word 0xf498 | cinva ic + cinva %ic rts ENTRY(DCFA) - .word 0xf478 | cpusha dc + cpusha %dc rts ENTRY(ICPL) - movl sp@(4),a0 | address - .word 0xf488 | cinvl ic,a0@ + movl %sp@(4),%a0 | address + cinvl %ic,%a0@ rts ENTRY(ICPP) - movl sp@(4),a0 | address - .word 0xf490 | cinvp ic,a0@ + movl %sp@(4),%a0 | address + cinvp %ic,%a0@ rts ENTRY(DCPL) - movl sp@(4),a0 | address - .word 0xf448 | cinvl dc,a0@ + movl %sp@(4),%a0 | address + cinvl %dc,%a0@ rts ENTRY(DCPP) - movl sp@(4),a0 | address - .word 0xf450 | cinvp dc,a0@ + movl %sp@(4),%a0 | address + cinvp %dc,%a0@ rts ENTRY(DCFL) - movl sp@(4),a0 | address - .word 0xf468 | cpushl dc,a0@ + movl %sp@(4),%a0 | address + cpushl %dc,%a0@ rts ENTRY(DCFP) - movl sp@(4),a0 | address - .word 0xf470 | cpushp dc,a0@ + movl %sp@(4),%a0 | address + cpushp %dc,%a0@ rts + .chip 68020 #endif ENTRY(ecacheon) tstl _C_LABEL(ectype) jeq Lnocache7 - MMUADDR(a0) - orl #MMU_CEN,a0@(MMUCMD) + MMUADDR(%a0) + orl #MMU_CEN,%a0@(MMUCMD) Lnocache7: rts ENTRY(ecacheoff) tstl _C_LABEL(ectype) jeq Lnocache8 - MMUADDR(a0) - andl #~MMU_CEN,a0@(MMUCMD) + MMUADDR(%a0) + andl #~MMU_CEN,%a0@(MMUCMD) Lnocache8: rts ENTRY_NOPROFILE(getsfc) - movc sfc,d0 + movc %sfc,%d0 rts ENTRY_NOPROFILE(getdfc) - movc dfc,d0 + movc %dfc,%d0 rts /* * Load a new user segment table pointer. */ ENTRY(loadustp) - movl sp@(4),d0 | new USTP - moveq #PGSHIFT,d1 - lsll d1,d0 | convert to addr + movl %sp@(4),%d0 | new USTP + moveq #PGSHIFT,%d1 + lsll %d1,%d0 | convert to addr #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne LmotommuC | no, skip - .word 0xf518 | yes, pflusha - .long 0x4e7b0806 | movc d0,urp + .chip 68040 + pflusha + movc %d0,%urp rts + .chip 68020 LmotommuC: #endif pflusha | flush entire TLB - lea _ASM_LABEL(protorp),a0 | CRP prototype - movl d0,a0@(4) | stash USTP - pmove a0@,crp | load root pointer - movl #CACHE_CLR,d0 - movc d0,cacr | invalidate cache(s) + lea _ASM_LABEL(protorp),%a0 | CRP prototype + movl %d0,%a0@(4) | stash USTP + pmove %a0@,%crp | load root pointer + movl #CACHE_CLR,%d0 + movc %d0,%cacr | invalidate cache(s) rts /* @@ -1653,15 +1633,15 @@ LmotommuC: */ ENTRY(spl0) - moveq #0,d0 - movw sr,d0 | get old SR for return - movw #PSL_LOWIPL,sr | restore new SR + moveq #0,%d0 + movw %sr,%d0 | get old SR for return + movw #PSL_LOWIPL,%sr | restore new SR tstl _C_LABEL(softpending) | software interrupt pending? jeq Lspldone | no, all done - subql #4,sp | make room for RTE frame - movl sp@(4),sp@(2) | position return address - clrw sp@(6) | set frame type 0 - movw #PSL_LOWIPL,sp@ | and new SR + subql #4,%sp | make room for RTE frame + movl %sp@(4),%sp@(2) | position return address + clrw %sp@(6) | set frame type 0 + movw #PSL_LOWIPL,%sp@ | and new SR jra Lgotsir | go handle it Lspldone: rts @@ -1675,9 +1655,9 @@ Lspldone: */ ENTRY_NOPROFILE(_delay) | d0 = arg = (usecs << 8) - movl sp@(4),d0 + movl %sp@(4),%d0 | d1 = delay_divisor - movl _C_LABEL(delay_divisor),d1 + movl _C_LABEL(delay_divisor),%d1 jra L_delay /* Jump into the loop! */ /* @@ -1689,7 +1669,7 @@ ENTRY_NOPROFILE(_delay) */ .balign 8 L_delay: - subl d1,d0 + subl %d1,%d0 jgt L_delay rts @@ -1697,23 +1677,23 @@ L_delay: * Save and restore 68881 state. */ ENTRY(m68881_save) - movl sp@(4),a0 | save area pointer - fsave a0@ | save state - tstb a0@ | null state frame? + movl %sp@(4),%a0 | save area pointer + fsave %a0@ | save state + tstb %a0@ | null state frame? jeq Lm68881sdone | yes, all done - fmovem fp0-fp7,a0@(FPF_REGS) | save FP general registers - fmovem fpcr/fpsr/fpi,a0@(FPF_FPCR) | save FP control registers + fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers + fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers Lm68881sdone: rts ENTRY(m68881_restore) - movl sp@(4),a0 | save area pointer - tstb a0@ | null state frame? + movl %sp@(4),%a0 | save area pointer + tstb %a0@ | null state frame? jeq Lm68881rdone | yes, easy - fmovem a0@(FPF_FPCR),fpcr/fpsr/fpi | restore FP control registers - fmovem a0@(FPF_REGS),fp0-fp7 | restore FP general registers + fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers + fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers Lm68881rdone: - frestore a0@ | restore state + frestore %a0@ | restore state rts /* @@ -1725,27 +1705,28 @@ Lm68881rdone: */ #define BUSERR 0xfffffffc ASLOCAL(phys_badaddr) - ASRELOC(_bsave,a3) - movl BUSERR,a3@ | save ROM bus errror handler - ASRELOC(_ssave,a3) - movl sp,a3@ | and current stack pointer - ASRELOC(catchbad,a3) - movl a3,BUSERR | plug in our handler - movw a0@,d1 | access address - ASRELOC(_bsave,a3) | no fault! - movl a3@,BUSERR - clrl d0 | return success + ASRELOC(_bsave,%a3) + movl BUSERR,%a3@ | save ROM bus errror handler + ASRELOC(_ssave,%a3) + movl %sp,%a3@ | and current stack pointer + ASRELOC(catchbad,%a3) + movl %a3,BUSERR | plug in our handler + movw %a0@,%d1 | access address + ASRELOC(_bsave,%a3) | no fault! + movl %a3@,BUSERR + clrl %d0 | return success rts ASLOCAL(catchbad) - ASRELOC(_bsave,a3) | got a bus error, so restore handler - movl a3@,BUSERR - ASRELOC(_ssave,a3) - movl a3@,sp | and stack - moveq #1,d0 | return fault + ASRELOC(_bsave,%a3) | got a bus error, so restore handler + movl %a3@,BUSERR + ASRELOC(_ssave,%a3) + movl %a3@,%sp | and stack + moveq #1,%d0 | return fault rts #undef BUSERR .data + .p2align 2 ASLOCAL(_bsave) .long 0 ASLOCAL(_ssave) @@ -1765,44 +1746,48 @@ ENTRY_NOPROFILE(doboot) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jeq Lnocache5 | yes, skip #endif - movl #CACHE_OFF,d0 - movc d0,cacr | disable on-chip cache(s) + movl #CACHE_OFF,%d0 + movc %d0,%cacr | disable on-chip cache(s) tstl _C_LABEL(ectype) | external cache? jeq Lnocache5 | no, skip - MMUADDR(a0) - andl #~MMU_CEN,a0@(MMUCMD) | disable external cache + MMUADDR(%a0) + andl #~MMU_CEN,%a0@(MMUCMD) | disable external cache Lnocache5: - lea MAXADDR,a0 | last page of physical memory - movl _C_LABEL(boothowto),a0@+ | store howto - movl _C_LABEL(bootdev),a0@+ | and devtype - lea Lbootcode,a1 | start of boot code - lea Lebootcode,a3 | end of boot code + lea MAXADDR,%a0 | last page of physical memory + movl _C_LABEL(boothowto),%a0@+ | store howto + movl _C_LABEL(bootdev),%a0@+ | and devtype + lea Lbootcode,%a1 | start of boot code + lea Lebootcode,%a3 | end of boot code Lbootcopy: - movw a1@+,a0@+ | copy a word - cmpl a3,a1 | done yet? + movw %a1@+,%a0@+ | copy a word + cmpl %a3,%a1 | done yet? jcs Lbootcopy | no, keep going #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne LmotommuE | no, skip - .word 0xf4f8 | cpusha bc + .chip 68040 + cpusha %bc LmotommuE: + .chip 68020 #endif jmp MAXADDR+8 | jump to last page Lbootcode: - lea MAXADDR+0x800,sp | physical SP in case of NMI + lea MAXADDR+0x800,%sp | physical SP in case of NMI #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne LmotommuF | no, skip - movl #0,d0 - movc d0,cacr | caches off - .long 0x4e7b0003 | movc d0,tc - movl d2,MAXADDR+NBPG-4 | restore old high page contents + .chip 68040 + movl #0,%d0 + movc %d0,%cacr | caches off + movc %d0,%tc + movl %d2,MAXADDR+NBPG-4 | restore old high page contents DOREBOOT + .chip 68020 LmotommuF: #endif - movl #0,a0@ | value for pmove to TC (turn off MMU) - pmove a0@,tc | disable MMU + movl #0,%a0@ | value for pmove to TC (turn off MMU) + pmove %a0@,%tc | disable MMU DOREBOOT Lebootcode: @@ -1810,6 +1795,7 @@ Lebootcode: * Misc. global variables. */ .data + .p2align 2 GLOBAL(machineid) .long -1 | default to unknown diff --git a/sys/arch/hp300/include/reloc.h b/sys/arch/hp300/include/reloc.h new file mode 100644 index 00000000000..e4c43abb13e --- /dev/null +++ b/sys/arch/hp300/include/reloc.h @@ -0,0 +1,3 @@ +/* $OpenBSD: reloc.h,v 1.1 2013/02/02 13:34:29 miod Exp $ */ +/* public domain */ +#include <m68k/reloc.h> diff --git a/sys/arch/hp300/stand/cdboot/Makefile b/sys/arch/hp300/stand/cdboot/Makefile index c739e230569..175025fe33a 100644 --- a/sys/arch/hp300/stand/cdboot/Makefile +++ b/sys/arch/hp300/stand/cdboot/Makefile @@ -1,6 +1,8 @@ -# $OpenBSD: Makefile,v 1.7 2013/01/01 17:17:44 miod Exp $ +# $OpenBSD: Makefile,v 1.8 2013/02/02 13:34:29 miod Exp $ PROG= cdboot +OBJCOPY?=objcopy +SIZE?= size NOMAN= NOPIE= @@ -21,14 +23,15 @@ SRCS= srt0.S cdboot.c clock.c conf.c cons.c devopen.c LIBS= ${LIBCOMMON} ${LIBSA} ${LIBZ} -CLEANFILES+= cdboot.lif +CLEANFILES+= ${PROG}.bin ${PROG}.lif -cdboot.lif: cdboot - ${MKBOOT_PROG} cdboot $@ +cdboot.lif: ${PROG} + ${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin + ${MKBOOT_PROG} -l 0x${RELOC} ${PROG}.bin $@ cdboot: ${OBJS} ${LIBS} - ${LD} -N -T ${RELOC} -e begin ${OBJS} ${LIBS} -o $@ - @size $@ + ${LD} -N -Ttext ${RELOC} -e begin --warn-common ${OBJS} ${LIBS} -o $@ + @${SIZE} $@ @echo $@ total size may not exceed 30000 bytes install: cdboot.lif ${MKBOOT_PROG} diff --git a/sys/arch/hp300/stand/common/autoconf.c b/sys/arch/hp300/stand/common/autoconf.c index 505e09dc95f..c8c1e17389c 100644 --- a/sys/arch/hp300/stand/common/autoconf.c +++ b/sys/arch/hp300/stand/common/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.9 2011/08/18 20:02:58 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.10 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.12 1997/01/30 10:32:51 thorpej Exp $ */ /* @@ -42,6 +42,8 @@ #include <sys/param.h> #include <sys/reboot.h> +#include <lib/libsa/stand.h> + #include "samachdep.h" #include "consdefs.h" #include "rominfo.h" @@ -84,9 +86,9 @@ printrominfo() { struct rominfo *rp = (struct rominfo *)ROMADDR; - printf("boottype %x, name %s, lowram %x, sysflag %x\n", + printf("boottype %lx, name %s, lowram %lx, sysflag %x\n", rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff); - printf("rambase %x, ndrives %x, sysflag2 %x, msus %x\n", + printf("rambase %lx, ndrives %x, sysflag2 %x, msus %lx\n", rp->rambase, rp->ndrives, rp->sysflag2&0xff, rp->msus); } #endif @@ -163,7 +165,7 @@ msustobdev() bdev = MAKEBOOTDEV(type, ctlr, slave, punit, 0); #ifdef PRINTROMINFO - printf("msus %x -> bdev %x\n", rp->msus, bdev); + printf("msus %lx -> bdev %lx\n", rp->msus, bdev); #endif return (bdev); } diff --git a/sys/arch/hp300/stand/common/hd.c b/sys/arch/hp300/stand/common/hd.c index 3f46e70b241..c54b5a5782c 100644 --- a/sys/arch/hp300/stand/common/hd.c +++ b/sys/arch/hp300/stand/common/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.7 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: hd.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: rd.c,v 1.11 1996/12/21 21:34:40 thorpej Exp $ */ /* @@ -203,7 +203,7 @@ hdident(int ctlr, int unit) return(id); } -char io_buf[MAXBSIZE]; +char hdio_buf[MAXBSIZE]; int hdgetinfo(struct hd_softc *rs) @@ -221,7 +221,7 @@ hdgetinfo(struct hd_softc *rs) savepart = rs->sc_part; rs->sc_part = RAW_PART; err = hdstrategy(rs, F_READ, LABELSECTOR, - lp->d_secsize ? lp->d_secsize : DEV_BSIZE, io_buf, &i); + lp->d_secsize ? lp->d_secsize : DEV_BSIZE, hdio_buf, &i); rs->sc_part = savepart; if (err) { @@ -229,7 +229,7 @@ hdgetinfo(struct hd_softc *rs) return(0); } - msg = getdisklabel(io_buf, lp); + msg = getdisklabel(hdio_buf, lp); if (msg) { printf("hd(%d,%d,%d): WARNING: %s, ", rs->sc_ctlr, rs->sc_unit, rs->sc_part, msg); diff --git a/sys/arch/hp300/stand/common/machdep.c b/sys/arch/hp300/stand/common/machdep.c index 0e39ceab203..4adf12b9323 100644 --- a/sys/arch/hp300/stand/common/machdep.c +++ b/sys/arch/hp300/stand/common/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.8 2011/08/18 19:54:19 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.9 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: machdep.c,v 1.4 1997/06/28 07:20:25 thorpej Exp $ */ /* @@ -196,14 +196,13 @@ void machdep_start(char *entry, int howto, char *loadaddr, char *ssym, char *esym) { /* Fix what we were passed in from exec() */ - entry = loadaddr; #define round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1)) esym = (char *)round_to_size(esym - (char *)loadaddr); #undef round_to_size - __asm __volatile ("movl %0,d7" : : "m" (howto)); - __asm __volatile ("movl %0,d6" : : "m" (opendev)); - __asm __volatile ("movl %0,a5" : : "a" (loadaddr)); - __asm __volatile ("movl %0,a4" : : "a" (esym)); + __asm __volatile ("movl %0,%%d7" : : "m" (howto)); + __asm __volatile ("movl %0,%%d6" : : "m" (opendev)); + __asm __volatile ("movl %0,%%a5" : : "a" (loadaddr)); + __asm __volatile ("movl %0,%%a4" : : "a" (esym)); (*((int (*)(void))entry))(); } diff --git a/sys/arch/hp300/stand/common/sd.c b/sys/arch/hp300/stand/common/sd.c index fb69a9f52d0..9af149b02d7 100644 --- a/sys/arch/hp300/stand/common/sd.c +++ b/sys/arch/hp300/stand/common/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.7 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: sd.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: sd.c,v 1.9 1996/12/21 21:34:41 thorpej Exp $ */ /* @@ -118,7 +118,7 @@ sdreset(int ctlr, int unit) { } -char io_buf[MAXBSIZE]; +char sdio_buf[MAXBSIZE]; int sdgetinfo(struct sd_softc *ss) @@ -136,7 +136,7 @@ sdgetinfo(struct sd_softc *ss) savepart = ss->sc_part; ss->sc_part = RAW_PART; err = sdstrategy(ss, F_READ, LABELSECTOR, - lp->d_secsize ? lp->d_secsize : DEV_BSIZE, io_buf, &i); + lp->d_secsize ? lp->d_secsize : DEV_BSIZE, sdio_buf, &i); ss->sc_part = savepart; if (err) { @@ -144,7 +144,7 @@ sdgetinfo(struct sd_softc *ss) return(0); } - msg = getdisklabel(io_buf, lp); + msg = getdisklabel(sdio_buf, lp); if (msg) { printf("sd(%d,%d,%d): WARNING: %s, ", ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg); diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c index 0e435af37c1..c605023e867 100644 --- a/sys/arch/hp300/stand/common/version.c +++ b/sys/arch/hp300/stand/common/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.12 2013/01/11 23:22:35 miod Exp $ */ +/* $OpenBSD: version.c,v 1.13 2013/02/02 13:34:29 miod Exp $ */ /* * Record major changes in the boot code here, and increment the version @@ -24,6 +24,7 @@ * 2.13 Allow kernels with uppercase characters in their names to be loaded * from the default boot device without an explicit device or a leading * `/'. + * 2.14 Build with the ELF toolchain. */ -const char version[] = "2.13"; +const char version[] = "2.14"; diff --git a/sys/arch/hp300/stand/include/rominfo.h b/sys/arch/hp300/stand/include/rominfo.h index 5e1673f2847..c7a824e3a96 100644 --- a/sys/arch/hp300/stand/include/rominfo.h +++ b/sys/arch/hp300/stand/include/rominfo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rominfo.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */ +/* $OpenBSD: rominfo.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: rominfo.h,v 1.5 1994/10/26 07:27:53 cgd Exp $ */ /* @@ -44,7 +44,7 @@ struct jmpvec { short op; /* jmp instruction */ long addr; /* address */ -}; +} __packed; struct rominfo { char p1[0xDC0]; @@ -62,4 +62,4 @@ struct rominfo { char p6; /* ?? (FFFFFEDB) */ long msus; /* ?? (FFFFFEDC) */ struct jmpvec jvec[48]; /* jump vectors (FFFFFEE0) */ -}; +} __packed; diff --git a/sys/arch/hp300/stand/include/scsireg.h b/sys/arch/hp300/stand/include/scsireg.h index 77a2e30c845..708bcd32c97 100644 --- a/sys/arch/hp300/stand/include/scsireg.h +++ b/sys/arch/hp300/stand/include/scsireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsireg.h,v 1.3 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: scsireg.h,v 1.4 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: scsireg.h,v 1.4 1994/10/26 07:24:59 cgd Exp $ */ /* @@ -291,7 +291,7 @@ struct scsi_format_parms { /* physical BFI format */ unsigned head : 8; long bytes_from_index; } defect[127]; -} format_parms; +}; struct scsi_reassign_parms { u_short reserved; @@ -299,7 +299,7 @@ struct scsi_reassign_parms { struct new_defect { unsigned lba; /* logical block address */ } new_defect[2]; -} reassign_parms; +}; struct scsi_modesel_hdr { u_char rsvd1; diff --git a/sys/arch/hp300/stand/libsa/exec_hp300.c b/sys/arch/hp300/stand/libsa/exec_hp300.c index 2edd6835377..4b4cb408efe 100644 --- a/sys/arch/hp300/stand/libsa/exec_hp300.c +++ b/sys/arch/hp300/stand/libsa/exec_hp300.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_hp300.c,v 1.2 2013/01/07 20:02:11 miod Exp $ */ +/* $OpenBSD: exec_hp300.c,v 1.3 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */ /*- @@ -49,9 +49,9 @@ exec(char *path, void *loadaddr, int howto) if (rc != 0) return; - printf("Start @ 0x%lx\n", marks[MARK_START]); + printf("Start @ 0x%lx\n", marks[MARK_ENTRY]); - machdep_start((char *)marks[MARK_START], howto, loadaddr, + machdep_start((char *)marks[MARK_ENTRY], howto, loadaddr, (char *)marks[MARK_SYM], (char *)marks[MARK_END]); /* exec failed */ diff --git a/sys/arch/hp300/stand/mkboot/mkboot.c b/sys/arch/hp300/stand/mkboot/mkboot.c index 6349431b629..2de22f91fe9 100644 --- a/sys/arch/hp300/stand/mkboot/mkboot.c +++ b/sys/arch/hp300/stand/mkboot/mkboot.c @@ -1,4 +1,5 @@ -/* $OpenBSD: mkboot.c,v 1.7 2011/08/18 20:02:58 miod Exp $ */ +/* $OpenBSD: mkboot.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */ +/* $NetBSD: mkboot.c,v 1.10 2006/06/18 05:53:51 gdamore Exp $ */ /* * Copyright (c) 1990, 1993 @@ -32,10 +33,11 @@ */ #include <unistd.h> +#include <stdlib.h> #include <string.h> #include <sys/param.h> #include <sys/file.h> -#include <a.out.h> +#include <sys/stat.h> #include "volhdr.h" @@ -53,18 +55,16 @@ #define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE) #define lifstob(s) ((s) * SECTSIZE) -int lpflag; -int loadpoint; -struct load ld; -struct lifvol lifv; -struct lifdir lifd[LIF_NUMDIR]; -struct exec ex; -char buf[10240]; +int lpflag; +int loadpoint; +struct load ld; +struct lifvol lifv; +struct lifdir lifd[LIF_NUMDIR]; -void bcddate(int, char *); -char * lifname(char *); -void putfile(int, int); -void usage(void); +void bcddate(char *, char *); +char *lifname(char *); +int putfile(char *, int); +void usage(void); /* * Old Format: @@ -85,208 +85,161 @@ void usage(void); int main(int argc, char **argv) { - int ac; - char **av; - int from1, from2, from3, to; - int n; char *n1, *n2, *n3; + int n, to; + int count; - ac = --argc; - av = ++argv; - if (ac == 0) + --argc; + ++argv; + if (argc == 0) usage(); - if (!strcmp(av[0], "-l")) { - av++; - ac--; - if (ac == 0) + if (!strcmp(argv[0], "-l")) { + argv++; + argc--; + if (argc == 0) usage(); - sscanf(av[0], "0x%x", &loadpoint); + sscanf(argv[0], "0x%x", &loadpoint); lpflag++; - av++; - ac--; + argv++; + argc--; } - if (ac == 0) + if (!lpflag || argc == 0) usage(); - from1 = open(av[0], O_RDONLY, 0); - if (from1 < 0) { - perror("open"); - exit(1); - } - n1 = av[0]; - av++; - ac--; - if (ac == 0) + n1 = argv[0]; + argv++; + argc--; + if (argc == 0) usage(); - if (ac > 1) { - from2 = open(av[0], O_RDONLY, 0); - if (from2 < 0) { - perror("open"); - exit(1); - } - n2 = av[0]; - av++; - ac--; - if (ac > 1) { - from3 = open(av[0], O_RDONLY, 0); - if (from3 < 0) { - perror("open"); - exit(1); - } - n3 = av[0]; - av++; - ac--; + if (argc > 1) { + n2 = argv[0]; + argv++; + argc--; + if (argc > 1) { + n3 = argv[0]; + argv++; + argc--; } else - from3 = -1; + n3 = NULL; } else - from2 = from3 = -1; - to = open(av[0], O_WRONLY | O_TRUNC | O_CREAT, 0644); + n2 = n3 = NULL; + + to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644); if (to < 0) { perror("open"); exit(1); } /* clear possibly unused directory entries */ bcopy(" ", lifd[1].dir_name, 10); - lifd[1].dir_type = -1; - lifd[1].dir_addr = 0; - lifd[1].dir_length = 0; - lifd[1].dir_flag = 0xFF; - lifd[1].dir_exec = 0; + lifd[1].dir_type = htobe16(-1); + lifd[1].dir_addr = htobe32(0); + lifd[1].dir_length = htobe32(0); + lifd[1].dir_flag = htobe16(0xFF); + lifd[1].dir_exec = htobe32(0); lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1]; /* record volume info */ - lifv.vol_id = VOL_ID; + lifv.vol_id = htobe16(VOL_ID); bcopy("BOOT44", lifv.vol_label, 6); - lifv.vol_addr = btolifs(LIF_DIRSTART); - lifv.vol_oct = VOL_OCT; - lifv.vol_dirsize = btolifs(LIF_DIRSIZE); - lifv.vol_version = 1; + lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART)); + lifv.vol_oct = htobe16(VOL_OCT); + lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE)); + lifv.vol_version = htobe16(1); /* output bootfile one */ - lseek(to, LIF_FILESTART, 0); - putfile(from1, to); - n = btolifs(ld.count + sizeof(ld)); - bcopy(lifname(n1), lifd[0].dir_name, 10); - lifd[0].dir_type = DIR_TYPE; - lifd[0].dir_addr = btolifs(LIF_FILESTART); - lifd[0].dir_length = n; - bcddate(from1, lifd[0].dir_toc); - lifd[0].dir_flag = DIR_FLAG; - lifd[0].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry; - lifv.vol_length = lifd[0].dir_addr + lifd[0].dir_length; + lseek(to, LIF_FILESTART, SEEK_SET); + count = putfile(n1, to); + n = btolifs(count); + strlcpy(lifd[0].dir_name, lifname(n1), sizeof lifd[0].dir_name); + lifd[0].dir_type = htobe16(DIR_TYPE); + lifd[0].dir_addr = htobe32(btolifs(LIF_FILESTART)); + lifd[0].dir_length = htobe32(n); + bcddate(n1, lifd[0].dir_toc); + lifd[0].dir_flag = htobe16(DIR_FLAG); + lifd[0].dir_exec = htobe32(loadpoint); + lifv.vol_length = htobe32(htobe32(lifd[0].dir_addr) + + htobe32(lifd[0].dir_length)); /* if there is an optional second boot program, output it */ - if (from2 >= 0) { - lseek(to, LIF_FILESTART+lifstob(n), 0); - putfile(from2, to); - n = btolifs(ld.count + sizeof(ld)); - bcopy(lifname(n2), lifd[1].dir_name, 10); - lifd[1].dir_type = DIR_TYPE; - lifd[1].dir_addr = lifv.vol_length; - lifd[1].dir_length = n; - bcddate(from2, lifd[1].dir_toc); - lifd[1].dir_flag = DIR_FLAG; - lifd[1].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry; - lifv.vol_length = lifd[1].dir_addr + lifd[1].dir_length; + if (n2) { + lseek(to, LIF_FILESTART+lifstob(n), SEEK_SET); + count = putfile(n2, to); + n = btolifs(count); + strlcpy(lifd[1].dir_name, lifname(n2), sizeof lifd[1].dir_name); + lifd[1].dir_type = htobe16(DIR_TYPE); + lifd[1].dir_addr = htobe32(lifv.vol_length); + lifd[1].dir_length = htobe32(n); + bcddate(n2, lifd[1].dir_toc); + lifd[1].dir_flag = htobe16(DIR_FLAG); + lifd[1].dir_exec = htobe32(loadpoint); + lifv.vol_length = htobe32(htobe32(lifd[1].dir_addr) + + htobe32(lifd[1].dir_length)); } /* ditto for three */ - if (from3 >= 0) { - lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n), 0); - putfile(from3, to); - n = btolifs(ld.count + sizeof(ld)); - bcopy(lifname(n3), lifd[2].dir_name, 10); - lifd[2].dir_type = DIR_TYPE; - lifd[2].dir_addr = lifv.vol_length; - lifd[2].dir_length = n; - bcddate(from3, lifd[2].dir_toc); - lifd[2].dir_flag = DIR_FLAG; - lifd[2].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry; - lifv.vol_length = lifd[2].dir_addr + lifd[2].dir_length; + if (n3) { + lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n), + SEEK_SET); + count = putfile(n3, to); + n = btolifs(count); + strlcpy(lifd[2].dir_name, lifname(n3), sizeof lifd[2].dir_name); + lifd[2].dir_type = htobe16(DIR_TYPE); + lifd[2].dir_addr = htobe32(lifv.vol_length); + lifd[2].dir_length = htobe32(n); + bcddate(n3, lifd[2].dir_toc); + lifd[2].dir_flag = htobe16(DIR_FLAG); + lifd[2].dir_exec = htobe32(loadpoint); + lifv.vol_length = htobe32(htobe32(lifd[2].dir_addr) + + htobe32(lifd[2].dir_length)); } /* output volume/directory header info */ - lseek(to, LIF_VOLSTART, 0); + lseek(to, LIF_VOLSTART, SEEK_SET); write(to, &lifv, LIF_VOLSIZE); - lseek(to, LIF_DIRSTART, 0); + lseek(to, LIF_DIRSTART, SEEK_SET); write(to, lifd, LIF_DIRSIZE); - return (0); + exit(0); } -void -putfile(int from, int to) +int +putfile(char *from, int to) { - int n, tcnt, dcnt; + int fd; + struct stat statb; + int nr; + void *bp; - n = read(from, &ex, sizeof(ex)); - if (n != sizeof(ex)) { - fprintf(stderr, "error reading file header\n"); + if ((fd = open(from, 0)) < 0) { + printf("error: unable to open file %s\n", from); exit(1); } - if (N_GETMAGIC(ex) == OMAGIC) { - tcnt = ex.a_text; - dcnt = ex.a_data; - } - else if (N_GETMAGIC(ex) == NMAGIC) { - tcnt = (ex.a_text + PGOFSET) & ~PGOFSET; - dcnt = ex.a_data; - } - else { - fprintf(stderr, "bad magic number\n"); + fstat(fd, &statb); + ld.address = htobe32(loadpoint); + ld.count = htobe32(statb.st_size); + bp = malloc(statb.st_size); + if ((nr = read(fd, bp, statb.st_size)) < 0) { + printf("error: reading from file %s\n", from); exit(1); } - ld.address = lpflag ? loadpoint : ex.a_entry; - ld.count = tcnt + dcnt; + (void)close(fd); write(to, &ld, sizeof(ld)); - while (tcnt) { - n = sizeof(buf); - if (n > tcnt) - n = tcnt; - n = read(from, buf, n); - if (n < 0) { - perror("read"); - exit(1); - } - if (n == 0) { - fprintf(stderr, "short read\n"); - exit(1); - } - if (write(to, buf, n) < 0) { - perror("write"); - exit(1); - } - tcnt -= n; - } - while (dcnt) { - n = sizeof(buf); - if (n > dcnt) - n = dcnt; - n = read(from, buf, n); - if (n < 0) { - perror("read"); - exit(1); - } - if (n == 0) { - fprintf(stderr, "short read\n"); - exit(1); - } - if (write(to, buf, n) < 0) { - perror("write"); - exit(1); - } - dcnt -= n; - } + write(to, bp, statb.st_size); + free(bp); + return (statb.st_size + sizeof(ld)); } void -usage() +usage(void) { + fprintf(stderr, - "usage: mkboot [-l loadpoint] prog1 [ prog2 ] outfile\n"); + "usage: mkboot -l loadpoint prog1 [ prog2 ] outfile\n"); exit(1); } char * -lifname(str) - char *str; +lifname(char *str) { static char lname[10] = "SYS_XXXXX"; + char *cp; int i; + if ((cp = strrchr(str, '/')) != NULL) + str = ++cp; for (i = 4; i < 10; i++) { if (islower(*str)) lname[i] = toupper(*str); @@ -301,18 +254,13 @@ lifname(str) return(lname); } -#include <sys/stat.h> -#include <time.h> /* XXX */ - void -bcddate(fd, toc) - int fd; - char *toc; +bcddate(char *name, char *toc) { struct stat statb; struct tm *tm; - fstat(fd, &statb); + stat(name, &statb); tm = localtime(&statb.st_ctime); *toc = ((tm->tm_mon+1) / 10) << 4; *toc++ |= (tm->tm_mon+1) % 10; diff --git a/sys/arch/hp300/stand/uboot/Makefile b/sys/arch/hp300/stand/uboot/Makefile index b10846645a0..49b0a3d018d 100644 --- a/sys/arch/hp300/stand/uboot/Makefile +++ b/sys/arch/hp300/stand/uboot/Makefile @@ -1,6 +1,8 @@ -# $OpenBSD: Makefile,v 1.8 2013/01/01 17:17:44 miod Exp $ +# $OpenBSD: Makefile,v 1.9 2013/02/02 13:34:29 miod Exp $ PROG= uboot +OBJCOPY?= objcopy +SIZE?= size NOMAN= NOPIE= @@ -19,15 +21,16 @@ SRCS= srt0.S uboot.c tgets.c netio.c clock.c conf.c prf.c LIBS= ${LIBCOMMON} ${LIBSAZ} ${LIBZ} -CLEANFILES+= uboot.lif +CLEANFILES+= ${PROG}.bin ${PROG}.lif -uboot.lif: uboot - ${MKBOOT_PROG} uboot $@ +uboot.lif: ${PROG} + ${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin + ${MKBOOT_PROG} -l 0x${RELOC} ${PROG}.bin $@ uboot: ${OBJS} ${LIBS} - ${LD} -N -T ${RELOC} -e begin ${OBJS} ${LIBS} \ + ${LD} -N -Ttext ${RELOC} -e begin --warn-common ${OBJS} ${LIBS} \ `${CC} -print-libgcc-file-name` -o $@ - @size $@ + @${SIZE} $@ @echo $@ total size should not exceed 1044480 bytes install: uboot.lif ${MKBOOT_PROG} diff --git a/sys/arch/hp300/stand/uboot/srt0.S b/sys/arch/hp300/stand/uboot/srt0.S index fb19bdc58d7..ac305efcc8b 100644 --- a/sys/arch/hp300/stand/uboot/srt0.S +++ b/sys/arch/hp300/stand/uboot/srt0.S @@ -1,4 +1,4 @@ -/* $OpenBSD: srt0.S,v 1.7 2011/08/18 19:54:19 miod Exp $ */ +/* $OpenBSD: srt0.S,v 1.8 2013/02/02 13:34:29 miod Exp $ */ /* $NetBSD: srt0.S,v 1.4 1997/05/12 07:56:00 thorpej Exp $ */ /* @@ -70,124 +70,129 @@ GLOBAL(machineid) GLOBAL(mmuid) .long 0 + .chip 68020 .text ASENTRY_NOPROFILE(begin) - movl #STACK,sp - moveq #47,d0 | # of vectors - 1 - movl #VECTORS+2,a0 | addr part of first vector + movl #STACK,%sp + moveq #47,%d0 | # of vectors - 1 + movl #VECTORS+2,%a0 | addr part of first vector 1: - movl #_ASM_LABEL(__trap),a0@ | make it direct to __trap - addql #6,a0 | move to next vector addr - dbf d0,1b | go til done - movl #NMIRESET,a0 | NMI keyboard reset addr - movl #nmi,a0@ | catch in reset routine + movl #_ASM_LABEL(__trap),%a0@ | make it direct to __trap + addql #6,%a0 | move to next vector addr + dbf %d0,1b | go til done + movl #NMIRESET,%a0 | NMI keyboard reset addr + movl #nmi,%a0@ | catch in reset routine /* * Determine our SPU type and look for internal HP-IB */ - lea _C_LABEL(machineid),a0 - movl #0x808,d0 - movc d0,cacr | clear and disable on-chip cache(s) - movl #0x200,d0 | data freeze bit - movc d0,cacr | only exists on 68030 - movc cacr,d0 | read it back - tstl d0 | zero? + lea _C_LABEL(machineid),%a0 + movl #0x808,%d0 + movc %d0,%cacr | clear and disable on-chip cache(s) + movl #0x200,%d0 | data freeze bit + movc %d0,%cacr | only exists on 68030 + movc %cacr,%d0 | read it back + tstl %d0 | zero? jeq not68030 | yes, we have 68020/68040 /* * 68030 models */ - movl #0x808,d0 - movc d0,cacr | clear data freeze bit again + .chip 68030 + movl #0x808,%d0 + movc %d0,%cacr | clear data freeze bit again movl #0x80,MMUCMD | set magic cookie - movl MMUCMD,d0 | read it back - btst #7,d0 | cookie still on? + movl MMUCMD,%d0 | read it back + btst #7,%d0 | cookie still on? jeq not370 | no, 360 or 375 - movl #HP_370,a0@ | consider a 370 for now + movl #HP_370,%a0@ | consider a 370 for now movl #0,MMUCMD | clear magic cookie - movl MMUCMD,d0 | read it back - btst #7,d0 | still on? + movl MMUCMD,%d0 | read it back + btst #7,%d0 | still on? jeq ihpibcheck | no, a 370 - movl #HP_340,a0@ | yes, must be a 340 + movl #HP_340,%a0@ | yes, must be a 340 jra ihpibcheck not370: - movl #HP_36X,a0@ | type is at least a 360 + movl #HP_36X,%a0@ | type is at least a 360 movl #0,MMUCMD | clear magic cookie2 - movl MMUCMD,d0 | read it back - btst #16,d0 | still on? + movl MMUCMD,%d0 | read it back + btst #16,%d0 | still on? jeq ihpibcheck | no, a 360 or a 362 - lsrl #MMUID_SHIFT,d0 | save MMU ID - andl #MMUID_MASK,d0 - movl d0,_C_LABEL(mmuid) | save mmuid - cmpb #MMUID_345,d0 | are we a 345? + lsrl #MMUID_SHIFT,%d0 | save MMU ID + andl #MMUID_MASK,%d0 + movl %d0,_C_LABEL(mmuid) | save mmuid + cmpb #MMUID_345,%d0 | are we a 345? jeq isa345 - cmpb #MMUID_375,d0 | how about a 375? + cmpb #MMUID_375,%d0 | how about a 375? jeq isa375 - movl #HP_400,a0@ | must be a 400 + movl #HP_400,%a0@ | must be a 400 jra ihpibcheck isa345: - movl #HP_345,a0@ + movl #HP_345,%a0@ jra ihpibcheck isa375: - movl #HP_375,a0@ + movl #HP_375,%a0@ jra ihpibcheck + .chip 68020 /* * End of 68030 section */ not68030: - bset #31,d0 | data cache enable bit - movc d0,cacr | only exists on 68040 - movc cacr,d0 | read it back - tstl d0 | zero? + bset #31,%d0 | data cache enable bit + movc %d0,%cacr | only exists on 68040 + movc %cacr,%d0 | read it back + tstl %d0 | zero? beq is68020 | yes, we have 68020 - moveq #0,d0 | now turn it back off - movec d0,cacr | before we access any data + moveq #0,%d0 | now turn it back off + movec %d0,%cacr | before we access any data /* * 68040 models */ - .long 0x4e7b0004 | movc d0,itt0 - .long 0x4e7b0005 | movc d0,itt1 - .long 0x4e7b0006 | movc d0,dtt0 - .long 0x4e7b0007 | movc d0,dtt1 - .word 0xf4d8 | cinva bc - movl MMUCMD,d0 | get MMU ID - lsrl #MMUID_SHIFT,d0 - andl #MMUID_MASK,d0 - movl d0,_C_LABEL(mmuid) | save mmuid - cmpb #MMUID_425_T,d0 | are we a 425t? + .chip 68040 + movc %d0,%itt0 + movc %d0,%itt1 + movc %d0,%dtt0 + movc %d0,%dtt1 + cinva %bc + movl MMUCMD,%d0 | get MMU ID + lsrl #MMUID_SHIFT,%d0 + andl #MMUID_MASK,%d0 + movl %d0,_C_LABEL(mmuid) | save mmuid + cmpb #MMUID_425_T,%d0 | are we a 425t? jeq isa425 - cmpb #MMUID_425_S,d0 | how about 425s? + cmpb #MMUID_425_S,%d0 | how about 425s? jeq isa425 - cmpb #MMUID_425_E,d0 | or maybe a 425e? + cmpb #MMUID_425_E,%d0 | or maybe a 425e? jeq isa425 - cmpb #MMUID_433_T,d0 | or a 433t? + cmpb #MMUID_433_T,%d0 | or a 433t? jeq isa433 - cmpb #MMUID_433_S,d0 | maybe a 433s? + cmpb #MMUID_433_S,%d0 | maybe a 433s? jeq isa433 - cmpb #MMUID_385,d0 | then a 385? + cmpb #MMUID_385,%d0 | then a 385? jeq isa385 - cmpb #MMUID_382,d0 | last chance... + cmpb #MMUID_382,%d0 | last chance... jeq isa382 - movl #HP_380,a0@ | guess we are a 380 + movl #HP_380,%a0@ | guess we are a 380 jra ihpibcheck isa425: - movl #HP_425,a0@ + movl #HP_425,%a0@ jra ihpibcheck isa433: - movl #HP_433,a0@ + movl #HP_433,%a0@ jra ihpibcheck isa385: - movl #HP_385,a0@ + movl #HP_385,%a0@ jra ihpibcheck isa382: - movl #HP_382,a0@ + movl #HP_382,%a0@ jra ihpibcheck + .chip 68020 /* * End 68040 section @@ -198,17 +203,17 @@ isa382: */ is68020: - movl #HP_330,a0@ | consider a 330 for now + movl #HP_330,%a0@ | consider a 330 for now movl #1,MMUCMD | a 68020, write HP MMU location - movl MMUCMD,d0 | read it back - btst #0,d0 | zero? + movl MMUCMD,%d0 | read it back + btst #0,%d0 | zero? jeq ihpibcheck | yes, a 330 - movl #HP_320,a0@ | no, consider a 320 for now + movl #HP_320,%a0@ | no, consider a 320 for now movl #0x80,MMUCMD | set magic cookie - movl MMUCMD,d0 | read it back - btst #7,d0 | cookie still on? + movl MMUCMD,%d0 | read it back + btst #7,%d0 | cookie still on? jeq ihpibcheck | no, just a 320 - movl #HP_350,a0@ | yes, a 350 + movl #HP_350,%a0@ | yes, a 350 /* * End 68020 section @@ -225,9 +230,9 @@ ihpibcheck: boottype: cmpw #12,BOOTTYPE | is this a reboot (REQ_REBOOT)? jne notreboot | no, skip - lea MAXADDR,a0 | find last page - movl a0@+,d7 | and extract howto, bootdev - movl a0@+,d6 | from where doboot() left them + lea MAXADDR,%a0 | find last page + movl %a0@+,%d7 | and extract howto, bootdev + movl %a0@+,%d6 | from where doboot() left them jra boot1 /* * At this point we do not know which logical device the MSUS select @@ -235,30 +240,30 @@ boottype: * and let configure() construct it. */ notreboot: - moveq #0,d6 | make sure bootdev is invalid + moveq #0,%d6 | make sure bootdev is invalid cmpw #18,BOOTTYPE | does the user want to interact? jeq askme | yes, go to it - moveq #0,d7 | default to RB_AUTOBOOT + moveq #0,%d7 | default to RB_AUTOBOOT jra boot1 askme: - moveq #3,d7 | default to RB_SINGLE|RB_ASKNAME + moveq #3,%d7 | default to RB_SINGLE|RB_ASKNAME boot1: - movl d6,_C_LABEL(bootdev) | save bootdev and howto - movl d7,_C_LABEL(howto) | globally so all can access - movl LOWRAM,d0 | read lowram value from bootrom + movl %d6,_C_LABEL(bootdev) | save bootdev and howto + movl %d7,_C_LABEL(howto) | globally so all can access + movl LOWRAM,%d0 | read lowram value from bootrom /* * Must preserve the scratch area for the BOOT ROM. * Round up to the next 8k boundary. */ - addl #((2*NBPG)-1),d0 - andl #-(2*NBPG),d0 - movl d0,_C_LABEL(lowram) | stash that value + addl #((2*NBPG)-1),%d0 + andl #-(2*NBPG),%d0 + movl %d0,_C_LABEL(lowram) | stash that value start: - movl #_C_LABEL(edata),a2 | start of BSS - movl #_C_LABEL(end),a3 | end + movl #_C_LABEL(edata),%a2 | start of BSS + movl #_C_LABEL(end),%a3 | end 1: - clrb a2@+ | clear BSS - cmpl a2,a3 | done? + clrb %a2@+ | clear BSS + cmpl %a2,%a3 | done? bne 1b | no, keep going jsr _C_LABEL(configure) | configure critical devices jsr _C_LABEL(main) | lets go @@ -271,19 +276,19 @@ GLOBAL(_rtt) */ ENTRY_NOPROFILE(badaddr) movl BUSERR,_C_LABEL(_bsave) | save ROM bus error handler address - movl sp,_C_LABEL(_ssave) | and current stack pointer + movl %sp,_C_LABEL(_ssave) | and current stack pointer movl #catchbad,BUSERR | plug in our handler - movl sp@(4),a0 | address to probe - movw a0@,d1 | do it + movl %sp@(4),%a0 | address to probe + movw %a0@,%d1 | do it movl _C_LABEL(_bsave),BUSERR | if we got here, it did not fault - clrl d0 | return that this was not a bad addr + clrl %d0 | return that this was not a bad addr rts catchbad: movl _C_LABEL(_bsave),BUSERR | got a bus error, so restore | old handler - movl _C_LABEL(_ssave),sp | manually restore stack - moveq #1,d0 | indicate that we got a fault + movl _C_LABEL(_ssave),%sp | manually restore stack + moveq #1,%d0 | indicate that we got a fault rts | return to caller of badaddr() .data @@ -294,14 +299,14 @@ GLOBAL(_ssave) .long 0 ASENTRY_NOPROFILE(__trap) - moveml #0xFFFF,sp@- | save registers - movl sp,sp@- | push pointer to frame + moveml #0xFFFF,%sp@- | save registers + movl %sp,%sp@- | push pointer to frame jsr _C_LABEL(trap) | call C routine to deal with it - tstl d0 + tstl %d0 jeq Lstop - addql #4,sp - moveml sp@+,#0x7FFF - addql #8,sp + addql #4,%sp + moveml %sp@+,#0x7FFF + addql #8,%sp rte Lstop: stop #0x2700 | stop cold @@ -317,7 +322,7 @@ ENTRY_NOPROFILE(call_req_reboot) rts | XXX: just in case? ENTRY_NOPROFILE(romout) - movl sp@(4),d0 | line number - movl sp@(8),a0 | string + movl %sp@(4),%d0 | line number + movl %sp@(8),%a0 | string jsr 0x150 | do it rts |