interrupts.cc (7629:0f0c231e3e97) interrupts.cc (7823:dac01f14f20f)
1/*
2 * Copyright (c) 2008 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

389 case APIC_CURRENT_COUNT:
390 {
391 if (apicTimerEvent.scheduled()) {
392 assert(clock);
393 // Compute how many m5 ticks happen per count.
394 uint64_t ticksPerCount = clock *
395 divideFromConf(regs[APIC_DIVIDE_CONFIGURATION]);
396 // Compute how many m5 ticks are left.
1/*
2 * Copyright (c) 2008 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

389 case APIC_CURRENT_COUNT:
390 {
391 if (apicTimerEvent.scheduled()) {
392 assert(clock);
393 // Compute how many m5 ticks happen per count.
394 uint64_t ticksPerCount = clock *
395 divideFromConf(regs[APIC_DIVIDE_CONFIGURATION]);
396 // Compute how many m5 ticks are left.
397 uint64_t val = apicTimerEvent.when() - curTick;
397 uint64_t val = apicTimerEvent.when() - curTick();
398 // Turn that into a count.
399 val = (val + ticksPerCount - 1) / ticksPerCount;
400 return val;
401 } else {
402 return 0;
403 }
404 }
405 default:

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

567 case APIC_INITIAL_COUNT:
568 {
569 assert(clock);
570 newVal = bits(val, 31, 0);
571 // Compute how many timer ticks we're being programmed for.
572 uint64_t newCount = newVal *
573 (divideFromConf(regs[APIC_DIVIDE_CONFIGURATION]));
574 // Schedule on the edge of the next tick plus the new count.
398 // Turn that into a count.
399 val = (val + ticksPerCount - 1) / ticksPerCount;
400 return val;
401 } else {
402 return 0;
403 }
404 }
405 default:

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

567 case APIC_INITIAL_COUNT:
568 {
569 assert(clock);
570 newVal = bits(val, 31, 0);
571 // Compute how many timer ticks we're being programmed for.
572 uint64_t newCount = newVal *
573 (divideFromConf(regs[APIC_DIVIDE_CONFIGURATION]));
574 // Schedule on the edge of the next tick plus the new count.
575 Tick offset = curTick % clock;
575 Tick offset = curTick() % clock;
576 if (offset) {
577 reschedule(apicTimerEvent,
576 if (offset) {
577 reschedule(apicTimerEvent,
578 curTick + (newCount + 1) * clock - offset, true);
578 curTick() + (newCount + 1) * clock - offset, true);
579 } else {
580 reschedule(apicTimerEvent,
579 } else {
580 reschedule(apicTimerEvent,
581 curTick + newCount * clock, true);
581 curTick() + newCount * clock, true);
582 }
583 }
584 break;
585 case APIC_CURRENT_COUNT:
586 //Local APIC Current Count register is read only.
587 return;
588 case APIC_DIVIDE_CONFIGURATION:
589 newVal = val & 0xB;

--- 125 unchanged lines hidden ---
582 }
583 }
584 break;
585 case APIC_CURRENT_COUNT:
586 //Local APIC Current Count register is read only.
587 return;
588 case APIC_DIVIDE_CONFIGURATION:
589 newVal = val & 0xB;

--- 125 unchanged lines hidden ---