diff --git a/hw/pc.c b/hw/pc.c index 203627d..76d0790 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -43,6 +43,7 @@ #include "ui/qemu-spice.h" #include "memory.h" #include "exec-memory.h" +#include "trace.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS @@ -516,6 +517,16 @@ static void handle_a20_line_change(void *opaque, int irq, int level) /***********************************************************/ /* Bochs BIOS debug ports */ +enum { + PROBE_SEABIOS_POST = 1001, + PROBE_SEABIOS_INT_18 = 1002, + PROBE_SEABIOS_INT_19 = 1003, + PROBE_SEABIOS_BOOT_OS = 1004, + + PROBE_LINUXBOOT_COPY_KERNEL = 2001, + PROBE_LINUXBOOT_COPY_INITRD = 2002, + PROBE_LINUXBOOT_BOOT_OS = 2003, +}; static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) { @@ -534,6 +545,31 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) fprintf(stderr, "%c", val); #endif break; + case 0x404: { + switch (val) { + case PROBE_SEABIOS_POST: + trace_seabios_post(); + break; + case PROBE_SEABIOS_INT_18: + trace_seabios_int_18(); + break; + case PROBE_SEABIOS_INT_19: + trace_seabios_int_19(); + break; + case PROBE_SEABIOS_BOOT_OS: + trace_seabios_boot_OS(); + break; + case PROBE_LINUXBOOT_COPY_KERNEL: + trace_linuxboot_copy_kernel(); + break; + case PROBE_LINUXBOOT_COPY_INITRD: + trace_linuxboot_copy_initrd(); + break; + case PROBE_LINUXBOOT_BOOT_OS: + trace_linuxboot_boot_OS(); + break; + } + } break; case 0x8900: /* same as Bochs power off */ if (val == shutdown_str[shutdown_index]) { @@ -589,6 +625,7 @@ static void *bochs_bios_init(void) register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL); + register_ioport_write(0x404, 1, 4, bochs_bios_write, NULL); register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL); diff --git a/pc-bios/linuxboot.bin b/pc-bios/linuxboot.bin index e7c3669..40b9217 100644 Binary files a/pc-bios/linuxboot.bin and b/pc-bios/linuxboot.bin differ diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S index 748c831..5c39fb1 100644 --- a/pc-bios/optionrom/linuxboot.S +++ b/pc-bios/optionrom/linuxboot.S @@ -108,11 +108,21 @@ copy_kernel: /* We're now running in 16-bit CS, but 32-bit ES! */ /* Load kernel and initrd */ + mov $0x7d1,%eax + mov $0x404,%edx + outl %eax,(%dx) read_fw_blob_addr32(FW_CFG_KERNEL) + mov $0x7d2,%eax + mov $0x404,%edx + outl %eax,(%dx) read_fw_blob_addr32(FW_CFG_INITRD) read_fw_blob_addr32(FW_CFG_CMDLINE) read_fw_blob_addr32(FW_CFG_SETUP) + mov $0x7d3,%eax + mov $0x404,%edx + outl %eax,(%dx) + /* And now jump into Linux! */ mov $0, %eax mov %eax, %cr0 diff --git a/trace-events b/trace-events index a31d9aa..34ca28b 100644 --- a/trace-events +++ b/trace-events @@ -289,6 +289,11 @@ scsi_request_sense(int target, int lun, int tag) "target %d lun %d tag %d" # vl.c vm_state_notify(int running, int reason) "running %d reason %d" +main_start(void) "startup" +main_loop(void) "loop" +main_stop(void) "stop" +qemu_shutdown_request(void) "shutdown request" +qemu_powerdown_request(void) "powerdown request" # block/qed-l2-cache.c qed_alloc_l2_cache_entry(void *l2_cache, void *entry) "l2_cache %p entry %p" @@ -502,3 +507,12 @@ escc_sunkbd_event_in(int ch) "Untranslated keycode %2.2x" escc_sunkbd_event_out(int ch) "Translated keycode %2.2x" escc_kbd_command(int val) "Command %d" escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=%01x" + +seabios_post(void) "BIOS post" +seabios_int_18(void) "BIOS int18" +seabios_int_19(void) "BIOS int19" +seabios_boot_OS(void) "BIOS boot OS" + +linuxboot_copy_kernel(void) "LinuxBoot Copy Kernel" +linuxboot_copy_initrd(void) "LinuxBoot Copy InitRD" +linuxboot_boot_OS(void) "LinuxBoot boot OS" diff --git a/vl.c b/vl.c index bd4a5ce..91e6f5e 100644 --- a/vl.c +++ b/vl.c @@ -162,7 +162,7 @@ int main(int argc, char **argv) #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" - +#include "trace.h" #include "ui/qemu-spice.h" //#define DEBUG_NET @@ -1414,12 +1414,14 @@ void qemu_system_killed(int signal, pid_t pid) void qemu_system_shutdown_request(void) { + trace_qemu_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); } void qemu_system_powerdown_request(void) { + trace_qemu_powerdown_request(); powerdown_requested = 1; qemu_notify_event(); } @@ -2313,6 +2315,8 @@ int main(int argc, char **argv, char **envp) const char *trace_events = NULL; const char *trace_file = NULL; + trace_main_start(); + atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); @@ -3571,10 +3575,12 @@ int main(int argc, char **argv, char **envp) os_setup_post(); + trace_main_loop(); main_loop(); quit_timers(); net_cleanup(); res_free(); + trace_main_stop(); return 0; }