28char *_kExecArg[] = {NULL};
31int PutTLBEntry(
unsigned int PageMask,
unsigned int EntryHi,
unsigned int EntryLo0,
unsigned int EntryLo1);
32int SetTLBEntry(
unsigned int index,
unsigned int PageMask,
unsigned int EntryHi,
unsigned int EntryLo0,
unsigned int EntryLo1);
33int GetTLBEntry(
unsigned int index,
unsigned int *PageMask,
unsigned int *EntryHi,
unsigned int *EntryLo0,
unsigned int *EntryLo1);
34int ProbeTLBEntry(
unsigned int EntryHi,
unsigned int *PageMask,
unsigned int *EntryLo0,
unsigned int *EntryLo1);
35int ExpandScratchPad(
unsigned int page);
41 {0x58, &ProbeTLBEntry},
42 {0x59, &ExpandScratchPad},
49int _start(
int syscall)
53 for (i = 0; i < 6; i++) {
63int PutTLBEntry(
unsigned int PageMask,
unsigned int EntryHi,
unsigned int EntryLo0,
unsigned int EntryLo1)
67 switch (EntryHi >> 24) {
72 __asm
volatile(
"mtc0 %1, $5\n"
83 :
"r"(PageMask),
"r"(EntryHi),
"r"(EntryLo0),
"r"(EntryLo1));
95int SetTLBEntry(
unsigned int index,
unsigned int PageMask,
unsigned int EntryHi,
unsigned int EntryLo0,
unsigned int EntryLo1)
100 __asm
volatile(
"mtc0 %0, $0\n"
107 "sync.p\n" ::
"r"(index),
108 "r"(PageMask),
"r"(EntryHi),
"r"(EntryLo0),
"r"(EntryLo1));
118int GetTLBEntry(
unsigned int index,
unsigned int *PageMask,
unsigned int *EntryHi,
unsigned int *EntryLo0,
unsigned int *EntryLo1)
123 __asm
volatile(
"mtc0 %0, $0\n"
134 "sw $v0, (%4)\n" ::
"r"(index),
135 "r"(PageMask),
"r"(EntryHi),
"r"(EntryLo0),
"r"(EntryLo1));
145int ProbeTLBEntry(
unsigned int EntryHi,
unsigned int *PageMask,
unsigned int *EntryLo0,
unsigned int *EntryLo1)
149 __asm
volatile(
"mtc0 %1, $10\n"
158 __asm
volatile(
"tlbr\n"
165 "sw $v0, (%2)\n" ::
"r"(PageMask),
166 "r"(EntryLo0),
"r"(EntryLo1));
176int ExpandScratchPad(
unsigned int page)
180 if (!(page & 0xFFF)) {
181 if (0xFFFFE < page - 1) {
183 unsigned int PageMask, EntryHi, EntryLo0, EntryLo1;
184 if ((index = ProbeTLBEntry(0x70004000, &PageMask, &EntryLo0, &EntryLo1)) >= 0) {
188 EntryHi = 0xE0010000 + ((index - 1) << 13);
190 __asm
volatile(
"mfc0 $v0, $6\n"
191 "addiu $v0, $v0, 0xFFFF\n"
200 "sync.p\n" ::
"r"(index),
205 __asm
volatile(
"mfc0 %0, $6\n"
207 "mtc0 $v0, $6\n" ::
"r"(index));
218 EntryHi = 0x70004000;
219 EntryLo0 = ((page + 0x1000) & 0xFFFFF000) >> 6 | 0x1F;
220 EntryLo1 = (page & 0xFFFFF000) >> 6 | 0x1F;
222 __asm
volatile(
"mtc0 %0, $0\n"
223 "daddu $v1, $zero, $zero\n"
230 "sync.p\n" ::
"r"(index),
231 "r"(EntryHi),
"r"(EntryLo0),
"r"(EntryLo1));