Fixed bug with user_mem_assert in sparc
[akaros.git] / kern / arch / sparc / process.c
1 #include <arch/arch.h>
2 #include <arch/trap.h>
3 #include <process.h>
4 #include <pmap.h>
5 #include <smp.h>
6
7 #include <string.h>
8 #include <assert.h>
9 #include <stdio.h>
10
11 #ifdef __SHARC__
12 #pragma nosharc
13 #endif
14
15
16 void
17 proc_set_program_counter(trapframe_t *tf, uintptr_t pc)
18 {
19         tf->pc = pc;
20         tf->npc = pc+4;
21 }
22
23 void
24 proc_init_trapframe(trapframe_t *tf)
25 {
26         extern char trap_table;
27
28         tf->gpr[14] = USTACKTOP-64;
29         tf->psr = PSR_S; // but PS = 0
30         tf->wim = 0;
31         tf->tbr = (uint32_t)&trap_table;
32 }
33
34 void proc_set_tfcoreid(trapframe_t *tf, uint32_t id)
35 {
36         tf->gpr[8] = id;
37 }