v86 0.5.473 → 0.5.475
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/build/libv86-debug.js +16 -7
- package/build/libv86-debug.mjs +16 -7
- package/build/libv86.js +2 -2
- package/build/libv86.mjs +21 -21
- package/build/v86-debug.wasm +0 -0
- package/build/v86-fallback.wasm +0 -0
- package/build/v86.wasm +0 -0
- package/package.json +1 -1
package/build/libv86-debug.js
CHANGED
|
@@ -7258,17 +7258,26 @@ $PCI$$module$src$pci$$.prototype.pci_query = function() {
|
|
|
7258
7258
|
$PCI$$module$src$pci$$.prototype.pci_write8 = function($addr$jscomp$25_address$jscomp$19$$, $written$$) {
|
|
7259
7259
|
var $bdf$jscomp$1$$ = $addr$jscomp$25_address$jscomp$19$$ >> 8 & 65535;
|
|
7260
7260
|
$addr$jscomp$25_address$jscomp$19$$ &= 255;
|
|
7261
|
-
var $
|
|
7262
|
-
|
|
7263
|
-
|
|
7261
|
+
var $device_space_space$jscomp$1$$ = this.device_spaces[$bdf$jscomp$1$$];
|
|
7262
|
+
if ($device_space_space$jscomp$1$$) {
|
|
7263
|
+
$device_space_space$jscomp$1$$ = new Uint8Array($device_space_space$jscomp$1$$.buffer);
|
|
7264
|
+
var $device$jscomp$6$$ = this.devices[$bdf$jscomp$1$$];
|
|
7265
|
+
$dbg_assert$$module$src$log$$(!(16 <= $addr$jscomp$25_address$jscomp$19$$ && 44 > $addr$jscomp$25_address$jscomp$19$$ || 48 <= $addr$jscomp$25_address$jscomp$19$$ && 52 > $addr$jscomp$25_address$jscomp$19$$), "PCI: Expected 32-bit write, got 8-bit (addr: " + $h$$module$src$lib$$($addr$jscomp$25_address$jscomp$19$$) + ")");
|
|
7266
|
+
$dbg_log$$module$src$log$$("PCI write8 dev=" + $h$$module$src$lib$$($bdf$jscomp$1$$ >> 3, 2) + " (" + $device$jscomp$6$$.name + ") addr=" + $h$$module$src$lib$$($addr$jscomp$25_address$jscomp$19$$, 4) + " value=" + $h$$module$src$lib$$($written$$, 2), 2048);
|
|
7267
|
+
$device_space_space$jscomp$1$$[$addr$jscomp$25_address$jscomp$19$$] = $written$$;
|
|
7268
|
+
}
|
|
7264
7269
|
};
|
|
7265
7270
|
$PCI$$module$src$pci$$.prototype.pci_write16 = function($addr$jscomp$26_address$jscomp$20$$, $written$jscomp$1$$) {
|
|
7266
7271
|
$dbg_assert$$module$src$log$$(0 === ($addr$jscomp$26_address$jscomp$20$$ & 1));
|
|
7267
7272
|
var $bdf$jscomp$2$$ = $addr$jscomp$26_address$jscomp$20$$ >> 8 & 65535;
|
|
7268
7273
|
$addr$jscomp$26_address$jscomp$20$$ &= 255;
|
|
7269
|
-
var $
|
|
7270
|
-
|
|
7271
|
-
|
|
7274
|
+
var $device_space$jscomp$1_space$jscomp$2$$ = this.device_spaces[$bdf$jscomp$2$$];
|
|
7275
|
+
if ($device_space$jscomp$1_space$jscomp$2$$) {
|
|
7276
|
+
$device_space$jscomp$1_space$jscomp$2$$ = new Uint16Array($device_space$jscomp$1_space$jscomp$2$$.buffer);
|
|
7277
|
+
var $device$jscomp$7$$ = this.devices[$bdf$jscomp$2$$];
|
|
7278
|
+
16 <= $addr$jscomp$26_address$jscomp$20$$ && 44 > $addr$jscomp$26_address$jscomp$20$$ ? $dbg_log$$module$src$log$$("Warning: PCI: Expected 32-bit write, got 16-bit (addr: " + $h$$module$src$lib$$($addr$jscomp$26_address$jscomp$20$$) + ")") : ($dbg_assert$$module$src$log$$(!(48 <= $addr$jscomp$26_address$jscomp$20$$ && 52 > $addr$jscomp$26_address$jscomp$20$$), "PCI: Expected 32-bit write, got 16-bit (addr: " + $h$$module$src$lib$$($addr$jscomp$26_address$jscomp$20$$) + ")"), $dbg_log$$module$src$log$$("PCI writ16 dev=" +
|
|
7279
|
+
$h$$module$src$lib$$($bdf$jscomp$2$$ >> 3, 2) + " (" + $device$jscomp$7$$.name + ") addr=" + $h$$module$src$lib$$($addr$jscomp$26_address$jscomp$20$$, 4) + " value=" + $h$$module$src$lib$$($written$jscomp$1$$, 4), 2048), $device_space$jscomp$1_space$jscomp$2$$[$addr$jscomp$26_address$jscomp$20$$ >>> 1] = $written$jscomp$1$$);
|
|
7280
|
+
}
|
|
7272
7281
|
};
|
|
7273
7282
|
$PCI$$module$src$pci$$.prototype.pci_write32 = function($addr$jscomp$27_address$jscomp$21$$, $written$jscomp$2$$) {
|
|
7274
7283
|
$dbg_assert$$module$src$log$$(0 === ($addr$jscomp$27_address$jscomp$21$$ & 3));
|
|
@@ -7859,7 +7868,7 @@ $VirtioConsole$$module$src$virtio_console$$.prototype.SendWindowSize = function(
|
|
|
7859
7868
|
$rows$jscomp$3$$ = $rows$jscomp$3$$ || this.rows;
|
|
7860
7869
|
$cols$jscomp$3$$ = $cols$jscomp$3$$ || this.cols;
|
|
7861
7870
|
const $bufchain$jscomp$3$$ = this.virtio.queues[2].pop_request(), $buf$jscomp$1$$ = new Uint8Array(12);
|
|
7862
|
-
$Marshall$$module$lib$marshall$$(["w", "h", "h", "h", "h"], [$port$jscomp$8$$, 5, 0, $
|
|
7871
|
+
$Marshall$$module$lib$marshall$$(["w", "h", "h", "h", "h"], [$port$jscomp$8$$, 5, 0, $cols$jscomp$3$$, $rows$jscomp$3$$], $buf$jscomp$1$$, 0);
|
|
7863
7872
|
this.Send(2, $bufchain$jscomp$3$$, $buf$jscomp$1$$);
|
|
7864
7873
|
};
|
|
7865
7874
|
$VirtioConsole$$module$src$virtio_console$$.prototype.SendName = function($i$jscomp$86_port$jscomp$9$$, $name$jscomp$102_namex$$) {
|
package/build/libv86-debug.mjs
CHANGED
|
@@ -7257,17 +7257,26 @@ $PCI$$module$src$pci$$.prototype.pci_query = function() {
|
|
|
7257
7257
|
$PCI$$module$src$pci$$.prototype.pci_write8 = function($addr$jscomp$25_address$jscomp$19$$, $written$$) {
|
|
7258
7258
|
var $bdf$jscomp$1$$ = $addr$jscomp$25_address$jscomp$19$$ >> 8 & 65535;
|
|
7259
7259
|
$addr$jscomp$25_address$jscomp$19$$ &= 255;
|
|
7260
|
-
var $
|
|
7261
|
-
|
|
7262
|
-
|
|
7260
|
+
var $device_space_space$jscomp$1$$ = this.device_spaces[$bdf$jscomp$1$$];
|
|
7261
|
+
if ($device_space_space$jscomp$1$$) {
|
|
7262
|
+
$device_space_space$jscomp$1$$ = new Uint8Array($device_space_space$jscomp$1$$.buffer);
|
|
7263
|
+
var $device$jscomp$6$$ = this.devices[$bdf$jscomp$1$$];
|
|
7264
|
+
$dbg_assert$$module$src$log$$(!(16 <= $addr$jscomp$25_address$jscomp$19$$ && 44 > $addr$jscomp$25_address$jscomp$19$$ || 48 <= $addr$jscomp$25_address$jscomp$19$$ && 52 > $addr$jscomp$25_address$jscomp$19$$), "PCI: Expected 32-bit write, got 8-bit (addr: " + $h$$module$src$lib$$($addr$jscomp$25_address$jscomp$19$$) + ")");
|
|
7265
|
+
$dbg_log$$module$src$log$$("PCI write8 dev=" + $h$$module$src$lib$$($bdf$jscomp$1$$ >> 3, 2) + " (" + $device$jscomp$6$$.name + ") addr=" + $h$$module$src$lib$$($addr$jscomp$25_address$jscomp$19$$, 4) + " value=" + $h$$module$src$lib$$($written$$, 2), 2048);
|
|
7266
|
+
$device_space_space$jscomp$1$$[$addr$jscomp$25_address$jscomp$19$$] = $written$$;
|
|
7267
|
+
}
|
|
7263
7268
|
};
|
|
7264
7269
|
$PCI$$module$src$pci$$.prototype.pci_write16 = function($addr$jscomp$26_address$jscomp$20$$, $written$jscomp$1$$) {
|
|
7265
7270
|
$dbg_assert$$module$src$log$$(0 === ($addr$jscomp$26_address$jscomp$20$$ & 1));
|
|
7266
7271
|
var $bdf$jscomp$2$$ = $addr$jscomp$26_address$jscomp$20$$ >> 8 & 65535;
|
|
7267
7272
|
$addr$jscomp$26_address$jscomp$20$$ &= 255;
|
|
7268
|
-
var $
|
|
7269
|
-
|
|
7270
|
-
|
|
7273
|
+
var $device_space$jscomp$1_space$jscomp$2$$ = this.device_spaces[$bdf$jscomp$2$$];
|
|
7274
|
+
if ($device_space$jscomp$1_space$jscomp$2$$) {
|
|
7275
|
+
$device_space$jscomp$1_space$jscomp$2$$ = new Uint16Array($device_space$jscomp$1_space$jscomp$2$$.buffer);
|
|
7276
|
+
var $device$jscomp$7$$ = this.devices[$bdf$jscomp$2$$];
|
|
7277
|
+
16 <= $addr$jscomp$26_address$jscomp$20$$ && 44 > $addr$jscomp$26_address$jscomp$20$$ ? $dbg_log$$module$src$log$$("Warning: PCI: Expected 32-bit write, got 16-bit (addr: " + $h$$module$src$lib$$($addr$jscomp$26_address$jscomp$20$$) + ")") : ($dbg_assert$$module$src$log$$(!(48 <= $addr$jscomp$26_address$jscomp$20$$ && 52 > $addr$jscomp$26_address$jscomp$20$$), "PCI: Expected 32-bit write, got 16-bit (addr: " + $h$$module$src$lib$$($addr$jscomp$26_address$jscomp$20$$) + ")"), $dbg_log$$module$src$log$$("PCI writ16 dev=" +
|
|
7278
|
+
$h$$module$src$lib$$($bdf$jscomp$2$$ >> 3, 2) + " (" + $device$jscomp$7$$.name + ") addr=" + $h$$module$src$lib$$($addr$jscomp$26_address$jscomp$20$$, 4) + " value=" + $h$$module$src$lib$$($written$jscomp$1$$, 4), 2048), $device_space$jscomp$1_space$jscomp$2$$[$addr$jscomp$26_address$jscomp$20$$ >>> 1] = $written$jscomp$1$$);
|
|
7279
|
+
}
|
|
7271
7280
|
};
|
|
7272
7281
|
$PCI$$module$src$pci$$.prototype.pci_write32 = function($addr$jscomp$27_address$jscomp$21$$, $written$jscomp$2$$) {
|
|
7273
7282
|
$dbg_assert$$module$src$log$$(0 === ($addr$jscomp$27_address$jscomp$21$$ & 3));
|
|
@@ -7858,7 +7867,7 @@ $VirtioConsole$$module$src$virtio_console$$.prototype.SendWindowSize = function(
|
|
|
7858
7867
|
$rows$jscomp$3$$ = $rows$jscomp$3$$ || this.rows;
|
|
7859
7868
|
$cols$jscomp$3$$ = $cols$jscomp$3$$ || this.cols;
|
|
7860
7869
|
const $bufchain$jscomp$3$$ = this.virtio.queues[2].pop_request(), $buf$jscomp$1$$ = new Uint8Array(12);
|
|
7861
|
-
$Marshall$$module$lib$marshall$$(["w", "h", "h", "h", "h"], [$port$jscomp$8$$, 5, 0, $
|
|
7870
|
+
$Marshall$$module$lib$marshall$$(["w", "h", "h", "h", "h"], [$port$jscomp$8$$, 5, 0, $cols$jscomp$3$$, $rows$jscomp$3$$], $buf$jscomp$1$$, 0);
|
|
7862
7871
|
this.Send(2, $bufchain$jscomp$3$$, $buf$jscomp$1$$);
|
|
7863
7872
|
};
|
|
7864
7873
|
$VirtioConsole$$module$src$virtio_console$$.prototype.SendName = function($i$jscomp$86_port$jscomp$9$$, $name$jscomp$102_namex$$) {
|
package/build/libv86.js
CHANGED
|
@@ -407,7 +407,7 @@ a.io.register_read_consecutive(3324,this,function(){return this.pci_response[0]}
|
|
|
407
407
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],pci_bars:[],name:"82371SB PIIX3 ISA"};this.isa_bridge_space=this.register_device(this.isa_bridge);this.isa_bridge_space8=new Uint8Array(this.isa_bridge_space.buffer)}Jc.prototype.get_state=function(){for(var a=[],b=0;256>b;b++)a[b]=this.device_spaces[b];a[256]=this.pci_addr;a[257]=this.pci_value;a[258]=this.pci_response;a[259]=this.pci_status;return a};
|
|
408
408
|
Jc.prototype.set_state=function(a){for(var b=0;256>b;b++){var c=this.devices[b],d=a[b];if(c&&d){for(var e=0;e<c.pci_bars.length;e++){var f=d[4+e];if(f&1){var g=c.pci_bars[e];this.set_io_bars(g,g.original_bar&65534,f&65534)}}this.device_spaces[b].set(d)}else d&&y(b,2)}this.pci_addr.set(a[256]);this.pci_value.set(a[257]);this.pci_response.set(a[258]);this.pci_status.set(a[259])};
|
|
409
409
|
Jc.prototype.pci_query=function(){var a=this.pci_addr[2]<<8|this.pci_addr[1],b=this.pci_addr[0]&252,c=a>>3&31;y(a,4);y(c,2);y(b,2);a=this.device_spaces[a];void 0!==a?(this.pci_status32[0]=-2147483648,this.pci_response32[0]=b<a.byteLength?a[b>>2]:0,y(this.pci_addr32[0]>>>0,8),y(this.pci_response32[0]>>>0,8)):(this.pci_response32[0]=-1,this.pci_status32[0]=0)};
|
|
410
|
-
Jc.prototype.pci_write8=function(a,b){var c=a>>8&65535;a&=255;var d=
|
|
410
|
+
Jc.prototype.pci_write8=function(a,b){var c=a>>8&65535;a&=255;var d=this.device_spaces[c];d&&(d=new Uint8Array(d.buffer),y(a),y(c>>3,2),y(a,4),y(b,2),d[a]=b)};Jc.prototype.pci_write16=function(a,b){var c=a>>8&65535;a&=255;var d=this.device_spaces[c];d&&(d=new Uint16Array(d.buffer),16<=a&&44>a?y(a):(y(a),y(c>>3,2),y(a,4),y(b,4),d[a>>>1]=b))};
|
|
411
411
|
Jc.prototype.pci_write32=function(a,b){var c=a>>8&65535;a&=255;var d=this.device_spaces[c],e=this.devices[c];if(d)if(16<=a&&40>a){e=e.pci_bars[a-16>>2];y(d[a>>2]);y(b>>>0);y(c>>3,2);if(e){c=a>>2;var f=d[c]&1;-1===(b|3|e.size-1)?(b=~(e.size-1)|f,0===f&&(d[c]=b)):0===f&&(d[c]=e.original_bar);if(1===f){f=d[c]&65534;var g=b&65534;y(f>>>0,8);y(g>>>0,8);this.set_io_bars(e,f,g);d[c]=b|1}}else d[a>>2]=0;y(d[a>>2]>>>0)}else 48===a?(y(c>>3,2),y(b>>>0,8),d[a>>2]=e.pci_rom_size?-1===(b|2047)?-e.pci_rom_size|
|
|
412
412
|
0:e.pci_rom_address|0:0):4===a?(y(c>>3,2),y(a,4),y(b>>>0,8)):(y(c>>3,2),y(a,4),y(b>>>0,8),d[a>>>2]=b)};Jc.prototype.register_device=function(a){var b=a.pci_id;y(b);var c=new Int32Array(64);c.set(new Int32Array((new Uint8Array(a.pci_space)).buffer));this.device_spaces[b]=c;this.devices[b]=a;b=c.slice(4,10);for(var d=0;d<a.pci_bars.length;d++){var e=a.pci_bars[d];if(e){var f=b[d],g=f&1;y(f);e.original_bar=f;e.entries=[];if(0!==g)for(f&=-2,g=0;g<e.size;g++)e.entries[g]=this.io.ports[f+g]}}return c};
|
|
413
413
|
Jc.prototype.set_io_bars=function(a,b,c){var d=a.size;y(b);y(c);for(var e=this.io.ports,f=0;f<d;f++){4096<=b+f&&(e[b+f]=this.io.create_empty_entry());var g=a.entries[f];4096<=c+f&&(e[c+f]=g)}};Jc.prototype.raise_irq=function(a){this.cpu.device_raise_irq(this.isa_bridge_space8[96+((this.device_spaces[a][15]>>8&255)-1+((a>>3)-1&255)&3)])};Jc.prototype.lower_irq=function(a){this.cpu.device_lower_irq(this.isa_bridge_space8[96+((this.device_spaces[a][15]>>8&255)+(a>>3&255)-2&3)])};function Kc(a,b,c){a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[4]=c[4],a[5]=c[5]);a[6]===b[0]&&a[7]===b[1]&&a[8]===b[2]&&a[9]===b[3]&&a[10]===b[4]&&a[11]===b[5]&&(a[6]=c[0],a[7]=c[1],a[8]=c[2],a[9]=c[3],a[10]=c[4],a[11]=c[5]);var d=a[12]<<8|a[13];if(2048===d){if(a=a.subarray(14),4===a[0]>>4&&17===a[9]){a=a.subarray(20);d=a[0]<<8|a[1];var e=a[2]<<8|a[3];y(a[6]<<8|a[7],4);if(67===d||67===e)if(d=a.subarray(8),e=d[236]<<24|d[237]<<
|
|
@@ -435,7 +435,7 @@ Mc.prototype.receive=function(a){if(!(this.cr&1)&&(this.bus.send("eth-receive-en
|
|
|
435
435
|
single_handler:!1,handlers:[()=>{},c=>{const d=this.virtio.queues[c],e=3<c?c-3>>1:0;for(;d.has_request();){const f=d.pop_request(),g=new Uint8Array(f.length_readable);f.get_next_blob(g);this.bus.send("virtio-console"+e+"-output-bytes",g);this.Ack(c,f)}},()=>{},c=>{if(3===c)for(var d=this.virtio.queues[c];d.has_request();){var e=d.pop_request(),f=new Uint8Array(e.length_readable);e.get_next_blob(f);var g=M(["w","h","h"],f,{offset:0});f=g[0];g=g[1];this.Ack(c,e);switch(g){case 0:for(e=0;e<this.ports;++e)this.SendEvent(e,
|
|
436
436
|
1,0);break;case 3:this.Ack(c,e);this.SendEvent(f,4,1);this.SendName(f,"virtio-"+f);this.SendEvent(f,6,1);break;case 6:this.Ack(c,e);0===f&&this.SendWindowSize(f);break;default:return}}}]},isr_status:{initial_port:46848},device_specific:{initial_port:46592,struct:[{bytes:2,name:"cols",read:()=>this.cols,write:()=>{}},{bytes:2,name:"rows",read:()=>this.rows,write:()=>{}},{bytes:4,name:"max_nr_ports",read:()=>this.ports,write:()=>{}},{bytes:4,name:"emerg_wr",read:()=>0,write:()=>{}}]}});for(let c=0;c<
|
|
437
437
|
this.ports;++c){const d=0===c?0:2*c+2;this.bus.register("virtio-console"+c+"-input-bytes",function(e){var f=this.virtio.queues[d];f.has_request()&&(f=f.pop_request(),this.Send(d,f,new Uint8Array(e)))},this);this.bus.register("virtio-console"+c+"-resize",function(e){0===c&&(this.cols=e[0],this.rows=e[1]);this.virtio.queues[2].is_configured()&&this.virtio.queues[2].has_request()&&this.SendWindowSize(c,e[0],e[1])},this)}}
|
|
438
|
-
Nc.prototype.SendWindowSize=function(a,b,c){c=c||this.rows;b=b||this.cols;const d=this.virtio.queues[2].pop_request(),e=new Uint8Array(12);K(["w","h","h","h","h"],[a,5,0,c
|
|
438
|
+
Nc.prototype.SendWindowSize=function(a,b,c){c=c||this.rows;b=b||this.cols;const d=this.virtio.queues[2].pop_request(),e=new Uint8Array(12);K(["w","h","h","h","h"],[a,5,0,b,c],e,0);this.Send(2,d,e)};Nc.prototype.SendName=function(a,b){const c=this.virtio.queues[2].pop_request();b=(new TextEncoder).encode(b);const d=new Uint8Array(8+b.length+1);K(["w","h","h"],[a,7,1],d,0);for(a=0;a<b.length;++a)d[a+8]=b[a];d[8+b.length]=0;this.Send(2,c,d)};
|
|
439
439
|
Nc.prototype.get_state=function(){const a=[];a[0]=this.virtio;a[1]=this.rows;a[2]=this.cols;a[3]=this.ports;return a};Nc.prototype.set_state=function(a){this.virtio.set_state(a[0]);this.rows=a[1];this.cols=a[2];this.ports=a[3]};Nc.prototype.reset=function(){this.virtio.reset()};Nc.prototype.SendEvent=function(a,b,c){const d=this.virtio.queues[2].pop_request(),e=new Uint8Array(8);K(["w","h","h"],[a,b,c],e,0);this.Send(2,d,e)};
|
|
440
440
|
Nc.prototype.Send=function(a,b,c){b.set_next_blob(c);this.virtio.queues[a].push_reply(b);this.virtio.queues[a].flush_replies()};Nc.prototype.Ack=function(a,b){b.set_next_blob(new Uint8Array(0));this.virtio.queues[a].push_reply(b);this.virtio.queues[a].flush_replies()};function Pc(a,b){this.cpu=a;this.bus=b;this.reset();this.bus.register("keyboard-code",function(c){this.kbd_send_code(c)},this);this.bus.register("mouse-click",function(c){this.mouse_send_click(c[0],c[1],c[2])},this);this.bus.register("mouse-delta",function(c){this.mouse_send_delta(c[0],c[1])},this);this.bus.register("mouse-wheel",function(c){this.have_mouse&&this.use_mouse&&this.mouse_stream_active()&&(this.wheel_movement-=c[0],this.wheel_movement-=2*c[1],this.wheel_movement=Math.min(7,Math.max(-8,
|
|
441
441
|
this.wheel_movement)),this.send_mouse_packet(0,0))},this);a.io.register_read(96,this,this.port60_read);a.io.register_read(100,this,this.port64_read);a.io.register_write(96,this,this.port60_write);a.io.register_write(100,this,this.port64_write)}
|
package/build/libv86.mjs
CHANGED
|
@@ -361,26 +361,26 @@ this,function(c){this.pci_write8(this.pci_addr32[0]+1|0,c)});a.io.register_write
|
|
|
361
361
|
this,function(){return this.pci_status[0]},function(){return this.pci_status[1]},function(){return this.pci_status[2]},function(){return this.pci_status[3]});a.io.register_write_consecutive(3320,this,function(c){this.pci_addr[0]=c&252},function(c){2===(this.pci_addr[1]&6)&&6===(c&6)?a.reboot_internal():this.pci_addr[1]=c},function(c){this.pci_addr[2]=c},function(c){this.pci_addr[3]=c;this.pci_query()});this.register_device({pci_id:0,pci_space:[134,128,55,18,0,0,0,0,2,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
362
362
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0],pci_bars:[],name:"82441FX PMC"});this.isa_bridge={pci_id:8,pci_space:[134,128,0,112,7,0,0,2,0,0,1,6,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],pci_bars:[],name:"82371SB PIIX3 ISA"};this.isa_bridge_space=this.register_device(this.isa_bridge);this.isa_bridge_space8=new Uint8Array(this.isa_bridge_space.buffer)}
|
|
363
363
|
Jc.prototype.get_state=function(){for(var a=[],b=0;256>b;b++)a[b]=this.device_spaces[b];a[256]=this.pci_addr;a[257]=this.pci_value;a[258]=this.pci_response;a[259]=this.pci_status;return a};Jc.prototype.set_state=function(a){for(var b=0;256>b;b++){var c=this.devices[b],d=a[b];if(c&&d){for(var e=0;e<c.pci_bars.length;e++){var f=d[4+e];if(f&1){var g=c.pci_bars[e];this.set_io_bars(g,g.original_bar&65534,f&65534)}}this.device_spaces[b].set(d)}else d&&y(b,2)}this.pci_addr.set(a[256]);this.pci_value.set(a[257]);
|
|
364
|
-
this.pci_response.set(a[258]);this.pci_status.set(a[259])};Jc.prototype.pci_query=function(){var a=this.pci_addr[2]<<8|this.pci_addr[1],b=this.pci_addr[0]&252,c=a>>3&31;y(a,4);y(c,2);y(b,2);a=this.device_spaces[a];void 0!==a?(this.pci_status32[0]=-2147483648,this.pci_response32[0]=b<a.byteLength?a[b>>2]:0,y(this.pci_addr32[0]>>>0,8),y(this.pci_response32[0]>>>0,8)):(this.pci_response32[0]=-1,this.pci_status32[0]=0)};Jc.prototype.pci_write8=function(a,b){var c=a>>8&65535;a&=255;var d=
|
|
365
|
-
y(a)
|
|
366
|
-
if(1===f){f=d[c]&65534;var g=b&65534;y(f>>>0,8);y(g>>>0,8);this.set_io_bars(e,f,g);d[c]=b|1}}else d[a>>2]=0;y(d[a>>2]>>>0)}else 48===a?(y(c>>3,2),y(b>>>0,8),d[a>>2]=e.pci_rom_size?-1===(b|2047)?-e.pci_rom_size|0:e.pci_rom_address|0:0):4===a?(y(c>>3,2),y(a,4),y(b>>>0,8)):(y(c>>3,2),y(a,4),y(b>>>0,8),d[a>>>2]=b)};Jc.prototype.register_device=function(a){var b=a.pci_id;y(b);var c=new Int32Array(64);c.set(new Int32Array((new Uint8Array(a.pci_space)).buffer));
|
|
367
|
-
b=c.slice(4,10);for(var d=0;d<a.pci_bars.length;d++){var e=a.pci_bars[d];if(e){var f=b[d],g=f&1;y(f);e.original_bar=f;e.entries=[];if(0!==g)for(f&=-2,g=0;g<e.size;g++)e.entries[g]=this.io.ports[f+g]}}return c};Jc.prototype.set_io_bars=function(a,b,c){var d=a.size;y(b);y(c);for(var e=this.io.ports,f=0;f<d;f++){4096<=b+f&&(e[b+f]=this.io.create_empty_entry());var g=a.entries[f];4096<=c+f&&(e[c+f]=g)}};Jc.prototype.raise_irq=function(a){this.cpu.device_raise_irq(this.isa_bridge_space8[96+
|
|
368
|
-
8&255)-1+((a>>3)-1&255)&3)])};Jc.prototype.lower_irq=function(a){this.cpu.device_lower_irq(this.isa_bridge_space8[96+((this.device_spaces[a][15]>>8&255)+(a>>3&255)-2&3)])};function Kc(a,b,c){a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[4]=c[4],a[5]=c[5]);a[6]===b[0]&&a[7]===b[1]&&a[8]===b[2]&&a[9]===b[3]&&a[10]===b[4]&&a[11]===b[5]&&(a[6]=c[0],a[7]=c[1],a[8]=c[2],a[9]=c[3],a[10]=c[4],a[11]=c[5]);
|
|
369
|
-
d){if(a=a.subarray(14),4===a[0]>>4&&17===a[9]){a=a.subarray(20);d=a[0]<<8|a[1];var e=a[2]<<8|a[3];y(a[6]<<8|a[7],4);if(67===d||67===e)if(d=a.subarray(8),e=d[236]<<24|d[237]<<16|d[238]<<8|d[239],1669485411!==e)y(e,8);else for(d[28]===b[0]&&d[29]===b[1]&&d[30]===b[2]&&d[31]===b[3]&&d[32]===b[4]&&d[33]===b[5]&&(d[28]=c[0],d[29]=c[1],d[30]=c[2],d[31]=c[3],d[32]=c[4],d[33]=c[5],a[6]=a[7]=0),e=240;e<d.length;){const f=d[e++];if(255===f)break;const g=d[e++];61===f&&1===d[e+
|
|
370
|
-
d[e+3]===b[2]&&d[e+4]===b[3]&&d[e+5]===b[4]&&d[e+6]===b[5]&&(d[e+1]=c[0],d[e+2]=c[1],d[e+3]=c[2],d[e+4]=c[3],d[e+5]=c[4],d[e+6]=c[5],a[6]=a[7]=0);e+=g}}}else 2054===d&&(a=a.subarray(14),Lc(a.subarray(8,14)),Lc(a.subarray(18,24)),a[8]===b[0]&&a[9]===b[1]&&a[10]===b[2]&&a[11]===b[3]&&a[12]===b[4]&&a[13]===b[5]&&(a[8]=c[0],a[9]=c[1],a[10]=c[2],a[11]=c[3],a[12]=c[4],a[13]=c[5]))}function Lc(a){return[a[0].toString(16).padStart(2,"0"),a[1].toString(16).padStart(2,"0"),
|
|
371
|
-
a[3].toString(16).padStart(2,"0"),a[4].toString(16).padStart(2,"0"),a[5].toString(16).padStart(2,"0")].join(":")}function Mc(a,b,c,d,e){this.cpu=a;this.pci=a.devices.pci;this.id=e||0;this.preserve_mac_from_state_image=c;this.mac_address_translation=d;this.bus=b;this.bus.register("net"+this.id+"-receive",function(f){this.receive(f)},this);this.port=768+256*this.id;this.name="ne2k";this.pci_space=[236,16,41,128,3,1,0,0,0,0,0,2,0,0,0,0,this.port&255|1,this.port>>8,0,
|
|
372
|
-
0,0,0,0,0,0,0,0,244,26,0,17,0,0,184,254,0,0,0,0,0,0,0,0,0,1,0,0];this.pci_id=(0===this.id?5:7+this.id)<<3;this.pci_bars=[{size:32}];this.imr=this.isr=0;this.cr=1;this.tpsr=this.tcnt=this.rcnt=this.dcfg=0;this.memory=new Uint8Array(32768);this.txcr=this.rxcr=0;this.tsr=1;this.mac=new Uint8Array([0,34,21,255*Math.random()|0,255*Math.random()|0,255*Math.random()|0]);this.bus.send("net"+this.id+"-mac",Lc(this.mac));this.mar=Uint8Array.of(255,255,255,255,255,255,255,255);
|
|
373
|
-
for(b=0;6>b;b++)this.memory[b<<1]=this.memory[b<<1|1]=this.mac[b];this.memory[28]=this.memory[29]=87;this.memory[30]=this.memory[31]=87;sa("Mac: "+Lc(this.mac),1048576);this.rsar=0;this.pstart=64;this.pstop=128;this.boundary=this.curpg=76;b=a.io;b.register_read(this.port|0,this,function(){return this.cr},function(){return this.cr});b.register_write(this.port|0,this,function(f){this.cr=f;y(f,2);y(this.txcr,2);this.cr&1||(f&24&&0===this.rcnt&&this.do_interrupt(64),f&4&&
|
|
374
|
-
f+this.tcnt),this.mac_address_in_state&&(f=new Uint8Array(f),Kc(f,this.mac_address_in_state,this.mac)),this.bus.send("net"+this.id+"-send",f),this.bus.send("eth-transmit-end",[f.length]),this.cr&=-5,this.do_interrupt(2),y(f.byteLength)))});b.register_read(this.port|13,this,function(){return 1===this.get_page()?this.mar[5]:0});b.register_read(this.port|14,this,function(){return 1===this.get_page()?this.mar[6]:0},function(){this.get_page();return 0});b.register_read(this.port|
|
|
375
|
-
this.get_page()?this.mar[7]:0});b.register_read(this.port|31,this,function(){this.get_page();this.do_interrupt(128);return 0});b.register_write(this.port|31,this,function(f){this.get_page();y(f,2)});b.register_read(this.port|1,this,function(){var f=this.get_page();return 0===f?this.pstart:1===f?this.mac[0]:2===f?this.pstart:0});b.register_write(this.port|1,this,function(f){var g=this.get_page();0===g?(y(f,2),this.pstart=f):1===g?(y(f),this.mac[0]=f):y(f)});b.register_read(this.port|
|
|
376
|
-
this.get_page();return 0===f?this.pstop:1===f?this.mac[1]:2===f?this.pstop:0});b.register_write(this.port|2,this,function(f){var g=this.get_page();0===g?(y(f,2),f>this.memory.length>>8&&(f=this.memory.length>>8,y(f)),this.pstop=f):1===g?(y(f),this.mac[1]=f):y(f)});b.register_read(this.port|7,this,function(){var f=this.get_page();return 0===f?(y(this.isr,2),this.isr):1===f?(y(this.curpg,2),this.curpg):0});b.register_write(this.port|7,this,function(f){var g=this.get_page();0===
|
|
377
|
-
this.update_irq()):1===g&&(y(f,2),this.curpg=f)});b.register_write(this.port|13,this,function(f){0===this.get_page()&&(this.txcr=f);y(f,2)});b.register_write(this.port|14,this,function(f){0===this.get_page()?(y(f,2),this.dcfg=f):y(f,2)});b.register_read(this.port|10,this,function(){var f=this.get_page();return 0===f?80:1===f?this.mar[2]:0});b.register_write(this.port|10,this,function(f){0===this.get_page()?(y(f,2),this.rcnt=this.rcnt&65280|f&255):y(f,2)});b.register_read(this.port|
|
|
378
|
-
this.get_page();return 0===f?67:1===f?this.mar[3]:0});b.register_write(this.port|11,this,function(f){0===this.get_page()?(y(f,2),this.rcnt=this.rcnt&255|f<<8&65280):y(f,2)});b.register_read(this.port|8,this,function(){var f=this.get_page();return 0===f?this.rsar&255:1===f?this.mar[0]:0});b.register_write(this.port|8,this,function(f){0===this.get_page()?(y(f,2),this.rsar=this.rsar&65280|f&255):y(f,2)});b.register_read(this.port|9,this,function(){var f=this.get_page();return 0===
|
|
379
|
-
1===f?this.mar[1]:0});b.register_write(this.port|9,this,function(f){0===this.get_page()?(y(f,2),this.rsar=this.rsar&255|f<<8&65280):y(f,2)});b.register_write(this.port|15,this,function(f){0===this.get_page()?(y(f,2),y(this.isr,2),this.imr=f,this.update_irq()):y(f,2)});b.register_read(this.port|3,this,function(){var f=this.get_page();return 0===f?(y(this.boundary,2),this.boundary):1===f?this.mac[2]:0});b.register_write(this.port|3,this,function(f){var g=this.get_page();0===g?(y(f,
|
|
380
|
-
f):1===g?(y(f),this.mac[2]=f):y(f)});b.register_read(this.port|4,this,function(){var f=this.get_page();return 0===f?this.tsr:1===f?this.mac[3]:0});b.register_write(this.port|4,this,function(f){var g=this.get_page();0===g?(y(f,2),this.tpsr=f):1===g?(y(f),this.mac[3]=f):y(f)});b.register_read(this.port|5,this,function(){var f=this.get_page();return 0===f?0:1===f?this.mac[4]:0});b.register_write(this.port|5,this,function(f){var g=this.get_page();0===g?(y(f,2),this.tcnt=this.tcnt&-256|
|
|
381
|
-
this.mac[4]=f):y(f)});b.register_read(this.port|6,this,function(){var f=this.get_page();return 0===f?0:1===f?this.mac[5]:0});b.register_write(this.port|6,this,function(f){var g=this.get_page();0===g?(y(f,2),this.tcnt=this.tcnt&255|f<<8):1===g?(y(f),this.mac[5]=f):y(f)});b.register_read(this.port|12,this,function(){var f=this.get_page();return 0===f?9:1===f?this.mar[4]:0});b.register_write(this.port|12,this,function(f){0===this.get_page()?(y(f,2),this.rxcr=f):y(f)});b.register_read(this.port|
|
|
382
|
-
this.data_port_read8,this.data_port_read16,this.data_port_read32);b.register_write(this.port|16,this,this.data_port_write16,this.data_port_write16,this.data_port_write32);a.devices.pci.register_device(this)}Mc.prototype.get_state=function(){var a=[];a[0]=this.isr;a[1]=this.imr;a[2]=this.cr;a[3]=this.dcfg;a[4]=this.rcnt;a[5]=this.tcnt;a[6]=this.tpsr;a[7]=this.rsar;a[8]=this.pstart;a[9]=this.curpg;a[10]=this.boundary;a[11]=this.pstop;a[12]=this.rxcr;a[13]=this.txcr;a[14]=this.tsr;a[15]=this.mac;
|
|
383
|
-
this.memory;return a};Mc.prototype.set_state=function(a){this.isr=a[0];this.imr=a[1];this.cr=a[2];this.dcfg=a[3];this.rcnt=a[4];this.tcnt=a[5];this.tpsr=a[6];this.rsar=a[7];this.pstart=a[8];this.curpg=a[9];this.boundary=a[10];this.pstop=a[11];this.rxcr=a[12];this.txcr=a[13];this.tsr=a[14];this.preserve_mac_from_state_image?(this.mac=a[15],this.memory=a[16]):this.mac_address_translation&&(this.mac_address_in_state=a[15],this.memory=a[16],Lc(this.mac_address_in_state),Lc(this.mac));this.bus.send("net"+
|
|
364
|
+
this.pci_response.set(a[258]);this.pci_status.set(a[259])};Jc.prototype.pci_query=function(){var a=this.pci_addr[2]<<8|this.pci_addr[1],b=this.pci_addr[0]&252,c=a>>3&31;y(a,4);y(c,2);y(b,2);a=this.device_spaces[a];void 0!==a?(this.pci_status32[0]=-2147483648,this.pci_response32[0]=b<a.byteLength?a[b>>2]:0,y(this.pci_addr32[0]>>>0,8),y(this.pci_response32[0]>>>0,8)):(this.pci_response32[0]=-1,this.pci_status32[0]=0)};Jc.prototype.pci_write8=function(a,b){var c=a>>8&65535;a&=255;var d=this.device_spaces[c];
|
|
365
|
+
d&&(d=new Uint8Array(d.buffer),y(a),y(c>>3,2),y(a,4),y(b,2),d[a]=b)};Jc.prototype.pci_write16=function(a,b){var c=a>>8&65535;a&=255;var d=this.device_spaces[c];d&&(d=new Uint16Array(d.buffer),16<=a&&44>a?y(a):(y(a),y(c>>3,2),y(a,4),y(b,4),d[a>>>1]=b))};Jc.prototype.pci_write32=function(a,b){var c=a>>8&65535;a&=255;var d=this.device_spaces[c],e=this.devices[c];if(d)if(16<=a&&40>a){e=e.pci_bars[a-16>>2];y(d[a>>2]);y(b>>>0);y(c>>3,2);if(e){c=a>>2;var f=d[c]&1;-1===(b|3|e.size-1)?(b=~(e.size-1)|f,0===
|
|
366
|
+
f&&(d[c]=b)):0===f&&(d[c]=e.original_bar);if(1===f){f=d[c]&65534;var g=b&65534;y(f>>>0,8);y(g>>>0,8);this.set_io_bars(e,f,g);d[c]=b|1}}else d[a>>2]=0;y(d[a>>2]>>>0)}else 48===a?(y(c>>3,2),y(b>>>0,8),d[a>>2]=e.pci_rom_size?-1===(b|2047)?-e.pci_rom_size|0:e.pci_rom_address|0:0):4===a?(y(c>>3,2),y(a,4),y(b>>>0,8)):(y(c>>3,2),y(a,4),y(b>>>0,8),d[a>>>2]=b)};Jc.prototype.register_device=function(a){var b=a.pci_id;y(b);var c=new Int32Array(64);c.set(new Int32Array((new Uint8Array(a.pci_space)).buffer));
|
|
367
|
+
this.device_spaces[b]=c;this.devices[b]=a;b=c.slice(4,10);for(var d=0;d<a.pci_bars.length;d++){var e=a.pci_bars[d];if(e){var f=b[d],g=f&1;y(f);e.original_bar=f;e.entries=[];if(0!==g)for(f&=-2,g=0;g<e.size;g++)e.entries[g]=this.io.ports[f+g]}}return c};Jc.prototype.set_io_bars=function(a,b,c){var d=a.size;y(b);y(c);for(var e=this.io.ports,f=0;f<d;f++){4096<=b+f&&(e[b+f]=this.io.create_empty_entry());var g=a.entries[f];4096<=c+f&&(e[c+f]=g)}};Jc.prototype.raise_irq=function(a){this.cpu.device_raise_irq(this.isa_bridge_space8[96+
|
|
368
|
+
((this.device_spaces[a][15]>>8&255)-1+((a>>3)-1&255)&3)])};Jc.prototype.lower_irq=function(a){this.cpu.device_lower_irq(this.isa_bridge_space8[96+((this.device_spaces[a][15]>>8&255)+(a>>3&255)-2&3)])};function Kc(a,b,c){a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[4]=c[4],a[5]=c[5]);a[6]===b[0]&&a[7]===b[1]&&a[8]===b[2]&&a[9]===b[3]&&a[10]===b[4]&&a[11]===b[5]&&(a[6]=c[0],a[7]=c[1],a[8]=c[2],a[9]=c[3],a[10]=c[4],a[11]=c[5]);
|
|
369
|
+
var d=a[12]<<8|a[13];if(2048===d){if(a=a.subarray(14),4===a[0]>>4&&17===a[9]){a=a.subarray(20);d=a[0]<<8|a[1];var e=a[2]<<8|a[3];y(a[6]<<8|a[7],4);if(67===d||67===e)if(d=a.subarray(8),e=d[236]<<24|d[237]<<16|d[238]<<8|d[239],1669485411!==e)y(e,8);else for(d[28]===b[0]&&d[29]===b[1]&&d[30]===b[2]&&d[31]===b[3]&&d[32]===b[4]&&d[33]===b[5]&&(d[28]=c[0],d[29]=c[1],d[30]=c[2],d[31]=c[3],d[32]=c[4],d[33]=c[5],a[6]=a[7]=0),e=240;e<d.length;){const f=d[e++];if(255===f)break;const g=d[e++];61===f&&1===d[e+
|
|
370
|
+
0]&&d[e+1]===b[0]&&d[e+2]===b[1]&&d[e+3]===b[2]&&d[e+4]===b[3]&&d[e+5]===b[4]&&d[e+6]===b[5]&&(d[e+1]=c[0],d[e+2]=c[1],d[e+3]=c[2],d[e+4]=c[3],d[e+5]=c[4],d[e+6]=c[5],a[6]=a[7]=0);e+=g}}}else 2054===d&&(a=a.subarray(14),Lc(a.subarray(8,14)),Lc(a.subarray(18,24)),a[8]===b[0]&&a[9]===b[1]&&a[10]===b[2]&&a[11]===b[3]&&a[12]===b[4]&&a[13]===b[5]&&(a[8]=c[0],a[9]=c[1],a[10]=c[2],a[11]=c[3],a[12]=c[4],a[13]=c[5]))}function Lc(a){return[a[0].toString(16).padStart(2,"0"),a[1].toString(16).padStart(2,"0"),
|
|
371
|
+
a[2].toString(16).padStart(2,"0"),a[3].toString(16).padStart(2,"0"),a[4].toString(16).padStart(2,"0"),a[5].toString(16).padStart(2,"0")].join(":")}function Mc(a,b,c,d,e){this.cpu=a;this.pci=a.devices.pci;this.id=e||0;this.preserve_mac_from_state_image=c;this.mac_address_translation=d;this.bus=b;this.bus.register("net"+this.id+"-receive",function(f){this.receive(f)},this);this.port=768+256*this.id;this.name="ne2k";this.pci_space=[236,16,41,128,3,1,0,0,0,0,0,2,0,0,0,0,this.port&255|1,this.port>>8,0,
|
|
372
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,244,26,0,17,0,0,184,254,0,0,0,0,0,0,0,0,0,1,0,0];this.pci_id=(0===this.id?5:7+this.id)<<3;this.pci_bars=[{size:32}];this.imr=this.isr=0;this.cr=1;this.tpsr=this.tcnt=this.rcnt=this.dcfg=0;this.memory=new Uint8Array(32768);this.txcr=this.rxcr=0;this.tsr=1;this.mac=new Uint8Array([0,34,21,255*Math.random()|0,255*Math.random()|0,255*Math.random()|0]);this.bus.send("net"+this.id+"-mac",Lc(this.mac));this.mar=Uint8Array.of(255,255,255,255,255,255,255,255);
|
|
373
|
+
this.mac_address_in_state=null;for(b=0;6>b;b++)this.memory[b<<1]=this.memory[b<<1|1]=this.mac[b];this.memory[28]=this.memory[29]=87;this.memory[30]=this.memory[31]=87;sa("Mac: "+Lc(this.mac),1048576);this.rsar=0;this.pstart=64;this.pstop=128;this.boundary=this.curpg=76;b=a.io;b.register_read(this.port|0,this,function(){return this.cr},function(){return this.cr});b.register_write(this.port|0,this,function(f){this.cr=f;y(f,2);y(this.txcr,2);this.cr&1||(f&24&&0===this.rcnt&&this.do_interrupt(64),f&4&&
|
|
374
|
+
(f=this.tpsr<<8,f=this.memory.subarray(f,f+this.tcnt),this.mac_address_in_state&&(f=new Uint8Array(f),Kc(f,this.mac_address_in_state,this.mac)),this.bus.send("net"+this.id+"-send",f),this.bus.send("eth-transmit-end",[f.length]),this.cr&=-5,this.do_interrupt(2),y(f.byteLength)))});b.register_read(this.port|13,this,function(){return 1===this.get_page()?this.mar[5]:0});b.register_read(this.port|14,this,function(){return 1===this.get_page()?this.mar[6]:0},function(){this.get_page();return 0});b.register_read(this.port|
|
|
375
|
+
15,this,function(){return 1===this.get_page()?this.mar[7]:0});b.register_read(this.port|31,this,function(){this.get_page();this.do_interrupt(128);return 0});b.register_write(this.port|31,this,function(f){this.get_page();y(f,2)});b.register_read(this.port|1,this,function(){var f=this.get_page();return 0===f?this.pstart:1===f?this.mac[0]:2===f?this.pstart:0});b.register_write(this.port|1,this,function(f){var g=this.get_page();0===g?(y(f,2),this.pstart=f):1===g?(y(f),this.mac[0]=f):y(f)});b.register_read(this.port|
|
|
376
|
+
2,this,function(){var f=this.get_page();return 0===f?this.pstop:1===f?this.mac[1]:2===f?this.pstop:0});b.register_write(this.port|2,this,function(f){var g=this.get_page();0===g?(y(f,2),f>this.memory.length>>8&&(f=this.memory.length>>8,y(f)),this.pstop=f):1===g?(y(f),this.mac[1]=f):y(f)});b.register_read(this.port|7,this,function(){var f=this.get_page();return 0===f?(y(this.isr,2),this.isr):1===f?(y(this.curpg,2),this.curpg):0});b.register_write(this.port|7,this,function(f){var g=this.get_page();0===
|
|
377
|
+
g?(y(f,2),this.isr&=~f,this.update_irq()):1===g&&(y(f,2),this.curpg=f)});b.register_write(this.port|13,this,function(f){0===this.get_page()&&(this.txcr=f);y(f,2)});b.register_write(this.port|14,this,function(f){0===this.get_page()?(y(f,2),this.dcfg=f):y(f,2)});b.register_read(this.port|10,this,function(){var f=this.get_page();return 0===f?80:1===f?this.mar[2]:0});b.register_write(this.port|10,this,function(f){0===this.get_page()?(y(f,2),this.rcnt=this.rcnt&65280|f&255):y(f,2)});b.register_read(this.port|
|
|
378
|
+
11,this,function(){var f=this.get_page();return 0===f?67:1===f?this.mar[3]:0});b.register_write(this.port|11,this,function(f){0===this.get_page()?(y(f,2),this.rcnt=this.rcnt&255|f<<8&65280):y(f,2)});b.register_read(this.port|8,this,function(){var f=this.get_page();return 0===f?this.rsar&255:1===f?this.mar[0]:0});b.register_write(this.port|8,this,function(f){0===this.get_page()?(y(f,2),this.rsar=this.rsar&65280|f&255):y(f,2)});b.register_read(this.port|9,this,function(){var f=this.get_page();return 0===
|
|
379
|
+
f?this.rsar>>8&255:1===f?this.mar[1]:0});b.register_write(this.port|9,this,function(f){0===this.get_page()?(y(f,2),this.rsar=this.rsar&255|f<<8&65280):y(f,2)});b.register_write(this.port|15,this,function(f){0===this.get_page()?(y(f,2),y(this.isr,2),this.imr=f,this.update_irq()):y(f,2)});b.register_read(this.port|3,this,function(){var f=this.get_page();return 0===f?(y(this.boundary,2),this.boundary):1===f?this.mac[2]:0});b.register_write(this.port|3,this,function(f){var g=this.get_page();0===g?(y(f,
|
|
380
|
+
2),this.boundary=f):1===g?(y(f),this.mac[2]=f):y(f)});b.register_read(this.port|4,this,function(){var f=this.get_page();return 0===f?this.tsr:1===f?this.mac[3]:0});b.register_write(this.port|4,this,function(f){var g=this.get_page();0===g?(y(f,2),this.tpsr=f):1===g?(y(f),this.mac[3]=f):y(f)});b.register_read(this.port|5,this,function(){var f=this.get_page();return 0===f?0:1===f?this.mac[4]:0});b.register_write(this.port|5,this,function(f){var g=this.get_page();0===g?(y(f,2),this.tcnt=this.tcnt&-256|
|
|
381
|
+
f):1===g?(y(f),this.mac[4]=f):y(f)});b.register_read(this.port|6,this,function(){var f=this.get_page();return 0===f?0:1===f?this.mac[5]:0});b.register_write(this.port|6,this,function(f){var g=this.get_page();0===g?(y(f,2),this.tcnt=this.tcnt&255|f<<8):1===g?(y(f),this.mac[5]=f):y(f)});b.register_read(this.port|12,this,function(){var f=this.get_page();return 0===f?9:1===f?this.mar[4]:0});b.register_write(this.port|12,this,function(f){0===this.get_page()?(y(f,2),this.rxcr=f):y(f)});b.register_read(this.port|
|
|
382
|
+
16,this,this.data_port_read8,this.data_port_read16,this.data_port_read32);b.register_write(this.port|16,this,this.data_port_write16,this.data_port_write16,this.data_port_write32);a.devices.pci.register_device(this)}Mc.prototype.get_state=function(){var a=[];a[0]=this.isr;a[1]=this.imr;a[2]=this.cr;a[3]=this.dcfg;a[4]=this.rcnt;a[5]=this.tcnt;a[6]=this.tpsr;a[7]=this.rsar;a[8]=this.pstart;a[9]=this.curpg;a[10]=this.boundary;a[11]=this.pstop;a[12]=this.rxcr;a[13]=this.txcr;a[14]=this.tsr;a[15]=this.mac;
|
|
383
|
+
a[16]=this.memory;return a};Mc.prototype.set_state=function(a){this.isr=a[0];this.imr=a[1];this.cr=a[2];this.dcfg=a[3];this.rcnt=a[4];this.tcnt=a[5];this.tpsr=a[6];this.rsar=a[7];this.pstart=a[8];this.curpg=a[9];this.boundary=a[10];this.pstop=a[11];this.rxcr=a[12];this.txcr=a[13];this.tsr=a[14];this.preserve_mac_from_state_image?(this.mac=a[15],this.memory=a[16]):this.mac_address_translation&&(this.mac_address_in_state=a[15],this.memory=a[16],Lc(this.mac_address_in_state),Lc(this.mac));this.bus.send("net"+
|
|
384
384
|
this.id+"-mac",Lc(this.mac))};Mc.prototype.do_interrupt=function(a){y(a,2);this.isr|=a;this.update_irq()};Mc.prototype.update_irq=function(){this.imr&this.isr?this.pci.raise_irq(this.pci_id):this.pci.lower_irq(this.pci_id)};Mc.prototype.data_port_write=function(a){if(16>=this.rsar||16384<=this.rsar&&32768>this.rsar)this.memory[this.rsar]=a;this.rsar++;this.rcnt--;this.rsar>=this.pstop<<8&&(this.rsar+=this.pstart-this.pstop<<8);0===this.rcnt&&this.do_interrupt(64)};Mc.prototype.data_port_write16=function(a){this.data_port_write(a);
|
|
385
385
|
this.dcfg&1&&this.data_port_write(a>>8)};Mc.prototype.data_port_write32=function(a){this.data_port_write(a);this.data_port_write(a>>8);this.data_port_write(a>>16);this.data_port_write(a>>24)};Mc.prototype.data_port_read=function(){let a=0;32768>this.rsar&&(a=this.memory[this.rsar]);this.rsar++;this.rcnt--;this.rsar>=this.pstop<<8&&(this.rsar+=this.pstart-this.pstop<<8);0===this.rcnt&&this.do_interrupt(64);return a};Mc.prototype.data_port_read8=function(){return this.data_port_read16()&255};Mc.prototype.data_port_read16=
|
|
386
386
|
function(){return this.dcfg&1?this.data_port_read()|this.data_port_read()<<8:this.data_port_read()};Mc.prototype.data_port_read32=function(){return this.data_port_read()|this.data_port_read()<<8|this.data_port_read()<<16|this.data_port_read()<<24};Mc.prototype.receive=function(a){if(!(this.cr&1)&&(this.bus.send("eth-receive-end",[a.length]),this.rxcr&16||this.rxcr&4&&255===a[0]&&255===a[1]&&255===a[2]&&255===a[3]&&255===a[4]&&255===a[5]||!(this.rxcr&8&&1===(a[0]&1)||a[0]!==this.mac[0]||a[1]!==this.mac[1]||
|
|
@@ -389,7 +389,7 @@ f),d),this.memory.set(a.subarray(f),this.pstart<<8),y(f)):(this.memory.set(a,d),
|
|
|
389
389
|
notify_offset:2},{size_supported:16,notify_offset:3}];for(let c=1;c<this.ports;++c)b.push({size_supported:16,notify_offset:0}),b.push({size_supported:8,notify_offset:1});this.virtio=new Oc(a,{name:"virtio-console",pci_id:96,device_id:4163,subsystem_device_id:3,common:{initial_port:47104,queues:b,features:[0,1,32],on_driver_ok:()=>{}},notification:{initial_port:47360,single_handler:!1,handlers:[()=>{},c=>{const d=this.virtio.queues[c],e=3<c?c-3>>1:0;for(;d.has_request();){const f=d.pop_request(),g=
|
|
390
390
|
new Uint8Array(f.length_readable);f.get_next_blob(g);this.bus.send("virtio-console"+e+"-output-bytes",g);this.Ack(c,f)}},()=>{},c=>{if(3===c)for(var d=this.virtio.queues[c];d.has_request();){var e=d.pop_request(),f=new Uint8Array(e.length_readable);e.get_next_blob(f);var g=M(["w","h","h"],f,{offset:0});f=g[0];g=g[1];this.Ack(c,e);switch(g){case 0:for(e=0;e<this.ports;++e)this.SendEvent(e,1,0);break;case 3:this.Ack(c,e);this.SendEvent(f,4,1);this.SendName(f,"virtio-"+f);this.SendEvent(f,6,1);break;
|
|
391
391
|
case 6:this.Ack(c,e);0===f&&this.SendWindowSize(f);break;default:return}}}]},isr_status:{initial_port:46848},device_specific:{initial_port:46592,struct:[{bytes:2,name:"cols",read:()=>this.cols,write:()=>{}},{bytes:2,name:"rows",read:()=>this.rows,write:()=>{}},{bytes:4,name:"max_nr_ports",read:()=>this.ports,write:()=>{}},{bytes:4,name:"emerg_wr",read:()=>0,write:()=>{}}]}});for(let c=0;c<this.ports;++c){const d=0===c?0:2*c+2;this.bus.register("virtio-console"+c+"-input-bytes",function(e){var f=this.virtio.queues[d];
|
|
392
|
-
f.has_request()&&(f=f.pop_request(),this.Send(d,f,new Uint8Array(e)))},this);this.bus.register("virtio-console"+c+"-resize",function(e){0===c&&(this.cols=e[0],this.rows=e[1]);this.virtio.queues[2].is_configured()&&this.virtio.queues[2].has_request()&&this.SendWindowSize(c,e[0],e[1])},this)}}Nc.prototype.SendWindowSize=function(a,b,c){c=c||this.rows;b=b||this.cols;const d=this.virtio.queues[2].pop_request(),e=new Uint8Array(12);K(["w","h","h","h","h"],[a,5,0,c
|
|
392
|
+
f.has_request()&&(f=f.pop_request(),this.Send(d,f,new Uint8Array(e)))},this);this.bus.register("virtio-console"+c+"-resize",function(e){0===c&&(this.cols=e[0],this.rows=e[1]);this.virtio.queues[2].is_configured()&&this.virtio.queues[2].has_request()&&this.SendWindowSize(c,e[0],e[1])},this)}}Nc.prototype.SendWindowSize=function(a,b,c){c=c||this.rows;b=b||this.cols;const d=this.virtio.queues[2].pop_request(),e=new Uint8Array(12);K(["w","h","h","h","h"],[a,5,0,b,c],e,0);this.Send(2,d,e)};Nc.prototype.SendName=
|
|
393
393
|
function(a,b){const c=this.virtio.queues[2].pop_request();b=(new TextEncoder).encode(b);const d=new Uint8Array(8+b.length+1);K(["w","h","h"],[a,7,1],d,0);for(a=0;a<b.length;++a)d[a+8]=b[a];d[8+b.length]=0;this.Send(2,c,d)};Nc.prototype.get_state=function(){const a=[];a[0]=this.virtio;a[1]=this.rows;a[2]=this.cols;a[3]=this.ports;return a};Nc.prototype.set_state=function(a){this.virtio.set_state(a[0]);this.rows=a[1];this.cols=a[2];this.ports=a[3]};Nc.prototype.reset=function(){this.virtio.reset()};
|
|
394
394
|
Nc.prototype.SendEvent=function(a,b,c){const d=this.virtio.queues[2].pop_request(),e=new Uint8Array(8);K(["w","h","h"],[a,b,c],e,0);this.Send(2,d,e)};Nc.prototype.Send=function(a,b,c){b.set_next_blob(c);this.virtio.queues[a].push_reply(b);this.virtio.queues[a].flush_replies()};Nc.prototype.Ack=function(a,b){b.set_next_blob(new Uint8Array(0));this.virtio.queues[a].push_reply(b);this.virtio.queues[a].flush_replies()};function Pc(a,b){this.cpu=a;this.bus=b;this.reset();this.bus.register("keyboard-code",
|
|
395
395
|
function(c){this.kbd_send_code(c)},this);this.bus.register("mouse-click",function(c){this.mouse_send_click(c[0],c[1],c[2])},this);this.bus.register("mouse-delta",function(c){this.mouse_send_delta(c[0],c[1])},this);this.bus.register("mouse-wheel",function(c){this.have_mouse&&this.use_mouse&&this.mouse_stream_active()&&(this.wheel_movement-=c[0],this.wheel_movement-=2*c[1],this.wheel_movement=Math.min(7,Math.max(-8,this.wheel_movement)),this.send_mouse_packet(0,0))},this);a.io.register_read(96,this,
|
package/build/v86-debug.wasm
CHANGED
|
Binary file
|
package/build/v86-fallback.wasm
CHANGED
|
Binary file
|
package/build/v86.wasm
CHANGED
|
Binary file
|