Line 329... |
Line 329... |
stw $29,$4,1*4 ; stack pointer
|
stw $29,$4,1*4 ; stack pointer
|
stw $16,$4,2*4 ; local variables
|
stw $16,$4,2*4 ; local variables
|
stw $17,$4,3*4
|
stw $17,$4,3*4
|
stw $18,$4,4*4
|
stw $18,$4,4*4
|
stw $19,$4,5*4
|
stw $19,$4,5*4
|
stw $20,$4,6*4
|
|
stw $21,$4,7*4
|
|
stw $22,$4,8*4
|
|
stw $23,$4,9*4
|
|
add $2,$0,1
|
|
jr $31
|
|
|
|
; load state when re-entering monitor
|
|
; this appears as if returning from saveState
|
|
; but the return value is 'false' here
|
|
loadState:
|
|
ldw $8,$0,monitorReturn
|
|
beq $8,$0,loadState ; fatal error: monitor state lost
|
|
ldw $31,$8,0*4 ; return address
|
|
ldw $29,$8,1*4 ; stack pointer
|
|
ldw $16,$8,2*4 ; local variables
|
|
ldw $17,$8,3*4
|
|
ldw $18,$8,4*4
|
|
ldw $19,$8,5*4
|
|
ldw $20,$8,6*4
|
|
ldw $21,$8,7*4
|
|
ldw $22,$8,8*4
|
|
ldw $23,$8,9*4
|
|
add $2,$0,0
|
|
jr $31
|
|
|
|
.bss
|
|
.align 4
|
|
|
|
; extern MonitorState *monitorReturn
|
|
monitorReturn:
|
|
.space 4
|
|
|
|
; extern UserContext userContext
|
|
userContext:
|
|
.space USER_CONTEXT_SIZE
|
|
|
|
;***************************************************************
|
|
|
|
.code
|
|
.align 4
|
|
|
|
; void resume(void)
|
|
; use userContext to load state
|
|
resume:
|
|
mvts $0,PSW
|
|
add $28,$0,userContext
|
|
.nosyn
|
|
ldw $8,$28,33*4 ; tlbIndex
|
|
mvts $8,TLB_INDEX
|
|
ldw $8,$28,34*4 ; tlbEntryHi
|
|
mvts $8,TLB_ENTRY_HI
|
|
ldw $8,$28,35*4 ; tlbEntryLo
|
|
mvts $8,TLB_ENTRY_LO
|
|
ldw $8,$28,36*4 ; badAddress
|
|
mvts $8,BAD_ADDRESS
|
|
ldw $8,$28,37*4 ; badAccess
|
|
mvts $8,BAD_ACCESS
|
|
;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
|
|
rfx
|
|
.syn
|
|
|
|
; debug entry
|
|
; use userContext to store state
|
|
debug:
|
|
.nosyn
|
|
ldhi $28,userContext
|
|
or $28,$28,userContext
|
|
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
|
|
mvfs $8,BAD_ADDRESS
|
|
stw $8,$28,36*4 ; badAddress
|
|
mvfs $8,BAD_ACCESS
|
|
stw $8,$28,37*4 ; badAccess
|
|
.syn
|
|
j loadState
|
|
|
|
No newline at end of file
|
No newline at end of file
|
|
stw $20
|
No newline at end of file
|
No newline at end of file
|