diff options
author | Frans Kaashoek <[email protected]> | 2017-02-01 20:36:41 -0500 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2017-02-01 20:36:41 -0500 |
commit | c9fa90f7e514f27fa1ac071cd9795f3830ab6a1b (patch) | |
tree | 2bfaf92fbd2a649247af758c8e8967f7df3c45ac /lapic.c | |
parent | 2e2d14c235b570a6beb222fc1bfa53de85a98de3 (diff) | |
download | xv6-labs-c9fa90f7e514f27fa1ac071cd9795f3830ab6a1b.tar.gz xv6-labs-c9fa90f7e514f27fa1ac071cd9795f3830ab6a1b.tar.bz2 xv6-labs-c9fa90f7e514f27fa1ac071cd9795f3830ab6a1b.zip |
A tiny bit of clean up (e.g., move code searching cpu array from lapic.c into
mycpu() in proc.c.
Diffstat (limited to 'lapic.c')
-rw-r--r-- | lapic.c | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -9,7 +9,6 @@ #include "traps.h" #include "mmu.h" #include "x86.h" -#include "proc.h" // ncpu // Local APIC registers, divided by 4 for use as uint[] indices. #define ID (0x0020/4) // ID @@ -98,22 +97,12 @@ lapicinit(void) lapicw(TPR, 0); } -// Should be called with interrupts disabled: the calling thread shouldn't be -// rescheduled between reading lapic[ID] and checking against cpu array. int -lapiccpunum(void) +lapicid(void) { - int apicid, i; - if (!lapic) return 0; - - apicid = lapic[ID] >> 24; - for (i = 0; i < ncpu; ++i) { - if (cpus[i].apicid == apicid) - return i; - } - panic("unknown apicid\n"); + return lapic[ID] >> 24; } // Acknowledge interrupt. |