|
|
@ -2,8 +2,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
.set noat
|
|
|
|
.set noat
|
|
|
|
.set noreorder
|
|
|
|
.set noreorder
|
|
|
|
.section .text
|
|
|
|
.section .text.ebase
|
|
|
|
.globl trap_entry
|
|
|
|
.globl trap_entry
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.org 0x0
|
|
|
|
trap_entry:
|
|
|
|
trap_entry:
|
|
|
|
# +0x000: TLB-miss vector
|
|
|
|
# +0x000: TLB-miss vector
|
|
|
|
b general_trap_vec
|
|
|
|
b general_trap_vec
|
|
|
@ -18,10 +20,9 @@ general_trap_vec:
|
|
|
|
nop # delayslot
|
|
|
|
nop # delayslot
|
|
|
|
|
|
|
|
|
|
|
|
trap_from_user:
|
|
|
|
trap_from_user:
|
|
|
|
# TODO: load kstack, we can use k0 to store something
|
|
|
|
# load kstack, we can use k0 to store something
|
|
|
|
# la k0, address_of_kstack
|
|
|
|
la k0, kernel_stack
|
|
|
|
# addiu sp, k0, size_of_kstack
|
|
|
|
la sp, kernel_stack_top
|
|
|
|
nop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trap_from_kernel:
|
|
|
|
trap_from_kernel:
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -92,7 +93,7 @@ trap_from_kernel:
|
|
|
|
|
|
|
|
|
|
|
|
# prepare to call rust_trap
|
|
|
|
# prepare to call rust_trap
|
|
|
|
jal rust_trap
|
|
|
|
jal rust_trap
|
|
|
|
addiu a0, sp, 16 /* set argument */
|
|
|
|
addiu a0, sp, 16 /* set argument (trapframe) */
|
|
|
|
|
|
|
|
|
|
|
|
.globl trap_return
|
|
|
|
.globl trap_return
|
|
|
|
trap_return:
|
|
|
|
trap_return:
|
|
|
@ -148,3 +149,10 @@ trap_return:
|
|
|
|
eret
|
|
|
|
eret
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.section .bss.stack
|
|
|
|
|
|
|
|
.align 12 #PGSHIFT
|
|
|
|
|
|
|
|
.global kernel_stack
|
|
|
|
|
|
|
|
kernel_stack:
|
|
|
|
|
|
|
|
.space 1024 * 16 # 16KB for kernel stack
|
|
|
|
|
|
|
|
.global kernel_stack_top
|
|
|
|
|
|
|
|
kernel_stack_top:
|
|
|
|