From: Brian Gerst <bgerst@didntduck.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] i386 head.S cleanup
Date: Fri, 24 May 2002 01:39:20 -0400 [thread overview]
Message-ID: <3CEDD208.4060706@didntduck.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 139 bytes --]
Cleans up some redundant code in head.S:
- Combine checking of AC and ID eflags.
- Streamline the setting of %cr0.
--
Brian Gerst
[-- Attachment #2: head-1 --]
[-- Type: text/plain, Size: 1633 bytes --]
diff -urN linux-bk/arch/i386/kernel/head.S linux/arch/i386/kernel/head.S
--- linux-bk/arch/i386/kernel/head.S Wed May 15 10:27:23 2002
+++ linux/arch/i386/kernel/head.S Fri May 24 01:22:06 2002
@@ -182,26 +182,19 @@
pushfl # push EFLAGS
popl %eax # get EFLAGS
movl %eax,%ecx # save original EFLAGS
- xorl $0x40000,%eax # flip AC bit in EFLAGS
+ xorl $0x240000,%eax # flip AC and ID bits 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
- andl $0x40000,%eax # check if AC bit changed
+ pushl %ecx # restore original EFLAGS
+ popfl
+ testl $0x40000,%eax # check if AC bit changed
je is386
movb $4,X86 # at least 486
- movl %ecx,%eax
- xorl $0x200000,%eax # check ID flag
- pushl %eax
- popfl # if we are on a straight 486DX, SX, or
- pushfl # 487SX we can't change it
- popl %eax
- xorl %ecx,%eax
- pushl %ecx # restore original EFLAGS
- popfl
- andl $0x200000,%eax
+ testl $0x200000,%eax # check if ID bit changed
je is486
/* get vendor info */
@@ -227,18 +220,15 @@
movb %cl,X86_MASK
movl %edx,X86_CAPABILITY
-is486:
- movl %cr0,%eax # 486 or better
- andl $0x80000011,%eax # Save PG,PE,ET
- orl $0x50022,%eax # set AM, WP, NE and MP
+is486: movl $0x50022,%ecx # set AM, WP, NE and MP
jmp 2f
-is386: pushl %ecx # restore original EFLAGS
- popfl
- movl %cr0,%eax # 386
+is386: movl $2,%ecx # set MP
+2: movl %cr0,%eax
andl $0x80000011,%eax # Save PG,PE,ET
- orl $2,%eax # set MP
-2: movl %eax,%cr0
+ orl %ecx,%eax
+ movl %eax,%cr0
+
call check_x87
incb ready
lgdt gdt_descr
reply other threads:[~2002-05-24 5:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3CEDD208.4060706@didntduck.org \
--to=bgerst@didntduck.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.