v86 0.4.0 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +56 -111
- package/build/libv86-debug.js +12680 -0
- package/build/libv86-debug.mjs +732 -0
- package/build/libv86.js +710 -0
- package/build/libv86.mjs +637 -0
- package/build/v86-debug.wasm +0 -0
- package/build/v86-fallback.wasm +0 -0
- package/build/v86.wasm +0 -0
- package/package.json +12 -35
- package/bios/.gitignore +0 -1
- package/bios/COPYING.LESSER +0 -165
- package/bios/bochs-bios.bin +0 -0
- package/bios/bochs-vgabios.bin +0 -0
- package/bios/fetch-and-build-seabios.sh +0 -13
- package/bios/seabios/.config +0 -113
- package/bios/seabios/.config.old +0 -114
- package/bios/seabios/.gitignore +0 -4
- package/bios/seabios/COPYING +0 -674
- package/bios/seabios/COPYING.LESSER +0 -165
- package/bios/seabios/Makefile +0 -286
- package/bios/seabios/README +0 -17
- package/bios/seabios/docs/Build_overview.md +0 -104
- package/bios/seabios/docs/Contributing.md +0 -20
- package/bios/seabios/docs/Debugging.md +0 -111
- package/bios/seabios/docs/Developer_Documentation.md +0 -25
- package/bios/seabios/docs/Developer_links.md +0 -86
- package/bios/seabios/docs/Download.md +0 -27
- package/bios/seabios/docs/Execution_and_code_flow.md +0 -178
- package/bios/seabios/docs/Linking_overview.md +0 -160
- package/bios/seabios/docs/Mailinglist.md +0 -8
- package/bios/seabios/docs/Memory_Model.md +0 -253
- package/bios/seabios/docs/README +0 -5
- package/bios/seabios/docs/Releases.md +0 -482
- package/bios/seabios/docs/Runtime_config.md +0 -193
- package/bios/seabios/docs/SeaBIOS.md +0 -17
- package/bios/seabios/docs/SeaVGABIOS.md +0 -39
- package/bios/seabios/out/autoconf.h +0 -117
- package/bios/seabios/out/include/config/acpi/dsdt.h +0 -0
- package/bios/seabios/out/include/config/acpi.h +0 -0
- package/bios/seabios/out/include/config/ahci.h +0 -0
- package/bios/seabios/out/include/config/apmbios.h +0 -0
- package/bios/seabios/out/include/config/ata/dma.h +0 -0
- package/bios/seabios/out/include/config/ata/pio32.h +0 -0
- package/bios/seabios/out/include/config/ata.h +0 -0
- package/bios/seabios/out/include/config/auto.conf +0 -69
- package/bios/seabios/out/include/config/auto.conf.cmd +0 -9
- package/bios/seabios/out/include/config/boot.h +0 -0
- package/bios/seabios/out/include/config/bootorder.h +0 -0
- package/bios/seabios/out/include/config/build/vgabios.h +0 -0
- package/bios/seabios/out/include/config/call32/smm.h +0 -0
- package/bios/seabios/out/include/config/cdrom/boot.h +0 -0
- package/bios/seabios/out/include/config/cdrom/emu.h +0 -0
- package/bios/seabios/out/include/config/debug/level.h +0 -0
- package/bios/seabios/out/include/config/drives.h +0 -0
- package/bios/seabios/out/include/config/entry/extrastack.h +0 -0
- package/bios/seabios/out/include/config/esp/scsi.h +0 -0
- package/bios/seabios/out/include/config/flash/floppy.h +0 -0
- package/bios/seabios/out/include/config/floppy.h +0 -0
- package/bios/seabios/out/include/config/fw/romfile/load.h +0 -0
- package/bios/seabios/out/include/config/hardware/irq.h +0 -0
- package/bios/seabios/out/include/config/kbd/call/int15/4f.h +0 -0
- package/bios/seabios/out/include/config/keyboard.h +0 -0
- package/bios/seabios/out/include/config/lpt.h +0 -0
- package/bios/seabios/out/include/config/lsi/scsi.h +0 -0
- package/bios/seabios/out/include/config/malloc/uppermemory.h +0 -0
- package/bios/seabios/out/include/config/megasas.h +0 -0
- package/bios/seabios/out/include/config/mouse.h +0 -0
- package/bios/seabios/out/include/config/mpt/scsi.h +0 -0
- package/bios/seabios/out/include/config/mptable.h +0 -0
- package/bios/seabios/out/include/config/mtrr/init.h +0 -0
- package/bios/seabios/out/include/config/optionroms.h +0 -0
- package/bios/seabios/out/include/config/override/pci/id.h +0 -0
- package/bios/seabios/out/include/config/pcibios.h +0 -0
- package/bios/seabios/out/include/config/pirtable.h +0 -0
- package/bios/seabios/out/include/config/pmm.h +0 -0
- package/bios/seabios/out/include/config/pmtimer.h +0 -0
- package/bios/seabios/out/include/config/pnpbios.h +0 -0
- package/bios/seabios/out/include/config/ps2port.h +0 -0
- package/bios/seabios/out/include/config/pvscsi.h +0 -0
- package/bios/seabios/out/include/config/qemu/hardware.h +0 -0
- package/bios/seabios/out/include/config/qemu.h +0 -0
- package/bios/seabios/out/include/config/rom/size.h +0 -0
- package/bios/seabios/out/include/config/rtc/timer.h +0 -0
- package/bios/seabios/out/include/config/s3/resume.h +0 -0
- package/bios/seabios/out/include/config/sdcard.h +0 -0
- package/bios/seabios/out/include/config/serial.h +0 -0
- package/bios/seabios/out/include/config/tcgbios.h +0 -0
- package/bios/seabios/out/include/config/threads.h +0 -0
- package/bios/seabios/out/include/config/tristate.conf +0 -4
- package/bios/seabios/out/include/config/tsc/timer.h +0 -0
- package/bios/seabios/out/include/config/use/smm.h +0 -0
- package/bios/seabios/out/include/config/vga/allocate/extra/stack.h +0 -0
- package/bios/seabios/out/include/config/vga/bochs/stdvga.h +0 -0
- package/bios/seabios/out/include/config/vga/bochs.h +0 -0
- package/bios/seabios/out/include/config/vga/did.h +0 -0
- package/bios/seabios/out/include/config/vga/extra/stack/size.h +0 -0
- package/bios/seabios/out/include/config/vga/fixup/asm.h +0 -0
- package/bios/seabios/out/include/config/vga/pci.h +0 -0
- package/bios/seabios/out/include/config/vga/stdvga/ports.h +0 -0
- package/bios/seabios/out/include/config/vga/vbe.h +0 -0
- package/bios/seabios/out/include/config/vga/vid.h +0 -0
- package/bios/seabios/out/include/config/vgahooks.h +0 -0
- package/bios/seabios/out/include/config/virtio/blk.h +0 -0
- package/bios/seabios/out/include/config/virtio/scsi.h +0 -0
- package/bios/seabios/out/include/config/xen.h +0 -0
- package/bios/seabios/out/scripts/kconfig/conf +0 -0
- package/bios/seabios/out/scripts/kconfig/conf.o +0 -0
- package/bios/seabios/out/scripts/kconfig/zconf.hash.c +0 -289
- package/bios/seabios/out/scripts/kconfig/zconf.lex.c +0 -2420
- package/bios/seabios/out/scripts/kconfig/zconf.tab.c +0 -2538
- package/bios/seabios/out/scripts/kconfig/zconf.tab.o +0 -0
- package/bios/seabios/scripts/acpi_extract.py +0 -366
- package/bios/seabios/scripts/acpi_extract_preprocess.py +0 -41
- package/bios/seabios/scripts/buildrom.py +0 -56
- package/bios/seabios/scripts/buildversion.py +0 -134
- package/bios/seabios/scripts/checkrom.py +0 -95
- package/bios/seabios/scripts/checkstack.py +0 -226
- package/bios/seabios/scripts/checksum.py +0 -16
- package/bios/seabios/scripts/encodeint.py +0 -21
- package/bios/seabios/scripts/gen-offsets.sh +0 -17
- package/bios/seabios/scripts/kconfig/.gitignore +0 -22
- package/bios/seabios/scripts/kconfig/Makefile +0 -331
- package/bios/seabios/scripts/kconfig/POTFILES.in +0 -12
- package/bios/seabios/scripts/kconfig/check.sh +0 -13
- package/bios/seabios/scripts/kconfig/conf.c +0 -718
- package/bios/seabios/scripts/kconfig/confdata.c +0 -1250
- package/bios/seabios/scripts/kconfig/expr.c +0 -1168
- package/bios/seabios/scripts/kconfig/expr.h +0 -241
- package/bios/seabios/scripts/kconfig/gconf.c +0 -1542
- package/bios/seabios/scripts/kconfig/gconf.glade +0 -661
- package/bios/seabios/scripts/kconfig/images.c +0 -326
- package/bios/seabios/scripts/kconfig/kxgettext.c +0 -235
- package/bios/seabios/scripts/kconfig/lex.zconf.c +0 -2430
- package/bios/seabios/scripts/kconfig/list.h +0 -131
- package/bios/seabios/scripts/kconfig/lkc.h +0 -200
- package/bios/seabios/scripts/kconfig/lkc_proto.h +0 -57
- package/bios/seabios/scripts/kconfig/lxdialog/.gitignore +0 -4
- package/bios/seabios/scripts/kconfig/lxdialog/BIG.FAT.WARNING +0 -4
- package/bios/seabios/scripts/kconfig/lxdialog/check-lxdialog.sh +0 -87
- package/bios/seabios/scripts/kconfig/lxdialog/checklist.c +0 -332
- package/bios/seabios/scripts/kconfig/lxdialog/dialog.h +0 -257
- package/bios/seabios/scripts/kconfig/lxdialog/inputbox.c +0 -301
- package/bios/seabios/scripts/kconfig/lxdialog/menubox.c +0 -437
- package/bios/seabios/scripts/kconfig/lxdialog/textbox.c +0 -408
- package/bios/seabios/scripts/kconfig/lxdialog/util.c +0 -713
- package/bios/seabios/scripts/kconfig/lxdialog/yesno.c +0 -114
- package/bios/seabios/scripts/kconfig/mconf.c +0 -1036
- package/bios/seabios/scripts/kconfig/menu.c +0 -697
- package/bios/seabios/scripts/kconfig/merge_config.sh +0 -150
- package/bios/seabios/scripts/kconfig/nconf.c +0 -1556
- package/bios/seabios/scripts/kconfig/nconf.gui.c +0 -656
- package/bios/seabios/scripts/kconfig/nconf.h +0 -96
- package/bios/seabios/scripts/kconfig/qconf.cc +0 -1795
- package/bios/seabios/scripts/kconfig/qconf.h +0 -338
- package/bios/seabios/scripts/kconfig/streamline_config.pl +0 -647
- package/bios/seabios/scripts/kconfig/symbol.c +0 -1373
- package/bios/seabios/scripts/kconfig/util.c +0 -157
- package/bios/seabios/scripts/kconfig/zconf.gperf +0 -48
- package/bios/seabios/scripts/kconfig/zconf.hash.c_shipped +0 -289
- package/bios/seabios/scripts/kconfig/zconf.l +0 -363
- package/bios/seabios/scripts/kconfig/zconf.lex.c_shipped +0 -2420
- package/bios/seabios/scripts/kconfig/zconf.tab.c_shipped +0 -2538
- package/bios/seabios/scripts/kconfig/zconf.y +0 -733
- package/bios/seabios/scripts/layoutrom.py +0 -705
- package/bios/seabios/scripts/python23compat.py +0 -14
- package/bios/seabios/scripts/readserial.py +0 -190
- package/bios/seabios/scripts/tarball.sh +0 -36
- package/bios/seabios/scripts/test-build.sh +0 -90
- package/bios/seabios/scripts/transdump.py +0 -53
- package/bios/seabios/scripts/vgafixup.py +0 -96
- package/bios/seabios/src/Kconfig +0 -579
- package/bios/seabios/src/apm.c +0 -215
- package/bios/seabios/src/asm-offsets.c +0 -23
- package/bios/seabios/src/biosvar.h +0 -130
- package/bios/seabios/src/block.c +0 -623
- package/bios/seabios/src/block.h +0 -121
- package/bios/seabios/src/bmp.c +0 -117
- package/bios/seabios/src/boot.c +0 -793
- package/bios/seabios/src/bootsplash.c +0 -255
- package/bios/seabios/src/bregs.h +0 -80
- package/bios/seabios/src/byteorder.h +0 -71
- package/bios/seabios/src/cdrom.c +0 -322
- package/bios/seabios/src/clock.c +0 -506
- package/bios/seabios/src/code16gcc.s +0 -1
- package/bios/seabios/src/config.h +0 -108
- package/bios/seabios/src/cp437.c +0 -275
- package/bios/seabios/src/cp437.h +0 -1
- package/bios/seabios/src/disk.c +0 -779
- package/bios/seabios/src/e820map.c +0 -152
- package/bios/seabios/src/e820map.h +0 -26
- package/bios/seabios/src/entryfuncs.S +0 -165
- package/bios/seabios/src/farptr.h +0 -208
- package/bios/seabios/src/font.c +0 -139
- package/bios/seabios/src/fw/acpi-dsdt-cpu-hotplug.dsl +0 -78
- package/bios/seabios/src/fw/acpi-dsdt-dbug.dsl +0 -26
- package/bios/seabios/src/fw/acpi-dsdt-hpet.dsl +0 -36
- package/bios/seabios/src/fw/acpi-dsdt-isa.dsl +0 -102
- package/bios/seabios/src/fw/acpi-dsdt-pci-crs.dsl +0 -90
- package/bios/seabios/src/fw/acpi-dsdt.dsl +0 -342
- package/bios/seabios/src/fw/acpi-dsdt.hex +0 -554
- package/bios/seabios/src/fw/acpi.c +0 -685
- package/bios/seabios/src/fw/biostables.c +0 -491
- package/bios/seabios/src/fw/coreboot.c +0 -569
- package/bios/seabios/src/fw/csm.c +0 -347
- package/bios/seabios/src/fw/dev-pci.h +0 -52
- package/bios/seabios/src/fw/dev-piix.h +0 -29
- package/bios/seabios/src/fw/dev-q35.h +0 -52
- package/bios/seabios/src/fw/lzmadecode.c +0 -398
- package/bios/seabios/src/fw/lzmadecode.h +0 -67
- package/bios/seabios/src/fw/mptable.c +0 -197
- package/bios/seabios/src/fw/mtrr.c +0 -105
- package/bios/seabios/src/fw/multiboot.c +0 -111
- package/bios/seabios/src/fw/paravirt.c +0 -624
- package/bios/seabios/src/fw/paravirt.h +0 -63
- package/bios/seabios/src/fw/pciinit.c +0 -1187
- package/bios/seabios/src/fw/pirtable.c +0 -103
- package/bios/seabios/src/fw/q35-acpi-dsdt.dsl +0 -450
- package/bios/seabios/src/fw/romfile_loader.c +0 -259
- package/bios/seabios/src/fw/romfile_loader.h +0 -91
- package/bios/seabios/src/fw/shadow.c +0 -208
- package/bios/seabios/src/fw/smbios.c +0 -585
- package/bios/seabios/src/fw/smm.c +0 -269
- package/bios/seabios/src/fw/smp.c +0 -194
- package/bios/seabios/src/fw/ssdt-misc.dsl +0 -104
- package/bios/seabios/src/fw/ssdt-misc.hex +0 -88
- package/bios/seabios/src/fw/ssdt-pcihp.dsl +0 -36
- package/bios/seabios/src/fw/ssdt-pcihp.hex +0 -38
- package/bios/seabios/src/fw/ssdt-proc.dsl +0 -48
- package/bios/seabios/src/fw/ssdt-proc.hex +0 -35
- package/bios/seabios/src/fw/xen.c +0 -149
- package/bios/seabios/src/fw/xen.h +0 -125
- package/bios/seabios/src/gen-defs.h +0 -19
- package/bios/seabios/src/hw/ahci.c +0 -697
- package/bios/seabios/src/hw/ahci.h +0 -201
- package/bios/seabios/src/hw/ata.c +0 -1046
- package/bios/seabios/src/hw/ata.h +0 -163
- package/bios/seabios/src/hw/blockcmd.c +0 -372
- package/bios/seabios/src/hw/blockcmd.h +0 -114
- package/bios/seabios/src/hw/dma.c +0 -67
- package/bios/seabios/src/hw/esp-scsi.c +0 -241
- package/bios/seabios/src/hw/esp-scsi.h +0 -8
- package/bios/seabios/src/hw/floppy.c +0 -741
- package/bios/seabios/src/hw/lsi-scsi.c +0 -221
- package/bios/seabios/src/hw/lsi-scsi.h +0 -8
- package/bios/seabios/src/hw/megasas.c +0 -405
- package/bios/seabios/src/hw/megasas.h +0 -8
- package/bios/seabios/src/hw/mpt-scsi.c +0 -319
- package/bios/seabios/src/hw/mpt-scsi.h +0 -8
- package/bios/seabios/src/hw/nvme-int.h +0 -199
- package/bios/seabios/src/hw/nvme.c +0 -708
- package/bios/seabios/src/hw/nvme.h +0 -17
- package/bios/seabios/src/hw/pci.c +0 -133
- package/bios/seabios/src/hw/pci.h +0 -47
- package/bios/seabios/src/hw/pci_ids.h +0 -2632
- package/bios/seabios/src/hw/pci_regs.h +0 -556
- package/bios/seabios/src/hw/pcidevice.c +0 -192
- package/bios/seabios/src/hw/pcidevice.h +0 -76
- package/bios/seabios/src/hw/pic.c +0 -115
- package/bios/seabios/src/hw/pic.h +0 -60
- package/bios/seabios/src/hw/ps2port.c +0 -543
- package/bios/seabios/src/hw/ps2port.h +0 -67
- package/bios/seabios/src/hw/pvscsi.c +0 -333
- package/bios/seabios/src/hw/pvscsi.h +0 -8
- package/bios/seabios/src/hw/ramdisk.c +0 -108
- package/bios/seabios/src/hw/rtc.c +0 -100
- package/bios/seabios/src/hw/rtc.h +0 -75
- package/bios/seabios/src/hw/sdcard.c +0 -572
- package/bios/seabios/src/hw/serialio.c +0 -113
- package/bios/seabios/src/hw/serialio.h +0 -29
- package/bios/seabios/src/hw/timer.c +0 -259
- package/bios/seabios/src/hw/tpm_drivers.c +0 -636
- package/bios/seabios/src/hw/tpm_drivers.h +0 -127
- package/bios/seabios/src/hw/usb-ehci.c +0 -650
- package/bios/seabios/src/hw/usb-ehci.h +0 -177
- package/bios/seabios/src/hw/usb-hid.c +0 -442
- package/bios/seabios/src/hw/usb-hid.h +0 -29
- package/bios/seabios/src/hw/usb-hub.c +0 -205
- package/bios/seabios/src/hw/usb-hub.h +0 -64
- package/bios/seabios/src/hw/usb-msc.c +0 -222
- package/bios/seabios/src/hw/usb-msc.h +0 -10
- package/bios/seabios/src/hw/usb-ohci.c +0 -568
- package/bios/seabios/src/hw/usb-ohci.h +0 -144
- package/bios/seabios/src/hw/usb-uas.c +0 -289
- package/bios/seabios/src/hw/usb-uas.h +0 -9
- package/bios/seabios/src/hw/usb-uhci.c +0 -571
- package/bios/seabios/src/hw/usb-uhci.h +0 -128
- package/bios/seabios/src/hw/usb-xhci.c +0 -1161
- package/bios/seabios/src/hw/usb-xhci.h +0 -133
- package/bios/seabios/src/hw/usb.c +0 -499
- package/bios/seabios/src/hw/usb.h +0 -254
- package/bios/seabios/src/hw/virtio-blk.c +0 -211
- package/bios/seabios/src/hw/virtio-blk.h +0 -43
- package/bios/seabios/src/hw/virtio-pci.c +0 -501
- package/bios/seabios/src/hw/virtio-pci.h +0 -151
- package/bios/seabios/src/hw/virtio-ring.c +0 -147
- package/bios/seabios/src/hw/virtio-ring.h +0 -121
- package/bios/seabios/src/hw/virtio-scsi.c +0 -220
- package/bios/seabios/src/hw/virtio-scsi.h +0 -47
- package/bios/seabios/src/jpeg.c +0 -1055
- package/bios/seabios/src/kbd.c +0 -599
- package/bios/seabios/src/list.h +0 -91
- package/bios/seabios/src/malloc.c +0 -561
- package/bios/seabios/src/malloc.h +0 -70
- package/bios/seabios/src/memmap.h +0 -21
- package/bios/seabios/src/misc.c +0 -195
- package/bios/seabios/src/mouse.c +0 -342
- package/bios/seabios/src/optionroms.c +0 -475
- package/bios/seabios/src/output.c +0 -584
- package/bios/seabios/src/output.h +0 -68
- package/bios/seabios/src/pcibios.c +0 -241
- package/bios/seabios/src/pmm.c +0 -176
- package/bios/seabios/src/pnpbios.c +0 -88
- package/bios/seabios/src/post.c +0 -337
- package/bios/seabios/src/resume.c +0 -157
- package/bios/seabios/src/romfile.c +0 -146
- package/bios/seabios/src/romfile.h +0 -21
- package/bios/seabios/src/romlayout.S +0 -698
- package/bios/seabios/src/sercon.c +0 -677
- package/bios/seabios/src/serial.c +0 -317
- package/bios/seabios/src/sha1.c +0 -147
- package/bios/seabios/src/sha1.h +0 -8
- package/bios/seabios/src/stacks.c +0 -771
- package/bios/seabios/src/stacks.h +0 -68
- package/bios/seabios/src/std/LegacyBios.h +0 -985
- package/bios/seabios/src/std/acpi.h +0 -323
- package/bios/seabios/src/std/bda.h +0 -174
- package/bios/seabios/src/std/disk.h +0 -175
- package/bios/seabios/src/std/mptable.h +0 -77
- package/bios/seabios/src/std/multiboot.h +0 -260
- package/bios/seabios/src/std/optionrom.h +0 -59
- package/bios/seabios/src/std/pirtable.h +0 -35
- package/bios/seabios/src/std/pmm.h +0 -19
- package/bios/seabios/src/std/pnpbios.h +0 -24
- package/bios/seabios/src/std/smbios.h +0 -167
- package/bios/seabios/src/std/tcg.h +0 -554
- package/bios/seabios/src/std/vbe.h +0 -156
- package/bios/seabios/src/std/vga.h +0 -63
- package/bios/seabios/src/string.c +0 -251
- package/bios/seabios/src/string.h +0 -31
- package/bios/seabios/src/system.c +0 -357
- package/bios/seabios/src/tcgbios.c +0 -2014
- package/bios/seabios/src/tcgbios.h +0 -19
- package/bios/seabios/src/types.h +0 -156
- package/bios/seabios/src/util.h +0 -251
- package/bios/seabios/src/version.c +0 -5
- package/bios/seabios/src/vgahooks.c +0 -355
- package/bios/seabios/src/x86.c +0 -23
- package/bios/seabios/src/x86.h +0 -277
- package/bios/seabios/vgasrc/Kconfig +0 -211
- package/bios/seabios/vgasrc/bochsdisplay.c +0 -59
- package/bios/seabios/vgasrc/bochsvga.c +0 -447
- package/bios/seabios/vgasrc/bochsvga.h +0 -57
- package/bios/seabios/vgasrc/cbvga.c +0 -337
- package/bios/seabios/vgasrc/clext.c +0 -627
- package/bios/seabios/vgasrc/geodevga.c +0 -434
- package/bios/seabios/vgasrc/geodevga.h +0 -89
- package/bios/seabios/vgasrc/ramfb.c +0 -163
- package/bios/seabios/vgasrc/stdvga.c +0 -485
- package/bios/seabios/vgasrc/stdvga.h +0 -81
- package/bios/seabios/vgasrc/stdvgaio.c +0 -186
- package/bios/seabios/vgasrc/stdvgamodes.c +0 -534
- package/bios/seabios/vgasrc/swcursor.c +0 -96
- package/bios/seabios/vgasrc/vbe.c +0 -432
- package/bios/seabios/vgasrc/vgabios.c +0 -1131
- package/bios/seabios/vgasrc/vgabios.h +0 -88
- package/bios/seabios/vgasrc/vgaentry.S +0 -161
- package/bios/seabios/vgasrc/vgafb.c +0 -661
- package/bios/seabios/vgasrc/vgafb.h +0 -42
- package/bios/seabios/vgasrc/vgafonts.c +0 -785
- package/bios/seabios/vgasrc/vgahw.h +0 -152
- package/bios/seabios/vgasrc/vgainit.c +0 -202
- package/bios/seabios/vgasrc/vgalayout.lds.S +0 -23
- package/bios/seabios/vgasrc/vgautil.h +0 -103
- package/bios/seabios/vgasrc/vgaversion.c +0 -6
- package/bios/seabios-debug.bin +0 -0
- package/bios/seabios-debug.config +0 -117
- package/bios/seabios.bin +0 -0
- package/bios/seabios.config +0 -114
- package/bios/vgabios-debug.bin +0 -0
- package/bios/vgabios.bin +0 -0
- package/build/binaries.js +0 -1
- package/build/index-debug.cjs +0 -1
- package/build/index-debug.js +0 -1
- package/build/index.cjs +0 -1
- package/build/index.js +0 -1
- package/v86.css +0 -259
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
// Coreboot interface support.
|
|
2
|
-
//
|
|
3
|
-
// Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
|
|
4
|
-
//
|
|
5
|
-
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
|
6
|
-
|
|
7
|
-
#include "block.h" // MAXDESCSIZE
|
|
8
|
-
#include "byteorder.h" // be32_to_cpu
|
|
9
|
-
#include "config.h" // CONFIG_*
|
|
10
|
-
#include "e820map.h" // e820_add
|
|
11
|
-
#include "hw/pcidevice.h" // pci_probe_devices
|
|
12
|
-
#include "lzmadecode.h" // LzmaDecode
|
|
13
|
-
#include "malloc.h" // free
|
|
14
|
-
#include "output.h" // dprintf
|
|
15
|
-
#include "paravirt.h" // PlatformRunningOn
|
|
16
|
-
#include "romfile.h" // romfile_findprefix
|
|
17
|
-
#include "stacks.h" // yield
|
|
18
|
-
#include "string.h" // memset
|
|
19
|
-
#include "util.h" // coreboot_preinit
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/****************************************************************
|
|
23
|
-
* Memory map
|
|
24
|
-
****************************************************************/
|
|
25
|
-
|
|
26
|
-
struct cb_header {
|
|
27
|
-
u32 signature;
|
|
28
|
-
u32 header_bytes;
|
|
29
|
-
u32 header_checksum;
|
|
30
|
-
u32 table_bytes;
|
|
31
|
-
u32 table_checksum;
|
|
32
|
-
u32 table_entries;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
#define CB_SIGNATURE 0x4f49424C // "LBIO"
|
|
36
|
-
|
|
37
|
-
struct cb_memory_range {
|
|
38
|
-
u64 start;
|
|
39
|
-
u64 size;
|
|
40
|
-
u32 type;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
#define CB_MEM_TABLE 16
|
|
44
|
-
|
|
45
|
-
struct cb_memory {
|
|
46
|
-
u32 tag;
|
|
47
|
-
u32 size;
|
|
48
|
-
struct cb_memory_range map[0];
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
#define CB_TAG_MEMORY 0x01
|
|
52
|
-
|
|
53
|
-
#define MEM_RANGE_COUNT(_rec) \
|
|
54
|
-
(((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))
|
|
55
|
-
|
|
56
|
-
struct cb_mainboard {
|
|
57
|
-
u32 tag;
|
|
58
|
-
u32 size;
|
|
59
|
-
u8 vendor_idx;
|
|
60
|
-
u8 part_idx;
|
|
61
|
-
char strings[0];
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
#define CB_TAG_MAINBOARD 0x0003
|
|
65
|
-
|
|
66
|
-
struct cb_forward {
|
|
67
|
-
u32 tag;
|
|
68
|
-
u32 size;
|
|
69
|
-
u64 forward;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
#define CB_TAG_FORWARD 0x11
|
|
73
|
-
|
|
74
|
-
struct cb_cbmem_ref {
|
|
75
|
-
u32 tag;
|
|
76
|
-
u32 size;
|
|
77
|
-
u64 cbmem_addr;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
#define CB_TAG_CBMEM_CONSOLE 0x17
|
|
81
|
-
|
|
82
|
-
struct cbmem_console {
|
|
83
|
-
u32 size;
|
|
84
|
-
u32 cursor;
|
|
85
|
-
u8 body[0];
|
|
86
|
-
} PACKED;
|
|
87
|
-
#define CBMC_CURSOR_MASK ((1 << 28) - 1)
|
|
88
|
-
#define CBMC_OVERFLOW (1 << 31)
|
|
89
|
-
static struct cbmem_console *cbcon = NULL;
|
|
90
|
-
|
|
91
|
-
static u16
|
|
92
|
-
ipchksum(char *buf, int count)
|
|
93
|
-
{
|
|
94
|
-
u16 *p = (u16*)buf;
|
|
95
|
-
u32 sum = 0;
|
|
96
|
-
while (count > 1) {
|
|
97
|
-
sum += GET_FARVAR(0, *p);
|
|
98
|
-
p++;
|
|
99
|
-
count -= 2;
|
|
100
|
-
}
|
|
101
|
-
if (count)
|
|
102
|
-
sum += GET_FARVAR(0, *(u8*)p);
|
|
103
|
-
sum = (sum >> 16) + (sum & 0xffff);
|
|
104
|
-
sum += (sum >> 16);
|
|
105
|
-
return ~sum;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Try to locate the coreboot header in a given address range.
|
|
109
|
-
static struct cb_header *
|
|
110
|
-
find_cb_header(u32 addr, int len)
|
|
111
|
-
{
|
|
112
|
-
u32 end = addr + len;
|
|
113
|
-
for (; addr < end; addr += 16) {
|
|
114
|
-
struct cb_header *cbh = (void*)addr;
|
|
115
|
-
if (GET_FARVAR(0, cbh->signature) != CB_SIGNATURE)
|
|
116
|
-
continue;
|
|
117
|
-
u32 tsize = GET_FARVAR(0, cbh->table_bytes);
|
|
118
|
-
if (! tsize)
|
|
119
|
-
continue;
|
|
120
|
-
if (ipchksum((void*)addr, sizeof(*cbh)) != 0)
|
|
121
|
-
continue;
|
|
122
|
-
if (ipchksum((void*)addr + sizeof(*cbh), tsize)
|
|
123
|
-
!= GET_FARVAR(0, cbh->table_checksum))
|
|
124
|
-
continue;
|
|
125
|
-
return cbh;
|
|
126
|
-
}
|
|
127
|
-
return NULL;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Try to find the coreboot memory table in the given coreboot table.
|
|
131
|
-
void *
|
|
132
|
-
find_cb_subtable(struct cb_header *cbh, u32 tag)
|
|
133
|
-
{
|
|
134
|
-
char *tbl = (char *)cbh + sizeof(*cbh);
|
|
135
|
-
u32 count = GET_FARVAR(0, cbh->table_entries);
|
|
136
|
-
int i;
|
|
137
|
-
for (i=0; i<count; i++) {
|
|
138
|
-
struct cb_memory *cbm = (void*)tbl;
|
|
139
|
-
tbl += GET_FARVAR(0, cbm->size);
|
|
140
|
-
if (GET_FARVAR(0, cbm->tag) == tag)
|
|
141
|
-
return cbm;
|
|
142
|
-
}
|
|
143
|
-
return NULL;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
struct cb_header *
|
|
147
|
-
find_cb_table(void)
|
|
148
|
-
{
|
|
149
|
-
struct cb_header *cbh = find_cb_header(0, 0x1000);
|
|
150
|
-
if (!cbh)
|
|
151
|
-
return NULL;
|
|
152
|
-
struct cb_forward *cbf = find_cb_subtable(cbh, CB_TAG_FORWARD);
|
|
153
|
-
if (cbf) {
|
|
154
|
-
dprintf(3, "Found coreboot table forwarder.\n");
|
|
155
|
-
cbh = find_cb_header(GET_FARVAR(0, cbf->forward), 0x100);
|
|
156
|
-
if (!cbh)
|
|
157
|
-
return NULL;
|
|
158
|
-
}
|
|
159
|
-
return cbh;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
static struct cb_memory *CBMemTable;
|
|
163
|
-
const char *CBvendor = "", *CBpart = "";
|
|
164
|
-
|
|
165
|
-
// Populate max ram and e820 map info by scanning for a coreboot table.
|
|
166
|
-
void
|
|
167
|
-
coreboot_preinit(void)
|
|
168
|
-
{
|
|
169
|
-
if (!CONFIG_COREBOOT)
|
|
170
|
-
return;
|
|
171
|
-
|
|
172
|
-
dprintf(3, "Attempting to find coreboot table\n");
|
|
173
|
-
|
|
174
|
-
// Find coreboot table.
|
|
175
|
-
struct cb_header *cbh = find_cb_table();
|
|
176
|
-
if (!cbh)
|
|
177
|
-
goto fail;
|
|
178
|
-
dprintf(3, "Now attempting to find coreboot memory map\n");
|
|
179
|
-
struct cb_memory *cbm = CBMemTable = find_cb_subtable(cbh, CB_TAG_MEMORY);
|
|
180
|
-
if (!cbm)
|
|
181
|
-
goto fail;
|
|
182
|
-
|
|
183
|
-
int i, count = MEM_RANGE_COUNT(cbm);
|
|
184
|
-
for (i=0; i<count; i++) {
|
|
185
|
-
struct cb_memory_range *m = &cbm->map[i];
|
|
186
|
-
u32 type = m->type;
|
|
187
|
-
if (type == CB_MEM_TABLE)
|
|
188
|
-
type = E820_RESERVED;
|
|
189
|
-
e820_add(m->start, m->size, type);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Ughh - coreboot likes to set a map at 0x0000-0x1000, but this
|
|
193
|
-
// confuses grub. So, override it.
|
|
194
|
-
e820_add(0, 16*1024, E820_RAM);
|
|
195
|
-
|
|
196
|
-
struct cb_cbmem_ref *cbref = find_cb_subtable(cbh, CB_TAG_CBMEM_CONSOLE);
|
|
197
|
-
if (cbref) {
|
|
198
|
-
cbcon = (void*)(u32)cbref->cbmem_addr;
|
|
199
|
-
debug_banner();
|
|
200
|
-
dprintf(1, "Found coreboot cbmem console @ %llx\n", cbref->cbmem_addr);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
struct cb_mainboard *cbmb = find_cb_subtable(cbh, CB_TAG_MAINBOARD);
|
|
204
|
-
if (cbmb) {
|
|
205
|
-
CBvendor = &cbmb->strings[cbmb->vendor_idx];
|
|
206
|
-
CBpart = &cbmb->strings[cbmb->part_idx];
|
|
207
|
-
dprintf(1, "Found mainboard %s %s\n", CBvendor, CBpart);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return;
|
|
211
|
-
|
|
212
|
-
fail:
|
|
213
|
-
// No table found.. Use 16Megs as a dummy value.
|
|
214
|
-
dprintf(1, "Unable to find coreboot table!\n");
|
|
215
|
-
e820_add(0, 16*1024*1024, E820_RAM);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
void coreboot_debug_putc(char c)
|
|
220
|
-
{
|
|
221
|
-
if (!CONFIG_DEBUG_COREBOOT)
|
|
222
|
-
return;
|
|
223
|
-
if (!cbcon)
|
|
224
|
-
return;
|
|
225
|
-
u32 cursor = cbcon->cursor & CBMC_CURSOR_MASK;
|
|
226
|
-
u32 flags = cbcon->cursor & ~CBMC_CURSOR_MASK;
|
|
227
|
-
if (cursor >= cbcon->size)
|
|
228
|
-
return; // Old coreboot version with legacy overflow mechanism.
|
|
229
|
-
cbcon->body[cursor++] = c;
|
|
230
|
-
if (cursor >= cbcon->size) {
|
|
231
|
-
cursor = 0;
|
|
232
|
-
flags |= CBMC_OVERFLOW;
|
|
233
|
-
}
|
|
234
|
-
cbcon->cursor = flags | cursor;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/****************************************************************
|
|
238
|
-
* BIOS table copying
|
|
239
|
-
****************************************************************/
|
|
240
|
-
|
|
241
|
-
// Attempt to find (and relocate) any standard bios tables found in a
|
|
242
|
-
// given address range.
|
|
243
|
-
static void
|
|
244
|
-
scan_tables(u32 start, u32 size)
|
|
245
|
-
{
|
|
246
|
-
void *p = (void*)ALIGN(start, 16);
|
|
247
|
-
void *end = (void*)start + size;
|
|
248
|
-
for (; p<end; p += 16)
|
|
249
|
-
copy_table(p);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
void
|
|
253
|
-
coreboot_platform_setup(void)
|
|
254
|
-
{
|
|
255
|
-
if (!CONFIG_COREBOOT)
|
|
256
|
-
return;
|
|
257
|
-
pci_probe_devices();
|
|
258
|
-
|
|
259
|
-
struct cb_memory *cbm = CBMemTable;
|
|
260
|
-
if (!cbm)
|
|
261
|
-
return;
|
|
262
|
-
|
|
263
|
-
dprintf(3, "Relocating coreboot bios tables\n");
|
|
264
|
-
|
|
265
|
-
// Scan CB_MEM_TABLE areas for bios tables.
|
|
266
|
-
int i, count = MEM_RANGE_COUNT(cbm);
|
|
267
|
-
for (i=0; i<count; i++) {
|
|
268
|
-
struct cb_memory_range *m = &cbm->map[i];
|
|
269
|
-
if (m->type == CB_MEM_TABLE)
|
|
270
|
-
scan_tables(m->start, m->size);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
find_acpi_features();
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
/****************************************************************
|
|
278
|
-
* ulzma
|
|
279
|
-
****************************************************************/
|
|
280
|
-
|
|
281
|
-
// Uncompress data in flash to an area of memory.
|
|
282
|
-
static int
|
|
283
|
-
ulzma(u8 *dst, u32 maxlen, const u8 *src, u32 srclen)
|
|
284
|
-
{
|
|
285
|
-
dprintf(3, "Uncompressing data %d@%p to %d@%p\n", srclen, src, maxlen, dst);
|
|
286
|
-
CLzmaDecoderState state;
|
|
287
|
-
int ret = LzmaDecodeProperties(&state.Properties, src, LZMA_PROPERTIES_SIZE);
|
|
288
|
-
if (ret != LZMA_RESULT_OK) {
|
|
289
|
-
dprintf(1, "LzmaDecodeProperties error - %d\n", ret);
|
|
290
|
-
return -1;
|
|
291
|
-
}
|
|
292
|
-
u8 scratch[15980];
|
|
293
|
-
int need = (LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
|
|
294
|
-
if (need > sizeof(scratch)) {
|
|
295
|
-
dprintf(1, "LzmaDecode need %d have %d\n", need, (unsigned int)sizeof(scratch));
|
|
296
|
-
return -1;
|
|
297
|
-
}
|
|
298
|
-
state.Probs = (CProb *)scratch;
|
|
299
|
-
|
|
300
|
-
u32 dstlen = *(u32*)(src + LZMA_PROPERTIES_SIZE);
|
|
301
|
-
if (dstlen > maxlen) {
|
|
302
|
-
dprintf(1, "LzmaDecode too large (max %d need %d)\n", maxlen, dstlen);
|
|
303
|
-
return -1;
|
|
304
|
-
}
|
|
305
|
-
u32 inProcessed, outProcessed;
|
|
306
|
-
ret = LzmaDecode(&state, src + LZMA_PROPERTIES_SIZE + 8, srclen
|
|
307
|
-
, &inProcessed, dst, dstlen, &outProcessed);
|
|
308
|
-
if (ret) {
|
|
309
|
-
dprintf(1, "LzmaDecode returned %d\n", ret);
|
|
310
|
-
return -1;
|
|
311
|
-
}
|
|
312
|
-
return dstlen;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
/****************************************************************
|
|
317
|
-
* Coreboot flash format
|
|
318
|
-
****************************************************************/
|
|
319
|
-
|
|
320
|
-
#define CBFS_HEADER_MAGIC 0x4F524243
|
|
321
|
-
#define CBFS_VERSION1 0x31313131
|
|
322
|
-
|
|
323
|
-
struct cbfs_header {
|
|
324
|
-
u32 magic;
|
|
325
|
-
u32 version;
|
|
326
|
-
u32 romsize;
|
|
327
|
-
u32 bootblocksize;
|
|
328
|
-
u32 align;
|
|
329
|
-
u32 offset;
|
|
330
|
-
u32 pad[2];
|
|
331
|
-
} PACKED;
|
|
332
|
-
|
|
333
|
-
#define CBFS_FILE_MAGIC 0x455649484352414cLL // LARCHIVE
|
|
334
|
-
|
|
335
|
-
struct cbfs_file {
|
|
336
|
-
u64 magic;
|
|
337
|
-
u32 len;
|
|
338
|
-
u32 type;
|
|
339
|
-
u32 checksum;
|
|
340
|
-
u32 offset;
|
|
341
|
-
char filename[0];
|
|
342
|
-
} PACKED;
|
|
343
|
-
|
|
344
|
-
struct cbfs_romfile_s {
|
|
345
|
-
struct romfile_s file;
|
|
346
|
-
struct cbfs_file *fhdr;
|
|
347
|
-
void *data;
|
|
348
|
-
u32 rawsize, flags;
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
// Copy a file to memory (uncompressing if necessary)
|
|
352
|
-
static int
|
|
353
|
-
cbfs_copyfile(struct romfile_s *file, void *dst, u32 maxlen)
|
|
354
|
-
{
|
|
355
|
-
if (!CONFIG_COREBOOT_FLASH)
|
|
356
|
-
return -1;
|
|
357
|
-
|
|
358
|
-
struct cbfs_romfile_s *cfile;
|
|
359
|
-
cfile = container_of(file, struct cbfs_romfile_s, file);
|
|
360
|
-
u32 size = cfile->rawsize;
|
|
361
|
-
void *src = cfile->data;
|
|
362
|
-
if (cfile->flags) {
|
|
363
|
-
// Compressed - copy to temp ram and uncompress it.
|
|
364
|
-
void *temp = malloc_tmphigh(size);
|
|
365
|
-
if (!temp) {
|
|
366
|
-
warn_noalloc();
|
|
367
|
-
return -1;
|
|
368
|
-
}
|
|
369
|
-
iomemcpy(temp, src, size);
|
|
370
|
-
int ret = ulzma(dst, maxlen, temp, size);
|
|
371
|
-
yield();
|
|
372
|
-
free(temp);
|
|
373
|
-
return ret;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// Not compressed.
|
|
377
|
-
dprintf(3, "Copying data %d@%p to %d@%p\n", size, src, maxlen, dst);
|
|
378
|
-
if (size > maxlen) {
|
|
379
|
-
warn_noalloc();
|
|
380
|
-
return -1;
|
|
381
|
-
}
|
|
382
|
-
iomemcpy(dst, src, size);
|
|
383
|
-
return size;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// Process CBFS links file. The links file is a newline separated
|
|
387
|
-
// file where each line has a "link name" and a "destination name"
|
|
388
|
-
// separated by a space character.
|
|
389
|
-
static void
|
|
390
|
-
process_links_file(void)
|
|
391
|
-
{
|
|
392
|
-
char *links = romfile_loadfile("links", NULL), *next = links;
|
|
393
|
-
while (next) {
|
|
394
|
-
// Parse out linkname and destname
|
|
395
|
-
char *linkname = next;
|
|
396
|
-
next = strchr(linkname, '\n');
|
|
397
|
-
if (next)
|
|
398
|
-
*next++ = '\0';
|
|
399
|
-
char *comment = strchr(linkname, '#');
|
|
400
|
-
if (comment)
|
|
401
|
-
*comment = '\0';
|
|
402
|
-
linkname = nullTrailingSpace(linkname);
|
|
403
|
-
char *destname = strchr(linkname, ' ');
|
|
404
|
-
if (!destname)
|
|
405
|
-
continue;
|
|
406
|
-
*destname++ = '\0';
|
|
407
|
-
destname = nullTrailingSpace(destname);
|
|
408
|
-
// Lookup destname and create new romfile entry for linkname
|
|
409
|
-
struct romfile_s *ufile = romfile_find(destname);
|
|
410
|
-
if (!ufile)
|
|
411
|
-
continue;
|
|
412
|
-
struct cbfs_romfile_s *cufile
|
|
413
|
-
= container_of(ufile, struct cbfs_romfile_s, file);
|
|
414
|
-
struct cbfs_romfile_s *cfile = malloc_tmp(sizeof(*cfile));
|
|
415
|
-
if (!cfile) {
|
|
416
|
-
warn_noalloc();
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
memcpy(cfile, cufile, sizeof(*cfile));
|
|
420
|
-
strtcpy(cfile->file.name, linkname, sizeof(cfile->file.name));
|
|
421
|
-
romfile_add(&cfile->file);
|
|
422
|
-
}
|
|
423
|
-
free(links);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
void
|
|
427
|
-
coreboot_cbfs_init(void)
|
|
428
|
-
{
|
|
429
|
-
if (!CONFIG_COREBOOT_FLASH)
|
|
430
|
-
return;
|
|
431
|
-
|
|
432
|
-
struct cbfs_header *hdr = *(void **)(CONFIG_CBFS_LOCATION - 4);
|
|
433
|
-
if ((u32)hdr & 0x03) {
|
|
434
|
-
dprintf(1, "Invalid CBFS pointer %p\n", hdr);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
if (CONFIG_CBFS_LOCATION && (u32)hdr > CONFIG_CBFS_LOCATION)
|
|
438
|
-
// Looks like the pointer is relative to CONFIG_CBFS_LOCATION
|
|
439
|
-
hdr = (void*)hdr + CONFIG_CBFS_LOCATION;
|
|
440
|
-
if (hdr->magic != cpu_to_be32(CBFS_HEADER_MAGIC)) {
|
|
441
|
-
dprintf(1, "Unable to find CBFS (ptr=%p; got %x not %x)\n"
|
|
442
|
-
, hdr, hdr->magic, cpu_to_be32(CBFS_HEADER_MAGIC));
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
dprintf(1, "Found CBFS header at %p\n", hdr);
|
|
446
|
-
|
|
447
|
-
u32 romsize = be32_to_cpu(hdr->romsize);
|
|
448
|
-
u32 romstart = CONFIG_CBFS_LOCATION - romsize;
|
|
449
|
-
struct cbfs_file *fhdr = (void*)romstart + be32_to_cpu(hdr->offset);
|
|
450
|
-
for (;;) {
|
|
451
|
-
if ((u32)fhdr - romstart > romsize)
|
|
452
|
-
break;
|
|
453
|
-
u64 magic = fhdr->magic;
|
|
454
|
-
if (magic != CBFS_FILE_MAGIC)
|
|
455
|
-
break;
|
|
456
|
-
struct cbfs_romfile_s *cfile = malloc_tmp(sizeof(*cfile));
|
|
457
|
-
if (!cfile) {
|
|
458
|
-
warn_noalloc();
|
|
459
|
-
break;
|
|
460
|
-
}
|
|
461
|
-
memset(cfile, 0, sizeof(*cfile));
|
|
462
|
-
strtcpy(cfile->file.name, fhdr->filename, sizeof(cfile->file.name));
|
|
463
|
-
cfile->file.size = cfile->rawsize = be32_to_cpu(fhdr->len);
|
|
464
|
-
cfile->fhdr = fhdr;
|
|
465
|
-
cfile->file.copy = cbfs_copyfile;
|
|
466
|
-
cfile->data = (void*)fhdr + be32_to_cpu(fhdr->offset);
|
|
467
|
-
int len = strlen(cfile->file.name);
|
|
468
|
-
if (len > 5 && strcmp(&cfile->file.name[len-5], ".lzma") == 0) {
|
|
469
|
-
// Using compression.
|
|
470
|
-
cfile->flags = 1;
|
|
471
|
-
cfile->file.name[len-5] = '\0';
|
|
472
|
-
cfile->file.size = *(u32*)(cfile->data + LZMA_PROPERTIES_SIZE);
|
|
473
|
-
}
|
|
474
|
-
romfile_add(&cfile->file);
|
|
475
|
-
|
|
476
|
-
fhdr = (void*)ALIGN((u32)cfile->data + cfile->rawsize
|
|
477
|
-
, be32_to_cpu(hdr->align));
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
process_links_file();
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
struct cbfs_payload_segment {
|
|
484
|
-
u32 type;
|
|
485
|
-
u32 compression;
|
|
486
|
-
u32 offset;
|
|
487
|
-
u64 load_addr;
|
|
488
|
-
u32 len;
|
|
489
|
-
u32 mem_len;
|
|
490
|
-
} PACKED;
|
|
491
|
-
|
|
492
|
-
#define PAYLOAD_SEGMENT_BSS 0x20535342
|
|
493
|
-
#define PAYLOAD_SEGMENT_ENTRY 0x52544E45
|
|
494
|
-
|
|
495
|
-
#define CBFS_COMPRESS_NONE 0
|
|
496
|
-
#define CBFS_COMPRESS_LZMA 1
|
|
497
|
-
|
|
498
|
-
struct cbfs_payload {
|
|
499
|
-
struct cbfs_payload_segment segments[1];
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
void
|
|
503
|
-
cbfs_run_payload(struct cbfs_file *fhdr)
|
|
504
|
-
{
|
|
505
|
-
if (!CONFIG_COREBOOT_FLASH || !fhdr)
|
|
506
|
-
return;
|
|
507
|
-
dprintf(1, "Run %s\n", fhdr->filename);
|
|
508
|
-
struct cbfs_payload *pay = (void*)fhdr + be32_to_cpu(fhdr->offset);
|
|
509
|
-
struct cbfs_payload_segment *seg = pay->segments;
|
|
510
|
-
for (;;) {
|
|
511
|
-
void *src = (void*)pay + be32_to_cpu(seg->offset);
|
|
512
|
-
void *dest = (void*)(u32)be64_to_cpu(seg->load_addr);
|
|
513
|
-
u32 src_len = be32_to_cpu(seg->len);
|
|
514
|
-
u32 dest_len = be32_to_cpu(seg->mem_len);
|
|
515
|
-
switch (seg->type) {
|
|
516
|
-
case PAYLOAD_SEGMENT_BSS:
|
|
517
|
-
dprintf(3, "BSS segment %d@%p\n", dest_len, dest);
|
|
518
|
-
memset(dest, 0, dest_len);
|
|
519
|
-
break;
|
|
520
|
-
case PAYLOAD_SEGMENT_ENTRY: {
|
|
521
|
-
dprintf(1, "Calling addr %p\n", dest);
|
|
522
|
-
void (*func)(void) = dest;
|
|
523
|
-
func();
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
default:
|
|
527
|
-
dprintf(3, "Segment %x %d@%p -> %d@%p\n"
|
|
528
|
-
, seg->type, src_len, src, dest_len, dest);
|
|
529
|
-
if (seg->compression == cpu_to_be32(CBFS_COMPRESS_NONE)) {
|
|
530
|
-
if (src_len > dest_len)
|
|
531
|
-
src_len = dest_len;
|
|
532
|
-
memcpy(dest, src, src_len);
|
|
533
|
-
} else if (CONFIG_LZMA
|
|
534
|
-
&& seg->compression == cpu_to_be32(CBFS_COMPRESS_LZMA)) {
|
|
535
|
-
int ret = ulzma(dest, dest_len, src, src_len);
|
|
536
|
-
if (ret < 0)
|
|
537
|
-
return;
|
|
538
|
-
src_len = ret;
|
|
539
|
-
} else {
|
|
540
|
-
dprintf(1, "No support for compression type %x\n"
|
|
541
|
-
, seg->compression);
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
if (dest_len > src_len)
|
|
545
|
-
memset(dest + src_len, 0, dest_len - src_len);
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
548
|
-
seg++;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
// Register payloads in "img/" directory with boot system.
|
|
553
|
-
void
|
|
554
|
-
cbfs_payload_setup(void)
|
|
555
|
-
{
|
|
556
|
-
if (!CONFIG_COREBOOT_FLASH)
|
|
557
|
-
return;
|
|
558
|
-
struct romfile_s *file = NULL;
|
|
559
|
-
for (;;) {
|
|
560
|
-
file = romfile_findprefix("img/", file);
|
|
561
|
-
if (!file)
|
|
562
|
-
break;
|
|
563
|
-
struct cbfs_romfile_s *cfile;
|
|
564
|
-
cfile = container_of(file, struct cbfs_romfile_s, file);
|
|
565
|
-
const char *filename = file->name;
|
|
566
|
-
char *desc = znprintf(MAXDESCSIZE, "Payload [%s]", &filename[4]);
|
|
567
|
-
boot_add_cbfs(cfile->fhdr, desc, bootprio_find_named_rom(filename, 0));
|
|
568
|
-
}
|
|
569
|
-
}
|