interrupts.cc (5898:541097c69e22) interrupts.cc (6041:949a8304e7f9)
1/*
2 * Copyright (c) 2008 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 272 unchanged lines hidden (view full) ---

281 } else if (deliveryMode == DeliveryMode::INIT && !pendingInit) {
282 pendingUnmaskableInt = pendingInit = true;
283 initVector = vector;
284 }
285 }
286 cpu->wakeup();
287}
288
1/*
2 * Copyright (c) 2008 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

--- 272 unchanged lines hidden (view full) ---

281 } else if (deliveryMode == DeliveryMode::INIT && !pendingInit) {
282 pendingUnmaskableInt = pendingInit = true;
283 initVector = vector;
284 }
285 }
286 cpu->wakeup();
287}
288
289
290void
291X86ISA::Interrupts::setCPU(BaseCPU * newCPU)
292{
293 cpu = newCPU;
294 assert(cpu);
295 regs[APIC_ID] = (cpu->cpuId() << 24);
296}
297
298
289Tick
290X86ISA::Interrupts::recvMessage(PacketPtr pkt)
291{
299Tick
300X86ISA::Interrupts::recvMessage(PacketPtr pkt)
301{
292 uint8_t id = 0;
302 uint8_t id = (regs[APIC_ID] >> 24);
293 Addr offset = pkt->getAddr() - x86InterruptAddress(id, 0);
294 assert(pkt->cmd == MemCmd::MessageReq);
295 switch(offset)
296 {
297 case 0:
298 {
299 TriggerIntMessage message = pkt->get<TriggerIntMessage>();
300 DPRINTF(LocalApic,

--- 13 unchanged lines hidden (view full) ---

314 break;
315 }
316 delete pkt->req;
317 delete pkt;
318 return latency;
319}
320
321
303 Addr offset = pkt->getAddr() - x86InterruptAddress(id, 0);
304 assert(pkt->cmd == MemCmd::MessageReq);
305 switch(offset)
306 {
307 case 0:
308 {
309 TriggerIntMessage message = pkt->get<TriggerIntMessage>();
310 DPRINTF(LocalApic,

--- 13 unchanged lines hidden (view full) ---

324 break;
325 }
326 delete pkt->req;
327 delete pkt;
328 return latency;
329}
330
331
332void
333X86ISA::Interrupts::addressRanges(AddrRangeList &range_list)
334{
335 uint8_t id = (regs[APIC_ID] >> 24);
336 range_list.clear();
337 range_list.push_back(RangeEx(x86LocalAPICAddress(id, 0),
338 x86LocalAPICAddress(id, 0) + PageBytes));
339}
340
341
342void
343X86ISA::Interrupts::getIntAddrRange(AddrRangeList &range_list)
344{
345 uint8_t id = (regs[APIC_ID] >> 24);
346 range_list.clear();
347 range_list.push_back(RangeEx(x86InterruptAddress(id, 0),
348 x86InterruptAddress(id, 0) + PhysAddrAPICRangeSize));
349}
350
351
322uint32_t
323X86ISA::Interrupts::readReg(ApicRegIndex reg)
324{
325 if (reg >= APIC_TRIGGER_MODE(0) &&
326 reg <= APIC_TRIGGER_MODE(15)) {
327 panic("Local APIC Trigger Mode registers are unimplemented.\n");
328 }
329 switch (reg) {

--- 144 unchanged lines hidden (view full) ---

474 break;
475 default:
476 break;
477 }
478 regs[reg] = newVal;
479 return;
480}
481
352uint32_t
353X86ISA::Interrupts::readReg(ApicRegIndex reg)
354{
355 if (reg >= APIC_TRIGGER_MODE(0) &&
356 reg <= APIC_TRIGGER_MODE(15)) {
357 panic("Local APIC Trigger Mode registers are unimplemented.\n");
358 }
359 switch (reg) {

--- 144 unchanged lines hidden (view full) ---

504 break;
505 default:
506 break;
507 }
508 regs[reg] = newVal;
509 return;
510}
511
512
513X86ISA::Interrupts::Interrupts(Params * p) :
514 BasicPioDevice(p), IntDev(this), latency(p->pio_latency), clock(0),
515 apicTimerEvent(this),
516 pendingSmi(false), smiVector(0),
517 pendingNmi(false), nmiVector(0),
518 pendingExtInt(false), extIntVector(0),
519 pendingInit(false), initVector(0),
520 pendingUnmaskableInt(false)
521{
522 pioSize = PageBytes;
523 memset(regs, 0, sizeof(regs));
524 //Set the local apic DFR to the flat model.
525 regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
526 ISRV = 0;
527 IRRV = 0;
528}
529
530
482bool
483X86ISA::Interrupts::checkInterrupts(ThreadContext *tc) const
484{
485 RFLAGS rflags = tc->readMiscRegNoEffect(MISCREG_RFLAGS);
486 if (pendingUnmaskableInt) {
487 DPRINTF(LocalApic, "Reported pending unmaskable interrupt.\n");
488 return true;
489 }

--- 80 unchanged lines hidden ---
531bool
532X86ISA::Interrupts::checkInterrupts(ThreadContext *tc) const
533{
534 RFLAGS rflags = tc->readMiscRegNoEffect(MISCREG_RFLAGS);
535 if (pendingUnmaskableInt) {
536 DPRINTF(LocalApic, "Reported pending unmaskable interrupt.\n");
537 return true;
538 }

--- 80 unchanged lines hidden ---