aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/head_32.S22
1 files changed, 5 insertions, 17 deletions
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index c8932c79e78b..a9c5cc851285 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -394,30 +394,21 @@ default_entry:
394 jz 1f # Did we do this already? 394 jz 1f # Did we do this already?
395 call *%eax 395 call *%eax
3961: 3961:
397 397
398/* check if it is 486 or 386. */
399/* 398/*
400 * XXX - this does a lot of unnecessary setup. Alignment checks don't 399 * Check if it is 486
401 * apply at our cpl of 0 and the stack ought to be aligned already, and
402 * we don't need to preserve eflags.
403 */ 400 */
404 movl $-1,X86_CPUID # -1 for no CPUID initially 401 movl $-1,X86_CPUID # -1 for no CPUID initially
405 movb $3,X86 # at least 386 402 movb $4,X86 # at least 486
406 pushfl # push EFLAGS 403 pushfl # push EFLAGS
407 popl %eax # get EFLAGS 404 popl %eax # get EFLAGS
408 movl %eax,%ecx # save original EFLAGS 405 movl %eax,%ecx # save original EFLAGS
409 xorl $0x240000,%eax # flip AC and ID bits in EFLAGS 406 xorl $0x200000,%eax # flip ID bit in EFLAGS
410 pushl %eax # copy to EFLAGS 407 pushl %eax # copy to EFLAGS
411 popfl # set EFLAGS 408 popfl # set EFLAGS
412 pushfl # get new EFLAGS 409 pushfl # get new EFLAGS
413 popl %eax # put it in eax 410 popl %eax # put it in eax
414 xorl %ecx,%eax # change in flags 411 xorl %ecx,%eax # change in flags
415 pushl %ecx # restore original EFLAGS
416 popfl
417 testl $0x40000,%eax # check if AC bit changed
418 je is386
419
420 movb $4,X86 # at least 486
421 testl $0x200000,%eax # check if ID bit changed 412 testl $0x200000,%eax # check if ID bit changed
422 je is486 413 je is486
423 414
@@ -445,10 +436,7 @@ default_entry:
445 movl %edx,X86_CAPABILITY 436 movl %edx,X86_CAPABILITY
446 437
447is486: movl $0x50022,%ecx # set AM, WP, NE and MP 438is486: movl $0x50022,%ecx # set AM, WP, NE and MP
448 jmp 2f 439 movl %cr0,%eax
449
450is386: movl $2,%ecx # set MP
4512: movl %cr0,%eax
452 andl $0x80000011,%eax # Save PG,PE,ET 440 andl $0x80000011,%eax # Save PG,PE,ET
453 orl %ecx,%eax 441 orl %ecx,%eax
454 movl %eax,%cr0 442 movl %eax,%cr0