mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-09 12:31:06 -04:00
Qemu debugging via serial port
This commit is contained in:
parent
9efd6430c2
commit
7d7b131911
3
.gitignore
vendored
3
.gitignore
vendored
@ -35,3 +35,6 @@ programs/uptime/uptime
|
|||||||
programs/df/df
|
programs/df/df
|
||||||
programs/dist/
|
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
|
sudo /sbin/losetup -d /dev/loop0
|
||||||
|
|
||||||
qemu: default
|
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
|
bochs: default
|
||||||
echo "c" > commands
|
echo "c" > commands
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
//TODO Integrate Qemu Serial debugging
|
//TODO Integrate Qemu Serial debugging
|
||||||
|
|
||||||
#include "kernel_utils.hpp"
|
#include "kernel_utils.hpp"
|
||||||
|
#include "serial.hpp"
|
||||||
|
|
||||||
#define BOCHS_E9 0xE9
|
#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){
|
inline void virtual_debug(const char* s){
|
||||||
if(is_bochs_e9()){
|
if(is_bochs_e9()){
|
||||||
bochs_print(s);
|
bochs_print(s);
|
||||||
|
} else {
|
||||||
|
serial_print(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user