Bochs/bochs/patches/patch.optional-romimages

326 lines
14 KiB
Plaintext
Raw Normal View History

----------------------------------------------------------------------
Patch name: patch.optional-romimages
Author: Christophe Bothamy
Date: July 24th 2002
Detailed description:
This patch enables the use of uo to 4 optional romimages.
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on July 24yh 2002
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: .bochsrc
===================================================================
RCS file: /cvsroot/bochs/bochs/.bochsrc,v
retrieving revision 1.42
diff -u -r1.42 .bochsrc
--- .bochsrc 26 Jun 2002 14:42:34 -0000 1.42
+++ .bochsrc 24 Jul 2002 17:47:30 -0000
@@ -6,7 +6,7 @@
# You now need to load a ROM BIOS into F0000-FFFFF. I've wiped
# out most of the BIOS hooks, and replace them with real BIOS
# support. Normally, you can use a precompiled BIOS in the bios/
-# directory, named BIOS-bochs-yymmdd. Use the latest one in there.
+# directory, named BIOS-bochs-latest.
#=======================================================================
#romimage: bios/BIOS-bochs-970717a
romimage: file=bios/BIOS-bochs-latest, address=0xf0000
@@ -27,6 +27,22 @@
megs: 32
#megs: 16
#megs: 8
+
+#=======================================================================
+# OPTROMIMAGE[1-4]:
+# You may now load up to 4 optional ROM images. Be sure to use a
+# read-only area, typically between C8000 and EFFFF. These optional
+# ROM images should not overwrite the rombios (located at
+# F0000-FFFFF) and the videobios (located at C0000-C7FFF).
+# Those ROM images will be initialized by the bios if they contain
+# the right signature (0x55AA).
+# It can also be a convenient way to upload some arbitary code/data
+# in the simulation, that can be retrieved by the boot loader
+#=======================================================================
+#optromimage1: file=optionalrom.bin, address=0xd0000
+#optromimage2: file=optionalrom.bin, address=0xd1000
+#optromimage3: file=optionalrom.bin, address=0xd2000
+#optromimage4: file=optionalrom.bin, address=0xd3000
#=======================================================================
# VGAROMIMAGE
Index: bochs.h
===================================================================
RCS file: /cvsroot/bochs/bochs/bochs.h,v
retrieving revision 1.71
diff -u -r1.71 bochs.h
--- bochs.h 21 Jul 2002 02:55:04 -0000 1.71
+++ bochs.h 24 Jul 2002 17:47:31 -0000
@@ -633,6 +633,10 @@
bx_cdrom_options cdromd;
bx_rom_options rom;
bx_vgarom_options vgarom;
+ bx_rom_options optrom1; // Optional rom image (1)
+ bx_rom_options optrom2; // Optional rom image (2)
+ bx_rom_options optrom3; // Optional rom image (3)
+ bx_rom_options optrom4; // Optional rom image (4)
bx_mem_options memory;
bx_parport_options par1; // parallel port #1
bx_parport_options par2; // parallel port #2 (not implemented)
Index: main.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/main.cc,v
retrieving revision 1.106
diff -u -r1.106 main.cc
--- main.cc 15 Jul 2002 20:12:14 -0000 1.106
+++ main.cc 24 Jul 2002 17:47:33 -0000
@@ -76,9 +76,13 @@
{ 0, NULL}, // com2
{ 0, NULL}, // com3
{ 0, NULL}, // com4
- { 0, NULL, 0 }, // cdromd
- { NULL, NULL }, // rom
- { NULL }, // vgarom
+ { 0, NULL, 0 }, // cdromd
+ { NULL, NULL }, // rom
+ { NULL }, // vgarom
+ { NULL, NULL }, // optrom1
+ { NULL, NULL }, // optrom2
+ { NULL, NULL }, // optrom3
+ { NULL, NULL }, // optrom4
{ NULL }, // memory
{ 0, NULL }, // parallel port 1
{ 0, NULL }, // parallel port 2
@@ -661,6 +665,59 @@
0);
bx_options.rom.Oaddress->set_format ("ROM BIOS address: 0x%05x");
bx_options.rom.Oaddress->set_base (16);
+
+ bx_options.optrom1.Opath = new bx_param_filename_c (BXP_OPTROM1_PATH,
+ "optional romimage #1",
+ "Pathname of optional ROM image #1 to load",
+ "", BX_PATHNAME_LEN);
+ bx_options.optrom1.Opath->set_format ("Name of optional ROM image #1 : %s");
+ bx_options.optrom1.Oaddress = new bx_param_num_c (BXP_OPTROM1_ADDRESS,
+ "optional romaddr #1",
+ "The address at which the optional ROM image #1 should be loaded",
+ 0, BX_MAX_INT,
+ 0);
+ bx_options.optrom1.Oaddress->set_format ("optional ROM #1 address: 0x%05x");
+ bx_options.optrom1.Oaddress->set_base (16);
+
+ bx_options.optrom2.Opath = new bx_param_filename_c (BXP_OPTROM2_PATH,
+ "optional romimage #2",
+ "Pathname of optional ROM image #2 to load",
+ "", BX_PATHNAME_LEN);
+ bx_options.optrom2.Opath->set_format ("Name of optional ROM image #2 : %s");
+ bx_options.optrom2.Oaddress = new bx_param_num_c (BXP_OPTROM2_ADDRESS,
+ "optional romaddr #2",
+ "The address at which the optional ROM image #2 should be loaded",
+ 0, BX_MAX_INT,
+ 0);
+ bx_options.optrom2.Oaddress->set_format ("optional ROM #2 address: 0x%05x");
+ bx_options.optrom2.Oaddress->set_base (16);
+
+ bx_options.optrom3.Opath = new bx_param_filename_c (BXP_OPTROM3_PATH,
+ "optional romimage #3",
+ "Pathname of optional ROM image #3 to load",
+ "", BX_PATHNAME_LEN);
+ bx_options.optrom3.Opath->set_format ("Name of optional ROM image #3 : %s");
+ bx_options.optrom3.Oaddress = new bx_param_num_c (BXP_OPTROM3_ADDRESS,
+ "optional romaddr #3",
+ "The address at which the optional ROM image #3 should be loaded",
+ 0, BX_MAX_INT,
+ 0);
+ bx_options.optrom3.Oaddress->set_format ("optional ROM #3 address: 0x%05x");
+ bx_options.optrom3.Oaddress->set_base (16);
+
+ bx_options.optrom4.Opath = new bx_param_filename_c (BXP_OPTROM4_PATH,
+ "optional romimage #4",
+ "Pathname of optional ROM image #4 to load",
+ "", BX_PATHNAME_LEN);
+ bx_options.optrom4.Opath->set_format ("Name of optional ROM image #4 : %s");
+ bx_options.optrom4.Oaddress = new bx_param_num_c (BXP_OPTROM4_ADDRESS,
+ "optional romaddr #4",
+ "The address at which the optional ROM image #4 should be loaded",
+ 0, BX_MAX_INT,
+ 0);
+ bx_options.optrom4.Oaddress->set_format ("optional ROM #4 address: 0x%05x");
+ bx_options.optrom4.Oaddress->set_base (16);
+
bx_options.vgarom.Opath = new bx_param_filename_c (BXP_VGA_ROM_PATH,
"vgaromimage",
"Pathname of VGA ROM image to load",
@@ -671,6 +728,14 @@
bx_options.vgarom.Opath,
bx_options.rom.Opath,
bx_options.rom.Oaddress,
+ bx_options.optrom1.Opath,
+ bx_options.optrom1.Oaddress,
+ bx_options.optrom2.Opath,
+ bx_options.optrom2.Oaddress,
+ bx_options.optrom3.Opath,
+ bx_options.optrom3.Oaddress,
+ bx_options.optrom4.Opath,
+ bx_options.optrom4.Oaddress,
NULL
};
menu = new bx_list_c (BXP_MENU_MEMORY, "Bochs Memory Options", "memmenu", memory_init_list);
@@ -1249,8 +1314,21 @@
#if BX_SMP_PROCESSORS==1
BX_MEM(0)->init_memory(bx_options.memory.Osize->get () * 1024*1024);
+
+ // First load the optional ROM images
+ if (bx_options.optrom1.Opath->getptr () > 0)
+ BX_MEM(0)->load_ROM(bx_options.optrom1.Opath->getptr (), bx_options.optrom1.Oaddress->get ());
+ if (bx_options.optrom2.Opath->getptr () > 0)
+ BX_MEM(0)->load_ROM(bx_options.optrom2.Opath->getptr (), bx_options.optrom2.Oaddress->get ());
+ if (bx_options.optrom3.Opath->getptr () > 0)
+ BX_MEM(0)->load_ROM(bx_options.optrom3.Opath->getptr (), bx_options.optrom3.Oaddress->get ());
+ if (bx_options.optrom4.Opath->getptr () > 0)
+ BX_MEM(0)->load_ROM(bx_options.optrom4.Opath->getptr (), bx_options.optrom4.Oaddress->get ());
+
+ // Then Load the BIOS and VGABIOS
BX_MEM(0)->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get ());
BX_MEM(0)->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000);
+
BX_CPU(0)->init (BX_MEM(0));
#if BX_SUPPORT_APIC
BX_CPU(0)->local_apic.set_id (0);
@@ -1260,8 +1338,22 @@
// SMP initialization
bx_mem_array[0] = new BX_MEM_C ();
bx_mem_array[0]->init_memory(bx_options.memory.Osize->get () * 1024*1024);
+
+ // First load the optional ROM images
+ if (bx_options.optrom1.Opath->getptr () > 0)
+ bx_mem_array[0]->load_ROM(bx_options.optrom1.Opath->getptr (), bx_options.optrom1.Oaddress->get ());
+ if (bx_options.optrom2.Opath->getptr () > 0)
+ bx_mem_array[0]->load_ROM(bx_options.optrom2.Opath->getptr (), bx_options.optrom2.Oaddress->get ());
+ if (bx_options.optrom3.Opath->getptr () > 0)
+ BX_MEM(0)->load_ROM(bx_options.optrom3.Opath->getptr (), bx_options.optrom3.Oaddress->get ());
+ bx_mem_array[0]->load_ROM(bx_options.optrom3.Opath->getptr (), bx_options.optrom3.Oaddress->get ());
+ if (bx_options.optrom4.Opath->getptr () > 0)
+ bx_mem_array[0]->load_ROM(bx_options.optrom4.Opath->getptr (), bx_options.optrom4.Oaddress->get ());
+
+ // Then Load the BIOS and VGABIOS
bx_mem_array[0]->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get ());
bx_mem_array[0]->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000);
+
for (int i=0; i<BX_SMP_PROCESSORS; i++) {
BX_CPU(i) = new BX_CPU_C ();
BX_CPU(i)->init (bx_mem_array[0]);
@@ -1810,6 +1902,70 @@
else
bx_options.rom.Oaddress->set (strtoul (&params[2][8], NULL, 10));
}
+ else if (!strcmp(params[0], "optromimage1")) {
+ if (num_params != 3) {
+ BX_PANIC(("%s: optromimage1 directive: wrong # args.", context));
+ }
+ if (strncmp(params[1], "file=", 5)) {
+ BX_PANIC(("%s: optromimage1 directive malformed.", context));
+ }
+ if (strncmp(params[2], "address=", 8)) {
+ BX_PANIC(("%s: optromimage2 directive malformed.", context));
+ }
+ bx_options.optrom1.Opath->set (&params[1][5]);
+ if ( (params[2][8] == '0') && (params[2][9] == 'x') )
+ bx_options.optrom1.Oaddress->set (strtoul (&params[2][8], NULL, 16));
+ else
+ bx_options.optrom1.Oaddress->set (strtoul (&params[2][8], NULL, 10));
+ }
+ else if (!strcmp(params[0], "optromimage2")) {
+ if (num_params != 3) {
+ BX_PANIC(("%s: optromimage2 directive: wrong # args.", context));
+ }
+ if (strncmp(params[1], "file=", 5)) {
+ BX_PANIC(("%s: optromimage2 directive malformed.", context));
+ }
+ if (strncmp(params[2], "address=", 8)) {
+ BX_PANIC(("%s: optromimage2 directive malformed.", context));
+ }
+ bx_options.optrom2.Opath->set (&params[1][5]);
+ if ( (params[2][8] == '0') && (params[2][9] == 'x') )
+ bx_options.optrom2.Oaddress->set (strtoul (&params[2][8], NULL, 16));
+ else
+ bx_options.optrom2.Oaddress->set (strtoul (&params[2][8], NULL, 10));
+ }
+ else if (!strcmp(params[0], "optromimage3")) {
+ if (num_params != 3) {
+ BX_PANIC(("%s: optromimage3 directive: wrong # args.", context));
+ }
+ if (strncmp(params[1], "file=", 5)) {
+ BX_PANIC(("%s: optromimage3 directive malformed.", context));
+ }
+ if (strncmp(params[2], "address=", 8)) {
+ BX_PANIC(("%s: optromimage2 directive malformed.", context));
+ }
+ bx_options.optrom3.Opath->set (&params[1][5]);
+ if ( (params[2][8] == '0') && (params[2][9] == 'x') )
+ bx_options.optrom3.Oaddress->set (strtoul (&params[2][8], NULL, 16));
+ else
+ bx_options.optrom3.Oaddress->set (strtoul (&params[2][8], NULL, 10));
+ }
+ else if (!strcmp(params[0], "optromimage4")) {
+ if (num_params != 3) {
+ BX_PANIC(("%s: optromimage4 directive: wrong # args.", context));
+ }
+ if (strncmp(params[1], "file=", 5)) {
+ BX_PANIC(("%s: optromimage4 directive malformed.", context));
+ }
+ if (strncmp(params[2], "address=", 8)) {
+ BX_PANIC(("%s: optromimage2 directive malformed.", context));
+ }
+ bx_options.optrom4.Opath->set (&params[1][5]);
+ if ( (params[2][8] == '0') && (params[2][9] == 'x') )
+ bx_options.optrom4.Oaddress->set (strtoul (&params[2][8], NULL, 16));
+ else
+ bx_options.optrom4.Oaddress->set (strtoul (&params[2][8], NULL, 10));
+ }
else if (!strcmp(params[0], "vgaromimage")) {
if (num_params != 2) {
BX_PANIC(("%s: vgaromimage directive: wrong # args.", context));
@@ -2377,6 +2533,14 @@
fprintf (fp, "vgaromimage: %s\n", bx_options.vgarom.Opath->getptr ());
else
fprintf (fp, "# no vgaromimage\n");
+ if (strlen (bx_options.optrom1.Opath->getptr ()) > 0)
+ fprintf (fp, "optromimage1: file=%s, address=0x%05x\n", bx_options.optrom1.Opath->getptr(), (unsigned int)bx_options.optrom1.Oaddress->get ());
+ if (strlen (bx_options.optrom2.Opath->getptr ()) > 0)
+ fprintf (fp, "optromimage2: file=%s, address=0x%05x\n", bx_options.optrom2.Opath->getptr(), (unsigned int)bx_options.optrom2.Oaddress->get ());
+ if (strlen (bx_options.optrom3.Opath->getptr ()) > 0)
+ fprintf (fp, "optromimage3: file=%s, address=0x%05x\n", bx_options.optrom3.Opath->getptr(), (unsigned int)bx_options.optrom3.Oaddress->get ());
+ if (strlen (bx_options.optrom4.Opath->getptr ()) > 0)
+ fprintf (fp, "optromimage4: file=%s, address=0x%05x\n", bx_options.optrom4.Opath->getptr(), (unsigned int)bx_options.optrom4.Oaddress->get ());
fprintf (fp, "megs: %d\n", bx_options.memory.Osize->get ());
bx_write_parport_options (fp, &bx_options.par1, 1);
//bx_write_parport_options (fp, &bx_options.par2);
Index: gui/siminterface.h
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/siminterface.h,v
retrieving revision 1.39
diff -u -r1.39 siminterface.h
--- gui/siminterface.h 4 Jul 2002 19:24:30 -0000 1.39
+++ gui/siminterface.h 24 Jul 2002 17:47:33 -0000
@@ -61,6 +61,14 @@
BXP_ROM_PATH,
BXP_ROM_ADDRESS,
BXP_VGA_ROM_PATH,
+ BXP_OPTROM1_PATH,
+ BXP_OPTROM1_ADDRESS,
+ BXP_OPTROM2_PATH,
+ BXP_OPTROM2_ADDRESS,
+ BXP_OPTROM3_PATH,
+ BXP_OPTROM3_ADDRESS,
+ BXP_OPTROM4_PATH,
+ BXP_OPTROM4_ADDRESS,
BXP_KBD_SERIAL_DELAY,
BXP_KBD_PASTE_DELAY,
BXP_KBD_TYPE,