Changeset 142 for trunk/hal/x86_64/core/hal_exception.c
- Timestamp:
- Jul 5, 2017, 10:49:55 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_exception.c
r51 r142 1 1 /* 2 * hal_exception.c - implementation of exception handler for TSAR-MIPS32. 3 * 4 * Author Alain Greiner (2016, 2017) 2 * hal_exception.c - Implementation of exception handler for x86_64 5 3 * 6 * Copyright (c) UPMC Sorbonne Universites4 * Copyright (c) 2017 Maxime Villard 7 5 * 8 6 * This file is part of ALMOS-MKH. … … 18 16 * 19 17 * You should have received a copy of the GNU General Public License 20 * along with ALMOS-MKH ; if not, write to the Free Software Foundation,18 * along with ALMOS-MKH.; if not, write to the Free Software Foundation, 21 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 20 */ … … 26 24 #include <hal_exception.h> 27 25 #include <thread.h> 28 #include <printk.h>29 #include <vmm.h>30 26 #include <errno.h> 31 #include <scheduler.h>32 27 #include <core.h> 33 #include <signal.h>34 #include <syscalls.h>35 28 #include <do_exception.h> 36 #include <remote_spinlock.h>37 29 30 31 #include <hal_kentry.h> 38 32 #include <hal_internal.h> 39 33 40 void hal_do_exception( thread_t * this, 34 static const char *exc_type[] = { 35 [T_PRIVINFLT]= "privileged instruction fault", 36 [T_BPTFLT] = "breakpoint trap", 37 [T_ARITHTRAP] = "arithmetic trap", 38 [T_ASTFLT] = "asynchronous system trap", 39 [T_PROTFLT] = "protection fault", 40 [T_TRCTRAP] = "trace trap", 41 [T_PAGEFLT] = "page fault", 42 [T_ALIGNFLT] = "alignment fault", 43 [T_DIVIDE] = "integer divide fault", 44 [T_NMI] = "non-maskable interrupt", 45 [T_OFLOW] = "overflow trap", 46 [T_BOUND] = "bounds check fault", 47 [T_DNA] = "FPU not available fault", 48 [T_DOUBLEFLT] = "double fault", 49 [T_FPOPFLT] = "FPU operand fetch fault", 50 [T_TSSFLT] = "invalid TSS fault", 51 [T_SEGNPFLT] = "segment not present fault", 52 [T_STKFLT] = "stack fault", 53 [T_MCA] = "machine check fault", 54 [T_XMM] = "SSE FP exception", 55 }; 56 int exc_types = __arraycount(exc_type); 57 58 /* 59 * Hexception handler. 60 */ 61 void hal_exception_entry(struct small_trapframe *tf) 62 { 63 uint64_t excno = tf->tf_trapno; 64 const char *buf; 65 66 if (excno < exc_types) { 67 buf = exc_type[excno]; 68 } else { 69 buf = "unknown exception"; 70 } 71 72 x86_printf("\n****** FAULT OCCURRED ******\n"); 73 x86_printf("%s\n", (char *)buf); 74 x86_printf("-> rip = %Z\n", tf->tf_rip); 75 x86_printf("-> rsp = %Z\n", tf->tf_rsp); 76 x86_printf("-> err = %Z\n", tf->tf_err); 77 if (excno == T_PAGEFLT) 78 x86_printf("-> va = %Z\n", rcr2()); 79 x86_printf("****** FAULT OCCURRED ******\n\n"); 80 81 while (1); 82 } 83 84 /* -------------------------------------------------------------------------- */ 85 86 void hal_do_exception( thread_t * this, 41 87 reg_t * regs_tbl ) 42 88 {
Note: See TracChangeset
for help on using the changeset viewer.