v86 0.3.4 → 0.3.7
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 +4 -4
- 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,599 @@
|
|
|
1
|
+
// 16bit code to handle keyboard requests.
|
|
2
|
+
//
|
|
3
|
+
// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
|
|
4
|
+
// Copyright (C) 2002 MandrakeSoft S.A.
|
|
5
|
+
//
|
|
6
|
+
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
|
7
|
+
|
|
8
|
+
#include "biosvar.h" // GET_BDA
|
|
9
|
+
#include "bregs.h" // struct bregs
|
|
10
|
+
#include "config.h" // CONFIG_*
|
|
11
|
+
#include "hw/ps2port.h" // ps2_kbd_command
|
|
12
|
+
#include "hw/usb-hid.h" // usb_kbd_command
|
|
13
|
+
#include "output.h" // debug_enter
|
|
14
|
+
#include "stacks.h" // yield
|
|
15
|
+
#include "string.h" // memset
|
|
16
|
+
#include "util.h" // kbd_init
|
|
17
|
+
|
|
18
|
+
void
|
|
19
|
+
kbd_init(void)
|
|
20
|
+
{
|
|
21
|
+
dprintf(3, "init keyboard\n");
|
|
22
|
+
u16 x = offsetof(struct bios_data_area_s, kbd_buf);
|
|
23
|
+
SET_BDA(kbd_flag1, KF1_101KBD);
|
|
24
|
+
SET_BDA(kbd_buf_head, x);
|
|
25
|
+
SET_BDA(kbd_buf_tail, x);
|
|
26
|
+
SET_BDA(kbd_buf_start_offset, x);
|
|
27
|
+
|
|
28
|
+
SET_BDA(kbd_buf_end_offset
|
|
29
|
+
, x + FIELD_SIZEOF(struct bios_data_area_s, kbd_buf));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
u8
|
|
33
|
+
enqueue_key(u16 keycode)
|
|
34
|
+
{
|
|
35
|
+
u16 buffer_start = GET_BDA(kbd_buf_start_offset);
|
|
36
|
+
u16 buffer_end = GET_BDA(kbd_buf_end_offset);
|
|
37
|
+
|
|
38
|
+
u16 buffer_head = GET_BDA(kbd_buf_head);
|
|
39
|
+
u16 buffer_tail = GET_BDA(kbd_buf_tail);
|
|
40
|
+
|
|
41
|
+
u16 temp_tail = buffer_tail;
|
|
42
|
+
buffer_tail += 2;
|
|
43
|
+
if (buffer_tail >= buffer_end)
|
|
44
|
+
buffer_tail = buffer_start;
|
|
45
|
+
|
|
46
|
+
if (buffer_tail == buffer_head)
|
|
47
|
+
return 0;
|
|
48
|
+
|
|
49
|
+
SET_FARVAR(SEG_BDA, *(u16*)(temp_tail+0), keycode);
|
|
50
|
+
SET_BDA(kbd_buf_tail, buffer_tail);
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static void
|
|
55
|
+
dequeue_key(struct bregs *regs, int incr, int extended)
|
|
56
|
+
{
|
|
57
|
+
yield();
|
|
58
|
+
u16 buffer_head;
|
|
59
|
+
u16 buffer_tail;
|
|
60
|
+
for (;;) {
|
|
61
|
+
buffer_head = GET_BDA(kbd_buf_head);
|
|
62
|
+
buffer_tail = GET_BDA(kbd_buf_tail);
|
|
63
|
+
|
|
64
|
+
if (buffer_head != buffer_tail)
|
|
65
|
+
break;
|
|
66
|
+
if (!incr) {
|
|
67
|
+
regs->flags |= F_ZF;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
yield_toirq();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
u16 keycode = GET_FARVAR(SEG_BDA, *(u16*)(buffer_head+0));
|
|
74
|
+
u8 ascii = keycode & 0xff;
|
|
75
|
+
if (!extended) {
|
|
76
|
+
// Translate extended keys
|
|
77
|
+
if (ascii == 0xe0 && keycode & 0xff00)
|
|
78
|
+
keycode &= 0xff00;
|
|
79
|
+
else if (keycode == 0xe00d || keycode == 0xe00a)
|
|
80
|
+
// Extended enter key
|
|
81
|
+
keycode = 0x1c00 | ascii;
|
|
82
|
+
else if (keycode == 0xe02f)
|
|
83
|
+
// Extended '/' key
|
|
84
|
+
keycode = 0x352f;
|
|
85
|
+
// Technically, if the ascii value is 0xf0 or if the
|
|
86
|
+
// 'scancode' is greater than 0x84 then the key should be
|
|
87
|
+
// discarded. However, there seems no harm in passing on the
|
|
88
|
+
// extended values in these cases.
|
|
89
|
+
}
|
|
90
|
+
if (ascii == 0xf0 && keycode & 0xff00)
|
|
91
|
+
keycode &= 0xff00;
|
|
92
|
+
regs->ax = keycode;
|
|
93
|
+
|
|
94
|
+
if (!incr) {
|
|
95
|
+
regs->flags &= ~F_ZF;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
u16 buffer_start = GET_BDA(kbd_buf_start_offset);
|
|
99
|
+
u16 buffer_end = GET_BDA(kbd_buf_end_offset);
|
|
100
|
+
|
|
101
|
+
buffer_head += 2;
|
|
102
|
+
if (buffer_head >= buffer_end)
|
|
103
|
+
buffer_head = buffer_start;
|
|
104
|
+
SET_BDA(kbd_buf_head, buffer_head);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static int
|
|
108
|
+
kbd_command(int command, u8 *param)
|
|
109
|
+
{
|
|
110
|
+
if (usb_kbd_active())
|
|
111
|
+
return usb_kbd_command(command, param);
|
|
112
|
+
return ps2_kbd_command(command, param);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// read keyboard input
|
|
116
|
+
static void
|
|
117
|
+
handle_1600(struct bregs *regs)
|
|
118
|
+
{
|
|
119
|
+
dequeue_key(regs, 1, 0);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// check keyboard status
|
|
123
|
+
static void
|
|
124
|
+
handle_1601(struct bregs *regs)
|
|
125
|
+
{
|
|
126
|
+
dequeue_key(regs, 0, 0);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// get shift flag status
|
|
130
|
+
static void
|
|
131
|
+
handle_1602(struct bregs *regs)
|
|
132
|
+
{
|
|
133
|
+
yield();
|
|
134
|
+
regs->al = GET_BDA(kbd_flag0);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// store key-stroke into buffer
|
|
138
|
+
static void
|
|
139
|
+
handle_1605(struct bregs *regs)
|
|
140
|
+
{
|
|
141
|
+
regs->al = !enqueue_key(regs->cx);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// GET KEYBOARD FUNCTIONALITY
|
|
145
|
+
static void
|
|
146
|
+
handle_1609(struct bregs *regs)
|
|
147
|
+
{
|
|
148
|
+
// bit Bochs Description
|
|
149
|
+
// 7 0 reserved
|
|
150
|
+
// 6 0 INT 16/AH=20h-22h supported (122-key keyboard support)
|
|
151
|
+
// 5 1 INT 16/AH=10h-12h supported (enhanced keyboard support)
|
|
152
|
+
// 4 1 INT 16/AH=0Ah supported
|
|
153
|
+
// 3 0 INT 16/AX=0306h supported
|
|
154
|
+
// 2 0 INT 16/AX=0305h supported
|
|
155
|
+
// 1 0 INT 16/AX=0304h supported
|
|
156
|
+
// 0 0 INT 16/AX=0300h supported
|
|
157
|
+
//
|
|
158
|
+
regs->al = 0x30;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// GET KEYBOARD ID
|
|
162
|
+
static void noinline
|
|
163
|
+
handle_160a(struct bregs *regs)
|
|
164
|
+
{
|
|
165
|
+
u8 param[2];
|
|
166
|
+
int ret = kbd_command(ATKBD_CMD_GETID, param);
|
|
167
|
+
if (ret) {
|
|
168
|
+
regs->bx = 0;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
regs->bx = (param[1] << 8) | param[0];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// read MF-II keyboard input
|
|
175
|
+
static void
|
|
176
|
+
handle_1610(struct bregs *regs)
|
|
177
|
+
{
|
|
178
|
+
dequeue_key(regs, 1, 1);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// check MF-II keyboard status
|
|
182
|
+
static void
|
|
183
|
+
handle_1611(struct bregs *regs)
|
|
184
|
+
{
|
|
185
|
+
dequeue_key(regs, 0, 1);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// get extended keyboard status
|
|
189
|
+
static void
|
|
190
|
+
handle_1612(struct bregs *regs)
|
|
191
|
+
{
|
|
192
|
+
yield();
|
|
193
|
+
regs->ax = ((GET_BDA(kbd_flag0) & ~((KF1_RCTRL|KF1_RALT) << 8))
|
|
194
|
+
| ((GET_BDA(kbd_flag1) & (KF1_RCTRL|KF1_RALT)) << 8));
|
|
195
|
+
//BX_DEBUG_INT16("int16: func 12 sending %04x\n",AX);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
static void
|
|
199
|
+
handle_166f(struct bregs *regs)
|
|
200
|
+
{
|
|
201
|
+
if (regs->al == 0x08)
|
|
202
|
+
// unsupported, aka normal keyboard
|
|
203
|
+
regs->ah = 2;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// keyboard capability check called by DOS 5.0+ keyb
|
|
207
|
+
static void
|
|
208
|
+
handle_1692(struct bregs *regs)
|
|
209
|
+
{
|
|
210
|
+
// function int16 ah=0x10-0x12 supported
|
|
211
|
+
regs->ah = 0x80;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// 122 keys capability check called by DOS 5.0+ keyb
|
|
215
|
+
static void
|
|
216
|
+
handle_16a2(struct bregs *regs)
|
|
217
|
+
{
|
|
218
|
+
// don't change AH : function int16 ah=0x20-0x22 NOT supported
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static void
|
|
222
|
+
handle_16XX(struct bregs *regs)
|
|
223
|
+
{
|
|
224
|
+
warn_unimplemented(regs);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
static void noinline
|
|
228
|
+
set_leds(void)
|
|
229
|
+
{
|
|
230
|
+
u8 shift_flags = (GET_BDA(kbd_flag0) >> 4) & 0x07;
|
|
231
|
+
u8 kbd_led = GET_BDA(kbd_led);
|
|
232
|
+
u8 led_flags = kbd_led & 0x07;
|
|
233
|
+
if (shift_flags == led_flags)
|
|
234
|
+
return;
|
|
235
|
+
|
|
236
|
+
int ret = kbd_command(ATKBD_CMD_SETLEDS, &shift_flags);
|
|
237
|
+
if (ret)
|
|
238
|
+
// Error
|
|
239
|
+
return;
|
|
240
|
+
kbd_led = (kbd_led & ~0x07) | shift_flags;
|
|
241
|
+
SET_BDA(kbd_led, kbd_led);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// INT 16h Keyboard Service Entry Point
|
|
245
|
+
void VISIBLE16
|
|
246
|
+
handle_16(struct bregs *regs)
|
|
247
|
+
{
|
|
248
|
+
debug_enter(regs, DEBUG_HDL_16);
|
|
249
|
+
if (! CONFIG_KEYBOARD)
|
|
250
|
+
return;
|
|
251
|
+
|
|
252
|
+
// XXX - set_leds should be called from irq handler
|
|
253
|
+
set_leds();
|
|
254
|
+
|
|
255
|
+
switch (regs->ah) {
|
|
256
|
+
case 0x00: handle_1600(regs); break;
|
|
257
|
+
case 0x01: handle_1601(regs); break;
|
|
258
|
+
case 0x02: handle_1602(regs); break;
|
|
259
|
+
case 0x05: handle_1605(regs); break;
|
|
260
|
+
case 0x09: handle_1609(regs); break;
|
|
261
|
+
case 0x0a: handle_160a(regs); break;
|
|
262
|
+
case 0x10: handle_1610(regs); break;
|
|
263
|
+
case 0x11: handle_1611(regs); break;
|
|
264
|
+
case 0x12: handle_1612(regs); break;
|
|
265
|
+
case 0x92: handle_1692(regs); break;
|
|
266
|
+
case 0xa2: handle_16a2(regs); break;
|
|
267
|
+
case 0x6f: handle_166f(regs); break;
|
|
268
|
+
default: handle_16XX(regs); break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
#define none 0
|
|
273
|
+
|
|
274
|
+
static struct scaninfo {
|
|
275
|
+
u16 normal;
|
|
276
|
+
u16 shift;
|
|
277
|
+
u16 control;
|
|
278
|
+
u16 alt;
|
|
279
|
+
} scan_to_keycode[] VAR16 = {
|
|
280
|
+
{ none, none, none, none },
|
|
281
|
+
{ 0x011b, 0x011b, 0x011b, 0x01f0 }, /* escape */
|
|
282
|
+
{ 0x0231, 0x0221, none, 0x7800 }, /* 1! */
|
|
283
|
+
{ 0x0332, 0x0340, 0x0300, 0x7900 }, /* 2@ */
|
|
284
|
+
{ 0x0433, 0x0423, none, 0x7a00 }, /* 3# */
|
|
285
|
+
{ 0x0534, 0x0524, none, 0x7b00 }, /* 4$ */
|
|
286
|
+
{ 0x0635, 0x0625, none, 0x7c00 }, /* 5% */
|
|
287
|
+
{ 0x0736, 0x075e, 0x071e, 0x7d00 }, /* 6^ */
|
|
288
|
+
{ 0x0837, 0x0826, none, 0x7e00 }, /* 7& */
|
|
289
|
+
{ 0x0938, 0x092a, none, 0x7f00 }, /* 8* */
|
|
290
|
+
{ 0x0a39, 0x0a28, none, 0x8000 }, /* 9( */
|
|
291
|
+
{ 0x0b30, 0x0b29, none, 0x8100 }, /* 0) */
|
|
292
|
+
{ 0x0c2d, 0x0c5f, 0x0c1f, 0x8200 }, /* -_ */
|
|
293
|
+
{ 0x0d3d, 0x0d2b, none, 0x8300 }, /* =+ */
|
|
294
|
+
{ 0x0e08, 0x0e08, 0x0e7f, 0x0ef0 }, /* backspace */
|
|
295
|
+
{ 0x0f09, 0x0f00, 0x9400, 0xa5f0 }, /* tab */
|
|
296
|
+
{ 0x1071, 0x1051, 0x1011, 0x1000 }, /* Q */
|
|
297
|
+
{ 0x1177, 0x1157, 0x1117, 0x1100 }, /* W */
|
|
298
|
+
{ 0x1265, 0x1245, 0x1205, 0x1200 }, /* E */
|
|
299
|
+
{ 0x1372, 0x1352, 0x1312, 0x1300 }, /* R */
|
|
300
|
+
{ 0x1474, 0x1454, 0x1414, 0x1400 }, /* T */
|
|
301
|
+
{ 0x1579, 0x1559, 0x1519, 0x1500 }, /* Y */
|
|
302
|
+
{ 0x1675, 0x1655, 0x1615, 0x1600 }, /* U */
|
|
303
|
+
{ 0x1769, 0x1749, 0x1709, 0x1700 }, /* I */
|
|
304
|
+
{ 0x186f, 0x184f, 0x180f, 0x1800 }, /* O */
|
|
305
|
+
{ 0x1970, 0x1950, 0x1910, 0x1900 }, /* P */
|
|
306
|
+
{ 0x1a5b, 0x1a7b, 0x1a1b, 0x1af0 }, /* [{ */
|
|
307
|
+
{ 0x1b5d, 0x1b7d, 0x1b1d, 0x1bf0 }, /* ]} */
|
|
308
|
+
{ 0x1c0d, 0x1c0d, 0x1c0a, 0x1cf0 }, /* Enter */
|
|
309
|
+
{ none, none, none, none }, /* L Ctrl */
|
|
310
|
+
{ 0x1e61, 0x1e41, 0x1e01, 0x1e00 }, /* A */
|
|
311
|
+
{ 0x1f73, 0x1f53, 0x1f13, 0x1f00 }, /* S */
|
|
312
|
+
{ 0x2064, 0x2044, 0x2004, 0x2000 }, /* D */
|
|
313
|
+
{ 0x2166, 0x2146, 0x2106, 0x2100 }, /* F */
|
|
314
|
+
{ 0x2267, 0x2247, 0x2207, 0x2200 }, /* G */
|
|
315
|
+
{ 0x2368, 0x2348, 0x2308, 0x2300 }, /* H */
|
|
316
|
+
{ 0x246a, 0x244a, 0x240a, 0x2400 }, /* J */
|
|
317
|
+
{ 0x256b, 0x254b, 0x250b, 0x2500 }, /* K */
|
|
318
|
+
{ 0x266c, 0x264c, 0x260c, 0x2600 }, /* L */
|
|
319
|
+
{ 0x273b, 0x273a, none, 0x27f0 }, /* ;: */
|
|
320
|
+
{ 0x2827, 0x2822, none, 0x28f0 }, /* '" */
|
|
321
|
+
{ 0x2960, 0x297e, none, 0x29f0 }, /* `~ */
|
|
322
|
+
{ none, none, none, none }, /* L shift */
|
|
323
|
+
{ 0x2b5c, 0x2b7c, 0x2b1c, 0x2bf0 }, /* |\ */
|
|
324
|
+
{ 0x2c7a, 0x2c5a, 0x2c1a, 0x2c00 }, /* Z */
|
|
325
|
+
{ 0x2d78, 0x2d58, 0x2d18, 0x2d00 }, /* X */
|
|
326
|
+
{ 0x2e63, 0x2e43, 0x2e03, 0x2e00 }, /* C */
|
|
327
|
+
{ 0x2f76, 0x2f56, 0x2f16, 0x2f00 }, /* V */
|
|
328
|
+
{ 0x3062, 0x3042, 0x3002, 0x3000 }, /* B */
|
|
329
|
+
{ 0x316e, 0x314e, 0x310e, 0x3100 }, /* N */
|
|
330
|
+
{ 0x326d, 0x324d, 0x320d, 0x3200 }, /* M */
|
|
331
|
+
{ 0x332c, 0x333c, none, 0x33f0 }, /* ,< */
|
|
332
|
+
{ 0x342e, 0x343e, none, 0x34f0 }, /* .> */
|
|
333
|
+
{ 0x352f, 0x353f, none, 0x35f0 }, /* /? */
|
|
334
|
+
{ none, none, none, none }, /* R Shift */
|
|
335
|
+
{ 0x372a, 0x372a, 0x9600, 0x37f0 }, /* * */
|
|
336
|
+
{ none, none, none, none }, /* L Alt */
|
|
337
|
+
{ 0x3920, 0x3920, 0x3920, 0x3920 }, /* space */
|
|
338
|
+
{ none, none, none, none }, /* caps lock */
|
|
339
|
+
{ 0x3b00, 0x5400, 0x5e00, 0x6800 }, /* F1 */
|
|
340
|
+
{ 0x3c00, 0x5500, 0x5f00, 0x6900 }, /* F2 */
|
|
341
|
+
{ 0x3d00, 0x5600, 0x6000, 0x6a00 }, /* F3 */
|
|
342
|
+
{ 0x3e00, 0x5700, 0x6100, 0x6b00 }, /* F4 */
|
|
343
|
+
{ 0x3f00, 0x5800, 0x6200, 0x6c00 }, /* F5 */
|
|
344
|
+
{ 0x4000, 0x5900, 0x6300, 0x6d00 }, /* F6 */
|
|
345
|
+
{ 0x4100, 0x5a00, 0x6400, 0x6e00 }, /* F7 */
|
|
346
|
+
{ 0x4200, 0x5b00, 0x6500, 0x6f00 }, /* F8 */
|
|
347
|
+
{ 0x4300, 0x5c00, 0x6600, 0x7000 }, /* F9 */
|
|
348
|
+
{ 0x4400, 0x5d00, 0x6700, 0x7100 }, /* F10 */
|
|
349
|
+
{ none, none, none, none }, /* Num Lock */
|
|
350
|
+
{ none, none, none, none }, /* Scroll Lock */
|
|
351
|
+
{ 0x4700, 0x4737, 0x7700, none }, /* 7 Home */
|
|
352
|
+
{ 0x4800, 0x4838, 0x8d00, none }, /* 8 UP */
|
|
353
|
+
{ 0x4900, 0x4939, 0x8400, none }, /* 9 PgUp */
|
|
354
|
+
{ 0x4a2d, 0x4a2d, 0x8e00, 0x4af0 }, /* - */
|
|
355
|
+
{ 0x4b00, 0x4b34, 0x7300, none }, /* 4 Left */
|
|
356
|
+
{ 0x4c00, 0x4c35, 0x8f00, none }, /* 5 */
|
|
357
|
+
{ 0x4d00, 0x4d36, 0x7400, none }, /* 6 Right */
|
|
358
|
+
{ 0x4e2b, 0x4e2b, 0x9000, 0x4ef0 }, /* + */
|
|
359
|
+
{ 0x4f00, 0x4f31, 0x7500, none }, /* 1 End */
|
|
360
|
+
{ 0x5000, 0x5032, 0x9100, none }, /* 2 Down */
|
|
361
|
+
{ 0x5100, 0x5133, 0x7600, none }, /* 3 PgDn */
|
|
362
|
+
{ 0x5200, 0x5230, 0x9200, none }, /* 0 Ins */
|
|
363
|
+
{ 0x5300, 0x532e, 0x9300, none }, /* Del */
|
|
364
|
+
{ none, none, none, none }, /* SysReq */
|
|
365
|
+
{ none, none, none, none },
|
|
366
|
+
{ 0x565c, 0x567c, none, none }, /* \| */
|
|
367
|
+
{ 0x8500, 0x8700, 0x8900, 0x8b00 }, /* F11 */
|
|
368
|
+
{ 0x8600, 0x8800, 0x8a00, 0x8c00 }, /* F12 */
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
struct scaninfo key_ext_enter VAR16 = {
|
|
372
|
+
0xe00d, 0xe00d, 0xe00a, 0xa600
|
|
373
|
+
};
|
|
374
|
+
struct scaninfo key_ext_slash VAR16 = {
|
|
375
|
+
0xe02f, 0xe02f, 0x9500, 0xa400
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
u16 ascii_to_keycode(u8 ascii)
|
|
379
|
+
{
|
|
380
|
+
int i;
|
|
381
|
+
|
|
382
|
+
for (i = 0; i < ARRAY_SIZE(scan_to_keycode); i++) {
|
|
383
|
+
if ((GET_GLOBAL(scan_to_keycode[i].normal) & 0xff) == ascii)
|
|
384
|
+
return GET_GLOBAL(scan_to_keycode[i].normal);
|
|
385
|
+
if ((GET_GLOBAL(scan_to_keycode[i].shift) & 0xff) == ascii)
|
|
386
|
+
return GET_GLOBAL(scan_to_keycode[i].shift);
|
|
387
|
+
if ((GET_GLOBAL(scan_to_keycode[i].control) & 0xff) == ascii)
|
|
388
|
+
return GET_GLOBAL(scan_to_keycode[i].control);
|
|
389
|
+
}
|
|
390
|
+
return 0;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Handle a ps2 style scancode read from the keyboard.
|
|
394
|
+
static void
|
|
395
|
+
kbd_set_flag(int key_release, u16 set_bit0, u8 set_bit1, u16 toggle_bit)
|
|
396
|
+
{
|
|
397
|
+
u16 flags0 = GET_BDA(kbd_flag0);
|
|
398
|
+
u8 flags1 = GET_BDA(kbd_flag1);
|
|
399
|
+
if (key_release) {
|
|
400
|
+
flags0 &= ~set_bit0;
|
|
401
|
+
flags1 &= ~set_bit1;
|
|
402
|
+
} else {
|
|
403
|
+
flags0 ^= toggle_bit;
|
|
404
|
+
flags0 |= set_bit0;
|
|
405
|
+
flags1 |= set_bit1;
|
|
406
|
+
}
|
|
407
|
+
SET_BDA(kbd_flag0, flags0);
|
|
408
|
+
SET_BDA(kbd_flag1, flags1);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
static void
|
|
412
|
+
kbd_ctrl_break(int key_release)
|
|
413
|
+
{
|
|
414
|
+
if (!key_release)
|
|
415
|
+
return;
|
|
416
|
+
// Clear keyboard buffer and place 0x0000 in buffer
|
|
417
|
+
u16 buffer_start = GET_BDA(kbd_buf_start_offset);
|
|
418
|
+
SET_BDA(kbd_buf_head, buffer_start);
|
|
419
|
+
SET_BDA(kbd_buf_tail, buffer_start+2);
|
|
420
|
+
SET_FARVAR(SEG_BDA, *(u16*)(buffer_start+0), 0x0000);
|
|
421
|
+
// Set break flag
|
|
422
|
+
SET_BDA(break_flag, 0x80);
|
|
423
|
+
// Generate int 0x1b
|
|
424
|
+
struct bregs br;
|
|
425
|
+
memset(&br, 0, sizeof(br));
|
|
426
|
+
br.flags = F_IF;
|
|
427
|
+
call16_int(0x1b, &br);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
static void
|
|
431
|
+
kbd_sysreq(int key_release)
|
|
432
|
+
{
|
|
433
|
+
// SysReq generates int 0x15/0x85
|
|
434
|
+
struct bregs br;
|
|
435
|
+
memset(&br, 0, sizeof(br));
|
|
436
|
+
br.ah = 0x85;
|
|
437
|
+
br.al = key_release ? 0x01 : 0x00;
|
|
438
|
+
br.flags = F_IF;
|
|
439
|
+
call16_int(0x15, &br);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
static void
|
|
443
|
+
kbd_prtscr(int key_release)
|
|
444
|
+
{
|
|
445
|
+
if (key_release)
|
|
446
|
+
return;
|
|
447
|
+
// PrtScr generates int 0x05 (ctrl-prtscr has keycode 0x7200?)
|
|
448
|
+
struct bregs br;
|
|
449
|
+
memset(&br, 0, sizeof(br));
|
|
450
|
+
br.flags = F_IF;
|
|
451
|
+
call16_int(0x05, &br);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// Handle a ps2 style scancode read from the keyboard.
|
|
455
|
+
static void
|
|
456
|
+
__process_key(u8 scancode)
|
|
457
|
+
{
|
|
458
|
+
// Check for multi-scancode key sequences
|
|
459
|
+
u8 flags1 = GET_BDA(kbd_flag1);
|
|
460
|
+
if (scancode == 0xe0 || scancode == 0xe1) {
|
|
461
|
+
// Start of two byte extended (e0) or three byte pause key (e1) sequence
|
|
462
|
+
u8 eflag = scancode == 0xe0 ? KF1_LAST_E0 : KF1_LAST_E1;
|
|
463
|
+
SET_BDA(kbd_flag1, flags1 | eflag);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
int key_release = scancode & 0x80;
|
|
467
|
+
scancode &= ~0x80;
|
|
468
|
+
if (flags1 & (KF1_LAST_E0|KF1_LAST_E1)) {
|
|
469
|
+
if (flags1 & KF1_LAST_E1 && scancode == 0x1d)
|
|
470
|
+
// Ignore second byte of pause key (e1 1d 45 / e1 9d c5)
|
|
471
|
+
return;
|
|
472
|
+
// Clear E0/E1 flag in memory for next key event
|
|
473
|
+
SET_BDA(kbd_flag1, flags1 & ~(KF1_LAST_E0|KF1_LAST_E1));
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Check for special keys
|
|
477
|
+
switch (scancode) {
|
|
478
|
+
case 0x3a: /* Caps Lock */
|
|
479
|
+
kbd_set_flag(key_release, KF0_CAPS, 0, KF0_CAPSACTIVE);
|
|
480
|
+
return;
|
|
481
|
+
case 0x2a: /* L Shift */
|
|
482
|
+
if (flags1 & KF1_LAST_E0)
|
|
483
|
+
// Ignore fake shifts
|
|
484
|
+
return;
|
|
485
|
+
kbd_set_flag(key_release, KF0_LSHIFT, 0, 0);
|
|
486
|
+
return;
|
|
487
|
+
case 0x36: /* R Shift */
|
|
488
|
+
if (flags1 & KF1_LAST_E0)
|
|
489
|
+
// Ignore fake shifts
|
|
490
|
+
return;
|
|
491
|
+
kbd_set_flag(key_release, KF0_RSHIFT, 0, 0);
|
|
492
|
+
return;
|
|
493
|
+
case 0x1d: /* Ctrl */
|
|
494
|
+
if (flags1 & KF1_LAST_E0)
|
|
495
|
+
kbd_set_flag(key_release, KF0_CTRLACTIVE, KF1_RCTRL, 0);
|
|
496
|
+
else
|
|
497
|
+
kbd_set_flag(key_release, KF0_CTRLACTIVE | KF0_LCTRL, 0, 0);
|
|
498
|
+
return;
|
|
499
|
+
case 0x38: /* Alt */
|
|
500
|
+
if (flags1 & KF1_LAST_E0)
|
|
501
|
+
kbd_set_flag(key_release, KF0_ALTACTIVE, KF1_RALT, 0);
|
|
502
|
+
else
|
|
503
|
+
kbd_set_flag(key_release, KF0_ALTACTIVE | KF0_LALT, 0, 0);
|
|
504
|
+
return;
|
|
505
|
+
case 0x45: /* Num Lock */
|
|
506
|
+
if (flags1 & KF1_LAST_E1)
|
|
507
|
+
// XXX - pause key.
|
|
508
|
+
return;
|
|
509
|
+
kbd_set_flag(key_release, KF0_NUM, 0, KF0_NUMACTIVE);
|
|
510
|
+
return;
|
|
511
|
+
case 0x46: /* Scroll Lock */
|
|
512
|
+
if (flags1 & KF1_LAST_E0) {
|
|
513
|
+
kbd_ctrl_break(key_release);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
kbd_set_flag(key_release, KF0_SCROLL, 0, KF0_SCROLLACTIVE);
|
|
517
|
+
return;
|
|
518
|
+
|
|
519
|
+
case 0x37: /* * */
|
|
520
|
+
if (flags1 & KF1_LAST_E0) {
|
|
521
|
+
kbd_prtscr(key_release);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
break;
|
|
525
|
+
case 0x54: /* SysReq */
|
|
526
|
+
kbd_sysreq(key_release);
|
|
527
|
+
return;
|
|
528
|
+
case 0x53: /* Del */
|
|
529
|
+
if ((GET_BDA(kbd_flag0) & (KF0_CTRLACTIVE|KF0_ALTACTIVE))
|
|
530
|
+
== (KF0_CTRLACTIVE|KF0_ALTACTIVE) && !key_release) {
|
|
531
|
+
// Ctrl+alt+del - reset machine.
|
|
532
|
+
SET_BDA(soft_reset_flag, 0x1234);
|
|
533
|
+
reset();
|
|
534
|
+
}
|
|
535
|
+
break;
|
|
536
|
+
|
|
537
|
+
default:
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Handle generic keys
|
|
542
|
+
if (key_release)
|
|
543
|
+
// ignore key releases
|
|
544
|
+
return;
|
|
545
|
+
if (!scancode || scancode >= ARRAY_SIZE(scan_to_keycode)) {
|
|
546
|
+
dprintf(1, "__process_key unknown scancode read: 0x%02x!\n", scancode);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
struct scaninfo *info = &scan_to_keycode[scancode];
|
|
550
|
+
if (flags1 & KF1_LAST_E0 && (scancode == 0x1c || scancode == 0x35))
|
|
551
|
+
info = (scancode == 0x1c ? &key_ext_enter : &key_ext_slash);
|
|
552
|
+
u16 flags0 = GET_BDA(kbd_flag0);
|
|
553
|
+
u16 keycode;
|
|
554
|
+
if (flags0 & KF0_ALTACTIVE) {
|
|
555
|
+
keycode = GET_GLOBAL(info->alt);
|
|
556
|
+
} else if (flags0 & KF0_CTRLACTIVE) {
|
|
557
|
+
keycode = GET_GLOBAL(info->control);
|
|
558
|
+
} else {
|
|
559
|
+
u8 useshift = flags0 & (KF0_RSHIFT|KF0_LSHIFT) ? 1 : 0;
|
|
560
|
+
u8 ascii = GET_GLOBAL(info->normal) & 0xff;
|
|
561
|
+
if ((flags0 & KF0_NUMACTIVE && scancode >= 0x47 && scancode <= 0x53)
|
|
562
|
+
|| (flags0 & KF0_CAPSACTIVE && ascii >= 'a' && ascii <= 'z'))
|
|
563
|
+
// Numlock/capslock toggles shift on certain keys
|
|
564
|
+
useshift ^= 1;
|
|
565
|
+
if (useshift)
|
|
566
|
+
keycode = GET_GLOBAL(info->shift);
|
|
567
|
+
else
|
|
568
|
+
keycode = GET_GLOBAL(info->normal);
|
|
569
|
+
}
|
|
570
|
+
if (flags1 & KF1_LAST_E0 && scancode >= 0x47 && scancode <= 0x53) {
|
|
571
|
+
/* extended keys handling */
|
|
572
|
+
if (flags0 & KF0_ALTACTIVE)
|
|
573
|
+
keycode = (scancode + 0x50) << 8;
|
|
574
|
+
else
|
|
575
|
+
keycode = (keycode & 0xff00) | 0xe0;
|
|
576
|
+
}
|
|
577
|
+
if (keycode)
|
|
578
|
+
enqueue_key(keycode);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
void
|
|
582
|
+
process_key(u8 key)
|
|
583
|
+
{
|
|
584
|
+
if (!CONFIG_KEYBOARD)
|
|
585
|
+
return;
|
|
586
|
+
|
|
587
|
+
if (CONFIG_KBD_CALL_INT15_4F) {
|
|
588
|
+
// allow for keyboard intercept
|
|
589
|
+
struct bregs br;
|
|
590
|
+
memset(&br, 0, sizeof(br));
|
|
591
|
+
br.eax = (0x4f << 8) | key;
|
|
592
|
+
br.flags = F_IF|F_CF;
|
|
593
|
+
call16_int(0x15, &br);
|
|
594
|
+
if (!(br.flags & F_CF))
|
|
595
|
+
return;
|
|
596
|
+
key = br.eax;
|
|
597
|
+
}
|
|
598
|
+
__process_key(key);
|
|
599
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#ifndef __LIST_H
|
|
2
|
+
#define __LIST_H
|
|
3
|
+
|
|
4
|
+
#include "types.h" // container_of
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/****************************************************************
|
|
8
|
+
* hlist - Double linked lists with a single pointer list head
|
|
9
|
+
****************************************************************/
|
|
10
|
+
|
|
11
|
+
struct hlist_node {
|
|
12
|
+
struct hlist_node *next, **pprev;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
struct hlist_head {
|
|
16
|
+
struct hlist_node *first;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
static inline int
|
|
20
|
+
hlist_empty(const struct hlist_head *h)
|
|
21
|
+
{
|
|
22
|
+
return !h->first;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static inline void
|
|
26
|
+
hlist_del(struct hlist_node *n)
|
|
27
|
+
{
|
|
28
|
+
struct hlist_node *next = n->next;
|
|
29
|
+
struct hlist_node **pprev = n->pprev;
|
|
30
|
+
*pprev = next;
|
|
31
|
+
if (next)
|
|
32
|
+
next->pprev = pprev;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static inline void
|
|
36
|
+
hlist_add(struct hlist_node *n, struct hlist_node **pprev)
|
|
37
|
+
{
|
|
38
|
+
struct hlist_node *next = *pprev;
|
|
39
|
+
n->pprev = pprev;
|
|
40
|
+
n->next = next;
|
|
41
|
+
if (next)
|
|
42
|
+
next->pprev = &n->next;
|
|
43
|
+
*pprev = n;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static inline void
|
|
47
|
+
hlist_add_head(struct hlist_node *n, struct hlist_head *h)
|
|
48
|
+
{
|
|
49
|
+
hlist_add(n, &h->first);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static inline void
|
|
53
|
+
hlist_add_before(struct hlist_node *n, struct hlist_node *next)
|
|
54
|
+
{
|
|
55
|
+
hlist_add(n, next->pprev);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static inline void
|
|
59
|
+
hlist_add_after(struct hlist_node *n, struct hlist_node *prev)
|
|
60
|
+
{
|
|
61
|
+
hlist_add(n, &prev->next);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static inline void
|
|
65
|
+
hlist_replace(struct hlist_node *old, struct hlist_node *new)
|
|
66
|
+
{
|
|
67
|
+
new->next = old->next;
|
|
68
|
+
if (new->next)
|
|
69
|
+
new->next->pprev = &new->next;
|
|
70
|
+
new->pprev = old->pprev;
|
|
71
|
+
*new->pprev = new;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#define hlist_for_each_entry(pos, head, member) \
|
|
75
|
+
for (pos = container_of((head)->first, typeof(*pos), member) \
|
|
76
|
+
; pos != container_of(NULL, typeof(*pos), member) \
|
|
77
|
+
; pos = container_of(pos->member.next, typeof(*pos), member))
|
|
78
|
+
|
|
79
|
+
#define hlist_for_each_entry_safe(pos, n, head, member) \
|
|
80
|
+
for (pos = container_of((head)->first, typeof(*pos), member) \
|
|
81
|
+
; pos != container_of(NULL, typeof(*pos), member) \
|
|
82
|
+
&& ({ n = pos->member.next; 1; }) \
|
|
83
|
+
; pos = container_of(n, typeof(*pos), member))
|
|
84
|
+
|
|
85
|
+
#define hlist_for_each_entry_pprev(pos, pprev, head, member) \
|
|
86
|
+
for (pprev = &(head)->first \
|
|
87
|
+
; *pprev && ({ pos=container_of(*pprev, typeof(*pos), member); 1; }) \
|
|
88
|
+
; pprev = &(*pprev)->next)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
#endif // list.h
|