diff options
author | Frans Kaashoek <[email protected]> | 2017-02-01 18:04:13 -0500 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2017-02-01 18:04:13 -0500 |
commit | ed396c068b881877330f7d40bfce02db9b1199b3 (patch) | |
tree | 69103a78128b46d6bae179b0440cca0a9c7f0b0c /lapic.c | |
parent | fbb4c0944422f860484142010bb9f366f3e87bf8 (diff) | |
download | xv6-labs-ed396c068b881877330f7d40bfce02db9b1199b3.tar.gz xv6-labs-ed396c068b881877330f7d40bfce02db9b1199b3.tar.bz2 xv6-labs-ed396c068b881877330f7d40bfce02db9b1199b3.zip |
Eliminate code for gs trick to track per-cpu state. We rely on lapiccpunum()
to find a per-cpu id with which we locate a cpu's cpu struct.
Diffstat (limited to 'lapic.c')
-rw-r--r-- | lapic.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -98,22 +98,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) { int apicid, i; - - // Cannot call cpunum 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("cpunum called from %x with interrupts enabled\n", - __builtin_return_address(0)); - } if (!lapic) return 0; |