summaryrefslogtreecommitdiffstats
path: root/sys/boot/sparc64/loader
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-10-30 06:27:34 +0000
committerjake <jake@FreeBSD.org>2001-10-30 06:27:34 +0000
commit2fe78b0a1ee8c6d846099e923d5462638f97ced0 (patch)
tree455a8ceff2848181503c165dfb97ae85fd53e84a /sys/boot/sparc64/loader
parent36e649fc50fadb400be092098cc64b53bbf82a7a (diff)
downloadFreeBSD-src-2fe78b0a1ee8c6d846099e923d5462638f97ced0.zip
FreeBSD-src-2fe78b0a1ee8c6d846099e923d5462638f97ced0.tar.gz
Use ENTRY() for defining functions in asm.
Remove asm functions to call the openfirmware and kernel entry points; we can just call them directly. Don't use the stack pointer for an intermediate result in setx. Put the stack in the bss.
Diffstat (limited to 'sys/boot/sparc64/loader')
-rw-r--r--sys/boot/sparc64/loader/locore.S94
-rw-r--r--sys/boot/sparc64/loader/locore.s94
2 files changed, 32 insertions, 156 deletions
diff --git a/sys/boot/sparc64/loader/locore.S b/sys/boot/sparc64/loader/locore.S
index 3a4eda2..8f3c401 100644
--- a/sys/boot/sparc64/loader/locore.S
+++ b/sys/boot/sparc64/loader/locore.S
@@ -9,19 +9,14 @@
* $FreeBSD$
*/
#include <machine/asi.h>
+#include <machine/asm.h>
#include <machine/pstate.h>
#include <machine/param.h>
-#define BIAS 2047
-#define CC64FSZ 192
-#define TLB_TAG_ACCESS 0x30
-
- .text
- .globl _start
-_start:
- setx ofw_entry, %l7, %l0
- stx %o4, [%l0]
+#define SPOFF 2047
+#define STACK_SIZE (2 * PAGE_SIZE)
+ENTRY(_start)
/* limit interrupts */
wrpr %g0, 13, %pil
@@ -30,32 +25,20 @@ _start:
* unit enabled
*/
wrpr %g0, PSTATE_PRIV|PSTATE_IE|PSTATE_PEF, %pstate
- wr %o0, 0x4, %fprs
+ wr %g0, 0x4, %fprs
- setx stack, %l7, %sp
+ setx stack + STACK_SIZE - SPOFF, %l7, %l6
+ mov %l6, %sp
call main
- nop
-
-/*
- * %o0 kernel entry (VA)
- * %o1 bootinfo structure pointer (VA)
- *
- * XXX Does the FreeBSD kernel expect the bootinfo pointer
- * in %o0 or in %o1?
- */
-.globl jmpkern
-jmpkern:
- setx ofw_entry, %l7, %o2
- jmp %o0
- ldx [%o2], %o2
+ mov %o4, %o0
+ illtrap
/*
* %o0 input VA constant
* %o1 current iTLB offset
* %o2 current iTLB TTE tag
*/
-.globl itlb_va_to_pa
-itlb_va_to_pa:
+ENTRY(itlb_va_to_pa)
clr %o1
0: ldxa [%o1] ASI_ITLB_TAG_READ_REG, %o2
cmp %o2, %o0
@@ -75,8 +58,7 @@ itlb_va_to_pa:
retl
not %o0
-.globl dtlb_va_to_pa
-dtlb_va_to_pa:
+ENTRY(dtlb_va_to_pa)
clr %o1
0: ldxa [%o1] ASI_DTLB_TAG_READ_REG, %o2
cmp %o2, %o0
@@ -102,68 +84,24 @@ dtlb_va_to_pa:
* %o2 = va
* %o3 = flags
*/
-.globl itlb_enter
-itlb_enter:
+ENTRY(itlb_enter)
sllx %o0, 3, %o0
or %o1, %o3, %o1
- mov TLB_TAG_ACCESS, %o3
+ mov AA_IMMU_TAR, %o3
stxa %o2, [%o3] ASI_IMMU
membar #Sync
stxa %o1, [%o0] ASI_ITLB_DATA_ACCESS_REG
retl
nop
-.globl dtlb_enter
-dtlb_enter:
+ENTRY(dtlb_enter)
sllx %o0, 3, %o0
or %o1, %o3, %o1
- mov TLB_TAG_ACCESS, %o3
+ mov AA_DMMU_TAR, %o3
stxa %o2, [%o3] ASI_DMMU
membar #Sync
stxa %o1, [%o0] ASI_DTLB_DATA_ACCESS_REG
retl
nop
-.globl ofw_gate
-ofw_gate:
- save %sp, -CC64FSZ, %sp
- setx ofw_entry, %i3, %i4
- ldx [%i4], %i4
-
- mov %g1, %l1
- mov %g2, %l2
- mov %g3, %l3
- mov %g4, %l4
- mov %g5, %l5
- mov %g6, %l6
- mov %g7, %l7
-
- rdpr %pstate, %i3
- wrpr %g0, PSTATE_PRIV, %pstate
-
- jmpl %i4, %o7
- mov %i0, %o0
- mov %o0, %i0
-
- wrpr %i3, 0, %pstate
-
- mov %l1, %g1
- mov %l2, %g2
- mov %l3, %g3
- mov %l4, %g4
- mov %l5, %g5
- mov %l6, %g6
- mov %l7, %g7
-
- ret
- restore
-
- .data
- .align 8
-ofw_entry: .xword 0
-
- .align 32
- .space 0x4000
- .set stack, _stack-BIAS
-_stack:
- .space 0x10000
+ .comm stack, STACK_SIZE, 32
diff --git a/sys/boot/sparc64/loader/locore.s b/sys/boot/sparc64/loader/locore.s
index 3a4eda2..8f3c401 100644
--- a/sys/boot/sparc64/loader/locore.s
+++ b/sys/boot/sparc64/loader/locore.s
@@ -9,19 +9,14 @@
* $FreeBSD$
*/
#include <machine/asi.h>
+#include <machine/asm.h>
#include <machine/pstate.h>
#include <machine/param.h>
-#define BIAS 2047
-#define CC64FSZ 192
-#define TLB_TAG_ACCESS 0x30
-
- .text
- .globl _start
-_start:
- setx ofw_entry, %l7, %l0
- stx %o4, [%l0]
+#define SPOFF 2047
+#define STACK_SIZE (2 * PAGE_SIZE)
+ENTRY(_start)
/* limit interrupts */
wrpr %g0, 13, %pil
@@ -30,32 +25,20 @@ _start:
* unit enabled
*/
wrpr %g0, PSTATE_PRIV|PSTATE_IE|PSTATE_PEF, %pstate
- wr %o0, 0x4, %fprs
+ wr %g0, 0x4, %fprs
- setx stack, %l7, %sp
+ setx stack + STACK_SIZE - SPOFF, %l7, %l6
+ mov %l6, %sp
call main
- nop
-
-/*
- * %o0 kernel entry (VA)
- * %o1 bootinfo structure pointer (VA)
- *
- * XXX Does the FreeBSD kernel expect the bootinfo pointer
- * in %o0 or in %o1?
- */
-.globl jmpkern
-jmpkern:
- setx ofw_entry, %l7, %o2
- jmp %o0
- ldx [%o2], %o2
+ mov %o4, %o0
+ illtrap
/*
* %o0 input VA constant
* %o1 current iTLB offset
* %o2 current iTLB TTE tag
*/
-.globl itlb_va_to_pa
-itlb_va_to_pa:
+ENTRY(itlb_va_to_pa)
clr %o1
0: ldxa [%o1] ASI_ITLB_TAG_READ_REG, %o2
cmp %o2, %o0
@@ -75,8 +58,7 @@ itlb_va_to_pa:
retl
not %o0
-.globl dtlb_va_to_pa
-dtlb_va_to_pa:
+ENTRY(dtlb_va_to_pa)
clr %o1
0: ldxa [%o1] ASI_DTLB_TAG_READ_REG, %o2
cmp %o2, %o0
@@ -102,68 +84,24 @@ dtlb_va_to_pa:
* %o2 = va
* %o3 = flags
*/
-.globl itlb_enter
-itlb_enter:
+ENTRY(itlb_enter)
sllx %o0, 3, %o0
or %o1, %o3, %o1
- mov TLB_TAG_ACCESS, %o3
+ mov AA_IMMU_TAR, %o3
stxa %o2, [%o3] ASI_IMMU
membar #Sync
stxa %o1, [%o0] ASI_ITLB_DATA_ACCESS_REG
retl
nop
-.globl dtlb_enter
-dtlb_enter:
+ENTRY(dtlb_enter)
sllx %o0, 3, %o0
or %o1, %o3, %o1
- mov TLB_TAG_ACCESS, %o3
+ mov AA_DMMU_TAR, %o3
stxa %o2, [%o3] ASI_DMMU
membar #Sync
stxa %o1, [%o0] ASI_DTLB_DATA_ACCESS_REG
retl
nop
-.globl ofw_gate
-ofw_gate:
- save %sp, -CC64FSZ, %sp
- setx ofw_entry, %i3, %i4
- ldx [%i4], %i4
-
- mov %g1, %l1
- mov %g2, %l2
- mov %g3, %l3
- mov %g4, %l4
- mov %g5, %l5
- mov %g6, %l6
- mov %g7, %l7
-
- rdpr %pstate, %i3
- wrpr %g0, PSTATE_PRIV, %pstate
-
- jmpl %i4, %o7
- mov %i0, %o0
- mov %o0, %i0
-
- wrpr %i3, 0, %pstate
-
- mov %l1, %g1
- mov %l2, %g2
- mov %l3, %g3
- mov %l4, %g4
- mov %l5, %g5
- mov %l6, %g6
- mov %l7, %g7
-
- ret
- restore
-
- .data
- .align 8
-ofw_entry: .xword 0
-
- .align 32
- .space 0x4000
- .set stack, _stack-BIAS
-_stack:
- .space 0x10000
+ .comm stack, STACK_SIZE, 32
OpenPOWER on IntegriCloud