2001-10-15 14:35:39 +00:00
|
|
|
/*
|
|
|
|
* Initial implementation:
|
|
|
|
* Copyright (c) 2001 Robert Drehmel
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* As long as the above copyright statement and this notice remain
|
|
|
|
* unchanged, you can do what ever you want with this file.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
#include <machine/asi.h>
|
2001-10-30 06:27:34 +00:00
|
|
|
#include <machine/asm.h>
|
2001-10-15 14:35:39 +00:00
|
|
|
#include <machine/pstate.h>
|
|
|
|
#include <machine/param.h>
|
|
|
|
|
2001-10-30 06:27:34 +00:00
|
|
|
#define SPOFF 2047
|
|
|
|
#define STACK_SIZE (2 * PAGE_SIZE)
|
2001-10-15 14:35:39 +00:00
|
|
|
|
2001-10-30 06:27:34 +00:00
|
|
|
ENTRY(_start)
|
2001-10-15 14:35:39 +00:00
|
|
|
/* limit interrupts */
|
|
|
|
wrpr %g0, 13, %pil
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PSTATE: privileged, interrupts enabled, floating point
|
|
|
|
* unit enabled
|
|
|
|
*/
|
|
|
|
wrpr %g0, PSTATE_PRIV|PSTATE_IE|PSTATE_PEF, %pstate
|
2001-10-30 06:27:34 +00:00
|
|
|
wr %g0, 0x4, %fprs
|
2001-10-15 14:35:39 +00:00
|
|
|
|
2001-10-30 06:27:34 +00:00
|
|
|
setx stack + STACK_SIZE - SPOFF, %l7, %l6
|
|
|
|
mov %l6, %sp
|
2001-10-15 14:35:39 +00:00
|
|
|
call main
|
2001-10-30 06:27:34 +00:00
|
|
|
mov %o4, %o0
|
|
|
|
illtrap
|
2001-10-15 14:35:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* %o0 input VA constant
|
|
|
|
* %o1 current iTLB offset
|
|
|
|
* %o2 current iTLB TTE tag
|
|
|
|
*/
|
2001-10-30 06:27:34 +00:00
|
|
|
ENTRY(itlb_va_to_pa)
|
2001-10-15 14:35:39 +00:00
|
|
|
clr %o1
|
|
|
|
0: ldxa [%o1] ASI_ITLB_TAG_READ_REG, %o2
|
|
|
|
cmp %o2, %o0
|
|
|
|
bne,a %xcc, 1f
|
|
|
|
nop
|
|
|
|
/* return PA of matching entry */
|
|
|
|
ldxa [%o1] ASI_ITLB_DATA_ACCESS_REG, %o0
|
|
|
|
sllx %o0, 23, %o0
|
|
|
|
srlx %o0, PAGE_SHIFT+23, %o0
|
|
|
|
sllx %o0, PAGE_SHIFT, %o0
|
|
|
|
retl
|
|
|
|
mov %o0, %o1
|
|
|
|
1: cmp %o1, 63<<3
|
|
|
|
blu %xcc, 0b
|
|
|
|
add %o1, 8, %o1
|
|
|
|
clr %o0
|
|
|
|
retl
|
|
|
|
not %o0
|
|
|
|
|
2001-10-30 06:27:34 +00:00
|
|
|
ENTRY(dtlb_va_to_pa)
|
2001-10-15 14:35:39 +00:00
|
|
|
clr %o1
|
|
|
|
0: ldxa [%o1] ASI_DTLB_TAG_READ_REG, %o2
|
|
|
|
cmp %o2, %o0
|
|
|
|
bne,a %xcc, 1f
|
|
|
|
nop
|
|
|
|
/* return PA of matching entry */
|
|
|
|
ldxa [%o1] ASI_DTLB_DATA_ACCESS_REG, %o0
|
|
|
|
sllx %o0, 23, %o0
|
|
|
|
srlx %o0, PAGE_SHIFT+23, %o0
|
|
|
|
sllx %o0, PAGE_SHIFT, %o0
|
|
|
|
retl
|
|
|
|
mov %o0, %o1
|
|
|
|
1: cmp %o1, 63<<3
|
|
|
|
blu %xcc, 0b
|
|
|
|
add %o1, 8, %o1
|
|
|
|
clr %o0
|
|
|
|
retl
|
|
|
|
not %o0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* %o0 = slot number
|
|
|
|
* %o1 = pa
|
|
|
|
* %o2 = va
|
|
|
|
* %o3 = flags
|
|
|
|
*/
|
2001-10-30 06:27:34 +00:00
|
|
|
ENTRY(itlb_enter)
|
2001-10-15 14:35:39 +00:00
|
|
|
sllx %o0, 3, %o0
|
|
|
|
or %o1, %o3, %o1
|
2001-10-30 06:27:34 +00:00
|
|
|
mov AA_IMMU_TAR, %o3
|
2001-10-15 14:35:39 +00:00
|
|
|
stxa %o2, [%o3] ASI_IMMU
|
|
|
|
membar #Sync
|
|
|
|
stxa %o1, [%o0] ASI_ITLB_DATA_ACCESS_REG
|
|
|
|
retl
|
|
|
|
nop
|
|
|
|
|
2001-10-30 06:27:34 +00:00
|
|
|
ENTRY(dtlb_enter)
|
2001-10-15 14:35:39 +00:00
|
|
|
sllx %o0, 3, %o0
|
|
|
|
or %o1, %o3, %o1
|
2001-10-30 06:27:34 +00:00
|
|
|
mov AA_DMMU_TAR, %o3
|
2001-10-15 14:35:39 +00:00
|
|
|
stxa %o2, [%o3] ASI_DMMU
|
|
|
|
membar #Sync
|
|
|
|
stxa %o1, [%o0] ASI_DTLB_DATA_ACCESS_REG
|
|
|
|
retl
|
|
|
|
nop
|
|
|
|
|
2001-10-30 06:27:34 +00:00
|
|
|
.comm stack, STACK_SIZE, 32
|