diff --git a/source/boot/disk_load.asm b/source/boot/disk_load.asm index 8858fab..6729a8b 100644 --- a/source/boot/disk_load.asm +++ b/source/boot/disk_load.asm @@ -89,4 +89,4 @@ disk_load: DISK_ERROR_MSG db "? - Disk read error!",0 -WOOT db "woot",0 \ No newline at end of file +WOOT db "woot",0 diff --git a/source/kernel/kernel.c b/source/kernel/kernel.c index 7dbf9a1..855031b 100644 --- a/source/kernel/kernel.c +++ b/source/kernel/kernel.c @@ -17,4 +17,5 @@ void main() terminal_update_cursor(); init_idt(); init_paging(); + printRegs(); } diff --git a/source/libc/include/io.h b/source/libc/include/io.h index f5b9f95..4d1fd46 100644 --- a/source/libc/include/io.h +++ b/source/libc/include/io.h @@ -6,4 +6,6 @@ void outb(unsigned short port, unsigned char value); void io_wait(); // printf attached to terminal for now int printf(const char *s, ...); -int printch(char c); \ No newline at end of file +int printch(char c); +void unitTest(const int errorNum,const char* errorMessage, const int bool); +void PrintRegs(); diff --git a/source/libc/io.c b/source/libc/io.c index d9f5cdc..7748176 100644 --- a/source/libc/io.c +++ b/source/libc/io.c @@ -38,4 +38,56 @@ int printch(char c) { terminal_putchar(c); terminal_update_cursor(); -} \ No newline at end of file +} + +void unitTest(const int errorNum,const char* errorMessage, const int bool){ + terminal_put64(errorNum); + terminal_putchar(':'); + terminal_putchar(' '); + printf(errorMessage); + + if(bool==1) asm("hlt"); +} + +void printRegs(){ + int i; + asm("mov %%eax, %0" : "+g" (i)::); + printf("eax: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%ebx, %0" : "+g" (i)::); + printf("ebx: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%ecx, %0" : "+g" (i)::); + printf("ecx: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%edx, %0" : "+g" (i)::); + printf("edx: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%esi, %0" : "+g" (i)::); + printf("esi: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%edi, %0" : "+g" (i)::); + printf("edi: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%ebp, %0" : "+g" (i)::); + printf("ebp: "); + terminal_put64(i); + printf("\n"); + + asm("mov %%esp, %0" : "+g" (i)::); + printf("esp: "); + terminal_put64(i); + printf("\n"); +}