aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-07-17 23:04:47 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-08-12 10:13:59 +0300
commit3973bfdf7936f4574aa28a97b7343319aa344bc3 (patch)
treefddaff0566b915be58fee0a7ad3af85906bcad67 /src
parentRemove duplicated linker.ld argument (diff)
downloadkernel-3973bfdf7936f4574aa28a97b7343319aa344bc3.tar.xz
Print version, compiler id and version, and cpuid on boot
Diffstat (limited to 'src')
-rw-r--r--src/kernel.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/kernel.c b/src/kernel.c
index ffa8814..b9a6bdf 100644
--- a/src/kernel.c
+++ b/src/kernel.c
@@ -8,6 +8,9 @@
#include "devices/uart_16550.h"
#include "devices/vga.h"
+#include <conf.h>
+#include <sys/cpuid.h>
+
void kmain() {
pic_init();
@@ -16,6 +19,15 @@ void kmain() {
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);
+
printf("hello %s world\n", "kernel");
printf("we are number %d\n", 1);
printf("a negative %d as hex %x\n", -1, -1);