- Queried some values from pcr at DISPATCH_LEVEL to prevent from changing the processor after a thread switch.

- Changed from bx to dx within inline assembler, because the ebx register must be saved.

svn path=/trunk/; revision=11502
This commit is contained in:
Hartmut Birr 2004-10-31 14:02:20 +00:00
parent 0ca2950639
commit 914140ad22

View file

@ -134,7 +134,7 @@ KiInitializeGdt(PKPCR Pcr)
"movl %1, %%fs\n\t" "movl %1, %%fs\n\t"
"movl %0, %%gs\n\t" "movl %0, %%gs\n\t"
: /* no output */ : /* no output */
: "a" (KERNEL_DS), "b" (PCR_SELECTOR)); : "a" (KERNEL_DS), "d" (PCR_SELECTOR));
__asm__ ("pushl %0\n\t" __asm__ ("pushl %0\n\t"
"pushl $.l4\n\t" "pushl $.l4\n\t"
"lret\n\t" "lret\n\t"
@ -146,10 +146,10 @@ KiInitializeGdt(PKPCR Pcr)
{ {
lgdt Descriptor; lgdt Descriptor;
mov ax, KERNEL_DS; mov ax, KERNEL_DS;
mov bx, PCR_SELECTOR; mov dx, PCR_SELECTOR;
mov ds, ax; mov ds, ax;
mov es, ax; mov es, ax;
mov fs, bx; mov fs, dx;
mov gs, ax; mov gs, ax;
push KERNEL_CS; push KERNEL_CS;
push offset l4 ; push offset l4 ;
@ -207,13 +207,14 @@ KeSetBaseGdtSelector(ULONG Entry,
PVOID Base) PVOID Base)
{ {
KIRQL oldIrql; KIRQL oldIrql;
PUSHORT Gdt = KeGetCurrentKPCR()->GDT; PUSHORT Gdt;
DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n", DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n",
Entry, Base); Entry, Base);
KeAcquireSpinLock(&GdtLock, &oldIrql); KeAcquireSpinLock(&GdtLock, &oldIrql);
Gdt = KeGetCurrentKPCR()->GDT;
Entry = (Entry & (~0x3)) / 2; Entry = (Entry & (~0x3)) / 2;
Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff); Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff);
@ -241,13 +242,14 @@ KeSetGdtSelector(ULONG Entry,
ULONG Value2) ULONG Value2)
{ {
KIRQL oldIrql; KIRQL oldIrql;
PULONG Gdt = (PULONG) KeGetCurrentKPCR()->GDT; PULONG Gdt;
DPRINT("KeSetGdtSelector(Entry %x, Value1 %x, Value2 %x)\n", DPRINT("KeSetGdtSelector(Entry %x, Value1 %x, Value2 %x)\n",
Entry, Value1, Value2); Entry, Value1, Value2);
KeAcquireSpinLock(&GdtLock, &oldIrql); KeAcquireSpinLock(&GdtLock, &oldIrql);
Gdt = (PULONG) KeGetCurrentKPCR()->GDT;;
Entry = (Entry & (~0x3)) / 4; Entry = (Entry & (~0x3)) / 4;
Gdt[Entry] = Value1; Gdt[Entry] = Value1;