Add: cpuid, meminfo, system info; + minor fixes
This commit is contained in:
@@ -14,9 +14,12 @@ char* ascii_title =
|
||||
" o888ooo888 o888o 88ooo88 8o o888o o888o o888o o888o 88ooo88 o88oooo888\n\n"
|
||||
" --------------------------------- v0.3.45 --------------------------------\n\n";
|
||||
|
||||
int kmain(int retvalue)
|
||||
unsigned int g_multiboot_info_address;
|
||||
|
||||
void kmain(unsigned int multiboot_info_address)
|
||||
{
|
||||
|
||||
g_multiboot_info_address = multiboot_info_address;
|
||||
|
||||
init_serial();
|
||||
log("serial connection established", 3);
|
||||
gdt_install();
|
||||
@@ -29,18 +32,14 @@ int kmain(int retvalue)
|
||||
__asm__ __volatile__("sti");
|
||||
log("initialized IRQs", 2),
|
||||
|
||||
log("kernel started", 2);
|
||||
|
||||
clear();
|
||||
|
||||
colorputs(ascii_title, 10);
|
||||
colorputs(" by @xamidev - star the repo for a cookie!\n\n", 14);
|
||||
|
||||
// TODO: Grub modules to load programs
|
||||
|
||||
|
||||
timer_install();
|
||||
log("initialized timer handler", 2);
|
||||
keyboard_install();
|
||||
log("initialized keyboard driver", 2);
|
||||
shell_install();
|
||||
|
||||
return retvalue;
|
||||
log("started system shell", 2);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ extern kmain
|
||||
loader:
|
||||
cli
|
||||
; mov eax, 0xCAFEBABE
|
||||
push dword 42
|
||||
; push dword 42
|
||||
push ebx
|
||||
call kmain
|
||||
|
||||
.loop:
|
||||
|
||||
@@ -64,6 +64,7 @@ void shell_install()
|
||||
register_command("bf", program_bf);
|
||||
register_command("uptime", program_uptime);
|
||||
register_command("echo", program_echo);
|
||||
register_command("sysinfo", program_sysinfo);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
11
src/kernel/sysinfo.c
Normal file
11
src/kernel/sysinfo.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "../libc/stdio.h"
|
||||
#include "../libc/string.h"
|
||||
|
||||
void cpuid(int code, unsigned int* a, unsigned int* d)
|
||||
{
|
||||
asm volatile("cpuid"
|
||||
: "=a"(*a), "=d"(*d)
|
||||
: "a"(code)
|
||||
: "ecx", "ebx");
|
||||
}
|
||||
|
||||
6
src/kernel/sysinfo.h
Normal file
6
src/kernel/sysinfo.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef SYSINFO_H
|
||||
#define SYSINFO_H
|
||||
|
||||
void cpuid(int code, unsigned int* a, unsigned int* d);
|
||||
|
||||
#endif
|
||||
@@ -26,5 +26,7 @@ int uptime();
|
||||
|
||||
extern volatile unsigned long global_ticks;
|
||||
|
||||
extern unsigned int g_multiboot_info_address;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user