From: Stas Sergeev <stsp@aknet.ru>
To: akpm@osdl.org
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: [patch] espfix code cleanup more
Date: Sun, 30 Jul 2006 14:57:39 +0400 [thread overview]
Message-ID: <44CC90A3.9000603@aknet.ru> (raw)
In-Reply-To: <200607300016.k6U0GYu4023664@shell0.pdx.osdl.net>
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
Hi Andrew.
Attached is a micro-optimization on top of the
previous cleanup patch. It removes the redundant
arguments from the C functions. No functionality changes.
Signed-off-by: <stsp@aknet.ru>
[-- Attachment #2: espfcln_a.diff --]
[-- Type: text/x-patch, Size: 2221 bytes --]
--- linux-2.6.18-rc2-mm1/arch/i386/kernel/traps.c 2006-07-29 15:32:14.000000000 +0400
+++ linux-2.6.18-rc2-mm1/arch/i386/kernel/traps.c 2006-07-30 02:19:59.000000000 +0400
@@ -1018,13 +1018,13 @@
#endif
}
-fastcall unsigned long patch_espfix_gdt(struct pt_regs *regs,
+fastcall unsigned long patch_espfix_base(unsigned long uesp,
unsigned long kesp)
{
int cpu = smp_processor_id();
struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
struct desc_struct *gdt = (struct desc_struct *)cpu_gdt_descr->address;
- unsigned long base = (kesp - regs->esp) & -THREAD_SIZE;
+ unsigned long base = (kesp - uesp) & -THREAD_SIZE;
__u64 desc = *(__u64 *)&gdt[GDT_ENTRY_ESPFIX_SS];
/* Set up base for espfix segment */
desc &= 0x00ffff000000ffffULL;
@@ -1034,14 +1034,13 @@
return kesp - base;
}
-fastcall unsigned long get_orig_kesp(unsigned long kesp, unsigned long cpu)
+fastcall unsigned long get_espfix_base(unsigned long cpu)
{
/* Since we are on a wrong stack, the smp_processor_id() cannot
* be used. So the cpu number is passed from an assembly. */
struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
struct desc_struct *gdt = (struct desc_struct *)cpu_gdt_descr->address;
- unsigned long base = get_desc_base(&gdt[GDT_ENTRY_ESPFIX_SS].a);
- return base + kesp;
+ return get_desc_base(&gdt[GDT_ENTRY_ESPFIX_SS].a);
}
/*
--- linux-2.6.18-rc2-mm1/arch/i386/kernel/entry.S 2006-07-29 15:29:00.000000000 +0400
+++ linux-2.6.18-rc2-mm1/arch/i386/kernel/entry.S 2006-07-30 02:19:47.000000000 +0400
@@ -401,9 +401,9 @@
* This is an "official" bug of all the x86-compatible
* CPUs, which we can try to work around to make
* dosemu and wine happy. */
- movl %esp, %eax # pt_regs pointer
+ movl OLDESP(%esp), %eax
movl %esp, %edx
- call patch_espfix_gdt
+ call patch_espfix_base
pushl $__ESPFIX_SS
CFI_ADJUST_CFA_OFFSET 4
pushl %eax
@@ -502,10 +502,10 @@
CFI_ENDPROC
#define FIXUP_ESPFIX_STACK \
- movl %esp, %eax; \
GET_THREAD_INFO(%ebp); \
- movl TI_cpu(%ebp), %edx; \
- call get_orig_kesp; \
+ movl TI_cpu(%ebp), %eax; \
+ call get_espfix_base; \
+ addl %esp, %eax; \
pushl $__KERNEL_DS; \
pushl %eax; \
lss (%esp), %esp;
next parent reply other threads:[~2006-07-30 10:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200607300016.k6U0GYu4023664@shell0.pdx.osdl.net>
2006-07-30 10:57 ` Stas Sergeev [this message]
[not found] ` <44CE766D.6000705@vmware.com>
2006-08-01 12:21 ` + espfix-code-cleanup.patch added to -mm tree Stas Sergeev
2006-08-01 13:38 ` Jan Beulich
2006-08-01 14:37 ` Stas Sergeev
2006-08-01 14:43 ` Jan Beulich
2006-08-01 15:09 ` Stas Sergeev
2006-08-01 21:01 ` Zachary Amsden
2006-08-02 17:12 ` Stas Sergeev
2006-08-02 18:30 ` Zachary Amsden
2006-08-02 19:12 ` Stas Sergeev
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=44CC90A3.9000603@aknet.ru \
--to=stsp@aknet.ru \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.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 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.