From: Borislav Petkov <bp@alien8.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Borislav Petkov <bp@suse.de>
Subject: [PATCH 3/4] x86, head_32: Remove CPUID detection from default_entry
Date: Sun, 3 Feb 2013 17:14:38 +0100 [thread overview]
Message-ID: <1359908079-10469-4-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1359908079-10469-1-git-send-email-bp@alien8.de>
From: Borislav Petkov <bp@suse.de>
We do that once earlier now and cache it into boot_cpu_data.cpuid_level
so no need for the EFLAGS.ID toggling dance anymore.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/head_32.S | 40 +++++++---------------------------------
1 file changed, 7 insertions(+), 33 deletions(-)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index ce6b557017f4..0dba3598cf02 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -334,25 +334,14 @@ default_entry:
movl %eax,%cr0
/*
- * New page tables may be in 4Mbyte page mode and may
- * be using the global pages.
+ * New page tables may be in 4Mbyte page mode and may be using the global pages.
*
- * NOTE! If we are on a 486 we may have no cr4 at all!
- * Specifically, cr4 exists if and only if CPUID exists
- * and has flags other than the FPU flag set.
+ * NOTE! If we are on a 486 we may have no cr4 at all! Specifically, cr4 exists
+ * if and only if CPUID exists (which has been checked above) and has flags
+ * other than the FPU flag set.
*/
- movl $X86_EFLAGS_ID,%ecx
- pushl %ecx
- popfl
- pushfl
- popl %eax
- pushl $0
- popfl
- pushfl
- popl %edx
- xorl %edx,%eax
- testl %ecx,%eax
- jz 6f # No ID flag = no CPUID = no CR4
+ cmpl $-1, pa(X86_CPUID)
+ je 6f # No CPUID = no CR4
movl $1,%eax
cpuid
@@ -389,7 +378,6 @@ default_entry:
btsl $_EFER_NX, %eax
/* Make changes effective */
wrmsr
-
6:
/*
@@ -417,21 +405,7 @@ default_entry:
call *%eax
1:
-/*
- * Check if it is 486
- */
- movl $-1,X86_CPUID # -1 for no CPUID initially
- movb $4,X86 # at least 486
- pushfl # push EFLAGS
- popl %eax # get EFLAGS
- movl %eax,%ecx # save original EFLAGS
- xorl $0x200000,%eax # flip ID bit in EFLAGS
- pushl %eax # copy to EFLAGS
- popfl # set EFLAGS
- pushfl # get new EFLAGS
- popl %eax # put it in eax
- xorl %ecx,%eax # change in flags
- testl $0x200000,%eax # check if ID bit changed
+ cmpl $-1,X86_CPUID
je is486
/* get vendor info */
--
1.8.1.2.422.g08c0e7f
next prev parent reply other threads:[~2013-02-03 16:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-03 16:14 [PATCH 0/4] x86, head_32: Some cleanups Borislav Petkov
2013-02-03 16:14 ` [PATCH 1/4] x86, head_32: Remove i386 pieces Borislav Petkov
2013-02-03 16:14 ` [PATCH 2/4] x86: Detect CPUID support early at boot Borislav Petkov
2013-02-03 16:14 ` Borislav Petkov [this message]
2013-02-03 16:14 ` [PATCH 4/4] x86, 32-bit: Drop new_cpu_data Borislav Petkov
2013-02-03 23:44 ` H. Peter Anvin
2013-02-04 5:27 ` Borislav Petkov
2013-02-04 5:44 ` H. Peter Anvin
2013-02-04 9:02 ` Borislav Petkov
2013-02-04 16:55 ` H. Peter Anvin
2013-02-04 17:01 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359908079-10469-4-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).