user_thread #9
@ -53,10 +53,12 @@ void print_handler(struct cpu_state *frame, ulong intr)
|
|||||||
|
|
||||||
void pagefault_handler(struct cpu_state *frame, ulong intr)
|
void pagefault_handler(struct cpu_state *frame, ulong intr)
|
||||||
{
|
{
|
||||||
|
// PAGE_FAULT is a interrupt with an error code (see exception_wrapper.S)
|
||||||
|
uint32_t error_code = cpu_context_get_EX_err(frame);
|
||||||
struct thread *current = getCurrentThread();
|
struct thread *current = getCurrentThread();
|
||||||
assert(frame == current->cpuState);
|
|
||||||
if (cpu_context_is_in_user_mode(current->cpuState)) {
|
if (cpu_context_is_in_user_mode(current->cpuState)) {
|
||||||
|
assert(frame == current->cpuState); // pagefault in kernel not supported ATM
|
||||||
|
|
||||||
struct uAddrSpace *as = processGetAddrSpace(current->process);
|
struct uAddrSpace *as = processGetAddrSpace(current->process);
|
||||||
vaddr_t faultAddr = cpu_context_get_EX_faulting_vaddr(frame);
|
vaddr_t faultAddr = cpu_context_get_EX_faulting_vaddr(frame);
|
||||||
@ -70,8 +72,6 @@ void pagefault_handler(struct cpu_state *frame, ulong intr)
|
|||||||
if (!uAddrSpaceHeapCheckNAlloc(as, faultAddr))
|
if (!uAddrSpaceHeapCheckNAlloc(as, faultAddr))
|
||||||
goto release_context;
|
goto release_context;
|
||||||
|
|
||||||
// PAGE_FAULT is a interrupt with an error code (see exception_wrapper.S)
|
|
||||||
uint32_t error_code = cpu_context_get_EX_err(frame);
|
|
||||||
int ret = uAddrSpaceSolvePageFault(as, faultAddr, error_code & 0x2);
|
int ret = uAddrSpaceSolvePageFault(as, faultAddr, error_code & 0x2);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -165,8 +165,9 @@ void threadDelete(struct thread *thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (thread->squattedContext) {
|
if (thread->squattedContext) {
|
||||||
threadChangeCurrentContext(NULL);
|
mmuContextUnref(thread->squattedContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread->process)
|
if (thread->process)
|
||||||
processRemoveThread(thread);
|
processRemoveThread(thread);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user