2011-01-16 04:01:19 +03:00
|
|
|
#ifndef __SYSTEM_H
|
|
|
|
#define __SYSTEM_H
|
|
|
|
|
2011-01-19 09:04:27 +03:00
|
|
|
/* Types */
|
|
|
|
|
2011-01-18 03:22:48 +03:00
|
|
|
#define NULL ((void *)0UL)
|
|
|
|
|
|
|
|
typedef unsigned long uintptr_t;
|
|
|
|
typedef long size_t;
|
2011-01-19 09:04:27 +03:00
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
|
|
|
|
/* Unimportant Kernel Strings */
|
|
|
|
#define KERNEL_UNAME "ToAruOS"
|
|
|
|
#define KERNEL_VERSION_STRING "0.0.1"
|
|
|
|
|
2011-01-18 03:22:48 +03:00
|
|
|
|
2011-01-16 04:01:19 +03:00
|
|
|
/* Kernel Main */
|
2011-01-18 03:22:48 +03:00
|
|
|
extern void *memcpy(void * restrict dest, const void * restrict src, size_t count);
|
|
|
|
extern void *memset(void *dest, int val, size_t count);
|
2011-01-16 04:01:19 +03:00
|
|
|
extern unsigned short *memsetw(unsigned short *dest, unsigned short val, int count);
|
|
|
|
extern int strlen(const char *str);
|
|
|
|
extern unsigned char inportb (unsigned short _port);
|
|
|
|
extern void outportb (unsigned short _port, unsigned char _data);
|
|
|
|
|
|
|
|
/* VGA driver */
|
|
|
|
extern void cls();
|
|
|
|
extern void putch(unsigned char c);
|
2011-01-16 19:56:44 +03:00
|
|
|
extern void puts(char *str);
|
2011-01-16 04:01:19 +03:00
|
|
|
extern void settextcolor(unsigned char forecolor, unsigned char backcolor);
|
2011-01-19 09:04:27 +03:00
|
|
|
extern void resettextcolor();
|
2011-01-16 04:01:19 +03:00
|
|
|
extern void init_video();
|
|
|
|
|
2011-01-16 04:59:11 +03:00
|
|
|
/* GDT */
|
|
|
|
extern void gdt_install();
|
|
|
|
extern void gdt_set_gate(int num, unsigned long base, unsigned long limit, unsigned char access, unsigned char gran);
|
|
|
|
|
2011-01-16 06:41:17 +03:00
|
|
|
/* IDT */
|
|
|
|
extern void idt_install();
|
|
|
|
extern void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel, unsigned char flags);
|
|
|
|
|
|
|
|
/* Registers */
|
|
|
|
struct regs {
|
|
|
|
unsigned int gs, fs, es, ds;
|
|
|
|
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
|
|
|
|
unsigned int int_no, err_code;
|
|
|
|
unsigned int eip, cs, eflags, useresp, ss;
|
|
|
|
};
|
|
|
|
|
2011-01-18 03:22:48 +03:00
|
|
|
typedef void (*irq_handler_t)(struct regs *);
|
|
|
|
|
2011-01-16 19:56:44 +03:00
|
|
|
/* ISRS */
|
|
|
|
extern void isrs_install();
|
|
|
|
|
2011-01-16 07:17:42 +03:00
|
|
|
/* Interrupt Handlers */
|
|
|
|
extern void irq_install();
|
2011-01-18 03:22:48 +03:00
|
|
|
extern void irq_install_handler(int irq, irq_handler_t);
|
2011-01-16 07:17:42 +03:00
|
|
|
extern void irq_uninstall_handler(int irq);
|
|
|
|
|
2011-01-16 19:56:44 +03:00
|
|
|
/* Timer */
|
|
|
|
extern void timer_install();
|
2011-01-18 03:22:48 +03:00
|
|
|
extern long timer_ticks;
|
2011-01-16 19:56:44 +03:00
|
|
|
extern void timer_wait(int ticks);
|
|
|
|
|
2011-01-16 21:45:51 +03:00
|
|
|
/* Keyboard */
|
|
|
|
extern void keyboard_install();
|
|
|
|
extern void keyboard_wait();
|
|
|
|
|
2011-01-17 19:24:55 +03:00
|
|
|
/* kprintf */
|
|
|
|
extern void kprintf(const char *fmt, ...);
|
|
|
|
|
2011-01-16 04:01:19 +03:00
|
|
|
#endif
|