v86 0.3.7 → 0.5.10

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.
Files changed (386) hide show
  1. package/Readme.md +64 -108
  2. package/build/libv86-debug.js +12677 -0
  3. package/build/libv86-debug.mjs +732 -0
  4. package/build/libv86.js +710 -0
  5. package/build/libv86.mjs +636 -0
  6. package/build/v86-debug.wasm +0 -0
  7. package/build/v86-fallback.wasm +0 -0
  8. package/build/v86.wasm +0 -0
  9. package/package.json +12 -35
  10. package/bios/.gitignore +0 -1
  11. package/bios/COPYING.LESSER +0 -165
  12. package/bios/bochs-bios.bin +0 -0
  13. package/bios/bochs-vgabios.bin +0 -0
  14. package/bios/fetch-and-build-seabios.sh +0 -13
  15. package/bios/seabios/.config +0 -113
  16. package/bios/seabios/.config.old +0 -114
  17. package/bios/seabios/.gitignore +0 -4
  18. package/bios/seabios/COPYING +0 -674
  19. package/bios/seabios/COPYING.LESSER +0 -165
  20. package/bios/seabios/Makefile +0 -286
  21. package/bios/seabios/README +0 -17
  22. package/bios/seabios/docs/Build_overview.md +0 -104
  23. package/bios/seabios/docs/Contributing.md +0 -20
  24. package/bios/seabios/docs/Debugging.md +0 -111
  25. package/bios/seabios/docs/Developer_Documentation.md +0 -25
  26. package/bios/seabios/docs/Developer_links.md +0 -86
  27. package/bios/seabios/docs/Download.md +0 -27
  28. package/bios/seabios/docs/Execution_and_code_flow.md +0 -178
  29. package/bios/seabios/docs/Linking_overview.md +0 -160
  30. package/bios/seabios/docs/Mailinglist.md +0 -8
  31. package/bios/seabios/docs/Memory_Model.md +0 -253
  32. package/bios/seabios/docs/README +0 -5
  33. package/bios/seabios/docs/Releases.md +0 -482
  34. package/bios/seabios/docs/Runtime_config.md +0 -193
  35. package/bios/seabios/docs/SeaBIOS.md +0 -17
  36. package/bios/seabios/docs/SeaVGABIOS.md +0 -39
  37. package/bios/seabios/out/autoconf.h +0 -117
  38. package/bios/seabios/out/include/config/acpi/dsdt.h +0 -0
  39. package/bios/seabios/out/include/config/acpi.h +0 -0
  40. package/bios/seabios/out/include/config/ahci.h +0 -0
  41. package/bios/seabios/out/include/config/apmbios.h +0 -0
  42. package/bios/seabios/out/include/config/ata/dma.h +0 -0
  43. package/bios/seabios/out/include/config/ata/pio32.h +0 -0
  44. package/bios/seabios/out/include/config/ata.h +0 -0
  45. package/bios/seabios/out/include/config/auto.conf +0 -69
  46. package/bios/seabios/out/include/config/auto.conf.cmd +0 -9
  47. package/bios/seabios/out/include/config/boot.h +0 -0
  48. package/bios/seabios/out/include/config/bootorder.h +0 -0
  49. package/bios/seabios/out/include/config/build/vgabios.h +0 -0
  50. package/bios/seabios/out/include/config/call32/smm.h +0 -0
  51. package/bios/seabios/out/include/config/cdrom/boot.h +0 -0
  52. package/bios/seabios/out/include/config/cdrom/emu.h +0 -0
  53. package/bios/seabios/out/include/config/debug/level.h +0 -0
  54. package/bios/seabios/out/include/config/drives.h +0 -0
  55. package/bios/seabios/out/include/config/entry/extrastack.h +0 -0
  56. package/bios/seabios/out/include/config/esp/scsi.h +0 -0
  57. package/bios/seabios/out/include/config/flash/floppy.h +0 -0
  58. package/bios/seabios/out/include/config/floppy.h +0 -0
  59. package/bios/seabios/out/include/config/fw/romfile/load.h +0 -0
  60. package/bios/seabios/out/include/config/hardware/irq.h +0 -0
  61. package/bios/seabios/out/include/config/kbd/call/int15/4f.h +0 -0
  62. package/bios/seabios/out/include/config/keyboard.h +0 -0
  63. package/bios/seabios/out/include/config/lpt.h +0 -0
  64. package/bios/seabios/out/include/config/lsi/scsi.h +0 -0
  65. package/bios/seabios/out/include/config/malloc/uppermemory.h +0 -0
  66. package/bios/seabios/out/include/config/megasas.h +0 -0
  67. package/bios/seabios/out/include/config/mouse.h +0 -0
  68. package/bios/seabios/out/include/config/mpt/scsi.h +0 -0
  69. package/bios/seabios/out/include/config/mptable.h +0 -0
  70. package/bios/seabios/out/include/config/mtrr/init.h +0 -0
  71. package/bios/seabios/out/include/config/optionroms.h +0 -0
  72. package/bios/seabios/out/include/config/override/pci/id.h +0 -0
  73. package/bios/seabios/out/include/config/pcibios.h +0 -0
  74. package/bios/seabios/out/include/config/pirtable.h +0 -0
  75. package/bios/seabios/out/include/config/pmm.h +0 -0
  76. package/bios/seabios/out/include/config/pmtimer.h +0 -0
  77. package/bios/seabios/out/include/config/pnpbios.h +0 -0
  78. package/bios/seabios/out/include/config/ps2port.h +0 -0
  79. package/bios/seabios/out/include/config/pvscsi.h +0 -0
  80. package/bios/seabios/out/include/config/qemu/hardware.h +0 -0
  81. package/bios/seabios/out/include/config/qemu.h +0 -0
  82. package/bios/seabios/out/include/config/rom/size.h +0 -0
  83. package/bios/seabios/out/include/config/rtc/timer.h +0 -0
  84. package/bios/seabios/out/include/config/s3/resume.h +0 -0
  85. package/bios/seabios/out/include/config/sdcard.h +0 -0
  86. package/bios/seabios/out/include/config/serial.h +0 -0
  87. package/bios/seabios/out/include/config/tcgbios.h +0 -0
  88. package/bios/seabios/out/include/config/threads.h +0 -0
  89. package/bios/seabios/out/include/config/tristate.conf +0 -4
  90. package/bios/seabios/out/include/config/tsc/timer.h +0 -0
  91. package/bios/seabios/out/include/config/use/smm.h +0 -0
  92. package/bios/seabios/out/include/config/vga/allocate/extra/stack.h +0 -0
  93. package/bios/seabios/out/include/config/vga/bochs/stdvga.h +0 -0
  94. package/bios/seabios/out/include/config/vga/bochs.h +0 -0
  95. package/bios/seabios/out/include/config/vga/did.h +0 -0
  96. package/bios/seabios/out/include/config/vga/extra/stack/size.h +0 -0
  97. package/bios/seabios/out/include/config/vga/fixup/asm.h +0 -0
  98. package/bios/seabios/out/include/config/vga/pci.h +0 -0
  99. package/bios/seabios/out/include/config/vga/stdvga/ports.h +0 -0
  100. package/bios/seabios/out/include/config/vga/vbe.h +0 -0
  101. package/bios/seabios/out/include/config/vga/vid.h +0 -0
  102. package/bios/seabios/out/include/config/vgahooks.h +0 -0
  103. package/bios/seabios/out/include/config/virtio/blk.h +0 -0
  104. package/bios/seabios/out/include/config/virtio/scsi.h +0 -0
  105. package/bios/seabios/out/include/config/xen.h +0 -0
  106. package/bios/seabios/out/scripts/kconfig/conf +0 -0
  107. package/bios/seabios/out/scripts/kconfig/conf.o +0 -0
  108. package/bios/seabios/out/scripts/kconfig/zconf.hash.c +0 -289
  109. package/bios/seabios/out/scripts/kconfig/zconf.lex.c +0 -2420
  110. package/bios/seabios/out/scripts/kconfig/zconf.tab.c +0 -2538
  111. package/bios/seabios/out/scripts/kconfig/zconf.tab.o +0 -0
  112. package/bios/seabios/scripts/acpi_extract.py +0 -366
  113. package/bios/seabios/scripts/acpi_extract_preprocess.py +0 -41
  114. package/bios/seabios/scripts/buildrom.py +0 -56
  115. package/bios/seabios/scripts/buildversion.py +0 -134
  116. package/bios/seabios/scripts/checkrom.py +0 -95
  117. package/bios/seabios/scripts/checkstack.py +0 -226
  118. package/bios/seabios/scripts/checksum.py +0 -16
  119. package/bios/seabios/scripts/encodeint.py +0 -21
  120. package/bios/seabios/scripts/gen-offsets.sh +0 -17
  121. package/bios/seabios/scripts/kconfig/.gitignore +0 -22
  122. package/bios/seabios/scripts/kconfig/Makefile +0 -331
  123. package/bios/seabios/scripts/kconfig/POTFILES.in +0 -12
  124. package/bios/seabios/scripts/kconfig/check.sh +0 -13
  125. package/bios/seabios/scripts/kconfig/conf.c +0 -718
  126. package/bios/seabios/scripts/kconfig/confdata.c +0 -1250
  127. package/bios/seabios/scripts/kconfig/expr.c +0 -1168
  128. package/bios/seabios/scripts/kconfig/expr.h +0 -241
  129. package/bios/seabios/scripts/kconfig/gconf.c +0 -1542
  130. package/bios/seabios/scripts/kconfig/gconf.glade +0 -661
  131. package/bios/seabios/scripts/kconfig/images.c +0 -326
  132. package/bios/seabios/scripts/kconfig/kxgettext.c +0 -235
  133. package/bios/seabios/scripts/kconfig/lex.zconf.c +0 -2430
  134. package/bios/seabios/scripts/kconfig/list.h +0 -131
  135. package/bios/seabios/scripts/kconfig/lkc.h +0 -200
  136. package/bios/seabios/scripts/kconfig/lkc_proto.h +0 -57
  137. package/bios/seabios/scripts/kconfig/lxdialog/.gitignore +0 -4
  138. package/bios/seabios/scripts/kconfig/lxdialog/BIG.FAT.WARNING +0 -4
  139. package/bios/seabios/scripts/kconfig/lxdialog/check-lxdialog.sh +0 -87
  140. package/bios/seabios/scripts/kconfig/lxdialog/checklist.c +0 -332
  141. package/bios/seabios/scripts/kconfig/lxdialog/dialog.h +0 -257
  142. package/bios/seabios/scripts/kconfig/lxdialog/inputbox.c +0 -301
  143. package/bios/seabios/scripts/kconfig/lxdialog/menubox.c +0 -437
  144. package/bios/seabios/scripts/kconfig/lxdialog/textbox.c +0 -408
  145. package/bios/seabios/scripts/kconfig/lxdialog/util.c +0 -713
  146. package/bios/seabios/scripts/kconfig/lxdialog/yesno.c +0 -114
  147. package/bios/seabios/scripts/kconfig/mconf.c +0 -1036
  148. package/bios/seabios/scripts/kconfig/menu.c +0 -697
  149. package/bios/seabios/scripts/kconfig/merge_config.sh +0 -150
  150. package/bios/seabios/scripts/kconfig/nconf.c +0 -1556
  151. package/bios/seabios/scripts/kconfig/nconf.gui.c +0 -656
  152. package/bios/seabios/scripts/kconfig/nconf.h +0 -96
  153. package/bios/seabios/scripts/kconfig/qconf.cc +0 -1795
  154. package/bios/seabios/scripts/kconfig/qconf.h +0 -338
  155. package/bios/seabios/scripts/kconfig/streamline_config.pl +0 -647
  156. package/bios/seabios/scripts/kconfig/symbol.c +0 -1373
  157. package/bios/seabios/scripts/kconfig/util.c +0 -157
  158. package/bios/seabios/scripts/kconfig/zconf.gperf +0 -48
  159. package/bios/seabios/scripts/kconfig/zconf.hash.c_shipped +0 -289
  160. package/bios/seabios/scripts/kconfig/zconf.l +0 -363
  161. package/bios/seabios/scripts/kconfig/zconf.lex.c_shipped +0 -2420
  162. package/bios/seabios/scripts/kconfig/zconf.tab.c_shipped +0 -2538
  163. package/bios/seabios/scripts/kconfig/zconf.y +0 -733
  164. package/bios/seabios/scripts/layoutrom.py +0 -705
  165. package/bios/seabios/scripts/python23compat.py +0 -14
  166. package/bios/seabios/scripts/readserial.py +0 -190
  167. package/bios/seabios/scripts/tarball.sh +0 -36
  168. package/bios/seabios/scripts/test-build.sh +0 -90
  169. package/bios/seabios/scripts/transdump.py +0 -53
  170. package/bios/seabios/scripts/vgafixup.py +0 -96
  171. package/bios/seabios/src/Kconfig +0 -579
  172. package/bios/seabios/src/apm.c +0 -215
  173. package/bios/seabios/src/asm-offsets.c +0 -23
  174. package/bios/seabios/src/biosvar.h +0 -130
  175. package/bios/seabios/src/block.c +0 -623
  176. package/bios/seabios/src/block.h +0 -121
  177. package/bios/seabios/src/bmp.c +0 -117
  178. package/bios/seabios/src/boot.c +0 -793
  179. package/bios/seabios/src/bootsplash.c +0 -255
  180. package/bios/seabios/src/bregs.h +0 -80
  181. package/bios/seabios/src/byteorder.h +0 -71
  182. package/bios/seabios/src/cdrom.c +0 -322
  183. package/bios/seabios/src/clock.c +0 -506
  184. package/bios/seabios/src/code16gcc.s +0 -1
  185. package/bios/seabios/src/config.h +0 -108
  186. package/bios/seabios/src/cp437.c +0 -275
  187. package/bios/seabios/src/cp437.h +0 -1
  188. package/bios/seabios/src/disk.c +0 -779
  189. package/bios/seabios/src/e820map.c +0 -152
  190. package/bios/seabios/src/e820map.h +0 -26
  191. package/bios/seabios/src/entryfuncs.S +0 -165
  192. package/bios/seabios/src/farptr.h +0 -208
  193. package/bios/seabios/src/font.c +0 -139
  194. package/bios/seabios/src/fw/acpi-dsdt-cpu-hotplug.dsl +0 -78
  195. package/bios/seabios/src/fw/acpi-dsdt-dbug.dsl +0 -26
  196. package/bios/seabios/src/fw/acpi-dsdt-hpet.dsl +0 -36
  197. package/bios/seabios/src/fw/acpi-dsdt-isa.dsl +0 -102
  198. package/bios/seabios/src/fw/acpi-dsdt-pci-crs.dsl +0 -90
  199. package/bios/seabios/src/fw/acpi-dsdt.dsl +0 -342
  200. package/bios/seabios/src/fw/acpi-dsdt.hex +0 -554
  201. package/bios/seabios/src/fw/acpi.c +0 -685
  202. package/bios/seabios/src/fw/biostables.c +0 -491
  203. package/bios/seabios/src/fw/coreboot.c +0 -569
  204. package/bios/seabios/src/fw/csm.c +0 -347
  205. package/bios/seabios/src/fw/dev-pci.h +0 -52
  206. package/bios/seabios/src/fw/dev-piix.h +0 -29
  207. package/bios/seabios/src/fw/dev-q35.h +0 -52
  208. package/bios/seabios/src/fw/lzmadecode.c +0 -398
  209. package/bios/seabios/src/fw/lzmadecode.h +0 -67
  210. package/bios/seabios/src/fw/mptable.c +0 -197
  211. package/bios/seabios/src/fw/mtrr.c +0 -105
  212. package/bios/seabios/src/fw/multiboot.c +0 -111
  213. package/bios/seabios/src/fw/paravirt.c +0 -624
  214. package/bios/seabios/src/fw/paravirt.h +0 -63
  215. package/bios/seabios/src/fw/pciinit.c +0 -1187
  216. package/bios/seabios/src/fw/pirtable.c +0 -103
  217. package/bios/seabios/src/fw/q35-acpi-dsdt.dsl +0 -450
  218. package/bios/seabios/src/fw/romfile_loader.c +0 -259
  219. package/bios/seabios/src/fw/romfile_loader.h +0 -91
  220. package/bios/seabios/src/fw/shadow.c +0 -208
  221. package/bios/seabios/src/fw/smbios.c +0 -585
  222. package/bios/seabios/src/fw/smm.c +0 -269
  223. package/bios/seabios/src/fw/smp.c +0 -194
  224. package/bios/seabios/src/fw/ssdt-misc.dsl +0 -104
  225. package/bios/seabios/src/fw/ssdt-misc.hex +0 -88
  226. package/bios/seabios/src/fw/ssdt-pcihp.dsl +0 -36
  227. package/bios/seabios/src/fw/ssdt-pcihp.hex +0 -38
  228. package/bios/seabios/src/fw/ssdt-proc.dsl +0 -48
  229. package/bios/seabios/src/fw/ssdt-proc.hex +0 -35
  230. package/bios/seabios/src/fw/xen.c +0 -149
  231. package/bios/seabios/src/fw/xen.h +0 -125
  232. package/bios/seabios/src/gen-defs.h +0 -19
  233. package/bios/seabios/src/hw/ahci.c +0 -697
  234. package/bios/seabios/src/hw/ahci.h +0 -201
  235. package/bios/seabios/src/hw/ata.c +0 -1046
  236. package/bios/seabios/src/hw/ata.h +0 -163
  237. package/bios/seabios/src/hw/blockcmd.c +0 -372
  238. package/bios/seabios/src/hw/blockcmd.h +0 -114
  239. package/bios/seabios/src/hw/dma.c +0 -67
  240. package/bios/seabios/src/hw/esp-scsi.c +0 -241
  241. package/bios/seabios/src/hw/esp-scsi.h +0 -8
  242. package/bios/seabios/src/hw/floppy.c +0 -741
  243. package/bios/seabios/src/hw/lsi-scsi.c +0 -221
  244. package/bios/seabios/src/hw/lsi-scsi.h +0 -8
  245. package/bios/seabios/src/hw/megasas.c +0 -405
  246. package/bios/seabios/src/hw/megasas.h +0 -8
  247. package/bios/seabios/src/hw/mpt-scsi.c +0 -319
  248. package/bios/seabios/src/hw/mpt-scsi.h +0 -8
  249. package/bios/seabios/src/hw/nvme-int.h +0 -199
  250. package/bios/seabios/src/hw/nvme.c +0 -708
  251. package/bios/seabios/src/hw/nvme.h +0 -17
  252. package/bios/seabios/src/hw/pci.c +0 -133
  253. package/bios/seabios/src/hw/pci.h +0 -47
  254. package/bios/seabios/src/hw/pci_ids.h +0 -2632
  255. package/bios/seabios/src/hw/pci_regs.h +0 -556
  256. package/bios/seabios/src/hw/pcidevice.c +0 -192
  257. package/bios/seabios/src/hw/pcidevice.h +0 -76
  258. package/bios/seabios/src/hw/pic.c +0 -115
  259. package/bios/seabios/src/hw/pic.h +0 -60
  260. package/bios/seabios/src/hw/ps2port.c +0 -543
  261. package/bios/seabios/src/hw/ps2port.h +0 -67
  262. package/bios/seabios/src/hw/pvscsi.c +0 -333
  263. package/bios/seabios/src/hw/pvscsi.h +0 -8
  264. package/bios/seabios/src/hw/ramdisk.c +0 -108
  265. package/bios/seabios/src/hw/rtc.c +0 -100
  266. package/bios/seabios/src/hw/rtc.h +0 -75
  267. package/bios/seabios/src/hw/sdcard.c +0 -572
  268. package/bios/seabios/src/hw/serialio.c +0 -113
  269. package/bios/seabios/src/hw/serialio.h +0 -29
  270. package/bios/seabios/src/hw/timer.c +0 -259
  271. package/bios/seabios/src/hw/tpm_drivers.c +0 -636
  272. package/bios/seabios/src/hw/tpm_drivers.h +0 -127
  273. package/bios/seabios/src/hw/usb-ehci.c +0 -650
  274. package/bios/seabios/src/hw/usb-ehci.h +0 -177
  275. package/bios/seabios/src/hw/usb-hid.c +0 -442
  276. package/bios/seabios/src/hw/usb-hid.h +0 -29
  277. package/bios/seabios/src/hw/usb-hub.c +0 -205
  278. package/bios/seabios/src/hw/usb-hub.h +0 -64
  279. package/bios/seabios/src/hw/usb-msc.c +0 -222
  280. package/bios/seabios/src/hw/usb-msc.h +0 -10
  281. package/bios/seabios/src/hw/usb-ohci.c +0 -568
  282. package/bios/seabios/src/hw/usb-ohci.h +0 -144
  283. package/bios/seabios/src/hw/usb-uas.c +0 -289
  284. package/bios/seabios/src/hw/usb-uas.h +0 -9
  285. package/bios/seabios/src/hw/usb-uhci.c +0 -571
  286. package/bios/seabios/src/hw/usb-uhci.h +0 -128
  287. package/bios/seabios/src/hw/usb-xhci.c +0 -1161
  288. package/bios/seabios/src/hw/usb-xhci.h +0 -133
  289. package/bios/seabios/src/hw/usb.c +0 -499
  290. package/bios/seabios/src/hw/usb.h +0 -254
  291. package/bios/seabios/src/hw/virtio-blk.c +0 -211
  292. package/bios/seabios/src/hw/virtio-blk.h +0 -43
  293. package/bios/seabios/src/hw/virtio-pci.c +0 -501
  294. package/bios/seabios/src/hw/virtio-pci.h +0 -151
  295. package/bios/seabios/src/hw/virtio-ring.c +0 -147
  296. package/bios/seabios/src/hw/virtio-ring.h +0 -121
  297. package/bios/seabios/src/hw/virtio-scsi.c +0 -220
  298. package/bios/seabios/src/hw/virtio-scsi.h +0 -47
  299. package/bios/seabios/src/jpeg.c +0 -1055
  300. package/bios/seabios/src/kbd.c +0 -599
  301. package/bios/seabios/src/list.h +0 -91
  302. package/bios/seabios/src/malloc.c +0 -561
  303. package/bios/seabios/src/malloc.h +0 -70
  304. package/bios/seabios/src/memmap.h +0 -21
  305. package/bios/seabios/src/misc.c +0 -195
  306. package/bios/seabios/src/mouse.c +0 -342
  307. package/bios/seabios/src/optionroms.c +0 -475
  308. package/bios/seabios/src/output.c +0 -584
  309. package/bios/seabios/src/output.h +0 -68
  310. package/bios/seabios/src/pcibios.c +0 -241
  311. package/bios/seabios/src/pmm.c +0 -176
  312. package/bios/seabios/src/pnpbios.c +0 -88
  313. package/bios/seabios/src/post.c +0 -337
  314. package/bios/seabios/src/resume.c +0 -157
  315. package/bios/seabios/src/romfile.c +0 -146
  316. package/bios/seabios/src/romfile.h +0 -21
  317. package/bios/seabios/src/romlayout.S +0 -698
  318. package/bios/seabios/src/sercon.c +0 -677
  319. package/bios/seabios/src/serial.c +0 -317
  320. package/bios/seabios/src/sha1.c +0 -147
  321. package/bios/seabios/src/sha1.h +0 -8
  322. package/bios/seabios/src/stacks.c +0 -771
  323. package/bios/seabios/src/stacks.h +0 -68
  324. package/bios/seabios/src/std/LegacyBios.h +0 -985
  325. package/bios/seabios/src/std/acpi.h +0 -323
  326. package/bios/seabios/src/std/bda.h +0 -174
  327. package/bios/seabios/src/std/disk.h +0 -175
  328. package/bios/seabios/src/std/mptable.h +0 -77
  329. package/bios/seabios/src/std/multiboot.h +0 -260
  330. package/bios/seabios/src/std/optionrom.h +0 -59
  331. package/bios/seabios/src/std/pirtable.h +0 -35
  332. package/bios/seabios/src/std/pmm.h +0 -19
  333. package/bios/seabios/src/std/pnpbios.h +0 -24
  334. package/bios/seabios/src/std/smbios.h +0 -167
  335. package/bios/seabios/src/std/tcg.h +0 -554
  336. package/bios/seabios/src/std/vbe.h +0 -156
  337. package/bios/seabios/src/std/vga.h +0 -63
  338. package/bios/seabios/src/string.c +0 -251
  339. package/bios/seabios/src/string.h +0 -31
  340. package/bios/seabios/src/system.c +0 -357
  341. package/bios/seabios/src/tcgbios.c +0 -2014
  342. package/bios/seabios/src/tcgbios.h +0 -19
  343. package/bios/seabios/src/types.h +0 -156
  344. package/bios/seabios/src/util.h +0 -251
  345. package/bios/seabios/src/version.c +0 -5
  346. package/bios/seabios/src/vgahooks.c +0 -355
  347. package/bios/seabios/src/x86.c +0 -23
  348. package/bios/seabios/src/x86.h +0 -277
  349. package/bios/seabios/vgasrc/Kconfig +0 -211
  350. package/bios/seabios/vgasrc/bochsdisplay.c +0 -59
  351. package/bios/seabios/vgasrc/bochsvga.c +0 -447
  352. package/bios/seabios/vgasrc/bochsvga.h +0 -57
  353. package/bios/seabios/vgasrc/cbvga.c +0 -337
  354. package/bios/seabios/vgasrc/clext.c +0 -627
  355. package/bios/seabios/vgasrc/geodevga.c +0 -434
  356. package/bios/seabios/vgasrc/geodevga.h +0 -89
  357. package/bios/seabios/vgasrc/ramfb.c +0 -163
  358. package/bios/seabios/vgasrc/stdvga.c +0 -485
  359. package/bios/seabios/vgasrc/stdvga.h +0 -81
  360. package/bios/seabios/vgasrc/stdvgaio.c +0 -186
  361. package/bios/seabios/vgasrc/stdvgamodes.c +0 -534
  362. package/bios/seabios/vgasrc/swcursor.c +0 -96
  363. package/bios/seabios/vgasrc/vbe.c +0 -432
  364. package/bios/seabios/vgasrc/vgabios.c +0 -1131
  365. package/bios/seabios/vgasrc/vgabios.h +0 -88
  366. package/bios/seabios/vgasrc/vgaentry.S +0 -161
  367. package/bios/seabios/vgasrc/vgafb.c +0 -661
  368. package/bios/seabios/vgasrc/vgafb.h +0 -42
  369. package/bios/seabios/vgasrc/vgafonts.c +0 -785
  370. package/bios/seabios/vgasrc/vgahw.h +0 -152
  371. package/bios/seabios/vgasrc/vgainit.c +0 -202
  372. package/bios/seabios/vgasrc/vgalayout.lds.S +0 -23
  373. package/bios/seabios/vgasrc/vgautil.h +0 -103
  374. package/bios/seabios/vgasrc/vgaversion.c +0 -6
  375. package/bios/seabios-debug.bin +0 -0
  376. package/bios/seabios-debug.config +0 -117
  377. package/bios/seabios.bin +0 -0
  378. package/bios/seabios.config +0 -114
  379. package/bios/vgabios-debug.bin +0 -0
  380. package/bios/vgabios.bin +0 -0
  381. package/build/binaries.js +0 -1
  382. package/build/index-debug.cjs +0 -1
  383. package/build/index-debug.js +0 -1
  384. package/build/index.cjs +0 -1
  385. package/build/index.js +0 -1
  386. package/v86.css +0 -259
@@ -1,1055 +0,0 @@
1
- /*
2
- * Copyright (C) 2001, Novell Inc.
3
- * Copyright (C) 2010 Kevin O'Connor <kevin@koconnor.net>
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- *
10
- * 1. Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- *
13
- * 2. Redistributions in binary form must reproduce the above copyright
14
- * notice, this list of conditions and the following disclaimer in the
15
- * documentation and/or other materials provided with the distribution.
16
- *
17
- * 3. Neither the name of Novell nor the names of the contributors may
18
- * be used to endorse or promote products derived from this software
19
- * without specific prior written permission.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
22
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
- * POSSIBILITY OF SUCH DAMAGE.
32
- *
33
- */
34
-
35
- /*
36
- * a tiny jpeg decoder.
37
- *
38
- * written in August 2001 by Michael Schroeder <mls@suse.de>
39
- *
40
- */
41
-
42
- #define __LITTLE_ENDIAN
43
- #include "malloc.h"
44
- #include "string.h"
45
- #include "util.h"
46
- #define ISHIFT 11
47
-
48
- #define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
49
- #define IMULT(a, b) (((a) * (b)) >> ISHIFT)
50
- #define ITOINT(a) ((a) >> ISHIFT)
51
-
52
- #ifndef __P
53
- # define __P(x) x
54
- #endif
55
-
56
- /* special markers */
57
- #define M_BADHUFF -1
58
- #define M_EOF 0x80
59
-
60
- struct in {
61
- unsigned char *p;
62
- unsigned int bits;
63
- int left;
64
- int marker;
65
-
66
- int (*func) __P((void *));
67
- void *data;
68
- };
69
-
70
- /*********************************/
71
- struct dec_hufftbl;
72
- struct enc_hufftbl;
73
-
74
- union hufftblp {
75
- struct dec_hufftbl *dhuff;
76
- struct enc_hufftbl *ehuff;
77
- };
78
-
79
- struct scan {
80
- int dc; /* old dc value */
81
-
82
- union hufftblp hudc;
83
- union hufftblp huac;
84
- int next; /* when to switch to next scan */
85
-
86
- int cid; /* component id */
87
- int hv; /* horiz/vert, copied from comp */
88
- int tq; /* quant tbl, copied from comp */
89
- };
90
-
91
- /*********************************/
92
-
93
- #define DECBITS 10 /* seems to be the optimum */
94
-
95
- struct dec_hufftbl {
96
- int maxcode[17];
97
- int valptr[16];
98
- unsigned char vals[256];
99
- unsigned int llvals[1 << DECBITS];
100
- };
101
-
102
- static void decode_mcus __P((struct in *, int *, int, struct scan *, int *));
103
- static int dec_readmarker __P((struct in *));
104
- static void dec_makehuff __P((struct dec_hufftbl *, int *, unsigned char *));
105
-
106
- static void setinput __P((struct in *, unsigned char *));
107
- /*********************************/
108
-
109
- #undef PREC
110
- #define PREC int
111
-
112
- static void idctqtab __P((unsigned char *, PREC *));
113
- static void idct __P((int *, int *, PREC *, PREC, int));
114
- static void scaleidctqtab __P((PREC *, PREC));
115
-
116
- /*********************************/
117
-
118
- static void initcol __P((PREC[][64]));
119
-
120
- static void col221111 __P((int *, unsigned char *, int));
121
- static void col221111_16 __P((int *, unsigned char *, int));
122
- static void col221111_32 __P((int *, unsigned char *, int));
123
-
124
- /*********************************/
125
-
126
- #define ERR_NO_SOI 1
127
- #define ERR_NOT_8BIT 2
128
- #define ERR_HEIGHT_MISMATCH 3
129
- #define ERR_WIDTH_MISMATCH 4
130
- #define ERR_BAD_WIDTH_OR_HEIGHT 5
131
- #define ERR_TOO_MANY_COMPPS 6
132
- #define ERR_ILLEGAL_HV 7
133
- #define ERR_QUANT_TABLE_SELECTOR 8
134
- #define ERR_NOT_YCBCR_221111 9
135
- #define ERR_UNKNOWN_CID_IN_SCAN 10
136
- #define ERR_NOT_SEQUENTIAL_DCT 11
137
- #define ERR_WRONG_MARKER 12
138
- #define ERR_NO_EOI 13
139
- #define ERR_BAD_TABLES 14
140
- #define ERR_DEPTH_MISMATCH 15
141
-
142
- /*********************************/
143
-
144
- #define M_SOI 0xd8
145
- #define M_APP0 0xe0
146
- #define M_DQT 0xdb
147
- #define M_SOF0 0xc0
148
- #define M_DHT 0xc4
149
- #define M_DRI 0xdd
150
- #define M_SOS 0xda
151
- #define M_RST0 0xd0
152
- #define M_EOI 0xd9
153
- #define M_COM 0xfe
154
-
155
- struct comp {
156
- int cid;
157
- int hv;
158
- int tq;
159
- };
160
-
161
- #define MAXCOMP 4
162
- struct jpginfo {
163
- int nc; /* number of components */
164
- int ns; /* number of scans */
165
- int dri; /* restart interval */
166
- int nm; /* mcus til next marker */
167
- int rm; /* next restart marker */
168
- };
169
-
170
- struct jpeg_decdata {
171
- int dcts[6 * 64 + 16];
172
- int out[64 * 6];
173
- int dquant[3][64];
174
-
175
- unsigned char *datap;
176
- struct jpginfo info;
177
- struct comp comps[MAXCOMP];
178
- struct scan dscans[MAXCOMP];
179
- unsigned char quant[4][64];
180
- struct dec_hufftbl dhuff[4];
181
- struct in in;
182
-
183
- int height, width;
184
- };
185
-
186
- static int getbyte(struct jpeg_decdata *jpeg)
187
- {
188
- return *jpeg->datap++;
189
- }
190
-
191
- static int getword(struct jpeg_decdata *jpeg)
192
- {
193
- int c1, c2;
194
- c1 = *jpeg->datap++;
195
- c2 = *jpeg->datap++;
196
- return c1 << 8 | c2;
197
- }
198
-
199
- static int readtables(struct jpeg_decdata *jpeg, int till)
200
- {
201
- int m, l, i, j, lq, pq, tq;
202
- int tc, th, tt;
203
-
204
- for (;;) {
205
- if (getbyte(jpeg) != 0xff)
206
- return -1;
207
- if ((m = getbyte(jpeg)) == till)
208
- break;
209
-
210
- switch (m) {
211
- case 0xc2:
212
- return 0;
213
-
214
- case M_DQT:
215
- lq = getword(jpeg);
216
- while (lq > 2) {
217
- pq = getbyte(jpeg);
218
- tq = pq & 15;
219
- if (tq > 3)
220
- return -1;
221
- pq >>= 4;
222
- if (pq != 0)
223
- return -1;
224
- for (i = 0; i < 64; i++)
225
- jpeg->quant[tq][i] = getbyte(jpeg);
226
- lq -= 64 + 1;
227
- }
228
- break;
229
-
230
- case M_DHT:
231
- l = getword(jpeg);
232
- while (l > 2) {
233
- int hufflen[16], k;
234
- unsigned char huffvals[256];
235
-
236
- tc = getbyte(jpeg);
237
- th = tc & 15;
238
- tc >>= 4;
239
- tt = tc * 2 + th;
240
- if (tc > 1 || th > 1)
241
- return -1;
242
- for (i = 0; i < 16; i++)
243
- hufflen[i] = getbyte(jpeg);
244
- l -= 1 + 16;
245
- k = 0;
246
- for (i = 0; i < 16; i++) {
247
- for (j = 0; j < hufflen[i]; j++)
248
- huffvals[k++] = getbyte(jpeg);
249
- l -= hufflen[i];
250
- }
251
- dec_makehuff(jpeg->dhuff + tt, hufflen, huffvals);
252
- }
253
- break;
254
-
255
- case M_DRI:
256
- l = getword(jpeg);
257
- jpeg->info.dri = getword(jpeg);
258
- break;
259
-
260
- default:
261
- l = getword(jpeg);
262
- while (l-- > 2)
263
- getbyte(jpeg);
264
- break;
265
- }
266
- }
267
- return 0;
268
- }
269
-
270
- static void dec_initscans(struct jpeg_decdata *jpeg)
271
- {
272
- int i;
273
-
274
- jpeg->info.nm = jpeg->info.dri + 1;
275
- jpeg->info.rm = M_RST0;
276
- for (i = 0; i < jpeg->info.ns; i++)
277
- jpeg->dscans[i].dc = 0;
278
- }
279
-
280
- static int dec_checkmarker(struct jpeg_decdata *jpeg)
281
- {
282
- int i;
283
-
284
- if (dec_readmarker(&jpeg->in) != jpeg->info.rm)
285
- return -1;
286
- jpeg->info.nm = jpeg->info.dri;
287
- jpeg->info.rm = (jpeg->info.rm + 1) & ~0x08;
288
- for (i = 0; i < jpeg->info.ns; i++)
289
- jpeg->dscans[i].dc = 0;
290
- return 0;
291
- }
292
-
293
- struct jpeg_decdata *jpeg_alloc(void)
294
- {
295
- struct jpeg_decdata *jpeg = malloc_tmphigh(sizeof(*jpeg));
296
- return jpeg;
297
- }
298
-
299
- int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf)
300
- {
301
- int i, j, m, tac, tdc;
302
-
303
- if (!jpeg || !buf)
304
- return -1;
305
- jpeg->datap = buf;
306
- if (getbyte(jpeg) != 0xff)
307
- return ERR_NO_SOI;
308
- if (getbyte(jpeg) != M_SOI)
309
- return ERR_NO_SOI;
310
- if (readtables(jpeg, M_SOF0))
311
- return ERR_BAD_TABLES;
312
- getword(jpeg);
313
- i = getbyte(jpeg);
314
- if (i != 8)
315
- return ERR_NOT_8BIT;
316
- jpeg->height = getword(jpeg);
317
- jpeg->width = getword(jpeg);
318
- if ((jpeg->height & 15) || (jpeg->width & 15))
319
- return ERR_BAD_WIDTH_OR_HEIGHT;
320
- jpeg->info.nc = getbyte(jpeg);
321
- if (jpeg->info.nc > MAXCOMP)
322
- return ERR_TOO_MANY_COMPPS;
323
- for (i = 0; i < jpeg->info.nc; i++) {
324
- int h, v;
325
- jpeg->comps[i].cid = getbyte(jpeg);
326
- jpeg->comps[i].hv = getbyte(jpeg);
327
- v = jpeg->comps[i].hv & 15;
328
- h = jpeg->comps[i].hv >> 4;
329
- jpeg->comps[i].tq = getbyte(jpeg);
330
- if (h > 3 || v > 3)
331
- return ERR_ILLEGAL_HV;
332
- if (jpeg->comps[i].tq > 3)
333
- return ERR_QUANT_TABLE_SELECTOR;
334
- }
335
- if (readtables(jpeg, M_SOS))
336
- return ERR_BAD_TABLES;
337
- getword(jpeg);
338
- jpeg->info.ns = getbyte(jpeg);
339
- if (jpeg->info.ns != 3)
340
- return ERR_NOT_YCBCR_221111;
341
- for (i = 0; i < 3; i++) {
342
- jpeg->dscans[i].cid = getbyte(jpeg);
343
- tdc = getbyte(jpeg);
344
- tac = tdc & 15;
345
- tdc >>= 4;
346
- if (tdc > 1 || tac > 1)
347
- return ERR_QUANT_TABLE_SELECTOR;
348
- for (j = 0; j < jpeg->info.nc; j++)
349
- if (jpeg->comps[j].cid == jpeg->dscans[i].cid)
350
- break;
351
- if (j == jpeg->info.nc)
352
- return ERR_UNKNOWN_CID_IN_SCAN;
353
- jpeg->dscans[i].hv = jpeg->comps[j].hv;
354
- jpeg->dscans[i].tq = jpeg->comps[j].tq;
355
- jpeg->dscans[i].hudc.dhuff = &jpeg->dhuff[tdc];
356
- jpeg->dscans[i].huac.dhuff = &jpeg->dhuff[2 + tac];
357
- }
358
-
359
- i = getbyte(jpeg);
360
- j = getbyte(jpeg);
361
- m = getbyte(jpeg);
362
-
363
- if (i != 0 || j != 63 || m != 0)
364
- return ERR_NOT_SEQUENTIAL_DCT;
365
-
366
- if (jpeg->dscans[0].cid != 1 || jpeg->dscans[1].cid != 2
367
- || jpeg->dscans[2].cid != 3)
368
- return ERR_NOT_YCBCR_221111;
369
-
370
- if (jpeg->dscans[0].hv != 0x22 || jpeg->dscans[1].hv != 0x11
371
- || jpeg->dscans[2].hv != 0x11)
372
- return ERR_NOT_YCBCR_221111;
373
-
374
- idctqtab(jpeg->quant[jpeg->dscans[0].tq], jpeg->dquant[0]);
375
- idctqtab(jpeg->quant[jpeg->dscans[1].tq], jpeg->dquant[1]);
376
- idctqtab(jpeg->quant[jpeg->dscans[2].tq], jpeg->dquant[2]);
377
- initcol(jpeg->dquant);
378
- setinput(&jpeg->in, jpeg->datap);
379
-
380
- #if 0
381
- /* landing zone */
382
- img[len] = 0;
383
- img[len + 1] = 0xff;
384
- img[len + 2] = M_EOF;
385
- #endif
386
-
387
- dec_initscans(jpeg);
388
-
389
- return 0;
390
- }
391
-
392
- void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height)
393
- {
394
- *width = jpeg->width;
395
- *height = jpeg->height;
396
- }
397
-
398
- int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
399
- , int height, int depth, int bytes_per_line_dest)
400
- {
401
- int m, mcusx, mcusy, mx, my, mloffset, jpgbpl;
402
- int max[6];
403
-
404
- if (jpeg->height != height)
405
- return ERR_HEIGHT_MISMATCH;
406
- if (jpeg->width != width)
407
- return ERR_WIDTH_MISMATCH;
408
-
409
- jpgbpl = width * depth / 8;
410
- mloffset = bytes_per_line_dest > jpgbpl ? bytes_per_line_dest : jpgbpl;
411
-
412
- mcusx = jpeg->width >> 4;
413
- mcusy = jpeg->height >> 4;
414
-
415
- jpeg->dscans[0].next = 6 - 4;
416
- jpeg->dscans[1].next = 6 - 4 - 1;
417
- jpeg->dscans[2].next = 6 - 4 - 1 - 1; /* 411 encoding */
418
- for (my = 0; my < mcusy; my++) {
419
- for (mx = 0; mx < mcusx; mx++) {
420
- if (jpeg->info.dri && !--jpeg->info.nm)
421
- if (dec_checkmarker(jpeg))
422
- return ERR_WRONG_MARKER;
423
-
424
- decode_mcus(&jpeg->in, jpeg->dcts, 6, jpeg->dscans, max);
425
- idct(jpeg->dcts, jpeg->out, jpeg->dquant[0],
426
- IFIX(128.5), max[0]);
427
- idct(jpeg->dcts + 64, jpeg->out + 64, jpeg->dquant[0],
428
- IFIX(128.5), max[1]);
429
- idct(jpeg->dcts + 128, jpeg->out + 128, jpeg->dquant[0],
430
- IFIX(128.5), max[2]);
431
- idct(jpeg->dcts + 192, jpeg->out + 192, jpeg->dquant[0],
432
- IFIX(128.5), max[3]);
433
- idct(jpeg->dcts + 256, jpeg->out + 256, jpeg->dquant[1],
434
- IFIX(0.5), max[4]);
435
- idct(jpeg->dcts + 320, jpeg->out + 320, jpeg->dquant[2],
436
- IFIX(0.5), max[5]);
437
-
438
- switch (depth) {
439
- case 32:
440
- col221111_32(jpeg->out,
441
- pic + (my * 16 * mloffset + mx * 16 * 4),
442
- mloffset);
443
- break;
444
- case 24:
445
- col221111(jpeg->out,
446
- pic + (my * 16 * mloffset + mx * 16 * 3),
447
- mloffset);
448
- break;
449
- case 16:
450
- col221111_16(jpeg->out,
451
- pic + (my * 16 * mloffset + mx * 16 * 2),
452
- mloffset);
453
- break;
454
- default:
455
- return ERR_DEPTH_MISMATCH;
456
- break;
457
- }
458
- }
459
- }
460
-
461
- m = dec_readmarker(&jpeg->in);
462
- if (m != M_EOI)
463
- return ERR_NO_EOI;
464
-
465
- return 0;
466
- }
467
-
468
- /****************************************************************/
469
- /************** huffman decoder ***************/
470
- /****************************************************************/
471
-
472
- static int fillbits __P((struct in *, int, unsigned int));
473
- static int dec_rec2 __P((struct in *, struct dec_hufftbl *, int *, int, int));
474
-
475
- static void setinput(struct in *in, unsigned char *p)
476
- {
477
- in->p = p;
478
- in->left = 0;
479
- in->bits = 0;
480
- in->marker = 0;
481
- }
482
-
483
- static int fillbits(struct in *in, int le, unsigned int bi)
484
- {
485
- int b, m;
486
-
487
- if (in->marker) {
488
- if (le <= 16)
489
- in->bits = bi << 16, le += 16;
490
- return le;
491
- }
492
- while (le <= 24) {
493
- b = *in->p++;
494
- if (b == 0xff && (m = *in->p++) != 0) {
495
- if (m == M_EOF) {
496
- if (in->func && (m = in->func(in->data)) == 0)
497
- continue;
498
- }
499
- in->marker = m;
500
- if (le <= 16)
501
- bi = bi << 16, le += 16;
502
- break;
503
- }
504
- bi = bi << 8 | b;
505
- le += 8;
506
- }
507
- in->bits = bi; /* tmp... 2 return values needed */
508
- return le;
509
- }
510
-
511
- static int dec_readmarker(struct in *in)
512
- {
513
- int m;
514
-
515
- in->left = fillbits(in, in->left, in->bits);
516
- if ((m = in->marker) == 0)
517
- return 0;
518
- in->left = 0;
519
- in->marker = 0;
520
- return m;
521
- }
522
-
523
- #define LEBI_DCL int le, bi
524
- #define LEBI_GET(in) (le = in->left, bi = in->bits)
525
- #define LEBI_PUT(in) (in->left = le, in->bits = bi)
526
-
527
- #define GETBITS(in, n) ( \
528
- (le < (n) ? le = fillbits(in, le, bi), bi = in->bits : 0), \
529
- (le -= (n)), \
530
- bi >> le & ((1 << (n)) - 1) \
531
- )
532
-
533
- #define UNGETBITS(in, n) ( \
534
- le += (n) \
535
- )
536
-
537
-
538
- static int dec_rec2(struct in *in, struct dec_hufftbl *hu, int *runp,
539
- int c, int i)
540
- {
541
- LEBI_DCL;
542
-
543
- LEBI_GET(in);
544
- if (i) {
545
- UNGETBITS(in, i & 127);
546
- *runp = i >> 8 & 15;
547
- i >>= 16;
548
- } else {
549
- for (i = DECBITS;
550
- (c = ((c << 1) | GETBITS(in, 1))) >= (hu->maxcode[i]); i++);
551
- if (i >= 16) {
552
- in->marker = M_BADHUFF;
553
- return 0;
554
- }
555
- i = hu->vals[hu->valptr[i] + c - hu->maxcode[i - 1] * 2];
556
- *runp = i >> 4;
557
- i &= 15;
558
- }
559
- if (i == 0) { /* sigh, 0xf0 is 11 bit */
560
- LEBI_PUT(in);
561
- return 0;
562
- }
563
- /* receive part */
564
- c = GETBITS(in, i);
565
- if (c < (1 << (i - 1)))
566
- c += (-1 << i) + 1;
567
- LEBI_PUT(in);
568
- return c;
569
- }
570
-
571
- #define DEC_REC(in, hu, r, i) ( \
572
- r = GETBITS(in, DECBITS), \
573
- i = hu->llvals[r], \
574
- i & 128 ? \
575
- ( \
576
- UNGETBITS(in, i & 127), \
577
- r = i >> 8 & 15, \
578
- i >> 16 \
579
- ) \
580
- : \
581
- ( \
582
- LEBI_PUT(in), \
583
- i = dec_rec2(in, hu, &r, r, i), \
584
- LEBI_GET(in), \
585
- i \
586
- ) \
587
- )
588
-
589
- static void decode_mcus(struct in *in, int *dct, int n, struct scan *sc,
590
- int *maxp)
591
- {
592
- struct dec_hufftbl *hu;
593
- int i, r, t;
594
- LEBI_DCL;
595
-
596
- memset(dct, 0, n * 64 * sizeof(*dct));
597
- LEBI_GET(in);
598
- while (n-- > 0) {
599
- hu = sc->hudc.dhuff;
600
- *dct++ = (sc->dc += DEC_REC(in, hu, r, t));
601
-
602
- hu = sc->huac.dhuff;
603
- i = 63;
604
- while (i > 0) {
605
- t = DEC_REC(in, hu, r, t);
606
- if (t == 0 && r == 0) {
607
- dct += i;
608
- break;
609
- }
610
- dct += r;
611
- *dct++ = t;
612
- i -= r + 1;
613
- }
614
- *maxp++ = 64 - i;
615
- if (n == sc->next)
616
- sc++;
617
- }
618
- LEBI_PUT(in);
619
- }
620
-
621
- static void dec_makehuff(struct dec_hufftbl *hu, int *hufflen,
622
- unsigned char *huffvals)
623
- {
624
- int code, k, i, j, d, x, c, v;
625
- for (i = 0; i < (1 << DECBITS); i++)
626
- hu->llvals[i] = 0;
627
-
628
- /*
629
- * llvals layout:
630
- *
631
- * value v already known, run r, backup u bits:
632
- * vvvvvvvvvvvvvvvv 0000 rrrr 1 uuuuuuu
633
- * value unknown, size b bits, run r, backup u bits:
634
- * 000000000000bbbb 0000 rrrr 0 uuuuuuu
635
- * value and size unknown:
636
- * 0000000000000000 0000 0000 0 0000000
637
- */
638
-
639
- code = 0;
640
- k = 0;
641
- for (i = 0; i < 16; i++, code <<= 1) { /* sizes */
642
- hu->valptr[i] = k;
643
- for (j = 0; j < hufflen[i]; j++) {
644
- hu->vals[k] = *huffvals++;
645
- if (i < DECBITS) {
646
- c = code << (DECBITS - 1 - i);
647
- v = hu->vals[k] & 0x0f; /* size */
648
- for (d = 1 << (DECBITS - 1 - i); --d >= 0;) {
649
- if (v + i < DECBITS) { /* both fit in table */
650
- x = d >> (DECBITS - 1 - v - i);
651
- if (v && x < (1 << (v - 1)))
652
- x += (-1 << v) + 1;
653
- x = x << 16 | (hu->vals[k] & 0xf0) << 4 |
654
- (DECBITS - (i + 1 + v)) | 128;
655
- } else
656
- x = v << 16 | (hu->vals[k] & 0xf0) << 4 |
657
- (DECBITS - (i + 1));
658
- hu->llvals[c | d] = x;
659
- }
660
- }
661
- code++;
662
- k++;
663
- }
664
- hu->maxcode[i] = code;
665
- }
666
- hu->maxcode[16] = 0x20000; /* always terminate decode */
667
- }
668
-
669
- /****************************************************************/
670
- /************** idct ***************/
671
- /****************************************************************/
672
-
673
- #define ONE ((PREC)IFIX(1.))
674
- #define S2 ((PREC)IFIX(0.382683432))
675
- #define C2 ((PREC)IFIX(0.923879532))
676
- #define C4 ((PREC)IFIX(0.707106781))
677
-
678
- #define S22 ((PREC)IFIX(2 * 0.382683432))
679
- #define C22 ((PREC)IFIX(2 * 0.923879532))
680
- #define IC4 ((PREC)IFIX(1 / 0.707106781))
681
-
682
- #define C3IC1 ((PREC)IFIX(0.847759065)) /* c3/c1 */
683
- #define C5IC1 ((PREC)IFIX(0.566454497)) /* c5/c1 */
684
- #define C7IC1 ((PREC)IFIX(0.198912367)) /* c7/c1 */
685
-
686
- #define XPP(a,b) (t = a + b, b = a - b, a = t)
687
- #define XMP(a,b) (t = a - b, b = a + b, a = t)
688
- #define XPM(a,b) (t = a + b, b = b - a, a = t)
689
-
690
- #define ROT(a,b,s,c) ( t = IMULT(a + b, s), \
691
- a = IMULT(a, c - s) + t, \
692
- b = IMULT(b, c + s) - t)
693
-
694
- #define IDCT \
695
- ( \
696
- XPP(t0, t1), \
697
- XMP(t2, t3), \
698
- t2 = IMULT(t2, IC4) - t3, \
699
- XPP(t0, t3), \
700
- XPP(t1, t2), \
701
- XMP(t4, t7), \
702
- XPP(t5, t6), \
703
- XMP(t5, t7), \
704
- t5 = IMULT(t5, IC4), \
705
- ROT(t4, t6, S22, C22), \
706
- t6 -= t7, \
707
- t5 -= t6, \
708
- t4 -= t5, \
709
- XPP(t0, t7), \
710
- XPP(t1, t6), \
711
- XPP(t2, t5), \
712
- XPP(t3, t4) \
713
- )
714
-
715
- static unsigned char zig2[64] = {
716
- 0, 2, 3, 9, 10, 20, 21, 35,
717
- 14, 16, 25, 31, 39, 46, 50, 57,
718
- 5, 7, 12, 18, 23, 33, 37, 48,
719
- 27, 29, 41, 44, 52, 55, 59, 62,
720
- 15, 26, 30, 40, 45, 51, 56, 58,
721
- 1, 4, 8, 11, 19, 22, 34, 36,
722
- 28, 42, 43, 53, 54, 60, 61, 63,
723
- 6, 13, 17, 24, 32, 38, 47, 49
724
- };
725
-
726
- static void idct(int *in, int *out, PREC * quant, PREC off, int max)
727
- {
728
- PREC t0, t1, t2, t3, t4, t5, t6, t7, t;
729
- PREC tmp[64], *tmpp;
730
- int i, j;
731
- unsigned char *zig2p;
732
-
733
- t0 = off;
734
- if (max == 1) {
735
- t0 += in[0] * quant[0];
736
- for (i = 0; i < 64; i++)
737
- out[i] = ITOINT(t0);
738
- return;
739
- }
740
- zig2p = zig2;
741
- tmpp = tmp;
742
- for (i = 0; i < 8; i++) {
743
- j = *zig2p++;
744
- t0 += in[j] * quant[j];
745
- j = *zig2p++;
746
- t5 = in[j] * quant[j];
747
- j = *zig2p++;
748
- t2 = in[j] * quant[j];
749
- j = *zig2p++;
750
- t7 = in[j] * quant[j];
751
- j = *zig2p++;
752
- t1 = in[j] * quant[j];
753
- j = *zig2p++;
754
- t4 = in[j] * quant[j];
755
- j = *zig2p++;
756
- t3 = in[j] * quant[j];
757
- j = *zig2p++;
758
- t6 = in[j] * quant[j];
759
- IDCT;
760
- tmpp[0 * 8] = t0;
761
- tmpp[1 * 8] = t1;
762
- tmpp[2 * 8] = t2;
763
- tmpp[3 * 8] = t3;
764
- tmpp[4 * 8] = t4;
765
- tmpp[5 * 8] = t5;
766
- tmpp[6 * 8] = t6;
767
- tmpp[7 * 8] = t7;
768
- tmpp++;
769
- t0 = 0;
770
- }
771
- for (i = 0; i < 8; i++) {
772
- t0 = tmp[8 * i + 0];
773
- t1 = tmp[8 * i + 1];
774
- t2 = tmp[8 * i + 2];
775
- t3 = tmp[8 * i + 3];
776
- t4 = tmp[8 * i + 4];
777
- t5 = tmp[8 * i + 5];
778
- t6 = tmp[8 * i + 6];
779
- t7 = tmp[8 * i + 7];
780
- IDCT;
781
- out[8 * i + 0] = ITOINT(t0);
782
- out[8 * i + 1] = ITOINT(t1);
783
- out[8 * i + 2] = ITOINT(t2);
784
- out[8 * i + 3] = ITOINT(t3);
785
- out[8 * i + 4] = ITOINT(t4);
786
- out[8 * i + 5] = ITOINT(t5);
787
- out[8 * i + 6] = ITOINT(t6);
788
- out[8 * i + 7] = ITOINT(t7);
789
- }
790
- }
791
-
792
- static unsigned char zig[64] = {
793
- 0, 1, 5, 6, 14, 15, 27, 28,
794
- 2, 4, 7, 13, 16, 26, 29, 42,
795
- 3, 8, 12, 17, 25, 30, 41, 43,
796
- 9, 11, 18, 24, 31, 40, 44, 53,
797
- 10, 19, 23, 32, 39, 45, 52, 54,
798
- 20, 22, 33, 38, 46, 51, 55, 60,
799
- 21, 34, 37, 47, 50, 56, 59, 61,
800
- 35, 36, 48, 49, 57, 58, 62, 63
801
- };
802
-
803
- static PREC aaidct[8] = {
804
- IFIX(0.3535533906), IFIX(0.4903926402),
805
- IFIX(0.4619397663), IFIX(0.4157348062),
806
- IFIX(0.3535533906), IFIX(0.2777851165),
807
- IFIX(0.1913417162), IFIX(0.0975451610)
808
- };
809
-
810
-
811
- static void idctqtab(unsigned char *qin, PREC * qout)
812
- {
813
- int i, j;
814
-
815
- for (i = 0; i < 8; i++)
816
- for (j = 0; j < 8; j++)
817
- qout[zig[i * 8 + j]] = qin[zig[i * 8 + j]] *
818
- IMULT(aaidct[i], aaidct[j]);
819
- }
820
-
821
- static void scaleidctqtab(PREC * q, PREC sc)
822
- {
823
- int i;
824
-
825
- for (i = 0; i < 64; i++)
826
- q[i] = IMULT(q[i], sc);
827
- }
828
-
829
- /****************************************************************/
830
- /************** color decoder ***************/
831
- /****************************************************************/
832
-
833
- #define ROUND
834
-
835
- /*
836
- * YCbCr Color transformation:
837
- *
838
- * y:0..255 Cb:-128..127 Cr:-128..127
839
- *
840
- * R = Y + 1.40200 * Cr
841
- * G = Y - 0.34414 * Cb - 0.71414 * Cr
842
- * B = Y + 1.77200 * Cb
843
- *
844
- * =>
845
- * Cr *= 1.40200;
846
- * Cb *= 1.77200;
847
- * Cg = 0.19421 * Cb + .50937 * Cr;
848
- * R = Y + Cr;
849
- * G = Y - Cg;
850
- * B = Y + Cb;
851
- *
852
- * =>
853
- * Cg = (50 * Cb + 130 * Cr + 128) >> 8;
854
- */
855
-
856
- static void initcol(PREC q[][64])
857
- {
858
- scaleidctqtab(q[1], IFIX(1.77200));
859
- scaleidctqtab(q[2], IFIX(1.40200));
860
- }
861
-
862
- /* This is optimized for the stupid sun SUNWspro compiler. */
863
- #define STORECLAMP(a,x) \
864
- ( \
865
- (a) = (x), \
866
- (unsigned int)(x) >= 256 ? \
867
- ((a) = (x) < 0 ? 0 : 255) \
868
- : \
869
- 0 \
870
- )
871
-
872
- #define CLAMP(x) ((unsigned int)(x) >= 256 ? ((x) < 0 ? 0 : 255) : (x))
873
-
874
- #ifdef ROUND
875
-
876
- #define CBCRCG(yin, xin) \
877
- ( \
878
- cb = outc[0 +yin*8+xin], \
879
- cr = outc[64+yin*8+xin], \
880
- cg = (50 * cb + 130 * cr + 128) >> 8 \
881
- )
882
-
883
- #else
884
-
885
- #define CBCRCG(yin, xin) \
886
- ( \
887
- cb = outc[0 +yin*8+xin], \
888
- cr = outc[64+yin*8+xin], \
889
- cg = (3 * cb + 8 * cr) >> 4 \
890
- )
891
-
892
- #endif
893
-
894
- #ifdef __LITTLE_ENDIAN
895
- #define PIC(yin, xin, p, xout) \
896
- ( \
897
- y = outy[(yin) * 8 + xin], \
898
- STORECLAMP(p[(xout) * 3 + 2], y + cr), \
899
- STORECLAMP(p[(xout) * 3 + 1], y - cg), \
900
- STORECLAMP(p[(xout) * 3 + 0], y + cb) \
901
- )
902
- #else
903
- #define PIC(yin, xin, p, xout) \
904
- ( \
905
- y = outy[(yin) * 8 + xin], \
906
- STORECLAMP(p[(xout) * 3 + 0], y + cr), \
907
- STORECLAMP(p[(xout) * 3 + 1], y - cg), \
908
- STORECLAMP(p[(xout) * 3 + 2], y + cb) \
909
- )
910
- #endif
911
-
912
- #ifdef __LITTLE_ENDIAN
913
- #define PIC_16(yin, xin, p, xout, add) \
914
- ( \
915
- y = outy[(yin) * 8 + xin], \
916
- y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
917
- ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
918
- ((CLAMP(y + cb + add*2+1) ) >> 3), \
919
- p[(xout) * 2 + 0] = y & 0xff, \
920
- p[(xout) * 2 + 1] = y >> 8 \
921
- )
922
- #else
923
- #ifdef CONFIG_PPC
924
- #define PIC_16(yin, xin, p, xout, add) \
925
- ( \
926
- y = outy[(yin) * 8 + xin], \
927
- y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 7) | \
928
- ((CLAMP(y - cg + add*2+1) & 0xf8) << 2) | \
929
- ((CLAMP(y + cb + add*2+1) ) >> 3), \
930
- p[(xout) * 2 + 0] = y >> 8, \
931
- p[(xout) * 2 + 1] = y & 0xff \
932
- )
933
- #else
934
- #define PIC_16(yin, xin, p, xout, add) \
935
- ( \
936
- y = outy[(yin) * 8 + xin], \
937
- y = ((CLAMP(y + cr + add*2+1) & 0xf8) << 8) | \
938
- ((CLAMP(y - cg + add ) & 0xfc) << 3) | \
939
- ((CLAMP(y + cb + add*2+1) ) >> 3), \
940
- p[(xout) * 2 + 0] = y >> 8, \
941
- p[(xout) * 2 + 1] = y & 0xff \
942
- )
943
- #endif
944
- #endif
945
-
946
- #define PIC_32(yin, xin, p, xout) \
947
- ( \
948
- y = outy[(yin) * 8 + xin], \
949
- STORECLAMP(p[(xout) * 4 + 0], y + cr), \
950
- STORECLAMP(p[(xout) * 4 + 1], y - cg), \
951
- STORECLAMP(p[(xout) * 4 + 2], y + cb), \
952
- p[(xout) * 4 + 3] = 0 \
953
- )
954
-
955
- #define PIC221111(xin) \
956
- ( \
957
- CBCRCG(0, xin), \
958
- PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
959
- PIC(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
960
- PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
961
- PIC(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
962
- )
963
-
964
- #define PIC221111_16(xin) \
965
- ( \
966
- CBCRCG(0, xin), \
967
- PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0, 3), \
968
- PIC_16(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1, 0), \
969
- PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0, 1), \
970
- PIC_16(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1, 2) \
971
- )
972
-
973
- #define PIC221111_32(xin) \
974
- ( \
975
- CBCRCG(0, xin), \
976
- PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 0, pic0, xin * 2 + 0), \
977
- PIC_32(xin / 4 * 8 + 0, (xin & 3) * 2 + 1, pic0, xin * 2 + 1), \
978
- PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 0, pic1, xin * 2 + 0), \
979
- PIC_32(xin / 4 * 8 + 1, (xin & 3) * 2 + 1, pic1, xin * 2 + 1) \
980
- )
981
-
982
- static void col221111(int *out, unsigned char *pic, int width)
983
- {
984
- int i, j, k;
985
- unsigned char *pic0, *pic1;
986
- int *outy, *outc;
987
- int cr, cg, cb, y;
988
-
989
- pic0 = pic;
990
- pic1 = pic + width;
991
- outy = out;
992
- outc = out + 64 * 4;
993
- for (i = 2; i > 0; i--) {
994
- for (j = 4; j > 0; j--) {
995
- for (k = 0; k < 8; k++) {
996
- PIC221111(k);
997
- }
998
- outc += 8;
999
- outy += 16;
1000
- pic0 += 2 * width;
1001
- pic1 += 2 * width;
1002
- }
1003
- outy += 64 * 2 - 16 * 4;
1004
- }
1005
- }
1006
-
1007
- static void col221111_16(int *out, unsigned char *pic, int width)
1008
- {
1009
- int i, j, k;
1010
- unsigned char *pic0, *pic1;
1011
- int *outy, *outc;
1012
- int cr, cg, cb, y;
1013
-
1014
- pic0 = pic;
1015
- pic1 = pic + width;
1016
- outy = out;
1017
- outc = out + 64 * 4;
1018
- for (i = 2; i > 0; i--) {
1019
- for (j = 4; j > 0; j--) {
1020
- for (k = 0; k < 8; k++) {
1021
- PIC221111_16(k);
1022
- }
1023
- outc += 8;
1024
- outy += 16;
1025
- pic0 += 2 * width;
1026
- pic1 += 2 * width;
1027
- }
1028
- outy += 64 * 2 - 16 * 4;
1029
- }
1030
- }
1031
-
1032
- static void col221111_32(int *out, unsigned char *pic, int width)
1033
- {
1034
- int i, j, k;
1035
- unsigned char *pic0, *pic1;
1036
- int *outy, *outc;
1037
- int cr, cg, cb, y;
1038
-
1039
- pic0 = pic;
1040
- pic1 = pic + width;
1041
- outy = out;
1042
- outc = out + 64 * 4;
1043
- for (i = 2; i > 0; i--) {
1044
- for (j = 4; j > 0; j--) {
1045
- for (k = 0; k < 8; k++) {
1046
- PIC221111_32(k);
1047
- }
1048
- outc += 8;
1049
- outy += 16;
1050
- pic0 += 2 * width;
1051
- pic1 += 2 * width;
1052
- }
1053
- outy += 64 * 2 - 16 * 4;
1054
- }
1055
- }