Remove pci register_device below registering IO ports

This commit is contained in:
copy 2017-05-29 12:25:28 -05:00
parent 461e3e7b5b
commit 888c6d2ce1
4 changed files with 13 additions and 9 deletions

View file

@ -116,16 +116,14 @@ function IDEDevice(cpu, buffer, is_cd, nr, bus)
{
size: 4,
},
false,
false,
undefined,
undefined,
{
size: 0x10,
},
];
this.name = "ide" + nr;
cpu.devices.pci.register_device(this);
/** @type {number} */
this.device_control = 2;
@ -281,6 +279,8 @@ function IDEDevice(cpu, buffer, is_cd, nr, bus)
dbg_log("DMA read 0xA", LOG_DISK); return 0;
});
cpu.devices.pci.register_device(this);
DEBUG && Object.seal(this);
}

View file

@ -90,7 +90,6 @@ function Ne2k(cpu, bus)
size: 32,
},
];
cpu.devices.pci.register_device(this);
}
this.isr = 0;
@ -496,6 +495,11 @@ function Ne2k(cpu, bus)
this.data_port_write16,
this.data_port_write16,
this.data_port_write32);
if(use_pci)
{
cpu.devices.pci.register_device(this);
}
}
Ne2k.prototype.get_state = function()

View file

@ -140,8 +140,6 @@ function VGAScreen(cpu, bus, vga_memory_size)
this.name = "vga";
cpu.devices.pci.register_device(this);
this.stats = {
is_graphical: false,
res_x: 0,
@ -272,6 +270,8 @@ function VGAScreen(cpu, bus, vga_memory_size)
function(addr) { return me.svga_memory_read32(addr); },
function(addr, value) { me.svga_memory_write32(addr, value); }
);
cpu.devices.pci.register_device(this);
};
VGAScreen.prototype.get_state = function()

View file

@ -27,8 +27,6 @@ function VirtIO(cpu, bus, filesystem)
];
this.name = "virtio";
cpu.devices.pci.register_device(this);
var io = cpu.io;
io.register_read(0xA800, this,
@ -199,6 +197,8 @@ function VirtIO(cpu, bus, filesystem)
// should be generalized to support more devices than just the filesystem
this.device = new Virtio9p(filesystem, bus);
this.device.SendReply = this.device_reply.bind(this);
cpu.devices.pci.register_device(this);
}
VirtIO.prototype.get_state = function()