blob: fda68b724f7e4232ff740da9c7162382ae5d0c84 (
plain)
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
|
#include <kernel/syscalls.h>
#include <stddef.h>
#include <stdint.h>
int _syscall(int, int, int, int);
int debuglog(const char *msg, size_t len) {
return _syscall(SC_DEBUGLOG, (void*)msg, len, 0);
}
int main() {
debuglog("hello from init! ",
sizeof("hello from init! ") - 1);
// change the colors of VGA text
// doesn't require a lot of code, but still shows that it's working
uint8_t *vga = (void*) 0xB8000;
for (int i = 0; i < 80 * 25; i++)
vga[(i << 1) + 1] = 0x4e;
// try to mess with kernel memory
uint8_t *kernel = (void*) 0x100000;
*kernel = 0; // should segfault
}
|