Mercurial > lcfOS
view cos/kernel/kernel.h @ 16:ddefe6d97cd7
Merged
author | windel-eee |
---|---|
date | Fri, 18 Nov 2011 14:41:53 +0100 |
parents | a58904747019 |
children | f3e3e0e9c4bc |
line wrap: on
line source
#ifndef KERNEL_H #define KERNEL_H // Include common functions, available to all! #define NULL ((void*)0) // Type defs: typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef unsigned short ushort_t; typedef unsigned char uchar_t; typedef unsigned int uint_t; typedef unsigned long ulong_t; typedef unsigned long long ulonglong_t; typedef unsigned long off_t; typedef unsigned long size_t; void printf(const char* fmt, ... ); void memset(void* ptr, uint32_t value, uint32_t num); void memcpy(void* dst, void* src, uint32_t num); struct IDT_entry { unsigned char b[8]; }; // memory alloc functions: void* malloc(size_t size); void free(void* ptr); void clear_screen(); void init_screen(); void print_string(const char *); // For IO ports: unsigned char inb(unsigned short); void outb(unsigned short, unsigned char); // ASM helper: int loadIDT(struct IDT_entry *table, unsigned short size); void halt(void); void setupIDT(void); void PICremap(void); // Assembler util functions: void enableinterrupts(void); void callint49(void); void doCPUID(int eax, int *ebx, int *ecx, int *edx); // Keyboard driver: void keyboardDriverUpdate(unsigned char scancode); void timerDriverUpdate(void); // Memory functions: void mappage(uint32_t address); int querymode(void); int getcs(void); void loadPageTable(void* tableAddress); void enablePaging(void); // Variable argument list things: #define va_start(v,l) __builtin_va_start(v,l) #define va_end(v) __builtin_va_end(v) #define va_arg(v,l) __builtin_va_arg(v,l) typedef __builtin_va_list va_list; struct multiboot_aout_symbol_table { uint32_t tabsize; uint32_t strsize, addr, reserved; }; struct multiboot_info { uint32_t flags; // Multiboot flags / version uint32_t mem_lower; // available memory from BIOS uint32_t mem_upper; uint32_t boot_device; uint32_t cmdline; // COmmand line uint32_t mods_count; uint32_t mods_addr; union { struct multiboot_aout_symbol_table aout_sym; } u; uint32_t mmap_length; uint32_t mmap_addr; }; struct memory_map { uint32_t size; uint32_t baselow, basehigh; uint32_t lenlow, lenhigh; uint32_t type; }; typedef struct { char name[32]; // Name of the console unsigned char screendata[80*25]; // All chars in the console! } console_t; typedef struct { uint32_t esp; uint32_t ss; uint32_t kstack; uint32_t ustack; uint32_t cr3; uint32_t number; uint32_t parent; uint32_t owner; uint32_t groups; uint32_t timetorun; uint32_t sleep; uint32_t priority; uint32_t filehandle; char naam[32]; console_t *console; } programma_t; #endif