40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
// Data type declarations
|
|
typedef unsigned char byte;
|
|
typedef unsigned short word;
|
|
typedef unsigned int dword;
|
|
|
|
/* This defines what the stack looks like after an ISR was running */
|
|
typedef struct
|
|
{
|
|
unsigned int gs, fs, es, ds; /* pushed the segs last */
|
|
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
|
|
unsigned int int_no, err_code; /* our 'push byte #' and ecodes do this */
|
|
unsigned int eip, cs, eflags, useresp, ss; /* pushed by the processor automatically */
|
|
} regs;
|
|
|
|
|
|
// Functions
|
|
void system_init();
|
|
void *memcpy(void *dest, const void *src, int count);
|
|
void *memset(void *dest, char val, int count);
|
|
unsigned short *memsetw(unsigned short *dest, unsigned short val, int count);
|
|
int strlen (const char *str);
|
|
byte inportb (word _port);
|
|
byte inb (word _port);
|
|
void outportb (word _port, byte _data);
|
|
void outb (word _port, byte _data) ;
|
|
|
|
void gdt_set_gate(int num, unsigned long base, unsigned long limit, unsigned char access, unsigned char gran);
|
|
void gdt_install();
|
|
|
|
void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel, unsigned char flags);
|
|
void idt_install();
|
|
|
|
void isrs_install();
|
|
|
|
void irq_install_handler(int irq, void (*handler)(regs *r));
|
|
void irq_uninstall_handler(int irq);
|
|
void irq_install();
|
|
void kb_handler(regs *r);
|
|
void reboot();
|
|
void kb_waitin(); |