22 #if defined (POK_NEEDS_DEBUG) || defined (POK_NEEDS_ERROR_HANDLING) 
   32 void            exception_divide_error();
 
   33 void            exception_debug();
 
   35 void            exception_breakpoint();
 
   36 void            exception_overflow();
 
   37 void            exception_boundrange();
 
   38 void            exception_invalidopcode();
 
   39 void            exception_nomath_coproc();
 
   40 void            exception_doublefault();
 
   41 void            exception_copseg_overrun();
 
   42 void            exception_invalid_tss();
 
   43 void            exception_segment_not_present();
 
   44 void            exception_stackseg_fault();
 
   45 void            exception_general_protection();
 
   46 void            exception_pagefault();
 
   47 void            exception_fpu_fault();
 
   48 void            exception_alignement_check();
 
   49 void            exception_machine_check();
 
   50 void            exception_simd_fault();
 
   55   void          (*handler)(void);
 
   85   for (i = 0; exception_list[i].handler != 
NULL; ++i)
 
   89                       (
uint32_t) exception_list[i].handler,
 
   97 #if defined (POK_NEEDS_DEBUG) && ! defined (POK_NEEDS_ERROR_HANDLING) 
  100   printf (
"ES: %x, DS: %x\n", frame->
es, frame->
ds);
 
  101   printf (
"CS: %x, SS: %x\n", frame->
cs, frame->
ss);
 
  102   printf (
"EDI: %x, ESI: %x\n", frame->
edi, frame->
esi);
 
  103   printf (
"EBP: %x, ESP: %x\n", frame->
ebp, frame->
esp);
 
  104   printf (
"EAX: %x, ECX: %x\n", frame->
eax, frame->
ecx);
 
  105   printf (
"EDX: %x, EBX: %x\n", frame->
edx, frame->
ebx);
 
  106   printf (
"EIP: %x, ErrorCode: %x\n", frame->
eip, frame->
error);
 
  107   printf (
"EFLAGS: %x\n\n", frame->
eflags);
 
  114 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  116 #ifdef POK_NEEDS_DEBUG 
  117   printf (
"[KERNEL] Raise divide by zero error, current thread=%d\n", POK_SCHED_CURRENT_THREAD);
 
  120   pok_error_declare (POK_ERROR_KIND_NUMERIC_ERROR);
 
  121   pok_sched_activate_error_thread ();
 
  123   pok_fatal (
"Divide error");
 
  130 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  132    #ifdef POK_NEEDS_DEBUG 
  133   printf (
"[KERNEL] Raise debug fault\n");
 
  136   pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
 
  137   pok_sched_activate_error_thread ();
 
  140    #ifdef POK_NEEDS_DEBUG 
  141   dump_registers(frame);
 
  142   pok_fatal (
"Debug fault");
 
  150 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  152    #ifdef POK_NEEDS_DEBUG 
  153    printf (
"[KERNEL] Raise exception NMI fault\n");
 
  156    pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
 
  157    pok_sched_activate_error_thread ();
 
  160    #ifdef POK_NEEDS_DEBUG 
  161    dump_registers(frame);
 
  162    pok_fatal (
"NMI Interrupt");
 
  170 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  172    #ifdef POK_NEEDS_DEBUG 
  173    printf (
"[KERNEL] Raise exception breakpoint fault\n");
 
  176   pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
 
  177   pok_sched_activate_error_thread ();
 
  179    #ifdef POK_NEEDS_DEBUG 
  180    dump_registers(frame);
 
  181    pok_fatal (
"Breakpoint");
 
  189 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  191    #ifdef POK_NEEDS_DEBUG 
  192    printf (
"[KERNEL] Raise exception overflow fault\n");
 
  195   pok_error_declare (POK_ERROR_KIND_STACK_OVERFLOW);
 
  196   pok_sched_activate_error_thread ();
 
  198    #ifdef POK_NEEDS_DEBUG 
  199    dump_registers(frame);
 
  200    pok_fatal (
"Overflow");
 
  208 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  210    #ifdef POK_NEEDS_DEBUG 
  211    printf (
"[KERNEL] Raise exception bound range fault\n");
 
  214   pok_error_declare (POK_ERROR_KIND_STACK_OVERFLOW);
 
  215   pok_sched_activate_error_thread ();
 
  217    #ifdef POK_NEEDS_DEBUG 
  218       dump_registers(frame);
 
  219       pok_fatal (
"Bound range exceded");
 
  227 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  229    #ifdef POK_NEEDS_DEBUG 
  230    printf (
"[KERNEL] Raise exception invalid opcode fault, current thread: %d\n", POK_SCHED_CURRENT_THREAD);
 
  233   pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
 
  234   pok_sched_activate_error_thread ();
 
  236    #ifdef POK_NEEDS_DEBUG 
  237       dump_registers(frame);
 
  238       pok_fatal (
"Invalid Opcode");
 
  246 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  248    #ifdef POK_NEEDS_DEBUG 
  249    printf (
"[KERNEL] Raise exception no math coprocessor fault\n");
 
  252   pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
 
  253   pok_sched_activate_error_thread ();
 
  256    #ifdef POK_NEEDS_DEBUG 
  257       dump_registers(frame);
 
  258       pok_fatal (
"Invalid No Math Coprocessor");
 
  267 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  269    #ifdef POK_NEEDS_DEBUG 
  270    printf (
"[KERNEL] Raise exception double fault\n");
 
  273   pok_partition_error (POK_SCHED_CURRENT_PARTITION, POK_ERROR_KIND_PARTITION_HANDLER);
 
  275    #ifdef POK_NEEDS_DEBUG 
  276       dump_registers(frame);
 
  277       pok_fatal (
"Double Fault");
 
  285 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  287    #ifdef POK_NEEDS_DEBUG 
  288    printf (
"[KERNEL] Raise exception copseg overrun fault\n");
 
  291   pok_error_declare (POK_ERROR_KIND_MEMORY_VIOLATION);
 
  292   pok_sched_activate_error_thread ();
 
  294    #ifdef POK_NEEDS_DEBUG 
  295       dump_registers(frame);
 
  296       pok_fatal (
"Coprocessur Segment Overrun");
 
  304 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  306    #ifdef POK_NEEDS_DEBUG 
  307    printf (
"[KERNEL] Raise exception invalid tss fault\n");
 
  310   pok_error_declare (POK_ERROR_KIND_MEMORY_VIOLATION);
 
  311   pok_sched_activate_error_thread ();
 
  313    #ifdef POK_NEEDS_DEBUG 
  314       dump_registers(frame);
 
  315       pok_fatal (
"Invalid TSS");
 
  323 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  325    #ifdef POK_NEEDS_DEBUG 
  326    printf (
"[KERNEL] Raise exception segment not present fault %d\n", POK_SCHED_CURRENT_THREAD);
 
  329   pok_error_declare (POK_ERROR_KIND_MEMORY_VIOLATION);
 
  330   pok_sched_activate_error_thread ();
 
  332    #ifdef POK_NEEDS_DEBUG 
  333       dump_registers(frame);
 
  334       pok_fatal (
"Segment Not Present");
 
  342 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  344    #ifdef POK_NEEDS_DEBUG 
  345    printf (
"[KERNEL] Raise exception stack segment fault\n");
 
  348    pok_error_declare (POK_ERROR_KIND_MEMORY_VIOLATION);
 
  349    pok_sched_activate_error_thread ();
 
  351    #ifdef POK_NEEDS_DEBUG 
  352       dump_registers(frame);
 
  353       pok_fatal (
"Stack-Segment Fault");
 
  361 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  363    #ifdef POK_NEEDS_DEBUG 
  364    printf (
"[KERNEL] Raise exception general protection fault current thread=%d\n", POK_SCHED_CURRENT_THREAD);
 
  367   pok_error_declare (POK_ERROR_KIND_ILLEGAL_REQUEST);
 
  368   pok_sched_activate_error_thread ();
 
  370    #ifdef POK_NEEDS_DEBUG 
  371    dump_registers(frame);
 
  372    pok_fatal (
"General Protection Fault");
 
  380 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  381    #ifdef POK_NEEDS_DEBUG 
  382    printf (
"[KERNEL] Raise exception pagefault fault\n");
 
  385    pok_error_declare (POK_ERROR_KIND_MEMORY_VIOLATION);
 
  386    pok_sched_activate_error_thread ();
 
  388    #ifdef POK_NEEDS_DEBUG 
  389       dump_registers(frame);
 
  390       pok_fatal (
"Page Fault");
 
  398 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  400    #ifdef POK_NEEDS_DEBUG 
  401    printf (
"[KERNEL] Raise exception FPU fault\n");
 
  404    pok_error_declare (POK_ERROR_KIND_HARDWARE_FAULT);
 
  405    pok_sched_activate_error_thread ();
 
  407    #ifdef POK_NEEDS_DEBUG 
  408       dump_registers(frame);
 
  409       pok_fatal (
"Floating Point Exception");
 
  417 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  419    #ifdef POK_NEEDS_DEBUG 
  420    printf (
"[KERNEL] Raise exception alignment fault\n");
 
  423   pok_error_declare (POK_ERROR_KIND_HARDWARE_FAULT);
 
  424   pok_sched_activate_error_thread ();
 
  426    #ifdef POK_NEEDS_DEBUG 
  427       dump_registers(frame);
 
  428       pok_fatal (
"Bad alignement");
 
  436 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  438    #ifdef POK_NEEDS_DEBUG 
  439    printf (
"[KERNEL] Raise exception machine check fault\n");
 
  442   pok_error_declare (POK_ERROR_KIND_HARDWARE_FAULT);
 
  443   pok_sched_activate_error_thread ();
 
  445    #ifdef POK_NEEDS_DEBUG 
  446       pok_fatal (
"Machine check error");
 
  447       dump_registers(frame);
 
  455 #if defined (POK_NEEDS_PARTITIONS) && defined (POK_NEEDS_ERROR_HANDLING) 
  457    #ifdef POK_NEEDS_DEBUG 
  458    printf (
"[KERNEL] Raise exception SIMD fault\n");
 
  461   pok_error_declare (POK_ERROR_KIND_HARDWARE_FAULT);
 
  462   pok_sched_activate_error_thread ();
 
  465    #ifdef POK_NEEDS_DEBUG 
  466       dump_registers(frame);
 
  467       pok_fatal (
"SIMD Fault");