Deleted Added
sdiff udiff text old ( 5898:541097c69e22 ) new ( 6041:949a8304e7f9 )
full compact
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
299Tick
300X86ISA::Interrupts::recvMessage(PacketPtr pkt)
301{
302 uint8_t id = (regs[APIC_ID] >> 24);
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
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
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 ---