v86 0.3.6 → 0.4.0
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 +17 -6
- package/bios/seabios/.config +113 -0
- package/bios/seabios/.config.old +114 -0
- package/bios/seabios/.gitignore +4 -0
- package/bios/seabios/COPYING +674 -0
- package/bios/seabios/COPYING.LESSER +165 -0
- package/bios/seabios/Makefile +286 -0
- package/bios/seabios/README +17 -0
- package/bios/seabios/docs/Build_overview.md +104 -0
- package/bios/seabios/docs/Contributing.md +20 -0
- package/bios/seabios/docs/Debugging.md +111 -0
- package/bios/seabios/docs/Developer_Documentation.md +25 -0
- package/bios/seabios/docs/Developer_links.md +86 -0
- package/bios/seabios/docs/Download.md +27 -0
- package/bios/seabios/docs/Execution_and_code_flow.md +178 -0
- package/bios/seabios/docs/Linking_overview.md +160 -0
- package/bios/seabios/docs/Mailinglist.md +8 -0
- package/bios/seabios/docs/Memory_Model.md +253 -0
- package/bios/seabios/docs/README +5 -0
- package/bios/seabios/docs/Releases.md +482 -0
- package/bios/seabios/docs/Runtime_config.md +193 -0
- package/bios/seabios/docs/SeaBIOS.md +17 -0
- package/bios/seabios/docs/SeaVGABIOS.md +39 -0
- package/bios/seabios/out/autoconf.h +117 -0
- 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 +69 -0
- package/bios/seabios/out/include/config/auto.conf.cmd +9 -0
- 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 +4 -0
- 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 +289 -0
- package/bios/seabios/out/scripts/kconfig/zconf.lex.c +2420 -0
- package/bios/seabios/out/scripts/kconfig/zconf.tab.c +2538 -0
- package/bios/seabios/out/scripts/kconfig/zconf.tab.o +0 -0
- package/bios/seabios/scripts/acpi_extract.py +366 -0
- package/bios/seabios/scripts/acpi_extract_preprocess.py +41 -0
- package/bios/seabios/scripts/buildrom.py +56 -0
- package/bios/seabios/scripts/buildversion.py +134 -0
- package/bios/seabios/scripts/checkrom.py +95 -0
- package/bios/seabios/scripts/checkstack.py +226 -0
- package/bios/seabios/scripts/checksum.py +16 -0
- package/bios/seabios/scripts/encodeint.py +21 -0
- package/bios/seabios/scripts/gen-offsets.sh +17 -0
- package/bios/seabios/scripts/kconfig/.gitignore +22 -0
- package/bios/seabios/scripts/kconfig/Makefile +331 -0
- package/bios/seabios/scripts/kconfig/POTFILES.in +12 -0
- package/bios/seabios/scripts/kconfig/check.sh +13 -0
- package/bios/seabios/scripts/kconfig/conf.c +718 -0
- package/bios/seabios/scripts/kconfig/confdata.c +1250 -0
- package/bios/seabios/scripts/kconfig/expr.c +1168 -0
- package/bios/seabios/scripts/kconfig/expr.h +241 -0
- package/bios/seabios/scripts/kconfig/gconf.c +1542 -0
- package/bios/seabios/scripts/kconfig/gconf.glade +661 -0
- package/bios/seabios/scripts/kconfig/images.c +326 -0
- package/bios/seabios/scripts/kconfig/kxgettext.c +235 -0
- package/bios/seabios/scripts/kconfig/lex.zconf.c +2430 -0
- package/bios/seabios/scripts/kconfig/list.h +131 -0
- package/bios/seabios/scripts/kconfig/lkc.h +200 -0
- package/bios/seabios/scripts/kconfig/lkc_proto.h +57 -0
- package/bios/seabios/scripts/kconfig/lxdialog/.gitignore +4 -0
- package/bios/seabios/scripts/kconfig/lxdialog/BIG.FAT.WARNING +4 -0
- package/bios/seabios/scripts/kconfig/lxdialog/check-lxdialog.sh +87 -0
- package/bios/seabios/scripts/kconfig/lxdialog/checklist.c +332 -0
- package/bios/seabios/scripts/kconfig/lxdialog/dialog.h +257 -0
- package/bios/seabios/scripts/kconfig/lxdialog/inputbox.c +301 -0
- package/bios/seabios/scripts/kconfig/lxdialog/menubox.c +437 -0
- package/bios/seabios/scripts/kconfig/lxdialog/textbox.c +408 -0
- package/bios/seabios/scripts/kconfig/lxdialog/util.c +713 -0
- package/bios/seabios/scripts/kconfig/lxdialog/yesno.c +114 -0
- package/bios/seabios/scripts/kconfig/mconf.c +1036 -0
- package/bios/seabios/scripts/kconfig/menu.c +697 -0
- package/bios/seabios/scripts/kconfig/merge_config.sh +150 -0
- package/bios/seabios/scripts/kconfig/nconf.c +1556 -0
- package/bios/seabios/scripts/kconfig/nconf.gui.c +656 -0
- package/bios/seabios/scripts/kconfig/nconf.h +96 -0
- package/bios/seabios/scripts/kconfig/qconf.cc +1795 -0
- package/bios/seabios/scripts/kconfig/qconf.h +338 -0
- package/bios/seabios/scripts/kconfig/streamline_config.pl +647 -0
- package/bios/seabios/scripts/kconfig/symbol.c +1373 -0
- package/bios/seabios/scripts/kconfig/util.c +157 -0
- package/bios/seabios/scripts/kconfig/zconf.gperf +48 -0
- package/bios/seabios/scripts/kconfig/zconf.hash.c_shipped +289 -0
- package/bios/seabios/scripts/kconfig/zconf.l +363 -0
- package/bios/seabios/scripts/kconfig/zconf.lex.c_shipped +2420 -0
- package/bios/seabios/scripts/kconfig/zconf.tab.c_shipped +2538 -0
- package/bios/seabios/scripts/kconfig/zconf.y +733 -0
- package/bios/seabios/scripts/layoutrom.py +705 -0
- package/bios/seabios/scripts/python23compat.py +14 -0
- package/bios/seabios/scripts/readserial.py +190 -0
- package/bios/seabios/scripts/tarball.sh +36 -0
- package/bios/seabios/scripts/test-build.sh +90 -0
- package/bios/seabios/scripts/transdump.py +53 -0
- package/bios/seabios/scripts/vgafixup.py +96 -0
- package/bios/seabios/src/Kconfig +579 -0
- package/bios/seabios/src/apm.c +215 -0
- package/bios/seabios/src/asm-offsets.c +23 -0
- package/bios/seabios/src/biosvar.h +130 -0
- package/bios/seabios/src/block.c +623 -0
- package/bios/seabios/src/block.h +121 -0
- package/bios/seabios/src/bmp.c +117 -0
- package/bios/seabios/src/boot.c +793 -0
- package/bios/seabios/src/bootsplash.c +255 -0
- package/bios/seabios/src/bregs.h +80 -0
- package/bios/seabios/src/byteorder.h +71 -0
- package/bios/seabios/src/cdrom.c +322 -0
- package/bios/seabios/src/clock.c +506 -0
- package/bios/seabios/src/code16gcc.s +1 -0
- package/bios/seabios/src/config.h +108 -0
- package/bios/seabios/src/cp437.c +275 -0
- package/bios/seabios/src/cp437.h +1 -0
- package/bios/seabios/src/disk.c +779 -0
- package/bios/seabios/src/e820map.c +152 -0
- package/bios/seabios/src/e820map.h +26 -0
- package/bios/seabios/src/entryfuncs.S +165 -0
- package/bios/seabios/src/farptr.h +208 -0
- package/bios/seabios/src/font.c +139 -0
- package/bios/seabios/src/fw/acpi-dsdt-cpu-hotplug.dsl +78 -0
- package/bios/seabios/src/fw/acpi-dsdt-dbug.dsl +26 -0
- package/bios/seabios/src/fw/acpi-dsdt-hpet.dsl +36 -0
- package/bios/seabios/src/fw/acpi-dsdt-isa.dsl +102 -0
- package/bios/seabios/src/fw/acpi-dsdt-pci-crs.dsl +90 -0
- package/bios/seabios/src/fw/acpi-dsdt.dsl +342 -0
- package/bios/seabios/src/fw/acpi-dsdt.hex +554 -0
- package/bios/seabios/src/fw/acpi.c +685 -0
- package/bios/seabios/src/fw/biostables.c +491 -0
- package/bios/seabios/src/fw/coreboot.c +569 -0
- package/bios/seabios/src/fw/csm.c +347 -0
- package/bios/seabios/src/fw/dev-pci.h +52 -0
- package/bios/seabios/src/fw/dev-piix.h +29 -0
- package/bios/seabios/src/fw/dev-q35.h +52 -0
- package/bios/seabios/src/fw/lzmadecode.c +398 -0
- package/bios/seabios/src/fw/lzmadecode.h +67 -0
- package/bios/seabios/src/fw/mptable.c +197 -0
- package/bios/seabios/src/fw/mtrr.c +105 -0
- package/bios/seabios/src/fw/multiboot.c +111 -0
- package/bios/seabios/src/fw/paravirt.c +624 -0
- package/bios/seabios/src/fw/paravirt.h +63 -0
- package/bios/seabios/src/fw/pciinit.c +1187 -0
- package/bios/seabios/src/fw/pirtable.c +103 -0
- package/bios/seabios/src/fw/q35-acpi-dsdt.dsl +450 -0
- package/bios/seabios/src/fw/romfile_loader.c +259 -0
- package/bios/seabios/src/fw/romfile_loader.h +91 -0
- package/bios/seabios/src/fw/shadow.c +208 -0
- package/bios/seabios/src/fw/smbios.c +585 -0
- package/bios/seabios/src/fw/smm.c +269 -0
- package/bios/seabios/src/fw/smp.c +194 -0
- package/bios/seabios/src/fw/ssdt-misc.dsl +104 -0
- package/bios/seabios/src/fw/ssdt-misc.hex +88 -0
- package/bios/seabios/src/fw/ssdt-pcihp.dsl +36 -0
- package/bios/seabios/src/fw/ssdt-pcihp.hex +38 -0
- package/bios/seabios/src/fw/ssdt-proc.dsl +48 -0
- package/bios/seabios/src/fw/ssdt-proc.hex +35 -0
- package/bios/seabios/src/fw/xen.c +149 -0
- package/bios/seabios/src/fw/xen.h +125 -0
- package/bios/seabios/src/gen-defs.h +19 -0
- package/bios/seabios/src/hw/ahci.c +697 -0
- package/bios/seabios/src/hw/ahci.h +201 -0
- package/bios/seabios/src/hw/ata.c +1046 -0
- package/bios/seabios/src/hw/ata.h +163 -0
- package/bios/seabios/src/hw/blockcmd.c +372 -0
- package/bios/seabios/src/hw/blockcmd.h +114 -0
- package/bios/seabios/src/hw/dma.c +67 -0
- package/bios/seabios/src/hw/esp-scsi.c +241 -0
- package/bios/seabios/src/hw/esp-scsi.h +8 -0
- package/bios/seabios/src/hw/floppy.c +741 -0
- package/bios/seabios/src/hw/lsi-scsi.c +221 -0
- package/bios/seabios/src/hw/lsi-scsi.h +8 -0
- package/bios/seabios/src/hw/megasas.c +405 -0
- package/bios/seabios/src/hw/megasas.h +8 -0
- package/bios/seabios/src/hw/mpt-scsi.c +319 -0
- package/bios/seabios/src/hw/mpt-scsi.h +8 -0
- package/bios/seabios/src/hw/nvme-int.h +199 -0
- package/bios/seabios/src/hw/nvme.c +708 -0
- package/bios/seabios/src/hw/nvme.h +17 -0
- package/bios/seabios/src/hw/pci.c +133 -0
- package/bios/seabios/src/hw/pci.h +47 -0
- package/bios/seabios/src/hw/pci_ids.h +2632 -0
- package/bios/seabios/src/hw/pci_regs.h +556 -0
- package/bios/seabios/src/hw/pcidevice.c +192 -0
- package/bios/seabios/src/hw/pcidevice.h +76 -0
- package/bios/seabios/src/hw/pic.c +115 -0
- package/bios/seabios/src/hw/pic.h +60 -0
- package/bios/seabios/src/hw/ps2port.c +543 -0
- package/bios/seabios/src/hw/ps2port.h +67 -0
- package/bios/seabios/src/hw/pvscsi.c +333 -0
- package/bios/seabios/src/hw/pvscsi.h +8 -0
- package/bios/seabios/src/hw/ramdisk.c +108 -0
- package/bios/seabios/src/hw/rtc.c +100 -0
- package/bios/seabios/src/hw/rtc.h +75 -0
- package/bios/seabios/src/hw/sdcard.c +572 -0
- package/bios/seabios/src/hw/serialio.c +113 -0
- package/bios/seabios/src/hw/serialio.h +29 -0
- package/bios/seabios/src/hw/timer.c +259 -0
- package/bios/seabios/src/hw/tpm_drivers.c +636 -0
- package/bios/seabios/src/hw/tpm_drivers.h +127 -0
- package/bios/seabios/src/hw/usb-ehci.c +650 -0
- package/bios/seabios/src/hw/usb-ehci.h +177 -0
- package/bios/seabios/src/hw/usb-hid.c +442 -0
- package/bios/seabios/src/hw/usb-hid.h +29 -0
- package/bios/seabios/src/hw/usb-hub.c +205 -0
- package/bios/seabios/src/hw/usb-hub.h +64 -0
- package/bios/seabios/src/hw/usb-msc.c +222 -0
- package/bios/seabios/src/hw/usb-msc.h +10 -0
- package/bios/seabios/src/hw/usb-ohci.c +568 -0
- package/bios/seabios/src/hw/usb-ohci.h +144 -0
- package/bios/seabios/src/hw/usb-uas.c +289 -0
- package/bios/seabios/src/hw/usb-uas.h +9 -0
- package/bios/seabios/src/hw/usb-uhci.c +571 -0
- package/bios/seabios/src/hw/usb-uhci.h +128 -0
- package/bios/seabios/src/hw/usb-xhci.c +1161 -0
- package/bios/seabios/src/hw/usb-xhci.h +133 -0
- package/bios/seabios/src/hw/usb.c +499 -0
- package/bios/seabios/src/hw/usb.h +254 -0
- package/bios/seabios/src/hw/virtio-blk.c +211 -0
- package/bios/seabios/src/hw/virtio-blk.h +43 -0
- package/bios/seabios/src/hw/virtio-pci.c +501 -0
- package/bios/seabios/src/hw/virtio-pci.h +151 -0
- package/bios/seabios/src/hw/virtio-ring.c +147 -0
- package/bios/seabios/src/hw/virtio-ring.h +121 -0
- package/bios/seabios/src/hw/virtio-scsi.c +220 -0
- package/bios/seabios/src/hw/virtio-scsi.h +47 -0
- package/bios/seabios/src/jpeg.c +1055 -0
- package/bios/seabios/src/kbd.c +599 -0
- package/bios/seabios/src/list.h +91 -0
- package/bios/seabios/src/malloc.c +561 -0
- package/bios/seabios/src/malloc.h +70 -0
- package/bios/seabios/src/memmap.h +21 -0
- package/bios/seabios/src/misc.c +195 -0
- package/bios/seabios/src/mouse.c +342 -0
- package/bios/seabios/src/optionroms.c +475 -0
- package/bios/seabios/src/output.c +584 -0
- package/bios/seabios/src/output.h +68 -0
- package/bios/seabios/src/pcibios.c +241 -0
- package/bios/seabios/src/pmm.c +176 -0
- package/bios/seabios/src/pnpbios.c +88 -0
- package/bios/seabios/src/post.c +337 -0
- package/bios/seabios/src/resume.c +157 -0
- package/bios/seabios/src/romfile.c +146 -0
- package/bios/seabios/src/romfile.h +21 -0
- package/bios/seabios/src/romlayout.S +698 -0
- package/bios/seabios/src/sercon.c +677 -0
- package/bios/seabios/src/serial.c +317 -0
- package/bios/seabios/src/sha1.c +147 -0
- package/bios/seabios/src/sha1.h +8 -0
- package/bios/seabios/src/stacks.c +771 -0
- package/bios/seabios/src/stacks.h +68 -0
- package/bios/seabios/src/std/LegacyBios.h +985 -0
- package/bios/seabios/src/std/acpi.h +323 -0
- package/bios/seabios/src/std/bda.h +174 -0
- package/bios/seabios/src/std/disk.h +175 -0
- package/bios/seabios/src/std/mptable.h +77 -0
- package/bios/seabios/src/std/multiboot.h +260 -0
- package/bios/seabios/src/std/optionrom.h +59 -0
- package/bios/seabios/src/std/pirtable.h +35 -0
- package/bios/seabios/src/std/pmm.h +19 -0
- package/bios/seabios/src/std/pnpbios.h +24 -0
- package/bios/seabios/src/std/smbios.h +167 -0
- package/bios/seabios/src/std/tcg.h +554 -0
- package/bios/seabios/src/std/vbe.h +156 -0
- package/bios/seabios/src/std/vga.h +63 -0
- package/bios/seabios/src/string.c +251 -0
- package/bios/seabios/src/string.h +31 -0
- package/bios/seabios/src/system.c +357 -0
- package/bios/seabios/src/tcgbios.c +2014 -0
- package/bios/seabios/src/tcgbios.h +19 -0
- package/bios/seabios/src/types.h +156 -0
- package/bios/seabios/src/util.h +251 -0
- package/bios/seabios/src/version.c +5 -0
- package/bios/seabios/src/vgahooks.c +355 -0
- package/bios/seabios/src/x86.c +23 -0
- package/bios/seabios/src/x86.h +277 -0
- package/bios/seabios/vgasrc/Kconfig +211 -0
- package/bios/seabios/vgasrc/bochsdisplay.c +59 -0
- package/bios/seabios/vgasrc/bochsvga.c +447 -0
- package/bios/seabios/vgasrc/bochsvga.h +57 -0
- package/bios/seabios/vgasrc/cbvga.c +337 -0
- package/bios/seabios/vgasrc/clext.c +627 -0
- package/bios/seabios/vgasrc/geodevga.c +434 -0
- package/bios/seabios/vgasrc/geodevga.h +89 -0
- package/bios/seabios/vgasrc/ramfb.c +163 -0
- package/bios/seabios/vgasrc/stdvga.c +485 -0
- package/bios/seabios/vgasrc/stdvga.h +81 -0
- package/bios/seabios/vgasrc/stdvgaio.c +186 -0
- package/bios/seabios/vgasrc/stdvgamodes.c +534 -0
- package/bios/seabios/vgasrc/swcursor.c +96 -0
- package/bios/seabios/vgasrc/vbe.c +432 -0
- package/bios/seabios/vgasrc/vgabios.c +1131 -0
- package/bios/seabios/vgasrc/vgabios.h +88 -0
- package/bios/seabios/vgasrc/vgaentry.S +161 -0
- package/bios/seabios/vgasrc/vgafb.c +661 -0
- package/bios/seabios/vgasrc/vgafb.h +42 -0
- package/bios/seabios/vgasrc/vgafonts.c +785 -0
- package/bios/seabios/vgasrc/vgahw.h +152 -0
- package/bios/seabios/vgasrc/vgainit.c +202 -0
- package/bios/seabios/vgasrc/vgalayout.lds.S +23 -0
- package/bios/seabios/vgasrc/vgautil.h +103 -0
- package/bios/seabios/vgasrc/vgaversion.c +6 -0
- package/build/binaries.js +1 -1
- package/build/index-debug.cjs +1 -1
- package/build/index-debug.js +1 -1
- package/build/index.cjs +1 -1
- package/build/index.js +1 -1
- package/build/v86-debug.wasm +0 -0
- package/build/v86.wasm +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Support for building memory maps suitable for int 15 e820 calls.
|
|
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 "config.h" // BUILD_MAX_E820
|
|
8
|
+
#include "e820map.h" // struct e820entry
|
|
9
|
+
#include "output.h" // dprintf
|
|
10
|
+
#include "string.h" // memmove
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/****************************************************************
|
|
14
|
+
* e820 memory map
|
|
15
|
+
****************************************************************/
|
|
16
|
+
|
|
17
|
+
// Info on e820 map location and size.
|
|
18
|
+
struct e820entry e820_list[BUILD_MAX_E820] VARFSEG;
|
|
19
|
+
int e820_count VARFSEG;
|
|
20
|
+
|
|
21
|
+
// Remove an entry from the e820_list.
|
|
22
|
+
static void
|
|
23
|
+
remove_e820(int i)
|
|
24
|
+
{
|
|
25
|
+
e820_count--;
|
|
26
|
+
memmove(&e820_list[i], &e820_list[i+1]
|
|
27
|
+
, sizeof(e820_list[0]) * (e820_count - i));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Insert an entry in the e820_list at the given position.
|
|
31
|
+
static void
|
|
32
|
+
insert_e820(int i, u64 start, u64 size, u32 type)
|
|
33
|
+
{
|
|
34
|
+
if (e820_count >= BUILD_MAX_E820) {
|
|
35
|
+
warn_noalloc();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
memmove(&e820_list[i+1], &e820_list[i]
|
|
40
|
+
, sizeof(e820_list[0]) * (e820_count - i));
|
|
41
|
+
e820_count++;
|
|
42
|
+
struct e820entry *e = &e820_list[i];
|
|
43
|
+
e->start = start;
|
|
44
|
+
e->size = size;
|
|
45
|
+
e->type = type;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static const char *
|
|
49
|
+
e820_type_name(u32 type)
|
|
50
|
+
{
|
|
51
|
+
switch (type) {
|
|
52
|
+
case E820_RAM: return "RAM";
|
|
53
|
+
case E820_RESERVED: return "RESERVED";
|
|
54
|
+
case E820_ACPI: return "ACPI";
|
|
55
|
+
case E820_NVS: return "NVS";
|
|
56
|
+
case E820_UNUSABLE: return "UNUSABLE";
|
|
57
|
+
default: return "UNKNOWN";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Show the current e820_list.
|
|
62
|
+
static void
|
|
63
|
+
dump_map(void)
|
|
64
|
+
{
|
|
65
|
+
dprintf(1, "e820 map has %d items:\n", e820_count);
|
|
66
|
+
int i;
|
|
67
|
+
for (i=0; i<e820_count; i++) {
|
|
68
|
+
struct e820entry *e = &e820_list[i];
|
|
69
|
+
u64 e_end = e->start + e->size;
|
|
70
|
+
dprintf(1, " %d: %016llx - %016llx = %d %s\n", i
|
|
71
|
+
, e->start, e_end, e->type, e820_type_name(e->type));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#define E820_HOLE ((u32)-1) // Used internally to remove entries
|
|
76
|
+
|
|
77
|
+
// Add a new entry to the list. This scans for overlaps and keeps the
|
|
78
|
+
// list sorted.
|
|
79
|
+
void
|
|
80
|
+
e820_add(u64 start, u64 size, u32 type)
|
|
81
|
+
{
|
|
82
|
+
dprintf(8, "Add to e820 map: %08llx %08llx %d\n", start, size, type);
|
|
83
|
+
|
|
84
|
+
if (! size)
|
|
85
|
+
// Huh? Nothing to do.
|
|
86
|
+
return;
|
|
87
|
+
|
|
88
|
+
// Find position of new item (splitting existing item if needed).
|
|
89
|
+
u64 end = start + size;
|
|
90
|
+
int i;
|
|
91
|
+
for (i=0; i<e820_count; i++) {
|
|
92
|
+
struct e820entry *e = &e820_list[i];
|
|
93
|
+
u64 e_end = e->start + e->size;
|
|
94
|
+
if (start > e_end)
|
|
95
|
+
continue;
|
|
96
|
+
// Found position - check if an existing item needs to be split.
|
|
97
|
+
if (start > e->start) {
|
|
98
|
+
if (type == e->type) {
|
|
99
|
+
// Same type - merge them.
|
|
100
|
+
size += start - e->start;
|
|
101
|
+
start = e->start;
|
|
102
|
+
} else {
|
|
103
|
+
// Split existing item.
|
|
104
|
+
e->size = start - e->start;
|
|
105
|
+
i++;
|
|
106
|
+
if (e_end > end)
|
|
107
|
+
insert_e820(i, end, e_end - end, e->type);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
// Remove/adjust existing items that are overlapping.
|
|
113
|
+
while (i<e820_count) {
|
|
114
|
+
struct e820entry *e = &e820_list[i];
|
|
115
|
+
if (end < e->start)
|
|
116
|
+
// No overlap - done.
|
|
117
|
+
break;
|
|
118
|
+
u64 e_end = e->start + e->size;
|
|
119
|
+
if (end >= e_end) {
|
|
120
|
+
// Existing item completely overlapped - remove it.
|
|
121
|
+
remove_e820(i);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
// Not completely overlapped - adjust its start.
|
|
125
|
+
e->start = end;
|
|
126
|
+
e->size = e_end - end;
|
|
127
|
+
if (type == e->type) {
|
|
128
|
+
// Same type - merge them.
|
|
129
|
+
size += e->size;
|
|
130
|
+
remove_e820(i);
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
// Insert new item.
|
|
135
|
+
if (type != E820_HOLE)
|
|
136
|
+
insert_e820(i, start, size, type);
|
|
137
|
+
//dump_map();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Remove any definitions in a memory range (make a memory hole).
|
|
141
|
+
void
|
|
142
|
+
e820_remove(u64 start, u64 size)
|
|
143
|
+
{
|
|
144
|
+
e820_add(start, size, E820_HOLE);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Report on final memory locations.
|
|
148
|
+
void
|
|
149
|
+
e820_prepboot(void)
|
|
150
|
+
{
|
|
151
|
+
dump_map();
|
|
152
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#ifndef __E820MAP_H
|
|
2
|
+
#define __E820MAP_H
|
|
3
|
+
|
|
4
|
+
#include "types.h" // u64
|
|
5
|
+
|
|
6
|
+
#define E820_RAM 1
|
|
7
|
+
#define E820_RESERVED 2
|
|
8
|
+
#define E820_ACPI 3
|
|
9
|
+
#define E820_NVS 4
|
|
10
|
+
#define E820_UNUSABLE 5
|
|
11
|
+
|
|
12
|
+
struct e820entry {
|
|
13
|
+
u64 start;
|
|
14
|
+
u64 size;
|
|
15
|
+
u32 type;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
void e820_add(u64 start, u64 size, u32 type);
|
|
19
|
+
void e820_remove(u64 start, u64 size);
|
|
20
|
+
void e820_prepboot(void);
|
|
21
|
+
|
|
22
|
+
// e820 map storage
|
|
23
|
+
extern struct e820entry e820_list[];
|
|
24
|
+
extern int e820_count;
|
|
25
|
+
|
|
26
|
+
#endif // e820map.h
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// Macros for entering C code
|
|
2
|
+
//
|
|
3
|
+
// Copyright (C) 2008-2014 Kevin O'Connor <kevin@koconnor.net>
|
|
4
|
+
//
|
|
5
|
+
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/****************************************************************
|
|
9
|
+
* Macros for save and restore of 'struct bregs' registers
|
|
10
|
+
****************************************************************/
|
|
11
|
+
|
|
12
|
+
#define PUSHBREGS_size 32
|
|
13
|
+
|
|
14
|
+
// Save registers (matches struct bregs) to stack
|
|
15
|
+
.macro PUSHBREGS
|
|
16
|
+
pushl %eax
|
|
17
|
+
pushl %ecx
|
|
18
|
+
pushl %edx
|
|
19
|
+
pushl %ebx
|
|
20
|
+
pushl %ebp
|
|
21
|
+
pushl %esi
|
|
22
|
+
pushl %edi
|
|
23
|
+
pushw %es
|
|
24
|
+
pushw %ds
|
|
25
|
+
.endm
|
|
26
|
+
|
|
27
|
+
// Restore registers (from struct bregs) from stack
|
|
28
|
+
.macro POPBREGS
|
|
29
|
+
popw %ds
|
|
30
|
+
popw %es
|
|
31
|
+
popl %edi
|
|
32
|
+
popl %esi
|
|
33
|
+
popl %ebp
|
|
34
|
+
popl %ebx
|
|
35
|
+
popl %edx
|
|
36
|
+
popl %ecx
|
|
37
|
+
popl %eax
|
|
38
|
+
.endm
|
|
39
|
+
|
|
40
|
+
// Save registers to struct bregs at %ds:%eax. The caller
|
|
41
|
+
// should "pushw %ds ; pushl %eax" prior to calling - this macro
|
|
42
|
+
// will pop them off.
|
|
43
|
+
.macro SAVEBREGS_POP_DSEAX
|
|
44
|
+
popl BREGS_eax(%eax)
|
|
45
|
+
popw BREGS_ds(%eax)
|
|
46
|
+
movl %edi, BREGS_edi(%eax)
|
|
47
|
+
movl %esi, BREGS_esi(%eax)
|
|
48
|
+
movl %ebp, BREGS_ebp(%eax)
|
|
49
|
+
movl %ebx, BREGS_ebx(%eax)
|
|
50
|
+
movl %edx, BREGS_edx(%eax)
|
|
51
|
+
movl %ecx, BREGS_ecx(%eax)
|
|
52
|
+
movw %es, BREGS_es(%eax)
|
|
53
|
+
.endm
|
|
54
|
+
|
|
55
|
+
// Restore registers from struct bregs at %ds:%eax
|
|
56
|
+
.macro RESTOREBREGS_DSEAX
|
|
57
|
+
movl BREGS_edi(%eax), %edi
|
|
58
|
+
movl BREGS_esi(%eax), %esi
|
|
59
|
+
movl BREGS_ebp(%eax), %ebp
|
|
60
|
+
movl BREGS_ebx(%eax), %ebx
|
|
61
|
+
movl BREGS_edx(%eax), %edx
|
|
62
|
+
movl BREGS_ecx(%eax), %ecx
|
|
63
|
+
movw BREGS_es(%eax), %es
|
|
64
|
+
pushl BREGS_eax(%eax)
|
|
65
|
+
movw BREGS_ds(%eax), %ds
|
|
66
|
+
popl %eax
|
|
67
|
+
.endm
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
/****************************************************************
|
|
71
|
+
* Entry macros
|
|
72
|
+
****************************************************************/
|
|
73
|
+
|
|
74
|
+
// Call a C function - this does the minimal work necessary to
|
|
75
|
+
// call into C. It sets up %ds, backs up %es, and backs up
|
|
76
|
+
// those registers that are call clobbered by the C compiler.
|
|
77
|
+
.macro ENTRY cfunc
|
|
78
|
+
cli // In case something far-calls instead of using "int"
|
|
79
|
+
cld
|
|
80
|
+
pushl %eax // Save registers clobbered by C code
|
|
81
|
+
pushl %ecx
|
|
82
|
+
pushl %edx
|
|
83
|
+
pushw %es
|
|
84
|
+
pushw %ds
|
|
85
|
+
movw %ss, %ax // Move %ss to %ds
|
|
86
|
+
movw %ax, %ds
|
|
87
|
+
pushl %esp // Backup %esp, then clear high bits
|
|
88
|
+
movzwl %sp, %esp
|
|
89
|
+
calll \cfunc
|
|
90
|
+
popl %esp // Restore %esp (including high bits)
|
|
91
|
+
popw %ds // Restore registers saved above
|
|
92
|
+
popw %es
|
|
93
|
+
popl %edx
|
|
94
|
+
popl %ecx
|
|
95
|
+
popl %eax
|
|
96
|
+
.endm
|
|
97
|
+
|
|
98
|
+
// Call a C function with current register list as an
|
|
99
|
+
// argument. This backs up the registers and sets %eax
|
|
100
|
+
// to point to the backup. On return, the registers are
|
|
101
|
+
// restored from the structure.
|
|
102
|
+
.macro ENTRY_ARG cfunc
|
|
103
|
+
cli
|
|
104
|
+
cld
|
|
105
|
+
PUSHBREGS
|
|
106
|
+
movw %ss, %ax // Move %ss to %ds
|
|
107
|
+
movw %ax, %ds
|
|
108
|
+
movl %esp, %ebx // Backup %esp, then zero high bits
|
|
109
|
+
movzwl %sp, %esp
|
|
110
|
+
movl %esp, %eax // First arg is pointer to struct bregs
|
|
111
|
+
calll \cfunc
|
|
112
|
+
movl %ebx, %esp // Restore %esp (including high bits)
|
|
113
|
+
POPBREGS
|
|
114
|
+
.endm
|
|
115
|
+
|
|
116
|
+
// As above, but get calling function from stack.
|
|
117
|
+
.macro ENTRY_ARG_ST
|
|
118
|
+
cli
|
|
119
|
+
cld
|
|
120
|
+
pushl %ecx
|
|
121
|
+
pushl %edx
|
|
122
|
+
pushl %ebx
|
|
123
|
+
pushl %ebp
|
|
124
|
+
pushl %esi
|
|
125
|
+
pushl %edi
|
|
126
|
+
pushw %es
|
|
127
|
+
pushw %ds
|
|
128
|
+
movw %ss, %cx // Move %ss to %ds
|
|
129
|
+
movw %cx, %ds
|
|
130
|
+
movl %esp, %ebx // Backup %esp, then zero high bits
|
|
131
|
+
movzwl %sp, %esp
|
|
132
|
+
movl 28(%esp), %ecx // Get calling function
|
|
133
|
+
movl %eax, 28(%esp) // Save %eax
|
|
134
|
+
movl %esp, %eax // First arg is pointer to struct bregs
|
|
135
|
+
calll *%ecx
|
|
136
|
+
movl %ebx, %esp // Restore %esp (including high bits)
|
|
137
|
+
POPBREGS
|
|
138
|
+
.endm
|
|
139
|
+
|
|
140
|
+
// Same as ENTRY_ARG, but don't mangle %esp
|
|
141
|
+
.macro ENTRY_ARG_ESP cfunc
|
|
142
|
+
cli
|
|
143
|
+
cld
|
|
144
|
+
PUSHBREGS
|
|
145
|
+
movw %ss, %ax // Move %ss to %ds
|
|
146
|
+
movw %ax, %ds
|
|
147
|
+
movl %esp, %eax // First arg is pointer to struct bregs
|
|
148
|
+
calll \cfunc
|
|
149
|
+
POPBREGS
|
|
150
|
+
.endm
|
|
151
|
+
|
|
152
|
+
// Reset stack, transition to 32bit mode, and call a C function.
|
|
153
|
+
.macro ENTRY_INTO32 cfunc
|
|
154
|
+
xorw %dx, %dx
|
|
155
|
+
movw %dx, %ss
|
|
156
|
+
movl $ BUILD_STACK_ADDR , %esp
|
|
157
|
+
movl $ \cfunc , %edx
|
|
158
|
+
jmp transition32
|
|
159
|
+
.endm
|
|
160
|
+
|
|
161
|
+
// Declare a function
|
|
162
|
+
.macro DECLFUNC func
|
|
163
|
+
.section .text.asm.\func
|
|
164
|
+
.global \func
|
|
165
|
+
.endm
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// Code to access multiple segments within gcc.
|
|
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
|
+
#ifndef __FARPTR_H
|
|
7
|
+
#define __FARPTR_H
|
|
8
|
+
|
|
9
|
+
#include "x86.h" // insb
|
|
10
|
+
|
|
11
|
+
// Dummy definitions used to make sure gcc understands dependencies
|
|
12
|
+
// between SET_SEG and GET/READ/WRITE_SEG macros.
|
|
13
|
+
extern u16 __segment_ES, __segment_CS, __segment_DS, __segment_SS;
|
|
14
|
+
extern u16 __segment_FS, __segment_GS;
|
|
15
|
+
|
|
16
|
+
// Low level macros for reading/writing memory via a segment selector.
|
|
17
|
+
#define READ8_SEG(prefix, SEG, value, var) \
|
|
18
|
+
__asm__(prefix "movb %%" #SEG ":%1, %b0" : "=Qi"(value) \
|
|
19
|
+
: "m"(var), "m"(__segment_ ## SEG))
|
|
20
|
+
#define READ16_SEG(prefix, SEG, value, var) \
|
|
21
|
+
__asm__(prefix "movw %%" #SEG ":%1, %w0" : "=ri"(value) \
|
|
22
|
+
: "m"(var), "m"(__segment_ ## SEG))
|
|
23
|
+
#define READ32_SEG(prefix, SEG, value, var) \
|
|
24
|
+
__asm__(prefix "movl %%" #SEG ":%1, %0" : "=ri"(value) \
|
|
25
|
+
: "m"(var), "m"(__segment_ ## SEG))
|
|
26
|
+
#define READ64_SEG(prefix, SEG, value, var) do { \
|
|
27
|
+
union u64_u32_u __value; \
|
|
28
|
+
union u64_u32_u *__r64_ptr = (union u64_u32_u *)&(var); \
|
|
29
|
+
READ32_SEG(prefix, SEG, __value.lo, __r64_ptr->lo); \
|
|
30
|
+
READ32_SEG(prefix, SEG, __value.hi, __r64_ptr->hi); \
|
|
31
|
+
*(u64*)&(value) = __value.val; \
|
|
32
|
+
} while (0)
|
|
33
|
+
#define WRITE8_SEG(prefix, SEG, var, value) \
|
|
34
|
+
__asm__(prefix "movb %b1, %%" #SEG ":%0" : "=m"(var) \
|
|
35
|
+
: "Q"(value), "m"(__segment_ ## SEG))
|
|
36
|
+
#define WRITE16_SEG(prefix, SEG, var, value) \
|
|
37
|
+
__asm__(prefix "movw %w1, %%" #SEG ":%0" : "=m"(var) \
|
|
38
|
+
: "r"(value), "m"(__segment_ ## SEG))
|
|
39
|
+
#define WRITE32_SEG(prefix, SEG, var, value) \
|
|
40
|
+
__asm__(prefix "movl %1, %%" #SEG ":%0" : "=m"(var) \
|
|
41
|
+
: "r"(value), "m"(__segment_ ## SEG))
|
|
42
|
+
#define WRITE64_SEG(prefix, SEG, var, value) do { \
|
|
43
|
+
union u64_u32_u __value; \
|
|
44
|
+
union u64_u32_u *__w64_ptr = (union u64_u32_u *)&(var); \
|
|
45
|
+
typeof(var) __value_tmp = (value); \
|
|
46
|
+
__value.val = *(u64*)&__value_tmp; \
|
|
47
|
+
WRITE32_SEG(prefix, SEG, __w64_ptr->lo, __value.lo); \
|
|
48
|
+
WRITE32_SEG(prefix, SEG, __w64_ptr->hi, __value.hi); \
|
|
49
|
+
} while (0)
|
|
50
|
+
|
|
51
|
+
// Macros for automatically choosing the appropriate memory size
|
|
52
|
+
// access method.
|
|
53
|
+
extern void __force_link_error__unknown_type(void);
|
|
54
|
+
|
|
55
|
+
#define __GET_VAR(prefix, seg, var) ({ \
|
|
56
|
+
typeof(var) __val; \
|
|
57
|
+
if (sizeof(__val) == 1) \
|
|
58
|
+
READ8_SEG(prefix, seg, __val, var); \
|
|
59
|
+
else if (sizeof(__val) == 2) \
|
|
60
|
+
READ16_SEG(prefix, seg, __val, var); \
|
|
61
|
+
else if (sizeof(__val) == 4) \
|
|
62
|
+
READ32_SEG(prefix, seg, __val, var); \
|
|
63
|
+
else if (sizeof(__val) == 8) \
|
|
64
|
+
READ64_SEG(prefix, seg, __val, var); \
|
|
65
|
+
else \
|
|
66
|
+
__force_link_error__unknown_type(); \
|
|
67
|
+
__val; })
|
|
68
|
+
|
|
69
|
+
#define __SET_VAR(prefix, seg, var, val) do { \
|
|
70
|
+
if (sizeof(var) == 1) \
|
|
71
|
+
WRITE8_SEG(prefix, seg, var, (val)); \
|
|
72
|
+
else if (sizeof(var) == 2) \
|
|
73
|
+
WRITE16_SEG(prefix, seg, var, (val)); \
|
|
74
|
+
else if (sizeof(var) == 4) \
|
|
75
|
+
WRITE32_SEG(prefix, seg, var, (val)); \
|
|
76
|
+
else if (sizeof(var) == 8) \
|
|
77
|
+
WRITE64_SEG(prefix, seg, var, (val)); \
|
|
78
|
+
else \
|
|
79
|
+
__force_link_error__unknown_type(); \
|
|
80
|
+
} while (0)
|
|
81
|
+
|
|
82
|
+
#define DECL_SEGFUNCS(SEG) \
|
|
83
|
+
static inline void __set_seg_##SEG(u16 seg) { \
|
|
84
|
+
__asm__("movw %w1, %%" #SEG : "=m"(__segment_##SEG) \
|
|
85
|
+
: "rm"(seg)); \
|
|
86
|
+
} \
|
|
87
|
+
static inline u16 __get_seg_##SEG(void) { \
|
|
88
|
+
u16 res; \
|
|
89
|
+
__asm__("movw %%" #SEG ", %w0" : "=rm"(res) \
|
|
90
|
+
: "m"(__segment_##SEG)); \
|
|
91
|
+
return res; \
|
|
92
|
+
}
|
|
93
|
+
DECL_SEGFUNCS(CS)
|
|
94
|
+
DECL_SEGFUNCS(DS)
|
|
95
|
+
DECL_SEGFUNCS(ES)
|
|
96
|
+
DECL_SEGFUNCS(FS)
|
|
97
|
+
DECL_SEGFUNCS(GS)
|
|
98
|
+
DECL_SEGFUNCS(SS)
|
|
99
|
+
|
|
100
|
+
// Low level macros for getting/setting a segment register.
|
|
101
|
+
#define __SET_SEG(SEG, value) \
|
|
102
|
+
__set_seg_##SEG(value)
|
|
103
|
+
#define __GET_SEG(SEG) \
|
|
104
|
+
__get_seg_##SEG()
|
|
105
|
+
|
|
106
|
+
// Macros for accessing a variable in another segment. (They
|
|
107
|
+
// automatically update the %es segment and then make the appropriate
|
|
108
|
+
// access.)
|
|
109
|
+
#define __GET_FARVAR(seg, var) ({ \
|
|
110
|
+
SET_SEG(ES, (seg)); \
|
|
111
|
+
GET_VAR(ES, (var)); })
|
|
112
|
+
#define __SET_FARVAR(seg, var, val) do { \
|
|
113
|
+
typeof(var) __sfv_val = (val); \
|
|
114
|
+
SET_SEG(ES, (seg)); \
|
|
115
|
+
SET_VAR(ES, (var), __sfv_val); \
|
|
116
|
+
} while (0)
|
|
117
|
+
|
|
118
|
+
// Macros for accesssing a 32bit flat mode pointer from 16bit real
|
|
119
|
+
// mode. (They automatically update the %es segment, break the
|
|
120
|
+
// pointer into segment/offset, and then make the access.)
|
|
121
|
+
#define __GET_FLATPTR(ptr) ({ \
|
|
122
|
+
typeof(&(ptr)) __ptr = &(ptr); \
|
|
123
|
+
GET_FARVAR(FLATPTR_TO_SEG(__ptr) \
|
|
124
|
+
, *(typeof(__ptr))FLATPTR_TO_OFFSET(__ptr)); })
|
|
125
|
+
#define __SET_FLATPTR(ptr, val) do { \
|
|
126
|
+
typeof (&(ptr)) __ptr = &(ptr); \
|
|
127
|
+
SET_FARVAR(FLATPTR_TO_SEG(__ptr) \
|
|
128
|
+
, *(typeof(__ptr))FLATPTR_TO_OFFSET(__ptr) \
|
|
129
|
+
, (val)); \
|
|
130
|
+
} while (0)
|
|
131
|
+
|
|
132
|
+
// Macros for converting to/from 32bit flat mode pointers to their
|
|
133
|
+
// equivalent 16bit segment/offset values.
|
|
134
|
+
#define FLATPTR_TO_SEG(p) (((u32)(p)) >> 4)
|
|
135
|
+
#define FLATPTR_TO_OFFSET(p) (((u32)(p)) & 0xf)
|
|
136
|
+
#define MAKE_FLATPTR(seg,off) ((void*)(((u32)(seg)<<4)+(u32)(off)))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
#if MODESEGMENT == 1
|
|
140
|
+
|
|
141
|
+
// Definitions when using segmented mode.
|
|
142
|
+
#define GET_FARVAR(seg, var) __GET_FARVAR((seg), (var))
|
|
143
|
+
#define SET_FARVAR(seg, var, val) __SET_FARVAR((seg), (var), (val))
|
|
144
|
+
#define GET_VAR(seg, var) __GET_VAR("", seg, (var))
|
|
145
|
+
#define SET_VAR(seg, var, val) __SET_VAR("", seg, (var), (val))
|
|
146
|
+
#define SET_SEG(SEG, value) __SET_SEG(SEG, (value))
|
|
147
|
+
#define GET_SEG(SEG) __GET_SEG(SEG)
|
|
148
|
+
#define GET_FLATPTR(ptr) __GET_FLATPTR(ptr)
|
|
149
|
+
#define SET_FLATPTR(ptr, val) __SET_FLATPTR((ptr), (val))
|
|
150
|
+
|
|
151
|
+
static inline void insb_fl(u16 port, void *ptr_fl, u16 count) {
|
|
152
|
+
SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
|
|
153
|
+
insb(port, (u8*)FLATPTR_TO_OFFSET(ptr_fl), count);
|
|
154
|
+
}
|
|
155
|
+
static inline void insw_fl(u16 port, void *ptr_fl, u16 count) {
|
|
156
|
+
SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
|
|
157
|
+
insw(port, (u16*)FLATPTR_TO_OFFSET(ptr_fl), count);
|
|
158
|
+
}
|
|
159
|
+
static inline void insl_fl(u16 port, void *ptr_fl, u16 count) {
|
|
160
|
+
SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
|
|
161
|
+
insl(port, (u32*)FLATPTR_TO_OFFSET(ptr_fl), count);
|
|
162
|
+
}
|
|
163
|
+
static inline void outsb_fl(u16 port, void *ptr_fl, u16 count) {
|
|
164
|
+
SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
|
|
165
|
+
outsb(port, (u8*)FLATPTR_TO_OFFSET(ptr_fl), count);
|
|
166
|
+
}
|
|
167
|
+
static inline void outsw_fl(u16 port, void *ptr_fl, u16 count) {
|
|
168
|
+
SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
|
|
169
|
+
outsw(port, (u16*)FLATPTR_TO_OFFSET(ptr_fl), count);
|
|
170
|
+
}
|
|
171
|
+
static inline void outsl_fl(u16 port, void *ptr_fl, u16 count) {
|
|
172
|
+
SET_SEG(ES, FLATPTR_TO_SEG(ptr_fl));
|
|
173
|
+
outsl(port, (u32*)FLATPTR_TO_OFFSET(ptr_fl), count);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
#else
|
|
177
|
+
|
|
178
|
+
// In 32-bit flat mode there is no need to mess with the segments.
|
|
179
|
+
#define GET_FARVAR(seg, var) \
|
|
180
|
+
(*((typeof(&(var)))MAKE_FLATPTR((seg), &(var))))
|
|
181
|
+
#define SET_FARVAR(seg, var, val) \
|
|
182
|
+
do { GET_FARVAR((seg), (var)) = (val); } while (0)
|
|
183
|
+
#define GET_VAR(seg, var) (var)
|
|
184
|
+
#define SET_VAR(seg, var, val) do { (var) = (val); } while (0)
|
|
185
|
+
#define SET_SEG(SEG, value) ((void)(value))
|
|
186
|
+
#define GET_SEG(SEG) 0
|
|
187
|
+
#define GET_FLATPTR(ptr) (ptr)
|
|
188
|
+
#define SET_FLATPTR(ptr, val) do { (ptr) = (val); } while (0)
|
|
189
|
+
|
|
190
|
+
#define insb_fl(port, ptr_fl, count) insb(port, ptr_fl, count)
|
|
191
|
+
#define insw_fl(port, ptr_fl, count) insw(port, ptr_fl, count)
|
|
192
|
+
#define insl_fl(port, ptr_fl, count) insl(port, ptr_fl, count)
|
|
193
|
+
#define outsb_fl(port, ptr_fl, count) outsb(port, ptr_fl, count)
|
|
194
|
+
#define outsw_fl(port, ptr_fl, count) outsw(port, ptr_fl, count)
|
|
195
|
+
#define outsl_fl(port, ptr_fl, count) outsl(port, ptr_fl, count)
|
|
196
|
+
|
|
197
|
+
#endif
|
|
198
|
+
|
|
199
|
+
#define SEGOFF(s,o) ({struct segoff_s __so; __so.offset=(o); __so.seg=(s); __so;})
|
|
200
|
+
|
|
201
|
+
static inline struct segoff_s FLATPTR_TO_SEGOFF(void *p) {
|
|
202
|
+
return SEGOFF(FLATPTR_TO_SEG(p), FLATPTR_TO_OFFSET(p));
|
|
203
|
+
}
|
|
204
|
+
static inline void *SEGOFF_TO_FLATPTR(struct segoff_s so) {
|
|
205
|
+
return MAKE_FLATPTR(so.seg, so.offset);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
#endif // farptr.h
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#include "types.h" // u8
|
|
2
|
+
|
|
3
|
+
// Character Font for 320x200 & 640x200 Graphics (lower 128 characters)
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* This font comes from the fntcol16.zip package (c) by Joseph Gil
|
|
7
|
+
* found at ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip
|
|
8
|
+
* This font is public domain
|
|
9
|
+
*/
|
|
10
|
+
u8 vgafont8[128*8] VARFSEGFIXED(0xfa6e) = {
|
|
11
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
12
|
+
0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e,
|
|
13
|
+
0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e,
|
|
14
|
+
0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00,
|
|
15
|
+
0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00,
|
|
16
|
+
0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c,
|
|
17
|
+
0x10, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c,
|
|
18
|
+
0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00,
|
|
19
|
+
0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff,
|
|
20
|
+
0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
|
|
21
|
+
0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff,
|
|
22
|
+
0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78,
|
|
23
|
+
0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18,
|
|
24
|
+
0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0,
|
|
25
|
+
0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0,
|
|
26
|
+
0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99,
|
|
27
|
+
0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00,
|
|
28
|
+
0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00,
|
|
29
|
+
0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18,
|
|
30
|
+
0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00,
|
|
31
|
+
0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00,
|
|
32
|
+
0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0xcc, 0x78,
|
|
33
|
+
0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00,
|
|
34
|
+
0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff,
|
|
35
|
+
0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00,
|
|
36
|
+
0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,
|
|
37
|
+
0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00,
|
|
38
|
+
0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,
|
|
39
|
+
0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00,
|
|
40
|
+
0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00,
|
|
41
|
+
0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00,
|
|
42
|
+
0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00,
|
|
43
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
44
|
+
0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00,
|
|
45
|
+
0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
46
|
+
0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00,
|
|
47
|
+
0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00,
|
|
48
|
+
0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00,
|
|
49
|
+
0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00,
|
|
50
|
+
0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
51
|
+
0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00,
|
|
52
|
+
0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
|
|
53
|
+
0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,
|
|
54
|
+
0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00,
|
|
55
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60,
|
|
56
|
+
0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
|
|
57
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00,
|
|
58
|
+
0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00,
|
|
59
|
+
0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0x7c, 0x00,
|
|
60
|
+
0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00,
|
|
61
|
+
0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00,
|
|
62
|
+
0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00,
|
|
63
|
+
0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00,
|
|
64
|
+
0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00,
|
|
65
|
+
0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00,
|
|
66
|
+
0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00,
|
|
67
|
+
0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00,
|
|
68
|
+
0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00,
|
|
69
|
+
0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00,
|
|
70
|
+
0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60,
|
|
71
|
+
0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00,
|
|
72
|
+
0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00,
|
|
73
|
+
0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00,
|
|
74
|
+
0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00,
|
|
75
|
+
0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x78, 0x00,
|
|
76
|
+
0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00,
|
|
77
|
+
0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00,
|
|
78
|
+
0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00,
|
|
79
|
+
0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00,
|
|
80
|
+
0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00,
|
|
81
|
+
0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00,
|
|
82
|
+
0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3e, 0x00,
|
|
83
|
+
0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00,
|
|
84
|
+
0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
|
|
85
|
+
0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00,
|
|
86
|
+
0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00,
|
|
87
|
+
0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00,
|
|
88
|
+
0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00,
|
|
89
|
+
0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00,
|
|
90
|
+
0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00,
|
|
91
|
+
0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
|
|
92
|
+
0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x1c, 0x00,
|
|
93
|
+
0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00,
|
|
94
|
+
0x78, 0xcc, 0xe0, 0x70, 0x1c, 0xcc, 0x78, 0x00,
|
|
95
|
+
0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
|
|
96
|
+
0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00,
|
|
97
|
+
0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00,
|
|
98
|
+
0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00,
|
|
99
|
+
0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00,
|
|
100
|
+
0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00,
|
|
101
|
+
0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00,
|
|
102
|
+
0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
|
|
103
|
+
0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00,
|
|
104
|
+
0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
|
|
105
|
+
0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
|
106
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
|
107
|
+
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
108
|
+
0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
|
|
109
|
+
0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00,
|
|
110
|
+
0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00,
|
|
111
|
+
0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00,
|
|
112
|
+
0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
|
|
113
|
+
0x38, 0x6c, 0x60, 0xf0, 0x60, 0x60, 0xf0, 0x00,
|
|
114
|
+
0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
|
|
115
|
+
0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00,
|
|
116
|
+
0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
|
|
117
|
+
0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78,
|
|
118
|
+
0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00,
|
|
119
|
+
0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
|
|
120
|
+
0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00,
|
|
121
|
+
0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00,
|
|
122
|
+
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
|
|
123
|
+
0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0,
|
|
124
|
+
0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e,
|
|
125
|
+
0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0xf0, 0x00,
|
|
126
|
+
0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00,
|
|
127
|
+
0x10, 0x30, 0x7c, 0x30, 0x30, 0x34, 0x18, 0x00,
|
|
128
|
+
0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
|
|
129
|
+
0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00,
|
|
130
|
+
0x00, 0x00, 0xc6, 0xd6, 0xfe, 0xfe, 0x6c, 0x00,
|
|
131
|
+
0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00,
|
|
132
|
+
0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
|
|
133
|
+
0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00,
|
|
134
|
+
0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00,
|
|
135
|
+
0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
|
|
136
|
+
0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00,
|
|
137
|
+
0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
138
|
+
0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00,
|
|
139
|
+
};
|