blob: 2777f722695f7908815230fed4e32a797ab957aa (
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
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
|
//=====================================================================
// glitch kernel
// spdx-license-identifier: ISC
// description: kernel entry point
//=====================================================================
#include "devices/keyboard.h"
#include "devices/mouse.h"
#include "devices/pic.h"
#include "devices/ps2_controller.h"
#include "devices/uart_16550.h"
#include "devices/vga.h"
#include "mem.h"
#include <conf.h>
#include <stdio.h>
#include <sys/cpuid.h>
void kmain() {
vga_init(vmm_map(0xb8000, 0xc03ff000));
if (uart_init(COM1) != 0) printf("UART self-test failed.\r\n");
printf("glitch [version " VERSION "] [" CC "]\n");
{
char vendor[13] = {'\0'};
unsigned int eax;
__get_cpuid(0, &eax, (unsigned int *)vendor, (unsigned int *)(vendor + 8), (unsigned int *)(vendor + 4));
struct CPUVersion v;
__get_cpuid(1, (unsigned int *)&v, &eax, &eax, &eax);
printf("CPU: %s family %u model %u stepping %u\n", vendor, family(v), model(v), v.stepping);
}
pic_init();
ps2_ctrl_init();
ps2_keyboard_init();
mouse_init();
pic_enable();
printf("interrupts enabled\n");
/*
alloc4M();
char *c = (char *)0xc0700000;
if (*c == 0) printf("c is 0\r\n");
*/
// asm volatile("int $0x80");
while (1)
;
}
|