Changeset 392 for trunk/hal


Ignore:
Timestamp:
Aug 16, 2017, 3:35:40 PM (7 years ago)
Author:
max@…
Message:

Start handling page faults. Not tested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_exception.c

    r382 r392  
    8585static void hal_exception_user(hal_trapframe_t *tf)
    8686{
     87        thread_t *thread = curtls()->tls_thr;
     88        process_t *process = thread->process;
     89        vseg_t *vseg;
     90        intptr_t bad_vaddr;
     91        error_t error;
     92
    8793        switch (tf->tf_trapno) {
    8894                case T_PAGEFLT:
    89                         // TODO
    90                         //do_exception(curtls()->tls_thr, true);
     95                        bad_vaddr = rcr2();
     96
     97                        error = vmm_get_vseg(process, bad_vaddr, &vseg);
     98                        if (error) {
     99                                x86_panic("vseg not found!");
     100                        }
     101
     102                        error = vmm_handle_page_fault(process, vseg,
     103                            bad_vaddr >> CONFIG_PPM_PAGE_SHIFT);
     104
     105                        x86_printf("VA=%Z ERROR=%Z\n", bad_vaddr, (uint64_t)error);
     106                        break;
    91107
    92108                default:
Note: See TracChangeset for help on using the changeset viewer.