0

(I saw one of my previous posts didn't actually answer the "where's the BIOS file used by simics?" question, so I renamed the previous one and am pulling that question out and making it standalone here.)

I can see the BIOS code for a default "targets\qsp-x86\firststeps.simics" invocation by just stepping through the debugger from the start. But if I want to see the full binary, is there a specific file somewhere I can look at?

Jimmy Wu
  • 149
  • 7

3 Answers3

2

you can check "bios" attribute on motherboard image:

simics> board.mb->bios 
"%simics%/targets/qsp-x86/images/SIMICSX58IA32X64_1_0_0_bp_r.fd"

You can specify what BIOS image to use by bios_image script parameter to qsp-clear-linux.simics scripts.

Help info for the script:

$ ./simics -h targets/qsp-x86/qsp-clear-linux.simics
System:
  bios_image  -  existing file or NIL
    BIOS file.
    Default value:
    "%simics%/targets/qsp-x86/images/SIMICSX58IA32X64_1_0_0_bp_r.fd"

you can run with your own BIOS like this:

$ ./simics -e '$bios_image=my-bios.bin' targets/qsp-x86/qsp-clear-linux.simics
  • 2
    Forgot one thing: you may want to use `lookup-file` to reveal the `%simics%` in the path: ```simics> lookup-file board.mb->bios``` – Evgenii Iuliugin Sep 10 '21 at 08:05
2

Now the BIOS is not quite handled consistently with some other things. Typically in Simics, disks and similar things are images. You can list them using list-persistent-images and resolve locations using lookup-file:

simics> list-persistent-images 
┌─────────────────────┬────────────┬───────────────────────────────────────────────────────┐
│Image                │Unsaved data│File(s) (read-only/read-write)                         │
├─────────────────────┼────────────┼───────────────────────────────────────────────────────┤
│board.disk0.hd_image │          no│%simics%/targets/qsp-x86/images/cl-b28910-v2.craff (ro)│
│board.disk1.hd_image │          no│                                                       │
│board.mb.sb.spi_image│         yes│%simics%/targets/qsp-x86/images/spi-flash.bin (ro)     │
└─────────────────────┴────────────┴───────────────────────────────────────────────────────┘

simics> lookup-file "%simics%/targets/qsp-x86/images/spi-flash.bin"
"/disk1/simics-6/simics-qsp-x86-6.0.47/targets/qsp-x86/images/spi-flash.bin"

The BIOS in the QSP is just loaded straight into target memory for execution. Which is a bit of a cheat for convenience.

jakobengblom2
  • 5,531
  • 2
  • 25
  • 33
  • What's the difference between the spi_flash_image and bios_image options? – Jimmy Wu Sep 10 '21 at 12:15
  • The SPI flash image is the contents of the SPI flash. Where the BIOS is not located. The BIOS on this model is loaded separately. The SPI flash is there in case software reads values via SPI. – jakobengblom2 Sep 14 '21 at 17:21
0

Upon searching around, I found the following folder:

C:\Users\yourusername\AppData\Local\Programs\Simics\simics-qsp-x86-6.0.44\targets\qsp-x86\images

Inside that folder are the following 3 files:

SIMICSX58IA32X64_1_0_0_bp_r.fd
SIMICSX58IA32X64-ahci.fd
spi-flash. bin

Both SIMICSX58IA32X64_1_0_0_bp_r. fd and SIMICSX58IA32X64-ahci.fd have UEFI filevolume headers at the start, and a seeming BIOS entry point at the end. The spi-flash. bin seems to have a placeholder of the flash descriptor which would go at the start of the flash, but is mostly empty. So I believe Intel basically either stitches these together in memory, or possibly just uses the spi-flash. bin to allow for "soft strap" configuration or somesuch (since it's a virtual MCH/ICH anyway.)

Jimmy Wu
  • 149
  • 7