1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#include <uchar.h>
#define nelem(arr) (sizeof(arr)/sizeof(*(arr)))
struct framebuffer
{
void *addr;
uint64_t width;
uint64_t height;
uint64_t pitch;
};
struct memmap
{
uintptr_t start;
uint64_t size;
};
struct boot_info
{
struct framebuffer framebuffer;
uint64_t memmap_count;
struct memmap *memmaps;
};
/* boot.c */
uint64_t cpu_count(void);
/* descriptors */
void setup_descriptors(void);
/* error.c */
void assert(bool);
/* font.c */
void font_init(void);
void font_draw(char8_t *, uint32_t, uint32_t, uint32_t, uint32_t);
/* main.c */
void main(struct boot_info *);
/* nasty.S */
struct table_reg;
void halt(void);
void disable_interrupts(void);
void enable_interrupts(void);
void set_gdt(struct table_reg *, uint64_t, uint64_t, uint64_t);
void set_idt(struct table_reg *);
uint64_t get_cr2(void);
extern void (*isr_stubs[32])(void);
/* paging.c */
bool page_fault_handler(uint32_t);
/* panic.c */
void panic(void);
/* screen.c */
void screen_init(struct framebuffer *);
void screen_draw_pixel(uint32_t, uint32_t, uint32_t);
void print(char8_t *, ...);
/* utf8.c */
int utf8_char_length(const char8_t *);
int utf8_cmp_n(const char8_t *, const char8_t *, uint64_t);
uint32_t utf8_value(const char8_t *);
/* util.c */
uint16_t read_uint16_le(const uint8_t *);
uint16_t read_uint16_be(const uint8_t *);
uint32_t read_uint32_le(const uint8_t *);
void write_uint16_le(uint8_t *, uint16_t);
void write_uint32_le(uint8_t *, uint32_t);
void write_uint64_le(uint8_t *, uint64_t);
int memcmp(const void *, const void *, size_t);
void memset(void *, uint8_t, size_t);
|