Orion
Barry Importing existing Orion kernel d41a53c (2 years, 4 months ago)diff --git a/proc/proc.h b/proc/proc.h new file mode 100644 index 0000000..bba44cf --- /dev/null +++ b/proc/proc.h @@ -0,0 +1,32 @@ +#ifndef KERNEL_PROC_H +#define KERNEL_PROC_H + +#include <stdint.h> + +/* Structure pushed on interrupt */ +typedef struct InterruptFrame { + uint32_t ds, fs, gs; + uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; + uint32_t intNo, errCode; + uint32_t eip, cs, eflags, useresp, ss; +} InterruptFrame; + +extern uint8_t numCores; +extern uint32_t lapicPtr, ioapicPtr; +extern uint8_t lapicNums[]; +#define LAPIC(off) (*((uint32_t *) ((uint32_t) lapicPtr + (off)))) +#define IOAPIC(off) (*((uint32_t *) ((uint32_t) ioapicPtr + (off)))) +#define CPUID lapicNums[(uint8_t) (LAPIC(0x20) >> 24)] +#define MAX_CPUS 2 + +void init_pic(void); +void init_multicore(void *ebda); + +void init_idt(void); +void init_gdt(void); +void cpu_load_idt(void); +void cpu_load_gdt(void); +void register_exception(int num, void (*handler)(InterruptFrame *)); +void register_interrupt(int num, void (*handler)(InterruptFrame *)); + +#endif