probelm 1: compiling bochs with default parameters causes arg '-rc' was not understood.
I tried to add --enable-debugger into bochs compile parameters and fixed it.
problem 2: core dump for getting plugin with 0 count.
void bx_init_config_interface_list()
{
Bit8u i, count = 0;
count = PLUG_get_plugins_count(PLUGTYPE_CI);
config_interface_list = (const char**) malloc((count + 1) * sizeof(char*));
for (i = 0; i < count; i++) {
config_interface_list[i] = PLUG_get_plugin_name(PLUGTYPE_CI, i);
}
config_interface_list[count] = NULL;
// move default config_intergface to the top of the list
if (strcmp(config_interface_list[0], BX_DEFAULT_CONFIG_INTERFACE)) {
for (i = 1; i < count; i++) {
PLUG_get_plugins_count returns 0 and config_interface_list[0] is null causes core dump.
I tried to set bochs config to 'normal' instead of 'plugin' to fix it.
problem 3: bochs still cores.
spu@ubuntu:~/Hypervisor-101-in-Rust/tests$ gdb /home/spu/bochs_install/bin/bochs
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/spu/bochs_install/bin/bochs...
(gdb) run -q -unlock -rc ./bochs/dbg_command.txt -f ./bochs/linux_cpu_type.bxrc
Starting program: /home/spu/bochs_install/bin/bochs -q -unlock -rc ./bochs/dbg_command.txt -f ./bochs/linux_cpu_type.bxrc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
========================================================================
Bochs x86 Emulator 2.7.svn
Built from SVN snapshot after release 2.7
Compiled on Nov 3 2023 at 17:27:08
========================================================================
00000000000i[ ] debugger using rc file './bochs/dbg_command.txt'.
00000000000i[ ] BXSHARE not set. using compile time default '/home/spu/bochs_install/share/bochs'
00000000000i[ ] reading configuration from ./bochs/linux_cpu_type.bxrc
00000000000p[ ] >>PANIC<< reading from ./bochs/linux_cpu_type.bxrc failed
00000000000e[SIM ] notify called, but no bxevent_callback function is registered
00000000000e[SIM ] notify called, but no bxevent_callback function is registered
========================================================================
Bochs is exiting with the following message:
[ ] reading from ./bochs/linux_cpu_type.bxrc failed
========================================================================
00000000000i[CPU0 ] CPU is in real mode (active)
00000000000i[CPU0 ] CS.mode = 16 bit
00000000000i[CPU0 ] SS.mode = 16 bit
00000000000i[CPU0 ] EFER = 0x00000000
00000000000i[CPU0 ] | EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000000
00000000000i[CPU0 ] | ESP=00000000 EBP=00000000 ESI=00000000 EDI=00000000
00000000000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf
00000000000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00000000000i[CPU0 ] | CS:0000( 0000| 0| 0) 00000000 00000000 0 0
00000000000i[CPU0 ] | DS:0000( 0000| 0| 0) 00000000 00000000 0 0
00000000000i[CPU0 ] | SS:0000( 0000| 0| 0) 00000000 00000000 0 0
00000000000i[CPU0 ] | ES:0000( 0000| 0| 0) 00000000 00000000 0 0
00000000000i[CPU0 ] | FS:0000( 0000| 0| 0) 00000000 00000000 0 0
00000000000i[CPU0 ] | GS:0000( 0000| 0| 0) 00000000 00000000 0 0
00000000000i[CPU0 ] | EIP=00000000 (00000000)
00000000000i[CPU0 ] | CR0=0x00000000 CR2=0x00000000
00000000000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
Program received signal SIGSEGV, Segmentation fault.
BX_MEM_C::dbg_fetch_mem (cpu=0x555555a1e7c0 <bx_cpu>, addr=0, len=16, buf=0x555557252de0 <bx_disasm_ibuf> "") at misc_mem.cc:617
617 memory_handler = BX_MEM_THIS memory_handlers[a20addr >> 20];
(gdb) bt
#0 BX_MEM_C::dbg_fetch_mem (cpu=0x555555a1e7c0 <bx_cpu>, addr=0, len=16, buf=0x555557252de0 <bx_disasm_ibuf> "") at misc_mem.cc:617
#1 0x00005555557d3d5e in bx_dbg_read_linear (which_cpu=0, laddr=0, len=16, buf=0x555557252de0 <bx_disasm_ibuf> "") at dbg_main.cc:1379
#2 0x00005555557d5d8d in bx_dbg_disassemble_current (which_cpu=0, print_time=1) at dbg_main.cc:2220
#3 0x0000555555857157 in BX_CPU_C::debug_disasm_instruction (offset=0) at debugstuff.cc:34
#4 0x0000555555857b48 in BX_CPU_C::debug (offset=0) at debugstuff.cc:251
#5 0x0000555555857fa3 in BX_CPU_C::atexit () at debugstuff.cc:374
#6 0x00005555557d1a1d in bx_dbg_exit (code=1) at dbg_main.cc:801
#7 0x000055555567bda7 in logfunctions::fatal (this=0x55555726ae00, level=3, prefix=0x55555726ae40 "[ ]", fmt=0x5555559048e7 "reading from %s failed", ap=0x7fffffffddf0, exit_status=1)
at logio.cc:680
#8 0x000055555567b571 in logfunctions::panic (this=0x55555726ae00, fmt=0x5555559048e7 "reading from %s failed") at logio.cc:463
#9 0x0000555555687cee in bx_read_configuration (rcfile=0x7fffffffe38d "./bochs/linux_cpu_type.bxrc") at config.cc:1852
#10 0x000055555567d53e in bx_init_main (argc=7, argv=0x7fffffffe078) at main.cc:897
#11 0x000055555567c664 in bxmain () at main.cc:317
#12 0x000055555567c7a6 in main (argc=7, argv=0x7fffffffe078) at main.cc:551
if ((a20addr >= 0x000a0000 && a20addr < 0x000c0000) && BX_MEM_THIS smram_available)
{
// SMRAM memory space
if (BX_MEM_THIS smram_enable || (cpu->smm_mode() && !BX_MEM_THIS smram_restricted))
use_smram = true;
}
memory_handler = BX_MEM_THIS memory_handlers[a20addr >> 20];
while (memory_handler) {
if (memory_handler->begin <= a20addr && memory_handler->end >= a20addr)
{
if (!use_smram) {
use_memory_handler = true;
break;
}
}
memory_handler = memory_handler->next;
}
I have no idea about it. Could you please help me with that?