Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Clean up <sh5/asm.h> to be more 64-bit friendly.
details: https://anonhg.NetBSD.org/src/rev/02a586e96290
branches: trunk
changeset: 534003:02a586e96290
user: scw <scw%NetBSD.org@localhost>
date: Fri Jul 12 15:42:27 2002 +0000
description:
Clean up <sh5/asm.h> to be more 64-bit friendly.
Clean up the kernel asm files to be less 32-bit dependent.
diffstat:
sys/arch/evbsh5/evbsh5/locore.S | 11 +----
sys/arch/sh5/include/asm.h | 80 +++++++++++++++++++++++++---------------
sys/arch/sh5/sh5/cpu_switch.S | 12 ++----
sys/arch/sh5/sh5/exception.S | 6 +--
sys/arch/sh5/sh5/locore_subr.S | 7 +--
sys/arch/sh5/sh5/sigcode.S | 13 ++----
sys/arch/sh5/sh5/stb1_locore.S | 17 +++++---
7 files changed, 76 insertions(+), 70 deletions(-)
diffs (truncated from 364 to 300 lines):
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/evbsh5/evbsh5/locore.S
--- a/sys/arch/evbsh5/evbsh5/locore.S Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/evbsh5/evbsh5/locore.S Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.1 2002/07/05 13:31:40 scw Exp $ */
+/* $NetBSD: locore.S,v 1.2 2002/07/12 15:42:30 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -38,19 +38,14 @@
#include "assym.h"
#include <machine/asm.h>
- .section .text
- .align 3
-
-
/*
* The main entry point.
*
* The bootloader (to be written) will have stashed the boot parameters
* in r56 - r62
*/
-GLOBAL(text)
- .globl start
-start:
+ASENTRY_NOPROFILE(text)
+ASENTRY_NOPROFILE(start)
LDC32(SH5_CONREG_SR_IMASK_ALL|SH5_CONREG_SR_BL|SH5_CONREG_SR_MD, r0)
putcon r0, ssr
pta/u 1f, tr0 /* PC-Relative */
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/sh5/include/asm.h
--- a/sys/arch/sh5/include/asm.h Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/sh5/include/asm.h Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.4 2002/07/11 14:09:34 scw Exp $ */
+/* $NetBSD: asm.h,v 1.5 2002/07/12 15:42:27 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -86,64 +86,80 @@
*/
#if __STDC__
#define _C_LABEL(x) _ ## x
-#define _ASM_LABEL(x) _ ## x
#else
#define _C_LABEL(x) _/**/x
-#define _ASM_LABEL(x) _/**/x
#endif
+#define _ASM_LABEL(x) x
+
/* let kernels and others override entrypoint alignment */
#ifndef _ALIGN_TEXT
-# define _ALIGN_TEXT .align 3
+# define _ALIGN_TEXT .align 5
#endif
-#ifndef _IPL64
+/* The text sections for 32 and 64 bit code are different ... */
+#ifndef _LP64
+#define _TEXT_SECTION .section .text..SHmedia32,"ax"
+#else
+#define _TEXT_SECTION .text
+#endif
+
+/*
+ * Building block for C-callable entry points
+ */
#define _ENTRY(x) \
- .section .text..SHmedia32,"ax" ;\
+ _TEXT_SECTION ;\
_ALIGN_TEXT ;\
.globl x ;\
.type x,@function ;\
x:
+/*
+ * Building block for Assembly-callable entry points
+ */
#define _ASENTRY(x) \
- .section .text..SHmedia32,"ax" ;\
- _ALIGN_TEXT ;\
- .globl x ;\
- .type x,@function ;\
- x:
-#else
-#define _ENTRY(x) \
- .text ;\
+ _TEXT_SECTION ;\
_ALIGN_TEXT ;\
.globl x ;\
- .type x,@function ;\
x:
-#define _ASENTRY(x) \
- .text ;\
- _ALIGN_TEXT ;\
- .globl x ;\
- .type x,@function ;\
- x:
-#endif
-
+/*
+ * When profiling, the following instructions are included in
+ * the function prologue...
+ */
#ifdef GPROF
#define _PROF_PROLOGUE pta/l _mcount, tr0; blink tr0, r0
#else
#define _PROF_PROLOGUE
#endif
-#define ENTRY(y) _ENTRY(_C_LABEL(y)) ;\
- _PROF_PROLOGUE
-#define ASENTRY(y) _ASENTRY(_ASM_LABEL(y)) ;\
- _PROF_PROLOGUE
+/*
+ * C-callable entry point, with profiling enabled.
+ */
+#define ENTRY(y) _ENTRY(_C_LABEL(y)) ;\
+ _PROF_PROLOGUE
+/*
+ * C-callable entry point, without profiling.
+ */
#define ENTRY_NOPROFILE(y) _ENTRY(_C_LABEL(y))
-#define ASENTRY_NOPROFILE(y) _ENTRY(_ASM_LABEL(y))
+
+/*
+ * Alternative name for a C-callable entry point.
+ */
+#define ALTENTRY(y) _ENTRY(_C_LABEL(y))
-#define ALTENTRY(name) .globl _C_LABEL(name) ;\
- .type _C_LABEL(name),@function ;\
- _C_LABEL(name):
+/*
+ * Profiled entry point, callable only from assembly code
+ */
+#define ASENTRY(y) _ASENTRY(_ASM_LABEL(y)) ;\
+ _PROF_PROLOGUE
+
+/*
+ * Non-profiled entry point, callable only from assembly code
+ */
+#define ASENTRY_NOPROFILE(y) _ASENTRY(_ASM_LABEL(y))
+
/*
* Global variables
@@ -292,6 +308,7 @@
*
* XXX: should really be in <sh5/pte.h>
*/
+#ifdef _KERNEL
#if SH5_NEFF_BITS == 32
#define HASH_TO_PTEG_IDX(r,t) \
shlli r, 5, t /* t = r * 32 */ ;\
@@ -307,5 +324,6 @@
#define LDPTE ld.q
#define STPTE st.q
#endif
+#endif /* _KERNEL */
#endif /* _SH5_ASM_H */
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/sh5/sh5/cpu_switch.S
--- a/sys/arch/sh5/sh5/cpu_switch.S Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/sh5/sh5/cpu_switch.S Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_switch.S,v 1.2 2002/07/10 15:49:33 scw Exp $ */
+/* $NetBSD: cpu_switch.S,v 1.3 2002/07/12 15:42:28 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -44,10 +44,6 @@
* ##########
*/
- .section .text..SHmedia32,"ax"
- .align 3
-
-
/*
* Helper macro for SAVE_CTX which skips 8 FP register saves if the USR
* register (right-shifted in r1) indicates the FP group is unused.
@@ -223,7 +219,7 @@
*
* We don't need to preserve caller-save registers.
*/
-ENTRY(idle)
+ASENTRY_NOPROFILE(idle)
/* Deactivate the old process' pmap */
getcon kcr0, r0
LDPTR r0, CI_CURPROC, r2
@@ -288,7 +284,7 @@
* XXX: Still needs to be optimised to avoid saving/restoring state if
* resuming curproc.
*/
-ENTRY(cpu_switch)
+ENTRY_NOPROFILE(cpu_switch)
getcon kcr0, r0
LDPTR r0, CI_CURPCB, r2 /* Fetch curpcb */
LDPTR r0, CI_CURPROC, r0 /* Fetch curproc */
@@ -301,7 +297,7 @@
st.l r0, P_MD_FLAGS, r3 /* Save FP state */
Lsw1:
- pta/u _C_LABEL(idle), tr0
+ pta/u _ASM_LABEL(idle), tr0
LEA(_C_LABEL(sched_whichqs), r11)
ld.l r11, 0, r0 /* Fetch sched_whichqs */
beq/u r0, r63, tr0 /* Go to sleep if nobody's around */
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/sh5/sh5/exception.S
--- a/sys/arch/sh5/sh5/exception.S Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/sh5/sh5/exception.S Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exception.S,v 1.1 2002/07/05 13:32:04 scw Exp $ */
+/* $NetBSD: exception.S,v 1.2 2002/07/12 15:42:28 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -44,9 +44,6 @@
* ##########
*/
- .section .text..SHmedia32,"ax"
- .align 3
-
/*
* SH5 Exception Handling 101
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -437,6 +434,7 @@
/*========================= Start of Vector Table ============================*/
+ _TEXT_SECTION /* XXX: from <sh5/asm.h> */
.balign 0x100
GLOBAL(sh5_vector_table)
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/sh5/sh5/locore_subr.S
--- a/sys/arch/sh5/sh5/locore_subr.S Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/sh5/sh5/locore_subr.S Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore_subr.S,v 1.1 2002/07/05 13:32:05 scw Exp $ */
+/* $NetBSD: locore_subr.S,v 1.2 2002/07/12 15:42:29 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -43,9 +43,8 @@
*
* ##########
*/
-
- .section .text..SHmedia32,"ax"
- .align 3
+ _TEXT_SECTION
+ _ALIGN_TEXT
/******************************************************************************
*
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/sh5/sh5/sigcode.S
--- a/sys/arch/sh5/sh5/sigcode.S Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/sh5/sh5/sigcode.S Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sigcode.S,v 1.1 2002/07/05 13:32:06 scw Exp $ */
+/* $NetBSD: sigcode.S,v 1.2 2002/07/12 15:42:29 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -44,16 +44,13 @@
* ##########
*/
- .section .text..SHmedia32,"ax"
- .align 3
-
/*
* Dummy sigcode routine.
* Signals not yet implemented.
*/
-GLOBAL(sigcode)
+ENTRY_NOPROFILE(sigcode)
movi SYS_exit, r0
- trapa r63
-GLOBAL(esigcode)
-
+ movi 0x80, r1
+ trapa r1
+ENTRY_NOPROFILE(esigcode)
diff -r 3b1d4ca320a8 -r 02a586e96290 sys/arch/sh5/sh5/stb1_locore.S
--- a/sys/arch/sh5/sh5/stb1_locore.S Fri Jul 12 14:22:16 2002 +0000
+++ b/sys/arch/sh5/sh5/stb1_locore.S Fri Jul 12 15:42:27 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stb1_locore.S,v 1.1 2002/07/05 13:32:07 scw Exp $ */
+/* $NetBSD: stb1_locore.S,v 1.2 2002/07/12 15:42:29 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
Home |
Main Index |
Thread Index |
Old Index