# idt.c File Reference

`#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/syscall.h>`
`#include <ubixos/kpanic.h>`
`#include <ubixos/endtask.h>`
`#include <string.h>`

Include dependency graph for idt.c:

Go to the source code of this file.

## Defines

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

## Functions

void | _int0 ()
void | _int1 ()
void | _int10 ()
void | _int11 ()
void | _int12 ()
void | _int13 ()
void | _int2 ()
void | _int3 ()
void | _int4 ()
void | _int5 ()
void | _int6 ()
void | _int7 ()
void | _int8 ()
void | _int9 ()
| 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")
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)
static | ubixDescriptorTable (ubixIDT, 256)

## Variables

struct {
descriptorTableUnion *idt | __attribute__ ((packed))
unsigned short limit | __attribute__ ((packed))
} | loadidt

## Define Documentation

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

Definition at line 43 of file idt.c.

Referenced by _int13().

## Function Documentation

void _int0 | ( |  | ) |

Definition at line 197 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int1 | ( |  | ) |

Definition at line 203 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int10 | ( |  | ) |

Definition at line 263 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int11 | ( |  | ) |

Definition at line 269 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int12 | ( |  | ) |

Definition at line 275 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int13 | ( |  | ) |

Definition at line 281 of file idt.c.

References _current, _int13(), tssStruct::cs, DEAD, tssStruct::eax, tssStruct::ebp, tssStruct::edx, EFLAG_IF, EFLAG_VM, tssStruct::eflags, tssStruct::eip, tssStruct::esp, FALSE, FP_TO_LINEAR, taskStruct::id, inportByte(), inportWord(), irqDisable(), irqEnable(), kpanic(), kprintf(), taskStruct::oInfo, outportByte(), outportWord(), tssStruct::ss, taskStruct::state, osInfo::timer, TRUE, taskStruct::tss, and osInfo::v86If.

Referenced by _int13(), and idt_init().

Here is the call graph for this function:

void _int2 | ( |  | ) |

Definition at line 209 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int3 | ( |  | ) |

Definition at line 215 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int4 | ( |  | ) |

Definition at line 221 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int5 | ( |  | ) |

Definition at line 227 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int6 | ( |  | ) |

Definition at line 233 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

void _int7 | ( |  | ) |

void _int8 | ( |  | ) |

Definition at line 239 of file idt.c.

References _current, _int8(), tssStruct::cr3, tssStruct::cs, tssStruct::ds, tssStruct::ebp, tssStruct::eflags, tssStruct::eip, tssStruct::es, tssStruct::esp, tssStruct::fs, tssStruct::gs, taskStruct::id, tssStruct::io_map, kernelPageDirectory, kpanic(), and tssStruct::ss.

Referenced by _int8(), and idt_init().

Here is the call graph for this function:

void _int9 | ( |  | ) |

Definition at line 257 of file idt.c.

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

Referenced by idt_init().

Here is the call graph for this function:

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" |  |
| ) |  |  |

int idt_init | ( |  | ) |

Definition at line 63 of file idt.c.

References _int0(), _int1(), _int10(), _int11(), _int12(), _int13(), _int2(), _int3(), _int4(), _int5(), _int6(), _int7(), _int8(), _int9(), _sysCall, _sysCall_new, _vmm_pageFault, tssStruct::back_link, tssStruct::cr3, tssStruct::cs, dDpl0, dDpl3, dInt, dPresent, tssStruct::ds, dTask, dTrap, tssStruct::ebp, tssStruct::edi, tssStruct::eflags, tssStruct::eip, tssStruct::es, tssStruct::esi, tssStruct::esp, tssStruct::esp0, tssStruct::esp1, tssStruct::esp2, tssStruct::fs, tssStruct::gs, intNull(), tssStruct::io_map, kernelPageDirectory, kprintf(), tssStruct::ldt, loadidt, memset(), setTaskVector(), setVector(), tssStruct::ss, tssStruct::ss0, tssStruct::ss1, tssStruct::ss2, timerInt, and tssStruct::trace_bitmap.

Here is the call graph for this function:

void intNull | ( |  | ) |

Definition at line 187 of file idt.c.

References _current, taskStruct::id, and kprintf().

Referenced by idt_init().

Here is the call graph for this function:

void mathStateRestore | ( |  | ) |

Definition at line 424 of file idt.c.

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

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

Definition at line 174 of file idt.c.

References gdtGate::access, descriptorTableUnion::gate, gdtGate::offsetHigh, gdtGate::offsetLow, and gdtGate::selector.

Referenced by idt_init().

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

Definition at line 156 of file idt.c.

References gdtGate::access, descriptorTableUnion::gate, gdtGate::offsetHigh, gdtGate::offsetLow, and gdtGate::selector.

Referenced by atkbd_init(), fdc_init(), idt_init(), initLNC(), mouseInit(), and ne2k_init().

static ubixDescriptorTable | ( | ubixIDT | ,
|  | 256 |  |
| ) |  |  | `[static]`

Definition at line 45 of file idt.c.

## Variable Documentation

struct { ... } loadidt `[static]`

Referenced by idt_init().