- Clear LDTR contents during initialization

This commit is contained in:
Jan Stoess 2008-06-20 14:33:41 +02:00
parent 16ebb49836
commit c8871cf853
2 changed files with 9 additions and 2 deletions

View File

@ -180,6 +180,8 @@ void SECTION(SEC_INIT) setup_gdt(x86_tss_t &tss, cpuid_t cpuid)
#else
"mov %0, %%fs \n" /* default without tracebuffer */
#endif
"xor %%eax, %%eax \n" /* */
"lldt %%ax \n" /* clear LDTR */
:
:
#if defined(CONFIG_X86_SMALL_SPACES)
@ -188,6 +190,7 @@ void SECTION(SEC_INIT) setup_gdt(x86_tss_t &tss, cpuid_t cpuid)
"r"(X86_UDS),
#endif
"r"(X86_KDS), "r"(X86_UTCBS), "r"(X86_TBS)
: "eax"
);
}

View File

@ -239,11 +239,15 @@ void SECTION(SEC_INIT) setup_gdt(x86_tss_t &tss, cpuid_t cpuid)
#else
"mov %0, %%fs \n\t" // no tracebuffer
#endif
"pushq %3 \n\t" // new CS
"xor %%rax, %%rax \n" //
"lldt %%ax \n" // clear LDTR
"pushq %3 \n\t" // new CS
"pushq $1f \n\t" // new IP
"lretq \n\t"
"1: \n\t"
: /* No Output */ : "r" (0), "r" (X86_UTCBS), "r" (X86_TBS), "r" ((u64_t) X86_KCS)
: /* No Output */
: "r" (0), "r" (X86_UTCBS), "r" (X86_TBS), "r" ((u64_t) X86_KCS)
: "rax"
);