summaryrefslogtreecommitdiff
path: root/lapic.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapic.c')
-rw-r--r--lapic.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/lapic.c b/lapic.c
index 7507f97..dc69eb6 100644
--- a/lapic.c
+++ b/lapic.c
@@ -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
@@ -99,31 +98,11 @@ lapicinit(void)
}
int
-cpunum(void)
+lapicid(void)
{
- int apicid, i;
-
- // Cannot call cpu when interrupts are enabled:
- // result not guaranteed to last long enough to be used!
- // Would prefer to panic but even printing is chancy here:
- // almost everything, including cprintf and panic, calls cpu,
- // often indirectly through acquire and release.
- if(readeflags()&FL_IF){
- static int n;
- if(n++ == 0)
- cprintf("cpu called from %x with interrupts enabled\n",
- __builtin_return_address(0));
- }
-
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.