mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +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
Notes:
sideshowbarker
2024-07-19 11:30:19 +09:00
Author: https://github.com/supercomputer7 🔰 Commit: https://github.com/SerenityOS/serenity/commit/ed45f67c000 Pull-request: https://github.com/SerenityOS/serenity/pull/696 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/jp-pulga
2 changed files with 43 additions and 15 deletions
|
@ -68,6 +68,8 @@ VFS* vfs;
|
|||
auto dev_random = make<RandomDevice>();
|
||||
auto dev_ptmx = make<PTYMultiplexer>();
|
||||
|
||||
bool textmode = !KParams::the().get("text_debug").is_null();
|
||||
|
||||
auto root = KParams::the().get("root");
|
||||
if (root.is_empty()) {
|
||||
root = "/dev/hda";
|
||||
|
@ -163,15 +165,23 @@ VFS* vfs;
|
|||
// SystemServer will start WindowServer, which will be doing graphics.
|
||||
// From this point on we don't want to touch the VGA text terminal or
|
||||
// accept keyboard input.
|
||||
if (textmode) {
|
||||
tty0->set_graphical(false);
|
||||
auto* shell_process = Process::create_user_process("/bin/Shell", (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
||||
if (error != 0) {
|
||||
kprintf("init_stage2: error spawning Shell: %d\n", error);
|
||||
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);
|
||||
|
||||
}
|
||||
Process::create_kernel_process("NetworkTask", NetworkTask_main);
|
||||
|
||||
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
|
||||
new KParams(String(reinterpret_cast<const char*>(multiboot_info_ptr->cmdline)));
|
||||
|
||||
bool textmode = !KParams::the().get("text_debug").is_null();
|
||||
|
||||
vfs = new VFS;
|
||||
dev_debuglog = new DebugLogDevice;
|
||||
|
||||
|
@ -257,7 +269,10 @@ extern "C" [[noreturn]] void init()
|
|||
id.device_id);
|
||||
});
|
||||
|
||||
if (multiboot_info_ptr->framebuffer_type == 1) {
|
||||
if (textmode) {
|
||||
dbgprintf("Text mode enabled\n");
|
||||
} else {
|
||||
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,
|
||||
|
@ -266,6 +281,7 @@ extern "C" [[noreturn]] void init()
|
|||
} else {
|
||||
new BXVGADevice;
|
||||
}
|
||||
}
|
||||
|
||||
LoopbackAdapter::the();
|
||||
auto e1000 = E1000NetworkAdapter::autodetect();
|
||||
|
|
12
Kernel/run
12
Kernel/run
|
@ -51,6 +51,18 @@ elif [ "$1" = "qgrub" ]; then
|
|||
-device e1000,netdev=breh \
|
||||
-hda _disk_image \
|
||||
-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
|
||||
# ./run: qemu with user networking
|
||||
$SERENITY_QEMU_BIN -s -m ${SERENITY_RAM_SIZE:-128} \
|
||||
|
|
Loading…
Add table
Reference in a new issue