blob: 3887d840ddb38a73be060d27e71bcf3c1b552aa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#ifndef _PK_H
#define _PK_H
#define USER_MEM_SIZE 0x70000000
#define USER_MAINVARS_SIZE 0x1000
#define USER_START 0x10000
#ifndef __ASSEMBLER__
#include <stdint.h>
typedef struct
{
long gpr[32];
long sr;
long epc;
long badvaddr;
long cause;
long insn;
} trapframe_t;
#define panic(s,...) do { printk(s"\n", ##__VA_ARGS__); sys_exit(-1); } while(0)
#define kassert(cond) do { if(!(cond)) panic("assertion failed: "#cond); } while(0)
#ifdef __cplusplus
extern "C" {
#endif
extern int have_fp;
extern int have_vector;
int emulate_fp(trapframe_t*);
void init_fp(trapframe_t* tf);
void printk(const char* s, ...);
void init_tf(trapframe_t*, long pc, long sp, int user64);
void pop_tf(trapframe_t*);
void dump_tf(trapframe_t*);
void unhandled_trap(trapframe_t*);
void handle_syscall(trapframe_t*);
void handle_misaligned_load(trapframe_t*);
void handle_misaligned_store(trapframe_t*);
void handle_fault_load(trapframe_t*);
void handle_fault_store(trapframe_t*);
void boot();
void sys_exit(int code) __attribute__((noreturn));
long load_elf(const char* fn, int* user64);
static inline void advance_pc(trapframe_t* tf)
{
tf->epc += 4;
}
#ifdef __cplusplus
}
#endif
#endif
#endif
|