mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-08-03 09:16:13 -04:00
Qemu debugging via serial port
This commit is contained in:
parent
9efd6430c2
commit
7d7b131911
5
.gitignore
vendored
5
.gitignore
vendored
@ -34,4 +34,7 @@ programs/mount/mount
|
||||
programs/uptime/uptime
|
||||
programs/df/df
|
||||
programs/dist/
|
||||
tstl/tester
|
||||
tstl/tester
|
||||
|
||||
# Ignore the generated log (Qemu)
|
||||
kernel.log
|
||||
|
6
Makefile
6
Makefile
@ -40,7 +40,11 @@ thor.flp: hdd.img bootloader/stage1.bin bootloader/stage2.bin kernel/kernel.bin
|
||||
sudo /sbin/losetup -d /dev/loop0
|
||||
|
||||
qemu: default
|
||||
qemu-system-x86_64 -enable-kvm -cpu host -vga std -hda hdd.img
|
||||
touch kernel.log
|
||||
qemu-system-x86_64 -enable-kvm -cpu host -serial file:kernel.log -vga std -hda hdd.img &
|
||||
echo "Reading kernel log (Ctrl+C for exit)"
|
||||
tail -f kernel.log
|
||||
kill %1
|
||||
|
||||
bochs: default
|
||||
echo "c" > commands
|
||||
|
@ -12,6 +12,7 @@
|
||||
//TODO Integrate Qemu Serial debugging
|
||||
|
||||
#include "kernel_utils.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
#define BOCHS_E9 0xE9
|
||||
|
||||
@ -30,9 +31,17 @@ inline void bochs_print(const char* s){
|
||||
}
|
||||
}
|
||||
|
||||
inline void serial_print(const char* s){
|
||||
for(uint64_t i = 0; s[i] != '\0'; ++i){
|
||||
serial::transmit(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
inline void virtual_debug(const char* s){
|
||||
if(is_bochs_e9()){
|
||||
bochs_print(s);
|
||||
} else {
|
||||
serial_print(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user