Mercurial > lcfOS
comparison cos/include/kernel.h @ 9:92ace1ca50a8
64 bits kernel without interrupts but with printf in C
author | windel |
---|---|
date | Sun, 13 Nov 2011 12:47:47 +0100 |
parents | |
children | fcdae30b2782 |
comparison
equal
deleted
inserted
replaced
8:edd70006d3e4 | 9:92ace1ca50a8 |
---|---|
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 struct multiboot_aout_symbol_table { | |
54 uint32_t tabsize; | |
55 uint32_t strsize, addr, reserved; | |
56 }; | |
57 | |
58 struct multiboot_info { | |
59 uint32_t flags; // Multiboot flags / version | |
60 uint32_t mem_lower; // available memory from BIOS | |
61 uint32_t mem_upper; | |
62 uint32_t boot_device; | |
63 uint32_t cmdline; // COmmand line | |
64 uint32_t mods_count; | |
65 uint32_t mods_addr; | |
66 union { | |
67 struct multiboot_aout_symbol_table aout_sym; | |
68 } u; | |
69 | |
70 uint32_t mmap_length; | |
71 uint32_t mmap_addr; | |
72 }; | |
73 | |
74 struct memory_map { | |
75 uint32_t size; | |
76 uint32_t baselow, basehigh; | |
77 uint32_t lenlow, lenhigh; | |
78 uint32_t type; | |
79 }; | |
80 | |
81 typedef struct { | |
82 char name[32]; // Name of the console | |
83 unsigned char screendata[80*25]; // All chars in the console! | |
84 } console_t; | |
85 | |
86 typedef struct { | |
87 uint32_t esp; | |
88 uint32_t ss; | |
89 uint32_t kstack; | |
90 uint32_t ustack; | |
91 uint32_t cr3; | |
92 | |
93 uint32_t number; | |
94 uint32_t parent; | |
95 uint32_t owner; | |
96 uint32_t groups; | |
97 uint32_t timetorun; | |
98 uint32_t sleep; | |
99 uint32_t priority; | |
100 uint32_t filehandle; | |
101 char naam[32]; | |
102 | |
103 console_t *console; | |
104 } programma_t; | |
105 | |
106 #endif | |
107 |