297a298,302
> assert(newCPU);
> if (cpu != NULL && cpu->cpuId() != newCPU->cpuId()) {
> panic("Local APICs can't be moved between CPUs"
> " with different IDs.\n");
> }
299,300c304,305
< assert(cpu);
< regs[APIC_ID] = (cpu->cpuId() << 24);
---
> initialApicId = cpu->cpuId();
> regs[APIC_ID] = (initialApicId << 24);
307,308c312
< uint8_t id = (regs[APIC_ID] >> 24);
< Addr offset = pkt->getAddr() - x86InterruptAddress(id, 0);
---
> Addr offset = pkt->getAddr() - x86InterruptAddress(initialApicId, 0);
318,320d321
< // Make sure we're really supposed to get this.
< assert((message.destMode == 0 && message.destination == id) ||
< (bits((int)message.destination, id)));
357d357
< uint8_t id = (regs[APIC_ID] >> 24);
359,360c359,361
< Range<Addr> range = RangeEx(x86LocalAPICAddress(id, 0),
< x86LocalAPICAddress(id, 0) + PageBytes);
---
> Range<Addr> range = RangeEx(x86LocalAPICAddress(initialApicId, 0),
> x86LocalAPICAddress(initialApicId, 0) +
> PageBytes);
369d369
< uint8_t id = (regs[APIC_ID] >> 24);
371,372c371,373
< range_list.push_back(RangeEx(x86InterruptAddress(id, 0),
< x86InterruptAddress(id, 0) + PhysAddrAPICRangeSize));
---
> range_list.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
> x86InterruptAddress(initialApicId, 0) +
> PhysAddrAPICRangeSize));
518,522d518
< // We have no way to get at the thread context we're part
< // of, so we'll just have to go with the CPU for now.
< hack_once("Broadcast IPIs can't handle more than "
< "one context per CPU.\n");
< int myId = cpu->getContext(0)->contextId();
525c521
< if (thisId != myId) {
---
> if (thisId != initialApicId) {
592c588
< pendingIPIs(0)
---
> pendingIPIs(0), cpu(NULL)