- Timestamp:
- Aug 14, 2017, 1:03:39 PM (7 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_exception.c
r336 r371 56 56 int exc_types = __arraycount(exc_type); 57 57 58 /* 59 * Hexception handler. 60 */ 61 void hal_exception_entry(hal_trapframe_t *ctx) 58 static void hal_exception_kern(hal_trapframe_t *tf) 62 59 { 63 uint64_t excno = ctx->tf_trapno;60 uint64_t trapno = tf->tf_trapno; 64 61 const char *buf; 65 62 66 if ( excno < exc_types) {67 buf = exc_type[ excno];63 if (trapno < exc_types) { 64 buf = exc_type[trapno]; 68 65 } else { 69 66 buf = "unknown exception"; … … 71 68 72 69 x86_lock(); 73 x86_printf("\n****** EXCEPTION OCCURRED ******\n");70 x86_printf("\n****** EXCEPTION OCCURRED IN KERNEL MODE ******\n"); 74 71 x86_printf("%s\n", (char *)buf); 75 x86_printf("-> rip = %Z\n", ctx->tf_rip);76 x86_printf("-> rdi = %Z\n", ctx->tf_rdi);77 x86_printf("-> rbp = %Z\n", ctx->tf_rbp);72 x86_printf("-> rip = %Z\n", tf->tf_rip); 73 x86_printf("-> rdi = %Z\n", tf->tf_rdi); 74 x86_printf("-> rbp = %Z\n", tf->tf_rbp); 78 75 x86_printf("-> tls = %Z (gid=%Z)\n", (uint64_t)curtls(), 79 76 (uint64_t)hal_get_gid()); 80 x86_printf("-> err = %Z\n", ctx->tf_err);81 if ( excno == T_PAGEFLT)77 x86_printf("-> err = %Z\n", tf->tf_err); 78 if (trapno == T_PAGEFLT) 82 79 x86_printf("-> va = %Z\n", rcr2()); 83 x86_printf(" ****** EXCEPTION OCCURRED ******\n\n");80 x86_printf("\n***********************************************\n"); 84 81 x86_unlock(); 85 82 86 83 while (1); 84 } 85 86 static void hal_exception_user(hal_trapframe_t *tf) 87 { 88 switch (tf->tf_trapno) { 89 case T_PAGEFLT: 90 // TODO 91 //do_exception(curtls()->tls_thr, true); 92 93 default: 94 x86_panic("userland not yet handled"); 95 } 96 } 97 98 /* 99 * Exception handler. 100 */ 101 void hal_exception_entry(hal_trapframe_t *tf) 102 { 103 if ((tf->tf_cs & SEL_RPL) == SEL_UPL) 104 hal_exception_user(tf); 105 else 106 hal_exception_kern(tf); 87 107 } 88 108 -
trunk/hal/x86_64/core/hal_special.c
r368 r371 148 148 } 149 149 150 void hal_get_mmu_excp( intptr_t * mmu_ins_excp_code, 151 intptr_t * mmu_ins_bad_vaddr, 152 intptr_t * mmu_dat_excp_code, 153 intptr_t * mmu_dat_bad_vaddr ) 150 void hal_get_mmu_excp(intptr_t *mmu_ins_excp_code, intptr_t *mmu_ins_bad_vaddr, 151 intptr_t *mmu_dat_excp_code, intptr_t *mmu_dat_bad_vaddr) 154 152 { 155 153 x86_panic((char *)__func__); 156 154 } 155
Note: See TracChangeset
for help on using the changeset viewer.