diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-07-02 18:11:44 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-07-02 18:11:44 +0000 |
commit | 3de388f676e936097f99fb58e8a58c5461eb696e (patch) | |
tree | ab63f67817bf6bb17c1245bbc2e08cae7fe8d2de /hw/pc.c | |
parent | 73133662c6db9e58d02716d9517b3947c853de68 (diff) |
more generic i8259 support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1487 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pc.c')
-rw-r--r-- | hw/pc.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -65,6 +65,33 @@ uint64_t cpu_get_tsc(CPUX86State *env) return qemu_get_clock(vm_clock); } +/* IRQ handling */ +int cpu_get_pic_interrupt(CPUState *env) +{ + int intno; + +#ifdef TARGET_X86_64 + intno = apic_get_interrupt(env); + if (intno >= 0) { + /* set irq request if a PIC irq is still pending */ + /* XXX: improve that */ + pic_update_irq(isa_pic); + return intno; + } +#endif + /* read the irq from the PIC */ + intno = pic_read_irq(isa_pic); + return intno; +} + +static void pic_irq_request(void *opaque, int level) +{ + if (level) + cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HARD); + else + cpu_reset_interrupt(cpu_single_env, CPU_INTERRUPT_HARD); +} + /* PC cmos mappings */ #define REG_EQUIPMENT_BYTE 0x14 @@ -532,7 +559,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, if (pci_enabled) apic_init(cpu_single_env); - pic_init(); + isa_pic = pic_init(pic_irq_request, cpu_single_env); pit = pit_init(0x40, 0); for(i = 0; i < MAX_SERIAL_PORTS; i++) { |