another attempt at cpu-local variables.

this time do it ourselves instead of piggybacking on TLS.
add -fno-pic to Makefile; pic code breaks our fake TLS.
This commit is contained in:
Russ Cox 2009-09-02 10:07:59 -07:00
parent 374362c55c
commit 7e0cc8e36e
4 changed files with 16 additions and 18 deletions

3
proc.c
View file

@ -70,12 +70,11 @@ ksegment(void)
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024-1, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
c->gdt[SEG_KCPU] = SEG(STA_W, &c->tlsstruct, 0xffffffff, 0);
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
lgdt(c->gdt, sizeof(c->gdt));
loadfsgs(SEG_KCPU << 3);
// Initialize cpu-local storage.
c->tlsstruct = &c->tlsstruct;
asm volatile(""); // Do not let gcc reorder across this line.
cpu = c;
proc = 0;