/kernel/trunk/arch/mips32/src/exception.c |
---|
40,6 → 40,7 |
#include <func.h> |
#include <console/kconsole.h> |
#include <arch/debugger.h> |
#include <syscall/syscall.h> |
static char * exctable[] = { |
"Interrupt","TLB Modified","TLB Invalid","TLB Invalid Store", |
134,7 → 135,22 |
exc_dispatch(i+INT_OFFSET, pstate); |
} |
#include <debug.h> |
/** Handle syscall userspace call */ |
static void syscall_exception(int n, void *data) |
{ |
struct exception_regdump *pstate = (struct exception_regdump *)data; |
if (pstate->a3 < SYSCALL_END) |
pstate->v0 = syscall_table[pstate->a3](pstate->a0, |
pstate->a1, |
pstate->a2); |
else |
panic("Undefined syscall %d", pstate->a3); |
pstate->epc += 4; |
} |
void exception(struct exception_regdump *pstate) |
{ |
int cause; |
190,4 → 206,5 |
#ifdef CONFIG_FPU_LAZY |
exc_register(EXC_CpU, "cpunus", cpuns_exception); |
#endif |
exc_register(EXC_Sys, "syscall", syscall_exception); |
} |
/kernel/trunk/arch/mips32/src/mips32.c |
---|
95,6 → 95,10 |
debugger_init(); |
arc_print_memory_map(); |
arc_print_devices(); |
/* Setup usermode...*/ |
config.init_addr = 0x20000000; |
config.init_size = FRAME_SIZE; |
} |
void arch_post_mm_init(void) |
109,6 → 113,14 |
{ |
} |
/* Stack pointer saved when entering user mode */ |
/* TODO: How do we do it on SMP system???? */ |
/* Why the hell moves the linker the variable 64K away in assembler |
* when not in .text section ???????? |
*/ |
__address supervisor_sp __attribute__ ((section (".text"))); |
void userspace(void) |
{ |
/* EXL=1, UM=1, IE=1 */ |
122,10 → 134,6 |
; |
} |
/* Stack pointer saved when entering user mode */ |
/* TODO: How do we do it on SMP system???? */ |
__address supervisor_sp; |
void before_thread_runs_arch(void) |
{ |
supervisor_sp = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; |