UbixOS  2.0
idt.c File Reference
#include <ubixos/syscall.h>
#include <ubixos/syscall_posix.h>
#include <sys/idt.h>
#include <sys/gdt.h>
#include <sys/io.h>
#include <ubixos/sched.h>
#include <isa/8259.h>
#include <lib/kprintf.h>
#include <lib/kmalloc.h>
#include <vmm/vmm.h>
#include <ubixos/kpanic.h>
#include <ubixos/endtask.h>
#include <string.h>
#include <sys/trap.h>
Include dependency graph for idt.c:

Go to the source code of this file.

Macros

#define FP_TO_LINEAR(seg, off)   ((void*) ((((uint16_t) (seg)) << 4) + ((uint16_t) (off))))
 

Functions

void __alignmentCheck (struct trapframe *)
 
void __debug (struct trapframe *)
 
void __divideError (struct trapframe *)
 
void __doubleFault (struct trapframe *)
 
void __floatingPoint (struct trapframe *)
 
void __gpf (struct trapframe *)
 
void __int6 (struct trapframe *frame)
 
void __machineCheck (struct trapframe *)
 
void __nmi (struct trapframe *)
 
void __security (struct trapframe *)
 
void __simd (struct trapframe *)
 
void __virtualization (struct trapframe *)
 
void _alignmentCheck ()
 
void _debug ()
 
void _divideError ()
 
void _doubleFault ()
 
void _floatingPoint ()
 
void _gpf ()
 
void _intNull (struct trapframe *frame)
 
void _machineCheck ()
 
void _nmi ()
 
void _security ()
 
void _simd ()
 
void _virtualization ()
 
 asm (".globl _alignmentCheck \n" "_alignmentCheck: \n" " pushl $0x11 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __alignmentCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _debug \n" "_debug: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _debug \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _divideError \n" "_divideError: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _divideError \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _doubleFault \n" "_doubleFault: \n" " pushl $0x8 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __doubleFault \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _floatingPoint \n" "_floatingPoint: \n" " pushl $0x0 \n" " pushl $0x10 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __floatingPoint \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _gpf \n" "_gpf: \n" " cli \n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __gpf \n" " add $0x4,%esp \n" " mov %esp,%eax \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " sti \n" " iret \n")
 
 asm (".globl _int6 \n" "_int6: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __int6 \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _int7 \n" "_int7: \n" " pushl %eax \n" " clts \n" " movl _current,%eax \n" " cmpl _usedMath,%eax \n" " je mathDone \n" " call mathStateRestore \n" "mathDone: \n" " popl %eax \n" " iret \n")
 
 asm (".globl _machineCheck \n" "_machineCheck: \n" " pushl $0x0\n" " pushl $0x12 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __machineCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _nmi \n" "_nmi: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _nmi \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _security \n" "_security: \n" " pushl $0x1E \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __security\n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _simd \n" "_simd: \n" " iret\n" " pushl $0x0\n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __simd \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl _virtualization \n" "_virtualization: \n" " pushl $0x0 \n" " pushl $0x14 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __virtualization \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
 asm (".globl intNull \n" "intNull: \n" " pushl $0x0 \n" " pushl $0x0 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _intNull \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n")
 
int idt_init ()
 
void intNull ()
 
void mathStateRestore ()
 
void setTaskVector (uInt8 interrupt, uInt16 controlMajor, uInt8 selector)
 
void setVector (void *handler, unsigned char interrupt, unsigned short controlMajor)
 

Macro Definition Documentation

◆ FP_TO_LINEAR

#define FP_TO_LINEAR (   seg,
  off 
)    ((void*) ((((uint16_t) (seg)) << 4) + ((uint16_t) (off))))

Definition at line 44 of file idt.c.

Function Documentation

◆ __alignmentCheck()

void __alignmentCheck ( struct trapframe frame)

Definition at line 633 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __debug()

void __debug ( struct trapframe frame)

Definition at line 285 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __divideError()

void __divideError ( struct trapframe frame)

Definition at line 259 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __doubleFault()

void __doubleFault ( struct trapframe frame)

Definition at line 382 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __floatingPoint()

void __floatingPoint ( struct trapframe frame)

Definition at line 607 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __gpf()

void __gpf ( struct trapframe frame)

Definition at line 431 of file idt.c.

◆ __int6()

void __int6 ( struct trapframe frame)

Definition at line 356 of file idt.c.

◆ __machineCheck()

void __machineCheck ( struct trapframe frame)

Definition at line 658 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __nmi()

void __nmi ( struct trapframe frame)

Definition at line 311 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __security()

void __security ( struct trapframe frame)

Definition at line 737 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __simd()

void __simd ( struct trapframe frame)

Definition at line 684 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ __virtualization()

void __virtualization ( struct trapframe frame)

Definition at line 711 of file idt.c.

References _current, die_if_kernel(), endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

◆ _alignmentCheck()

void _alignmentCheck ( )

◆ _debug()

void _debug ( )

◆ _divideError()

void _divideError ( )

◆ _doubleFault()

void _doubleFault ( )

◆ _floatingPoint()

void _floatingPoint ( )

◆ _gpf()

void _gpf ( )

◆ _intNull()

void _intNull ( struct trapframe frame)

Definition at line 235 of file idt.c.

References die_if_kernel().

Here is the call graph for this function:

◆ _machineCheck()

void _machineCheck ( )

◆ _nmi()

void _nmi ( )

◆ _security()

void _security ( )

◆ _simd()

void _simd ( )

◆ _virtualization()

void _virtualization ( )

◆ asm() [1/14]

asm ( ".globl _alignmentCheck \n" "_alignmentCheck: \n" " pushl $0x11 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __alignmentCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [2/14]

asm ( ".globl _debug \n" "_debug: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _debug \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [3/14]

asm ( ".globl _divideError \n" "_divideError: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _divideError \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [4/14]

asm ( ".globl _doubleFault \n" "_doubleFault: \n" " pushl $0x8 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __doubleFault \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [5/14]

asm ( ".globl _floatingPoint \n" "_floatingPoint: \n" " pushl $0x0 \n" " pushl $0x10 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __floatingPoint \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [6/14]

asm ( ".globl _gpf \n" "_gpf: \n" " cli \n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __gpf \n" " add  $0x4,
%esp \n" " mov %  esp,
%eax \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " sti \n" " iret \n"   
)

◆ asm() [7/14]

asm ( ".globl _int6 \n" "_int6: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __int6 \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [8/14]

asm ( ".globl _int7 \n" "_int7: \n" " pushl %eax \n" " clts \n" " movl  _current,
%eax \n" " cmpl  _usedMath,
%eax \n" " je mathDone \n" " call mathStateRestore \n" "mathDone:\n" " popl %eax \n" " iret \n"   
)

◆ asm() [9/14]

asm ( ".globl _machineCheck \n" "_machineCheck: \n" " pushl $0x0\n" " pushl $0x12 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __machineCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [10/14]

asm ( ".globl _nmi \n" "_nmi: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _nmi \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [11/14]

asm ( ".globl _security \n" "_security: \n" " pushl $0x1E \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __security\n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [12/14]

asm ( ".globl _simd \n" "_simd: \n" " iret\n" " pushl $0x0\n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __simd \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [13/14]

asm ( ".globl _virtualization \n" "_virtualization: \n" " pushl $0x0 \n" " pushl $0x14 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __virtualization \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ asm() [14/14]

asm ( ".globl intNull \n" "intNull: \n" " pushl $0x0 \n" " pushl $0x0 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _intNull \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n"  )

◆ idt_init()

int idt_init ( )

Definition at line 109 of file idt.c.

◆ intNull()

void intNull ( )

◆ mathStateRestore()

void mathStateRestore ( )

Definition at line 763 of file idt.c.

References _current, _usedMath, taskStruct::i387, and taskStruct::usedMath.

◆ setTaskVector()

void setTaskVector ( uInt8  interrupt,
uInt16  controlMajor,
uInt8  selector 
)

Definition at line 224 of file idt.c.

References selector.

◆ setVector()

void setVector ( void *  handler,
unsigned char  interrupt,
unsigned short  controlMajor 
)

Definition at line 208 of file idt.c.

Referenced by atkbd_init(), fdc_init(), and initLNC().