mips32-nemu: small refactor
This commit is contained in:
parent
5051c13e02
commit
ff88f398bc
2 changed files with 2 additions and 5 deletions
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
static Context* (*user_handler)(Event, Context*) = NULL;
|
static Context* (*user_handler)(Event, Context*) = NULL;
|
||||||
|
|
||||||
static inline bool get_CU0(Context *c) { return (c->status >> 28) & 0x1; }
|
|
||||||
|
|
||||||
Context* __am_irq_handle(Context *c) {
|
Context* __am_irq_handle(Context *c) {
|
||||||
if (user_handler) {
|
if (user_handler) {
|
||||||
Event ev = {0};
|
Event ev = {0};
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
static void* (*pgalloc_usr)(int) = NULL;
|
static void* (*pgalloc_usr)(int) = NULL;
|
||||||
static void (*pgfree_usr)(void*) = NULL;
|
static void (*pgfree_usr)(void*) = NULL;
|
||||||
static int vme_enable = 0;
|
static int vme_enable = 0;
|
||||||
|
static PTE *cur_pdir = NULL;
|
||||||
|
|
||||||
bool vme_init(void* (*pgalloc_f)(int), void (*pgfree_f)(void*)) {
|
bool vme_init(void* (*pgalloc_f)(int), void (*pgfree_f)(void*)) {
|
||||||
pgalloc_usr = pgalloc_f;
|
pgalloc_usr = pgalloc_f;
|
||||||
pgfree_usr = pgfree_f;
|
pgfree_usr = pgfree_f;
|
||||||
vme_enable = 1;
|
vme_enable = 1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,8 @@ void protect(AddrSpace *as) {
|
||||||
void unprotect(AddrSpace *as) {
|
void unprotect(AddrSpace *as) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static PTE *cur_pdir = NULL;
|
|
||||||
void __am_get_cur_as(Context *c) {
|
void __am_get_cur_as(Context *c) {
|
||||||
c->pdir = cur_pdir;
|
c->pdir = (vme_enable ? cur_pdir : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __am_switch(Context *c) {
|
void __am_switch(Context *c) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue