[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] linux/i386: Improve critical region handling code



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1170805013 0
# Node ID 383ade1b0da40b4c692058eddddb1595feff84b1
# Parent  625aa1547cb698a473a139f45263f23e2309631a
linux/i386: Improve critical region handling code

- use symbolics instead of raw numbers (going to help the 2.6.20 port,
as those numbers change there)
- fold instructions where possible
- move fixup table into .rodata

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff -r 625aa1547cb6 -r 383ade1b0da4 
linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S
--- a/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S Tue Feb 06 23:14:21 
2007 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S Tue Feb 06 23:36:53 
2007 +0000
@@ -747,7 +747,7 @@ ENTRY(hypervisor_callback)
        jb   11f
        cmpl $sysexit_ecrit,%eax
        ja   11f
-       addl $0x34,%esp                 # Remove cs...ebx from stack frame.
+       addl $OLDESP,%esp               # Remove eflags...ebx from stack frame.
 11:    push %esp
        call evtchn_do_upcall
        add  $4,%esp
@@ -777,18 +777,13 @@ ecrit:  /**** END OF CRITICAL REGION ***
 # provides the number of bytes which have already been popped from the
 # interrupted stack frame.
 critical_region_fixup:
-       addl $critical_fixup_table-scrit,%eax
-       movzbl (%eax),%eax              # %eax contains num bytes popped
-       cmpb $0xff,%al                  # 0xff => vcpu_info critical region
+       movzbl critical_fixup_table-scrit(%eax),%ecx # %eax contains num bytes 
popped
+       cmpb $0xff,%cl                  # 0xff => vcpu_info critical region
        jne  15f
-       GET_THREAD_INFO(%ebp)
-        xorl %eax,%eax
-15:    mov  %esp,%esi
-       add  %eax,%esi                  # %esi points at end of src region
-       mov  %esp,%edi
-       add  $0x34,%edi                 # %edi points at end of dst region
-       mov  %eax,%ecx
-       shr  $2,%ecx                    # convert words to bytes
+       xorl %ecx,%ecx
+15:    leal (%esp,%ecx),%esi           # %esi points at end of src region
+       leal OLDESP(%esp),%edi          # %edi points at end of dst region
+       shrl $2,%ecx                    # convert words to bytes
        je   17f                        # skip loop if nothing to copy
 16:    subl $4,%esi                    # pre-decrementing copy loop
        subl $4,%edi
@@ -798,6 +793,7 @@ 17: movl %edi,%esp                  # final %edi is top
 17:    movl %edi,%esp                  # final %edi is top of merged stack
        jmp  11b
 
+.section .rodata,"a"
 critical_fixup_table:
        .byte 0xff,0xff,0xff            # testb $0xff,(%esi) = __TEST_PENDING
        .byte 0xff,0xff                 # jnz  14f
@@ -814,6 +810,7 @@ critical_fixup_table:
        .byte 0x28                      # iret
        .byte 0xff,0xff,0xff,0xff       # movb $1,1(%esi)
        .byte 0x00,0x00                 # jmp  11b
+.previous
 
 # Hypervisor uses this for application faults while it executes.
 # We get here for two reasons:
@@ -1194,6 +1191,7 @@ ENTRY(fixup_4gb_segment)
        jmp error_code
 
 .section .rodata,"a"
+.align 4
 #include "syscall_table.S"
 
 syscall_table_size=(.-sys_call_table)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.