added kprintf and kprintp as random useful things to have

also changed bochsrc master path to jos.iso
This commit is contained in:
shockrah 2019-11-09 17:24:41 -08:00
parent c5c518cbdf
commit d1866c5e93
3 changed files with 18 additions and 1 deletions

View File

@ -2,7 +2,7 @@ megs: 32
display_library: x, options="gui_debug"
romimage: file=/usr/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
ata0-master: type=cdrom, path=os.iso, status=inserted
ata0-master: type=cdrom, path=jos.iso, status=inserted
boot: cdrom
log: bochslog.txt
clock: sync=realtime, time0=local

View File

@ -11,6 +11,21 @@ void kinit() {
test_dispatcher();
}
void kprintp(const u32 ptr) {
// Prints our hex version of whatever is given
const char _chars[] = "0123456789abcdef";
u32 idx = 0; // used as hash into the _chars mapping
// iterate over each nibble
for(u32 i = 0 ;i < 7;i++) {
idx = (ptr << (i * 4)) & 0xf0000000;
idx = idx >> 28;
putch(_chars[idx]);
}
}
void kprints(const char* s) {
printf(s);
}
void kmain() {
kinit();

View File

@ -1,4 +1,6 @@
#include "types.h"
void kinit();
void kprintp(const u32);
void kprints(const char*);
void kmain();