aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMarvin Borner2021-03-12 17:27:01 +0100
committerMarvin Borner2021-03-12 17:27:01 +0100
commit0aef683b9d1e08555791426ba12223ed78051353 (patch)
tree324cbc61b7fb38f648a82041656f5fea48e53856 /libc
parentf1751c121d48f2d8936c72bdc347777d1e7402d9 (diff)
Boots successfully...
Diffstat (limited to 'libc')
-rw-r--r--libc/cpu.c7
-rw-r--r--libc/inc/cpu.h1
-rw-r--r--libc/print.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/libc/cpu.c b/libc/cpu.c
index cb9aa49..8ca4d27 100644
--- a/libc/cpu.c
+++ b/libc/cpu.c
@@ -82,6 +82,13 @@ void cr0_set(u32 cr0)
__asm__ volatile("movl %%eax, %%cr0" ::"a"(cr0));
}
+u32 cr3_get(void)
+{
+ u32 cr3;
+ __asm__ volatile("movl %%cr0, %%eax" : "=a"(cr3));
+ return cr3;
+}
+
void cr3_set(u32 cr3)
{
__asm__ volatile("movl %%eax, %%cr3" ::"a"(cr3));
diff --git a/libc/inc/cpu.h b/libc/inc/cpu.h
index 161b7a4..d709d86 100644
--- a/libc/inc/cpu.h
+++ b/libc/inc/cpu.h
@@ -29,6 +29,7 @@ void fpu_restore(void);
u32 cr0_get(void);
void cr0_set(u32 cr0);
+u32 cr3_get(void);
void cr3_set(u32 cr3);
u32 cr4_get(void);
void cr4_set(u32 cr4);
diff --git a/libc/print.c b/libc/print.c
index 173e117..1c577e5 100644
--- a/libc/print.c
+++ b/libc/print.c
@@ -238,6 +238,7 @@ NORETURN void panic(const char *format, ...)
vsprintf(buf, format, ap);
va_end(ap);
#ifdef kernel
+ print("--- DON'T PANIC! ---\n");
print(buf);
loop();
#else