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.
This commit is contained in:
Jake Burkholder 2001-10-30 06:27:34 +00:00
parent eea923d7f8
commit 073e92a52c
2 changed files with 32 additions and 156 deletions

View File

@ -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

View File

@ -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