comparison cos/kernel/kernel.h @ 13:d07d4701a103

Cleanup of header files
author windel
date Mon, 14 Nov 2011 21:44:35 +0100
parents cos/include/kernel.h@fcdae30b2782
children a58904747019
comparison
equal deleted inserted replaced
12:fcdae30b2782 13:d07d4701a103
1 #ifndef KERNEL_H
2 #define KERNEL_H
3
4 // Include common functions, available to all!
5 #define NULL ((void*)0)
6
7 // Type defs:
8 typedef unsigned int uint32_t;
9 typedef unsigned long long uint64_t;
10 typedef unsigned short ushort_t;
11 typedef unsigned char uchar_t;
12 typedef unsigned int uint_t;
13 typedef unsigned long ulong_t;
14 typedef unsigned long long ulonglong_t;
15 typedef unsigned long off_t;
16 typedef unsigned long size_t;
17
18 void printf(const char* fmt, ... );
19 void memset(void* ptr, uint32_t value, uint32_t num);
20 void memcpy(void* dst, void* src, uint32_t num);
21
22 // memory alloc functions:
23 void* malloc(size_t size);
24 void free(void* ptr);
25
26 void clear_screen();
27 void init_screen();
28 void print_string(const char *);
29
30 // For IO ports:
31 unsigned char inb(unsigned short);
32 void outb(unsigned short, unsigned char);
33
34 void setupIDT(void);
35 void PICremap(void);
36 // Assembler util functions:
37 void enableinterrupts(void);
38 void callint49(void);
39 void doCPUID(int eax, int *ebx, int *ecx, int *edx);
40
41 // Keyboard driver:
42 void keyboardDriverUpdate(unsigned char scancode);
43 void timerDriverUpdate(void);
44
45 // Memory functions:
46 void mappage(uint32_t address);
47
48 int querymode(void);
49 int getcs(void);
50 void loadPageTable(void* tableAddress);
51 void enablePaging(void);
52
53 // Variable argument list things:
54 #define va_start(v,l) __builtin_va_start(v,l)
55 #define va_end(v) __builtin_va_end(v)
56 #define va_arg(v,l) __builtin_va_arg(v,l)
57 typedef __builtin_va_list va_list;
58
59 struct multiboot_aout_symbol_table {
60 uint32_t tabsize;
61 uint32_t strsize, addr, reserved;
62 };
63
64 struct multiboot_info {
65 uint32_t flags; // Multiboot flags / version
66 uint32_t mem_lower; // available memory from BIOS
67 uint32_t mem_upper;
68 uint32_t boot_device;
69 uint32_t cmdline; // COmmand line
70 uint32_t mods_count;
71 uint32_t mods_addr;
72 union {
73 struct multiboot_aout_symbol_table aout_sym;
74 } u;
75
76 uint32_t mmap_length;
77 uint32_t mmap_addr;
78 };
79
80 struct memory_map {
81 uint32_t size;
82 uint32_t baselow, basehigh;
83 uint32_t lenlow, lenhigh;
84 uint32_t type;
85 };
86
87 typedef struct {
88 char name[32]; // Name of the console
89 unsigned char screendata[80*25]; // All chars in the console!
90 } console_t;
91
92 typedef struct {
93 uint32_t esp;
94 uint32_t ss;
95 uint32_t kstack;
96 uint32_t ustack;
97 uint32_t cr3;
98
99 uint32_t number;
100 uint32_t parent;
101 uint32_t owner;
102 uint32_t groups;
103 uint32_t timetorun;
104 uint32_t sleep;
105 uint32_t priority;
106 uint32_t filehandle;
107 char naam[32];
108
109 console_t *console;
110 } programma_t;
111
112 #endif
113