OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /eco32/tags/eco32-0.22/hwtests/xcptest
    from Rev 14 to Rev 21
    Reverse comparison

Rev 14 → Rev 21

/serial.s
0,0 → 1,98
;
; serial.s -- the serial line interface
;
 
;***************************************************************
 
.set ser0base,0xF0300000 ; serial line 0 base address
.set ser1base,0xF0300010 ; serial line 1 base address
 
.export serinit ; initialize serial interface
 
.export ser0inchk ; line 0 input check
.export ser0in ; line 0 input
.export ser0outchk ; line 0 output check
.export ser0out ; line 0 output
 
.export ser1inchk ; line 1 input check
.export ser1in ; line 1 input
.export ser1outchk ; line 1 output check
.export ser1out ; line 1 output
 
;***************************************************************
 
.code
.align 4
 
serinit:
jr $31
 
;***************************************************************
 
.code
.align 4
 
ser0inchk:
add $8,$0,ser0base
ldw $2,$8,0
and $2,$2,1
jr $31
 
ser0in:
add $8,$0,ser0base
ser0in1:
ldw $9,$8,0
and $9,$9,1
beq $9,$0,ser0in1
ldw $2,$8,4
jr $31
 
ser0outchk:
add $8,$0,ser0base
ldw $2,$8,8
and $2,$2,1
jr $31
 
ser0out:
add $8,$0,ser0base
ser0out1:
ldw $9,$8,8
and $9,$9,1
beq $9,$0,ser0out1
stw $4,$8,12
jr $31
 
;***************************************************************
 
.code
.align 4
 
ser1inchk:
add $8,$0,ser1base
ldw $2,$8,0
and $2,$2,1
jr $31
 
ser1in:
add $8,$0,ser1base
ser1in1:
ldw $9,$8,0
and $9,$9,1
beq $9,$0,ser1in1
ldw $2,$8,4
jr $31
 
ser1outchk:
add $8,$0,ser1base
ldw $2,$8,8
and $2,$2,1
jr $31
 
ser1out:
add $8,$0,ser1base
ser1out1:
ldw $9,$8,8
and $9,$9,1
beq $9,$0,ser1out1
stw $4,$8,12
jr $31
/start.h
0,0 → 1,102
/*
* start.h -- startup and support routines
*/
 
 
#ifndef _START_H_
#define _START_H_
 
 
typedef struct {
Word reg[32]; /* general purpose registers */
Word psw; /* PSW */
Word tlbIndex; /* TLB index register */
Word tlbHi; /* TLB EntryHi register */
Word tlbLo; /* TLB EntryLo register */
} InterruptContext;
 
 
int cin(void);
void cout(char c);
 
void xtest1(InterruptContext *icp);
extern Word xtest1x;
void xtest2(InterruptContext *icp);
extern Word xtest2x;
void xtest3(InterruptContext *icp);
extern Word xtest3x;
void xtest4(InterruptContext *icp);
extern Word xtest4x;
void xtest5(InterruptContext *icp);
extern Word xtest5x;
void xtest6(InterruptContext *icp);
extern Word xtest6x;
void xtest7(InterruptContext *icp);
extern Word xtest7x;
void xtest8(InterruptContext *icp);
extern Word xtest8x;
void xtest9(InterruptContext *icp);
extern Word xtest9x;
void xtest10(InterruptContext *icp);
extern Word xtest10x;
void xtest11(InterruptContext *icp);
extern Word xtest11x;
void xtest12(InterruptContext *icp);
extern Word xtest12x;
void xtest13(InterruptContext *icp);
extern Word xtest13x;
void xtest14(InterruptContext *icp);
extern Word xtest14x;
void xtest15(InterruptContext *icp);
extern Word xtest15x;
void xtest16(InterruptContext *icp);
extern Word xtest16x;
void xtest17(InterruptContext *icp);
extern Word xtest17x;
void xtest18(InterruptContext *icp);
extern Word xtest18x;
void xtest19(InterruptContext *icp);
extern Word xtest19x;
void xtest20(InterruptContext *icp);
extern Word xtest20x;
void xtest21(InterruptContext *icp);
extern Word xtest21x;
void xtest22(InterruptContext *icp);
extern Word xtest22x;
void xtest23(InterruptContext *icp);
extern Word xtest23x;
void xtest24(InterruptContext *icp);
extern Word xtest24x;
void xtest25(InterruptContext *icp);
extern Word xtest25x;
void xtest26(InterruptContext *icp);
extern Word xtest26x;
void xtest27(InterruptContext *icp);
extern Word xtest27x;
void xtest28(InterruptContext *icp);
extern Word xtest28x;
void xtest29(InterruptContext *icp);
extern Word xtest29x;
void xtest30(InterruptContext *icp);
extern Word xtest30x;
void xtest31(InterruptContext *icp);
extern Word xtest31x;
void xtest32(InterruptContext *icp);
extern Word xtest32x;
void xtest33(InterruptContext *icp);
extern Word xtest33x;
void xtest34(InterruptContext *icp);
extern Word xtest34x;
void xtest35(InterruptContext *icp);
extern Word xtest35x;
void xtest36(InterruptContext *icp);
extern Word xtest36x;
void xtest37(InterruptContext *icp);
extern Word xtest37x;
 
Word getTLB_HI(int index);
Word getTLB_LO(int index);
void setTLB(int index, Word entryHi, Word entryLo);
 
 
#endif /* _START_H_ */
/main.c
0,0 → 1,272
/*
* main.c -- the main program
*/
 
 
#include "common.h"
#include "lib.h"
#include "start.h"
 
 
Word userMissTaken;
 
 
static InterruptContext initial = {
/* regs */
0x00000011, 0x11111112, 0x22222213, 0x33333314,
0x44444415, 0x55555516, 0x66666617, 0x77777718,
0x88888819, 0x9999991A, 0xAAAAAA1B, 0xBBBBBB1C,
0xCCCCCC1D, 0xDDDDDD1E, 0xEEEEEE1F, 0xFFFFFF10,
0x00000021, 0x11111122, 0x22222223, 0x33333324,
0x44444425, 0x55555526, 0x66666627, 0x77777728,
0x88888829, 0x9999992A, 0xAAAAAA2B, 0xBBBBBB2C,
0xCCCCCC2D, 0xDDDDDD2E, 0xEEEEEE2F, 0xFFFFFF20,
/* PSW */
0x03FF5678,
/* TLB index */
0x87654321,
/* TLB EntryHi */
0x9ABCDEF0,
/* TLB EntryLo */
0x0FEDCBA9
};
 
static InterruptContext ic;
 
 
static char *errorMessage[] = {
/* 0 */ "no error",
/* 1 */ "general register clobbered",
/* 2 */ "write to register 0 succeeded",
/* 3 */ "locus of exception incorrect",
/* 4 */ "TLB register clobbered",
/* 5 */ "vector bit incorrect",
/* 6 */ "user mode bits incorrect",
/* 7 */ "interrupt enable bits incorrect",
/* 8 */ "wrong exception number",
/* 9 */ "interrupt mask bits clobbered",
/* 10 */ "ISR entry was 'user miss'",
/* 11 */ "ISR entry was not 'user miss'",
};
 
 
static void flushTLB(void) {
Word invalPage;
int i;
 
invalPage = 0xC0000000;
for (i = 0; i < 32; i++) {
setTLB(i, invalPage, 0);
invalPage += (1 << 12);
}
}
 
 
static void check(unsigned int *res1, unsigned int *res2,
Word expectedEntryHi) {
int i;
 
*res1 = 0;
*res2 = 0;
for (i = 0; i < 32; i++) {
if (ic.reg[i] != initial.reg[i]) {
*res1 |= (1 << i);
}
}
if ((ic.psw & 0x0FFFFFFF) != (initial.psw & 0x0FFFFFFF)) {
*res2 |= (1 << 0);
}
if ((ic.tlbIndex & 0x0000001F) != (initial.tlbIndex & 0x0000001F)) {
*res2 |= (1 << 1);
}
if ((ic.tlbHi & 0xFFFFF000) != (expectedEntryHi & 0xFFFFF000)) {
*res2 |= (1 << 2);
}
if ((ic.tlbLo & 0x3FFFF003) != (initial.tlbLo & 0x3FFFF003)) {
*res2 |= (1 << 3);
}
}
 
 
static int execTest(void (*run)(InterruptContext *icp),
Word *expectedLocus,
int expectedException,
Bool execInUserMode,
Bool clobberEntryHi,
Bool shouldTakeUserMiss) {
unsigned int res1, res2;
int result;
Word *locus;
 
if (execInUserMode) {
initial.psw |= 1 << 26;
}
ic = initial;
flushTLB();
userMissTaken = 0xFFFFFFFF;
(*run)(&ic);
if (execInUserMode) {
locus = (Word *) (0xC0000000 | ic.reg[30]);
} else {
locus = (Word *) ic.reg[30];
}
if (!clobberEntryHi) {
check(&res1, &res2, initial.tlbHi);
} else {
if (shouldTakeUserMiss) {
check(&res1, &res2, initial.reg[3]);
} else {
check(&res1, &res2, initial.reg[11]);
}
}
result = 0;
if (((ic.psw >> 16) & 0x1F) != expectedException) {
result = 8;
} else
if (!shouldTakeUserMiss && userMissTaken != 0) {
result = 10;
} else
if (shouldTakeUserMiss && userMissTaken != (Word) &userMissTaken) {
result = 11;
} else
if (res1 != 0x50000001) {
result = 1;
} else
if (ic.reg[0] != 0x00000000) {
result = 2;
} else
if (locus != expectedLocus) {
result = 3;
} else
if (res2 != 0x00000001) {
result = 4;
} else
if (((ic.psw >> 27) & 0x01) != ((initial.psw >> 27) & 0x01)) {
result = 5;
} else
if (((ic.psw >> 24) & 0x07) != ((initial.psw >> 25) & 0x03)) {
result = 6;
} else
if (((ic.psw >> 21) & 0x07) != ((initial.psw >> 22) & 0x03)) {
result = 7;
} else
if (((ic.psw >> 0) & 0xFF) != ((initial.psw >> 0) & 0xFF)) {
result = 9;
}
if (execInUserMode) {
initial.psw &= ~(1 << 26);
}
return result;
}
 
 
static struct {
char *name;
void (*run)(InterruptContext *icp);
Word *locus;
int exception;
Bool execInUserMode;
Bool clobberEntryHi;
Bool shouldTakeUserMiss;
} tests[] = {
{ "Trap instr test:\t\t\t",
xtest1, &xtest1x, 20, false, false, false },
{ "Illegal instr test:\t\t\t",
xtest2, &xtest2x, 17, false, false, false },
{ "Divide instr test 1 (div):\t\t",
xtest3, &xtest3x, 19, false, false, false },
{ "Divide instr test 2 (divi):\t\t",
xtest4, &xtest4x, 19, false, false, false },
{ "Divide instr test 3 (divu):\t\t",
xtest5, &xtest5x, 19, false, false, false },
{ "Divide instr test 4 (divui):\t\t",
xtest6, &xtest6x, 19, false, false, false },
{ "Divide instr test 5 (rem):\t\t",
xtest7, &xtest7x, 19, false, false, false },
{ "Divide instr test 6 (remi):\t\t",
xtest8, &xtest8x, 19, false, false, false },
{ "Divide instr test 7 (remu):\t\t",
xtest9, &xtest9x, 19, false, false, false },
{ "Divide instr test 8 (remui):\t\t",
xtest10, &xtest10x, 19, false, false, false },
{ "Bus timeout test 1 (fetch):\t\t",
xtest11, &xtest11x, 16, false, false, false },
{ "Bus timeout test 2 (load):\t\t",
xtest12, &xtest12x, 16, false, false, false },
{ "Bus timeout test 3 (store):\t\t",
xtest13, &xtest13x, 16, false, false, false },
{ "Privileged instr test 1 (rfx):\t\t",
xtest14, &xtest14x, 18, true, false, false },
{ "Privileged instr test 2 (mvts):\t\t",
xtest15, &xtest15x, 18, true, false, false },
{ "Privileged instr test 3 (tb..):\t\t",
xtest16, &xtest16x, 18, true, false, false },
{ "Privileged address test 1 (fetch):\t",
xtest17, &xtest17x, 25, true, false, false },
{ "Privileged address test 2 (load):\t",
xtest18, &xtest18x, 25, true, false, false },
{ "Privileged address test 3 (store):\t",
xtest19, &xtest19x, 25, true, false, false },
{ "Illegal address test 1 (fetch):\t\t",
xtest20, &xtest20x, 24, false, false, false },
{ "Illegal address test 2 (fetch):\t\t",
xtest21, &xtest21x, 24, false, false, false },
{ "Illegal address test 3 (ldw):\t\t",
xtest22, &xtest22x, 24, false, false, false },
{ "Illegal address test 4 (ldw):\t\t",
xtest23, &xtest23x, 24, false, false, false },
{ "Illegal address test 5 (ldh):\t\t",
xtest24, &xtest24x, 24, false, false, false },
{ "Illegal address test 6 (stw):\t\t",
xtest25, &xtest25x, 24, false, false, false },
{ "Illegal address test 7 (stw):\t\t",
xtest26, &xtest26x, 24, false, false, false },
{ "Illegal address test 8 (sth):\t\t",
xtest27, &xtest27x, 24, false, false, false },
{ "TLB user miss test 1 (fetch):\t\t",
xtest28, &xtest28x, 21, false, true, true },
{ "TLB user miss test 2 (load):\t\t",
xtest29, &xtest29x, 21, false, true, true },
{ "TLB user miss test 3 (store):\t\t",
xtest30, &xtest30x, 21, false, true, true },
{ "TLB kernel miss test 1 (fetch):\t\t",
xtest31, &xtest31x, 21, false, true, false },
{ "TLB kernel miss test 2 (load):\t\t",
xtest32, &xtest32x, 21, false, true, false },
{ "TLB kernel miss test 3 (store):\t\t",
xtest33, &xtest33x, 21, false, true, false },
{ "TLB invalid test 1 (fetch):\t\t",
xtest34, &xtest34x, 23, false, true, false },
{ "TLB invalid test 2 (load):\t\t",
xtest35, &xtest35x, 23, false, true, false },
{ "TLB invalid test 3 (store):\t\t",
xtest36, &xtest36x, 23, false, true, false },
{ "TLB wrtprot test (store):\t\t",
xtest37, &xtest37x, 22, false, true, false },
};
 
 
int main(void) {
int i;
int result;
 
printf("\nStart of exception tests.\n\n");
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
printf("%s", tests[i].name);
result = execTest(tests[i].run,
tests[i].locus,
tests[i].exception,
tests[i].execInUserMode,
tests[i].clobberEntryHi,
tests[i].shouldTakeUserMiss);
if (result == 0) {
printf("ok");
} else {
printf("failed (%s)", errorMessage[result]);
}
printf("\n");
}
printf("\nEnd of exception tests.\n");
while (1) ;
return 0;
}
/end.s
0,0 → 1,19
;
; end.s -- end-of-segment labels
;
 
.export _ecode
.export _edata
.export _ebss
 
.code
.align 4
_ecode:
 
.data
.align 4
_edata:
 
.bss
.align 4
_ebss:
/lib.c
0,0 → 1,636
/*
* lib.c -- the library
*/
 
 
#include "common.h"
#include "lib.h"
#include "stdarg.h"
#include "start.h"
 
 
/**************************************************************/
 
 
/*
* This is only for debugging.
* Place a breakpoint at the very beginning of this routine
* and call it wherever you want to break execution.
*/
void debugBreak(void) {
}
 
 
/**************************************************************/
 
 
/*
* Count the length of a string (without terminating null character).
*/
int strlen(const char *s) {
const char *p;
 
p = s;
while (*p != '\0') {
p++;
}
return p - s;
}
 
 
/*
* Compare two strings.
* Return a number < 0, = 0, or > 0 iff the first string is less
* than, equal to, or greater than the second one, respectively.
*/
int strcmp(const char *s, const char *t) {
while (*s == *t) {
if (*s == '\0') {
return 0;
}
s++;
t++;
}
return *s - *t;
}
 
 
/*
* Copy string t to string s (includes terminating null character).
*/
char *strcpy(char *s, const char *t) {
char *p;
 
p = s;
while ((*p = *t) != '\0') {
p++;
t++;
}
return s;
}
 
 
/*
* Append string t to string s.
*/
char *strcat(char *s, const char *t) {
char *p;
 
p = s;
while (*p != '\0') {
p++;
}
while ((*p = *t) != '\0') {
p++;
t++;
}
return s;
}
 
 
/*
* Locate character c in string s.
*/
char *strchr(const char *s, char c) {
while (*s != c) {
if (*s == '\0') {
return NULL;
}
s++;
}
return (char *) s;
}
 
 
/*
* Extract the next token from the string s, delimited
* by any character from the delimiter string t.
*/
char *strtok(char *s, const char *t) {
static char *p;
char *q;
 
if (s != NULL) {
p = s;
} else {
p++;
}
while (*p != '\0' && strchr(t, *p) != NULL) {
p++;
}
if (*p == '\0') {
return NULL;
}
q = p++;
while (*p != '\0' && strchr(t, *p) == NULL) {
p++;
}
if (*p != '\0') {
*p = '\0';
} else {
p--;
}
return q;
}
 
 
/**************************************************************/
 
 
/*
* Determine if a character is 'white space'.
*/
static Bool isspace(char c) {
Bool res;
 
switch (c) {
case ' ':
case '\f':
case '\n':
case '\r':
case '\t':
case '\v':
res = true;
break;
default:
res = false;
break;
}
return res;
}
 
 
/*
* Check for valid digit, and convert to value.
*/
static Bool checkDigit(char c, int base, int *value) {
if (c >= '0' && c <= '9') {
*value = c - '0';
} else
if (c >= 'A' && c <= 'Z') {
*value = c - 'A' + 10;
} else
if (c >= 'a' && c <= 'z') {
*value = c - 'a' + 10;
} else {
return false;
}
return *value < base;
}
 
 
/*
* Convert initial part of string to unsigned long integer.
*/
unsigned long strtoul(const char *s, char **endp, int base) {
unsigned long res;
int sign;
int digit;
 
res = 0;
while (isspace(*s)) {
s++;
}
if (*s == '+') {
sign = 1;
s++;
} else
if (*s == '-') {
sign = -1;
s++;
} else {
sign = 1;
}
if (base == 0 || base == 16) {
if (*s == '0' &&
(*(s + 1) == 'x' || *(s + 1) == 'X')) {
/* base is 16 */
s += 2;
base = 16;
} else {
/* base is 0 or 16, but number does not start with "0x" */
if (base == 0) {
if (*s == '0') {
s++;
base = 8;
} else {
base = 10;
}
} else {
/* take base as is */
}
}
} else {
/* take base as is */
}
while (checkDigit(*s, base, &digit)) {
res *= base;
res += digit;
s++;
}
if (endp != NULL) {
*endp = (char *) s;
}
return sign * res;
}
 
 
/**************************************************************/
 
 
/*
* Exchange two array items of a given size.
*/
static void xchg(char *p, char *q, int size) {
char t;
 
while (size--) {
t = *p;
*p++ = *q;
*q++ = t;
}
}
 
 
/*
* This is a recursive version of quicksort.
*/
static void sort(char *l, char *r, int size,
int (*cmp)(const void *, const void *)) {
char *i;
char *j;
char *x;
 
i = l;
j = r;
x = l + (((r - l) / size) / 2) * size;
do {
while (cmp(i, x) < 0) {
i += size;
}
while (cmp(x, j) < 0) {
j -= size;
}
if (i <= j) {
/* exchange array elements i and j */
/* attention: update x if it is one of these */
if (x == i) {
x = j;
} else
if (x == j) {
x = i;
}
xchg(i, j, size);
i += size;
j -= size;
}
} while (i <= j);
if (l < j) {
sort(l, j, size, cmp);
}
if (i < r) {
sort(i, r, size, cmp);
}
}
 
 
/*
* External interface for the quicksort algorithm.
*/
void qsort(void *base, int n, int size,
int (*cmp)(const void *, const void*)) {
sort((char *) base, (char *) base + (n - 1) * size, size, cmp);
}
 
 
/**************************************************************/
 
 
/*
* Input a character from the console.
*/
char getchar(void) {
return cin();
}
 
 
/*
* Output a character on the console.
* Replace LF by CR/LF.
*/
void putchar(char c) {
if (c == '\n') {
cout('\r');
}
cout(c);
}
 
 
/*
* Output a string on the console.
* Replace LF by CR/LF.
*/
void puts(const char *s) {
while (*s != '\0') {
putchar(*s);
s++;
}
}
 
 
/**************************************************************/
 
 
/*
* Count the number of characters needed to represent
* a given number in base 10.
*/
static int countPrintn(long n) {
long a;
int res;
 
res = 0;
if (n < 0) {
res++;
n = -n;
}
a = n / 10;
if (a != 0) {
res += countPrintn(a);
}
return res + 1;
}
 
 
/*
* Output a number in base 10.
*/
static void *printn(void *(*emit)(void *, char), void *arg,
int *nchar, long n) {
long a;
 
if (n < 0) {
arg = emit(arg, '-');
(*nchar)++;
n = -n;
}
a = n / 10;
if (a != 0) {
arg = printn(emit, arg, nchar, a);
}
arg = emit(arg, n % 10 + '0');
(*nchar)++;
return arg;
}
 
 
/*
* Count the number of characters needed to represent
* a given number in a given base.
*/
static int countPrintu(unsigned long n, unsigned long b) {
unsigned long a;
int res;
 
res = 0;
a = n / b;
if (a != 0) {
res += countPrintu(a, b);
}
return res + 1;
}
 
 
/*
* Output a number in a given base.
*/
static void *printu(void *(*emit)(void *, char), void *arg,
int *nchar, unsigned long n, unsigned long b,
Bool upperCase) {
unsigned long a;
 
a = n / b;
if (a != 0) {
arg = printu(emit, arg, nchar, a, b, upperCase);
}
if (upperCase) {
arg = emit(arg, "0123456789ABCDEF"[n % b]);
(*nchar)++;
} else {
arg = emit(arg, "0123456789abcdef"[n % b]);
(*nchar)++;
}
return arg;
}
 
 
/*
* Output a number of filler characters.
*/
static void *fill(void *(*emit)(void *, char), void *arg,
int *nchar, int numFillers, char filler) {
while (numFillers-- > 0) {
arg = emit(arg, filler);
(*nchar)++;
}
return arg;
}
 
 
/*
* This function does the real work of formatted printing.
*/
static int doPrintf(void *(*emit)(void *, char), void *arg,
const char *fmt, va_list ap) {
int nchar;
char c;
int n;
long ln;
unsigned int u;
unsigned long lu;
char *s;
Bool negFlag;
char filler;
int width, count;
 
nchar = 0;
while (1) {
while ((c = *fmt++) != '%') {
if (c == '\0') {
return nchar;
}
arg = emit(arg, c);
nchar++;
}
c = *fmt++;
if (c == '-') {
negFlag = true;
c = *fmt++;
} else {
negFlag = false;
}
if (c == '0') {
filler = '0';
c = *fmt++;
} else {
filler = ' ';
}
width = 0;
while (c >= '0' && c <= '9') {
width *= 10;
width += c - '0';
c = *fmt++;
}
if (c == 'd') {
n = va_arg(ap, int);
count = countPrintn(n);
if (width > 0 && !negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
arg = printn(emit, arg, &nchar, n);
if (width > 0 && negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
} else
if (c == 'u' || c == 'o' || c == 'x' || c == 'X') {
u = va_arg(ap, int);
count = countPrintu(u,
c == 'o' ? 8 : ((c == 'x' || c == 'X') ? 16 : 10));
if (width > 0 && !negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
arg = printu(emit, arg, &nchar, u,
c == 'o' ? 8 : ((c == 'x' || c == 'X') ? 16 : 10),
c == 'X');
if (width > 0 && negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
} else
if (c == 'l') {
c = *fmt++;
if (c == 'd') {
ln = va_arg(ap, long);
count = countPrintn(ln);
if (width > 0 && !negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
arg = printn(emit, arg, &nchar, ln);
if (width > 0 && negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
} else
if (c == 'u' || c == 'o' || c == 'x' || c == 'X') {
lu = va_arg(ap, long);
count = countPrintu(lu,
c == 'o' ? 8 : ((c == 'x' || c == 'X') ? 16 : 10));
if (width > 0 && !negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
arg = printu(emit, arg, &nchar, lu,
c == 'o' ? 8 : ((c == 'x' || c == 'X') ? 16 : 10),
c == 'X');
if (width > 0 && negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
} else {
arg = emit(arg, 'l');
nchar++;
arg = emit(arg, c);
nchar++;
}
} else
if (c == 's') {
s = va_arg(ap, char *);
count = strlen(s);
if (width > 0 && !negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
while ((c = *s++) != '\0') {
arg = emit(arg, c);
nchar++;
}
if (width > 0 && negFlag) {
arg = fill(emit, arg, &nchar, width - count, filler);
}
} else
if (c == 'c') {
c = va_arg(ap, char);
arg = emit(arg, c);
nchar++;
} else {
arg = emit(arg, c);
nchar++;
}
}
/* never reached */
return 0;
}
 
 
/*
* Emit a character to the console.
*/
static void *emitToConsole(void *dummy, char c) {
putchar(c);
return dummy;
}
 
 
/*
* Formatted output with a variable argument list.
*/
static int vprintf(const char *fmt, va_list ap) {
int n;
 
n = doPrintf(emitToConsole, NULL, fmt, ap);
return n;
}
 
 
/*
* Formatted output.
*/
int printf(const char *fmt, ...) {
int n;
va_list ap;
 
va_start(ap, fmt);
n = vprintf(fmt, ap);
va_end(ap);
return n;
}
 
 
/*
* Emit a character to a buffer.
*/
static void *emitToBuffer(void *bufptr, char c) {
*(char *)bufptr = c;
return (char *) bufptr + 1;
}
 
 
/*
* Formatted output into a buffer with a variable argument list.
*/
static int vsprintf(char *s, const char *fmt, va_list ap) {
int n;
 
n = doPrintf(emitToBuffer, s, fmt, ap);
s[n] = '\0';
return n;
}
 
 
/*
* Formatted output into a buffer.
*/
int sprintf(char *s, const char *fmt, ...) {
int n;
va_list ap;
 
va_start(ap, fmt);
n = vsprintf(s, fmt, ap);
va_end(ap);
return n;
}
/stdarg.h
0,0 → 1,41
/*
* stdarg.h -- variable argument lists
*/
 
 
#ifndef _STDARG_H_
#define _STDARG_H_
 
 
typedef char *va_list;
 
 
static float __va_arg_tmp;
 
 
#define va_start(list, start) \
((void)((list) = (sizeof(start)<4 ? \
(char *)((int *)&(start)+1) : (char *)(&(start)+1))))
 
#define __va_arg(list, mode, n) \
(__typecode(mode)==1 && sizeof(mode)==4 ? \
(__va_arg_tmp = *(double *)(&(list += \
((sizeof(double)+n)&~n))[-(int)((sizeof(double)+n)&~n)]), \
*(mode *)&__va_arg_tmp) : \
*(mode *)(&(list += \
((sizeof(mode)+n)&~n))[-(int)((sizeof(mode)+n)&~n)]))
 
#define _bigendian_va_arg(list, mode, n) \
(sizeof(mode)==1 ? *(mode *)(&(list += 4)[-1]) : \
sizeof(mode)==2 ? *(mode *)(&(list += 4)[-2]) : \
__va_arg(list, mode, n))
 
#define va_end(list) ((void)0)
 
#define va_arg(list, mode) \
(sizeof(mode)==8 ? \
*(mode *)(&(list = (char*)(((int)list + 15)&~7U))[-8]) : \
_bigendian_va_arg(list, mode, 3U))
 
 
#endif /* _STDARG_H_ */
/lib.h
0,0 → 1,32
/*
* lib.h -- the library
*/
 
 
#ifndef _LIB_H_
#define _LIB_H_
 
 
void debugBreak(void);
 
int strlen(const char *s);
int strcmp(const char *s, const char *t);
char *strcpy(char *s, const char *t);
char *strcat(char *s, const char *t);
char *strchr(const char *s, char c);
char *strtok(char *s, const char *t);
 
unsigned long strtoul(const char *s, char **endp, int base);
 
void qsort(void *base, int n, int size,
int (*cmp)(const void *, const void *));
 
char getchar(void);
void putchar(char c);
void puts(const char *s);
 
int printf(const char *fmt, ...);
int sprintf(char *s, const char *fmt, ...);
 
 
#endif /* _LIB_H_ */
/Makefile
0,0 → 1,27
#
# Makefile for xcptest ROM
#
 
BUILD = ../../build
 
XCPTEST_SRC = start.s main.c lib.c serial.s end.s
 
.PHONY: all install run clean
 
all: xcptest.exo
 
install: xcptest.exo
 
xcptest.exo: xcptest.bin
$(BUILD)/bin/bin2exo 0 xcptest.bin xcptest.exo
 
xcptest.bin: $(XCPTEST_SRC)
$(BUILD)/bin/lcc -A -Wo-rom -Wl-rd -Wl0xC03F0000 \
-Wl-m -Wlxcptest.map -o xcptest.bin $(XCPTEST_SRC)
 
run: xcptest.bin
$(BUILD)/bin/sim -i -t 1 -r xcptest.bin
 
clean:
rm -f *~
rm -f xcptest.map xcptest.bin xcptest.exo
/common.h
0,0 → 1,27
/*
* common.h -- common definitions
*/
 
 
#ifndef _COMMON_H_
#define _COMMON_H_
 
 
#define PAGE_SHIFT 12 /* log2 of page size */
#define PAGE_SIZE (1 << PAGE_SHIFT) /* page size in bytes */
#define OFFSET_MASK (PAGE_SIZE - 1) /* mask for offset in page */
#define PAGE_MASK (~OFFSET_MASK) /* mask for page number */
 
 
typedef enum { false, true } Bool; /* truth values */
 
 
typedef unsigned int Word; /* 32 bit quantities */
typedef unsigned short Half; /* 16 bit quantities */
typedef unsigned char Byte; /* 8 bit quantities */
 
 
#define NULL ((void *) 0)
 
 
#endif /* _COMMON_H_ */
/start.s
0,0 → 1,2755
;
; start.s -- startup and support routines
;
 
.set dmapaddr,0xC0000000 ; base of directly mapped addresses
.set stacktop,0xC0400000 ; monitor stack is at top of memory
 
.set PSW,0 ; reg # of PSW
.set TLB_INDEX,1 ; reg # of TLB Index
.set TLB_ENTRY_HI,2 ; reg # of TLB EntryHi
.set TLB_ENTRY_LO,3 ; reg # of TLB EntryLo
.set TLB_ENTRIES,32 ; number of TLB entries
 
;***************************************************************
 
.import _ecode
.import _edata
.import _ebss
 
.import serinit
.import ser0in
.import ser0out
 
.import main
.import userMissTaken
 
.export _bcode
.export _bdata
.export _bbss
 
.export cin
.export cout
 
.export xtest1
.export xtest1x
.export xtest2
.export xtest2x
.export xtest3
.export xtest3x
.export xtest4
.export xtest4x
.export xtest5
.export xtest5x
.export xtest6
.export xtest6x
.export xtest7
.export xtest7x
.export xtest8
.export xtest8x
.export xtest9
.export xtest9x
.export xtest10
.export xtest10x
.export xtest11
.export xtest11x
.export xtest12
.export xtest12x
.export xtest13
.export xtest13x
.export xtest14
.export xtest14x
.export xtest15
.export xtest15x
.export xtest16
.export xtest16x
.export xtest17
.export xtest17x
.export xtest18
.export xtest18x
.export xtest19
.export xtest19x
.export xtest20
.export xtest20x
.export xtest21
.export xtest21x
.export xtest22
.export xtest22x
.export xtest23
.export xtest23x
.export xtest24
.export xtest24x
.export xtest25
.export xtest25x
.export xtest26
.export xtest26x
.export xtest27
.export xtest27x
.export xtest28
.export xtest28x
.export xtest29
.export xtest29x
.export xtest30
.export xtest30x
.export xtest31
.export xtest31x
.export xtest32
.export xtest32x
.export xtest33
.export xtest33x
.export xtest34
.export xtest34x
.export xtest35
.export xtest35x
.export xtest36
.export xtest36x
.export xtest37
.export xtest37x
 
.export getTLB_HI
.export getTLB_LO
.export setTLB
 
;***************************************************************
 
.code
_bcode:
 
.data
_bdata:
 
.bss
_bbss:
 
;***************************************************************
 
.code
.align 4
 
reset:
j start
 
interrupt:
j isr
 
userMiss:
j umsr
 
;***************************************************************
 
.code
.align 4
 
cin:
j ser0in
 
cout:
j ser0out
 
;***************************************************************
 
.code
.align 4
 
start:
; force CPU into a defined state
mvts $0,PSW ; disable interrupts and user mode
 
; initialize TLB
mvts $0,TLB_ENTRY_LO ; invalidate all TLB entries
add $8,$0,dmapaddr ; by impossible virtual page number
add $9,$0,$0
add $10,$0,TLB_ENTRIES
tlbloop:
mvts $8,TLB_ENTRY_HI
mvts $9,TLB_INDEX
tbwi
add $8,$8,0x1000 ; all entries must be different
add $9,$9,1
bne $9,$10,tlbloop
 
; copy data segment
add $10,$0,_bdata ; lowest dst addr to be written to
add $8,$0,_edata ; one above the top dst addr
sub $9,$8,$10 ; $9 = size of data segment
add $9,$9,_ecode ; data is waiting right after code
j cpytest
cpyloop:
ldw $11,$9,0 ; src addr in $9
stw $11,$8,0 ; dst addr in $8
cpytest:
sub $8,$8,4 ; downward
sub $9,$9,4
bgeu $8,$10,cpyloop
 
; clear bss segment
add $8,$0,_bbss ; start with first word of bss
add $9,$0,_ebss ; this is one above the top
j clrtest
clrloop:
stw $0,$8,0 ; dst addr in $8
add $8,$8,4 ; upward
clrtest:
bltu $8,$9,clrloop
 
; now do some useful work
add $29,$0,stacktop ; setup monitor stack
jal serinit ; init serial interface
jal main ; enter command loop
 
; main should never return
j start ; just to be sure...
 
;***************************************************************
 
xtest1:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest1x:
trap
j halt
.syn
 
xtest2:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest2x:
.word 0x1E << 26
j halt
.syn
 
xtest3:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest3x:
div $5,$7,$0
j halt
.syn
 
xtest4:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest4x:
div $5,$7,0
j halt
.syn
 
xtest5:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest5x:
divu $5,$7,$0
j halt
.syn
 
xtest6:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest6x:
divu $5,$7,0
j halt
.syn
 
xtest7:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest7x:
rem $5,$7,$0
j halt
.syn
 
xtest8:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest8x:
rem $5,$7,0
j halt
.syn
 
xtest9:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest9x:
remu $5,$7,$0
j halt
.syn
 
xtest10:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest10x:
remu $5,$7,0
j halt
.syn
 
xtest11:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest11x:
.set xtest11x,0xFFFFFF10
jr $15
j halt
.syn
 
xtest12:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest12x:
ldw $5,$15,0
j halt
.syn
 
xtest13:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest13x:
stw $5,$15,0
j halt
.syn
 
xtest14:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $16,$0,xtest14v ; switch to virtual addressing
add $8,$0,11
mvts $8,TLB_INDEX
and $8,$16,0x3FFFF000
mvts $8,TLB_ENTRY_HI
and $8,$16,0x3FFFF000
or $8,$8,3
mvts $8,TLB_ENTRY_LO
tbwi
mvfs $8,TLB_INDEX ; we could cross a page boundary
add $8,$8,1
mvts $8,TLB_INDEX
mvfs $8,TLB_ENTRY_HI
add $8,$8,0x1000
mvts $8,TLB_ENTRY_HI
mvfs $8,TLB_ENTRY_LO
add $8,$8,0x1000
mvts $8,TLB_ENTRY_LO
tbwi
and $16,$16,0x3FFFFFFF
jr $16
xtest14v:
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest14x:
rfx
j halt
.syn
 
xtest15:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $16,$0,xtest15v ; switch to virtual addressing
add $8,$0,11
mvts $8,TLB_INDEX
and $8,$16,0x3FFFF000
mvts $8,TLB_ENTRY_HI
and $8,$16,0x3FFFF000
or $8,$8,3
mvts $8,TLB_ENTRY_LO
tbwi
mvfs $8,TLB_INDEX ; we could cross a page boundary
add $8,$8,1
mvts $8,TLB_INDEX
mvfs $8,TLB_ENTRY_HI
add $8,$8,0x1000
mvts $8,TLB_ENTRY_HI
mvfs $8,TLB_ENTRY_LO
add $8,$8,0x1000
mvts $8,TLB_ENTRY_LO
tbwi
and $16,$16,0x3FFFFFFF
jr $16
xtest15v:
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest15x:
mvts $0,PSW
j halt
.syn
 
xtest16:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $16,$0,xtest16v ; switch to virtual addressing
add $8,$0,11
mvts $8,TLB_INDEX
and $8,$16,0x3FFFF000
mvts $8,TLB_ENTRY_HI
and $8,$16,0x3FFFF000
or $8,$8,3
mvts $8,TLB_ENTRY_LO
tbwi
mvfs $8,TLB_INDEX ; we could cross a page boundary
add $8,$8,1
mvts $8,TLB_INDEX
mvfs $8,TLB_ENTRY_HI
add $8,$8,0x1000
mvts $8,TLB_ENTRY_HI
mvfs $8,TLB_ENTRY_LO
add $8,$8,0x1000
mvts $8,TLB_ENTRY_LO
tbwi
and $16,$16,0x3FFFFFFF
jr $16
xtest16v:
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest16x:
tbs
j halt
.syn
 
xtest17:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $16,$0,xtest17v ; switch to virtual addressing
add $8,$0,11
mvts $8,TLB_INDEX
and $8,$16,0x3FFFF000
mvts $8,TLB_ENTRY_HI
and $8,$16,0x3FFFF000
or $8,$8,3
mvts $8,TLB_ENTRY_LO
tbwi
mvfs $8,TLB_INDEX ; we could cross a page boundary
add $8,$8,1
mvts $8,TLB_INDEX
mvfs $8,TLB_ENTRY_HI
add $8,$8,0x1000
mvts $8,TLB_ENTRY_HI
mvfs $8,TLB_ENTRY_LO
add $8,$8,0x1000
mvts $8,TLB_ENTRY_LO
tbwi
and $16,$16,0x3FFFFFFF
jr $16
xtest17v:
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest17x:
.set xtest17x,0xFFFFFF10
jr $15
j halt
.syn
 
xtest18:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $16,$0,xtest18v ; switch to virtual addressing
add $8,$0,11
mvts $8,TLB_INDEX
and $8,$16,0x3FFFF000
mvts $8,TLB_ENTRY_HI
and $8,$16,0x3FFFF000
or $8,$8,3
mvts $8,TLB_ENTRY_LO
tbwi
mvfs $8,TLB_INDEX ; we could cross a page boundary
add $8,$8,1
mvts $8,TLB_INDEX
mvfs $8,TLB_ENTRY_HI
add $8,$8,0x1000
mvts $8,TLB_ENTRY_HI
mvfs $8,TLB_ENTRY_LO
add $8,$8,0x1000
mvts $8,TLB_ENTRY_LO
tbwi
and $16,$16,0x3FFFFFFF
jr $16
xtest18v:
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest18x:
ldw $5,$15,0
j halt
.syn
 
xtest19:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $16,$0,xtest19v ; switch to virtual addressing
add $8,$0,11
mvts $8,TLB_INDEX
and $8,$16,0x3FFFF000
mvts $8,TLB_ENTRY_HI
and $8,$16,0x3FFFF000
or $8,$8,3
mvts $8,TLB_ENTRY_LO
tbwi
mvfs $8,TLB_INDEX ; we could cross a page boundary
add $8,$8,1
mvts $8,TLB_INDEX
mvfs $8,TLB_ENTRY_HI
add $8,$8,0x1000
mvts $8,TLB_ENTRY_HI
mvfs $8,TLB_ENTRY_LO
add $8,$8,0x1000
mvts $8,TLB_ENTRY_LO
tbwi
and $16,$16,0x3FFFFFFF
jr $16
xtest19v:
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest19x:
stw $5,$15,0
j halt
.syn
 
xtest20:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest20x:
.set xtest20x,0x11111122
jr $17
j halt
.syn
 
xtest21:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest21x:
.set xtest21x,0x00000021
jr $16
j halt
.syn
 
xtest22:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest22x:
ldw $5,$15,2
j halt
.syn
 
xtest23:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest23x:
ldw $5,$15,1
j halt
.syn
 
xtest24:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest24x:
ldh $5,$15,1
j halt
.syn
 
xtest25:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest25x:
stw $5,$15,2
j halt
.syn
 
xtest26:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest26x:
stw $5,$15,1
j halt
.syn
 
xtest27:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest27x:
sth $5,$15,1
j halt
.syn
 
xtest28:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest28x:
.set xtest28x,0x33333314
jr $3
j halt
.syn
 
xtest29:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest29x:
ldw $5,$3,0
j halt
.syn
 
xtest30:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest30x:
stw $5,$3,0
j halt
.syn
 
xtest31:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest31x:
.set xtest31x,0xBBBBBB1C
jr $11
j halt
.syn
 
xtest32:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest32x:
ldw $5,$11,0
j halt
.syn
 
xtest33:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest33x:
stw $5,$11,0
j halt
.syn
 
xtest34:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $8,$0,11 ; construct TLB entry
mvts $8,TLB_INDEX
add $8,$0,0xBBBBBB1C
and $8,$8,0xFFFFF000
mvts $8,TLB_ENTRY_HI
add $8,$0,0
mvts $8,TLB_ENTRY_LO
tbwi
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
;xtest34x:
.set xtest34x,0xBBBBBB1C
jr $11
j halt
.syn
 
xtest35:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $8,$0,11 ; construct TLB entry
mvts $8,TLB_INDEX
add $8,$0,0xBBBBBB1C
and $8,$8,0xFFFFF000
mvts $8,TLB_ENTRY_HI
add $8,$0,0
mvts $8,TLB_ENTRY_LO
tbwi
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest35x:
ldw $5,$11,0
j halt
.syn
 
xtest36:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $8,$0,11 ; construct TLB entry
mvts $8,TLB_INDEX
add $8,$0,0xBBBBBB1C
and $8,$8,0xFFFFF000
mvts $8,TLB_ENTRY_HI
add $8,$0,0
mvts $8,TLB_ENTRY_LO
tbwi
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest36x:
stw $5,$11,0
j halt
.syn
 
xtest37:
mvts $0,PSW
add $8,$0,returnState
stw $4,$8,0*4 ; pointer to interrupt context
stw $31,$8,1*4 ; return address
stw $29,$8,2*4 ; stack pointer
stw $16,$8,3*4 ; local variables
stw $17,$8,4*4
stw $18,$8,5*4
stw $19,$8,6*4
stw $20,$8,7*4
stw $21,$8,8*4
stw $22,$8,9*4
stw $23,$8,10*4
add $8,$0,11 ; construct TLB entry
mvts $8,TLB_INDEX
add $8,$0,0xBBBBBB1C
and $8,$8,0xFFFFF000
mvts $8,TLB_ENTRY_HI
add $8,$0,1
mvts $8,TLB_ENTRY_LO
tbwi
.nosyn
add $28,$4,$0
ldw $8,$28,33*4 ; tlbIndex
mvts $8,TLB_INDEX
ldw $8,$28,34*4 ; tlbWntryHi
mvts $8,TLB_ENTRY_HI
ldw $8,$28,35*4 ; tlbEntryLo
mvts $8,TLB_ENTRY_LO
;ldw $0,$28,0*4 ; registers
ldw $1,$28,1*4
ldw $2,$28,2*4
ldw $3,$28,3*4
ldw $4,$28,4*4
ldw $5,$28,5*4
ldw $6,$28,6*4
ldw $7,$28,7*4
ldw $8,$28,8*4
ldw $9,$28,9*4
ldw $10,$28,10*4
ldw $11,$28,11*4
ldw $12,$28,12*4
ldw $13,$28,13*4
ldw $14,$28,14*4
ldw $15,$28,15*4
ldw $16,$28,16*4
ldw $17,$28,17*4
ldw $18,$28,18*4
ldw $19,$28,19*4
ldw $20,$28,20*4
ldw $21,$28,21*4
ldw $22,$28,22*4
ldw $23,$28,23*4
ldw $24,$28,24*4
ldw $25,$28,25*4
ldw $26,$28,26*4
ldw $27,$28,27*4
;ldw $28,$28,28*4
ldw $29,$28,29*4
ldw $30,$28,30*4
ldw $31,$28,31*4
ldw $28,$28,32*4 ; psw
mvts $28,PSW
xtest37x:
stw $5,$11,0
j halt
.syn
 
; last resort if the exception did not trigger
halt:
j halt
 
;***************************************************************
 
; Word getTLB_HI(int index)
getTLB_HI:
mvts $4,TLB_INDEX
tbri
mvfs $2,TLB_ENTRY_HI
jr $31
 
; Word getTLB_LO(int index)
getTLB_LO:
mvts $4,TLB_INDEX
tbri
mvfs $2,TLB_ENTRY_LO
jr $31
 
; void setTLB(int index, Word entryHi, Word entryLo)
setTLB:
mvts $4,TLB_INDEX
mvts $5,TLB_ENTRY_HI
mvts $6,TLB_ENTRY_LO
tbwi
jr $31
 
;***************************************************************
 
; general interrupt entry
isr:
.nosyn
ldhi $28,userMissTaken ; remember entry point
or $28,$28,userMissTaken
stw $0,$28,0
j common
 
; TLB user miss entry
umsr:
.nosyn
ldhi $28,userMissTaken ; remember entry point
or $28,$28,userMissTaken
stw $28,$28,0
j common
 
common:
ldhi $28,returnState
or $28,$28,returnState
ldw $28,$28,0 ; pointer to interrupt context
stw $0,$28,0*4 ; registers
stw $1,$28,1*4
stw $2,$28,2*4
stw $3,$28,3*4
stw $4,$28,4*4
stw $5,$28,5*4
stw $6,$28,6*4
stw $7,$28,7*4
stw $8,$28,8*4
stw $9,$28,9*4
stw $10,$28,10*4
stw $11,$28,11*4
stw $12,$28,12*4
stw $13,$28,13*4
stw $14,$28,14*4
stw $15,$28,15*4
stw $16,$28,16*4
stw $17,$28,17*4
stw $18,$28,18*4
stw $19,$28,19*4
stw $20,$28,20*4
stw $21,$28,21*4
stw $22,$28,22*4
stw $23,$28,23*4
stw $24,$28,24*4
stw $25,$28,25*4
stw $26,$28,26*4
stw $27,$28,27*4
stw $28,$28,28*4
stw $29,$28,29*4
stw $30,$28,30*4
stw $31,$28,31*4
mvfs $8,PSW
stw $8,$28,32*4 ; psw
mvfs $8,TLB_INDEX
stw $8,$28,33*4 ; tlbIndex
mvfs $8,TLB_ENTRY_HI
stw $8,$28,34*4 ; tlbEntryHi
mvfs $8,TLB_ENTRY_LO
stw $8,$28,35*4 ; tlbEntryLo
.syn
add $8,$0,returnState
ldw $4,$8,0*4 ; pointer to interrupt context
ldw $31,$8,1*4 ; return address
ldw $29,$8,2*4 ; stack pointer
ldw $16,$8,3*4 ; local variables
ldw $17,$8,4*4
ldw $18,$8,5*4
ldw $19,$8,6*4
ldw $20,$8,7*4
ldw $21,$8,8*4
ldw $22,$8,9*4
ldw $23,$8,10*4
jr $31
 
.bss
.align 4
 
; monitor state
; stored when leaving to execute a user program
; loaded when re-entering the monitor
returnState:
.word 0 ; pointer to interrupt context
.word 0 ; $31 (return address)
.word 0 ; $29 (stack pointer)
.word 0 ; $16 (local variable)
.word 0 ; $17 (local variable)
.word 0 ; $18 (local variable)
.word 0 ; $19 (local variable)
.word 0 ; $20 (local variable)
.word 0 ; $21 (local variable)
.word 0 ; $22 (local variable)
.word 0 ; $23 (local variable)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.