Andi Kleen wrote:
>
> On Wed, Oct 04, 2000 at 11:00:41AM -0400, Brian Gerst wrote:
> > Mikulas Patocka wrote:
> > >
> > > Hi.
> > >
> > > arch/i386/kernel/entry.S
> > > xchgl %eax, ORIG_EAX(%esp) # orig_eax (get the error code. )
> > > movl %esp,%edx
> > > xchgl %ecx, ES(%esp) # get the address and save es.
> > > pushl %eax # push the error code
> > >
> > > xchg with memory operand has implicit lock prefix and is slooooooow. It is
> > > really bad idea to have it in page fault handler.
> >
> > Thank the small register set of the x86 for this. If you can come up
> > with a way to do it in fewer cycles and preserve all the registers and
> > stack layout, your input is welcome.
>
> You don't need to preserve any registers which are not %eax, they are already
> saved. There are tons of ways to do it via the stack or with a temporary
> register.
You are correct. That's what I get for posting before my normal dose of
caffeine. Something like this should work (untested):
--- entry.S Tue Oct 3 13:05:07 2000
+++ entry.S.new Wed Oct 4 11:29:45 2000
@@ -305,16 +305,18 @@
pushl %ebx
cld
movl %es,%ecx
- xchgl %eax, ORIG_EAX(%esp) # orig_eax (get the error code.
)
+ movl ORIG_EAX(%esp), %esi # get the error code
+ movl ES(%esp), %edi # get the address
movl %esp,%edx
- xchgl %ecx, ES(%esp) # get the address and save es.
- pushl %eax # push the error code
- pushl %edx
+ movl %eax, ORIG_EAX(%esp)
+ movl %ecx, ES(%esp)
+ pushl %esi # push the error code
+ pushl %edx # push pt_regs pointer
movl $(__KERNEL_DS),%edx
movl %edx,%ds
movl %edx,%es
GET_CURRENT(%ebx)
- call *%ecx
+ call *%edi
addl $8,%esp
jmp ret_from_exception
--Brian Gerst - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:14 EST