mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:48:11 +00:00
Kernel: Enabling Text mode debugging (#696)
Also added an option to start Serenity with text mode in QEMU in the run script.
This commit is contained in:
parent
014f8ca8c4
commit
ed45f67c00
2 changed files with 43 additions and 15 deletions
|
@ -68,6 +68,8 @@ VFS* vfs;
|
||||||
auto dev_random = make<RandomDevice>();
|
auto dev_random = make<RandomDevice>();
|
||||||
auto dev_ptmx = make<PTYMultiplexer>();
|
auto dev_ptmx = make<PTYMultiplexer>();
|
||||||
|
|
||||||
|
bool textmode = !KParams::the().get("text_debug").is_null();
|
||||||
|
|
||||||
auto root = KParams::the().get("root");
|
auto root = KParams::the().get("root");
|
||||||
if (root.is_empty()) {
|
if (root.is_empty()) {
|
||||||
root = "/dev/hda";
|
root = "/dev/hda";
|
||||||
|
@ -163,15 +165,23 @@ VFS* vfs;
|
||||||
// SystemServer will start WindowServer, which will be doing graphics.
|
// SystemServer will start WindowServer, which will be doing graphics.
|
||||||
// From this point on we don't want to touch the VGA text terminal or
|
// From this point on we don't want to touch the VGA text terminal or
|
||||||
// accept keyboard input.
|
// accept keyboard input.
|
||||||
tty0->set_graphical(true);
|
if (textmode) {
|
||||||
|
tty0->set_graphical(false);
|
||||||
auto* system_server_process = Process::create_user_process("/bin/SystemServer", (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
auto* shell_process = Process::create_user_process("/bin/Shell", (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
kprintf("init_stage2: error spawning SystemServer: %d\n", error);
|
kprintf("init_stage2: error spawning Shell: %d\n", error);
|
||||||
hang();
|
hang();
|
||||||
|
}
|
||||||
|
shell_process->set_priority(Process::HighPriority);
|
||||||
|
} else {
|
||||||
|
tty0->set_graphical(true);
|
||||||
|
auto* system_server_process = Process::create_user_process("/bin/SystemServer", (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
||||||
|
if (error != 0) {
|
||||||
|
kprintf("init_stage2: error spawning SystemServer: %d\n", error);
|
||||||
|
hang();
|
||||||
|
}
|
||||||
|
system_server_process->set_priority(Process::HighPriority);
|
||||||
}
|
}
|
||||||
system_server_process->set_priority(Process::HighPriority);
|
|
||||||
|
|
||||||
Process::create_kernel_process("NetworkTask", NetworkTask_main);
|
Process::create_kernel_process("NetworkTask", NetworkTask_main);
|
||||||
|
|
||||||
current->process().sys$exit(0);
|
current->process().sys$exit(0);
|
||||||
|
@ -212,6 +222,8 @@ extern "C" [[noreturn]] void init()
|
||||||
// must come after kmalloc_init because we use AK_MAKE_ETERNAL in KParams
|
// must come after kmalloc_init because we use AK_MAKE_ETERNAL in KParams
|
||||||
new KParams(String(reinterpret_cast<const char*>(multiboot_info_ptr->cmdline)));
|
new KParams(String(reinterpret_cast<const char*>(multiboot_info_ptr->cmdline)));
|
||||||
|
|
||||||
|
bool textmode = !KParams::the().get("text_debug").is_null();
|
||||||
|
|
||||||
vfs = new VFS;
|
vfs = new VFS;
|
||||||
dev_debuglog = new DebugLogDevice;
|
dev_debuglog = new DebugLogDevice;
|
||||||
|
|
||||||
|
@ -257,14 +269,18 @@ extern "C" [[noreturn]] void init()
|
||||||
id.device_id);
|
id.device_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (multiboot_info_ptr->framebuffer_type == 1) {
|
if (textmode) {
|
||||||
new MBVGADevice(
|
dbgprintf("Text mode enabled\n");
|
||||||
PhysicalAddress((u32)(multiboot_info_ptr->framebuffer_addr)),
|
|
||||||
multiboot_info_ptr->framebuffer_pitch,
|
|
||||||
multiboot_info_ptr->framebuffer_width,
|
|
||||||
multiboot_info_ptr->framebuffer_height);
|
|
||||||
} else {
|
} else {
|
||||||
new BXVGADevice;
|
if (multiboot_info_ptr->framebuffer_type == 1 || multiboot_info_ptr->framebuffer_type == 2) {
|
||||||
|
new MBVGADevice(
|
||||||
|
PhysicalAddress((u32)(multiboot_info_ptr->framebuffer_addr)),
|
||||||
|
multiboot_info_ptr->framebuffer_pitch,
|
||||||
|
multiboot_info_ptr->framebuffer_width,
|
||||||
|
multiboot_info_ptr->framebuffer_height);
|
||||||
|
} else {
|
||||||
|
new BXVGADevice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoopbackAdapter::the();
|
LoopbackAdapter::the();
|
||||||
|
|
12
Kernel/run
12
Kernel/run
|
@ -51,6 +51,18 @@ elif [ "$1" = "qgrub" ]; then
|
||||||
-device e1000,netdev=breh \
|
-device e1000,netdev=breh \
|
||||||
-hda _disk_image \
|
-hda _disk_image \
|
||||||
-soundhw pcspk
|
-soundhw pcspk
|
||||||
|
elif [ "$1" = "qtext" ]; then
|
||||||
|
$SERENITY_QEMU_BIN -s -m ${SERENITY_RAM_SIZE:-128} \
|
||||||
|
$SERENITY_EXTRA_QEMU_ARGS \
|
||||||
|
-d cpu_reset,guest_errors \
|
||||||
|
-device VGA,vgamem_mb=64 \
|
||||||
|
-debugcon stdio \
|
||||||
|
-device e1000 \
|
||||||
|
-kernel kernel \
|
||||||
|
-append "${SERENITY_KERNEL_CMDLINE} text_debug" \
|
||||||
|
-hda _disk_image \
|
||||||
|
-soundhw pcspk \
|
||||||
|
-soundhw sb16
|
||||||
else
|
else
|
||||||
# ./run: qemu with user networking
|
# ./run: qemu with user networking
|
||||||
$SERENITY_QEMU_BIN -s -m ${SERENITY_RAM_SIZE:-128} \
|
$SERENITY_QEMU_BIN -s -m ${SERENITY_RAM_SIZE:-128} \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue