feat: reformatted code base to be more standard
This commit is contained in:
37
include/myke/cpu/idt.h
Normal file
37
include/myke/cpu/idt.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by rick on 8/18/19.
|
||||
//
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef MY_KERNEL_IDT_H
|
||||
#define MY_KERNEL_IDT_H
|
||||
#include <myke/attributes.h>
|
||||
|
||||
#define KERNEL_CS 0x08
|
||||
|
||||
/* How every interrupt gate (handler) is defined */
|
||||
typedef struct {
|
||||
uint16_t low_offset; /* Lower 16 bits of handler function address */
|
||||
uint16_t sel; /* Kernel segment selector */
|
||||
uint8_t always0;
|
||||
/* First byte
|
||||
* Bit 7: "Interrupt is present"
|
||||
* Bits 6-5: Privilege level of caller (0=kernel..3=user)
|
||||
* Bit 4: Set to 0 for interrupt gates
|
||||
* Bits 3-0: bits 1110 = decimal 14 = "32 bit interrupt gate" */
|
||||
uint8_t flags;
|
||||
uint16_t high_offset; /* Higher 16 bits of handler function address */
|
||||
} packed idt_gate_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t limit;
|
||||
uint32_t base;
|
||||
} packed idt_register_t;
|
||||
|
||||
#define IDT_REGISTERS 256
|
||||
|
||||
void set_idt_gate(int n, uint32_t handler);
|
||||
|
||||
void set_idt();
|
||||
|
||||
#endif //MY_KERNEL_IDT_H
|
||||
Reference in New Issue
Block a user