direct-io.hg

changeset 13813:383ade1b0da4

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@novell.com>
author kfraser@localhost.localdomain
date Tue Feb 06 23:36:53 2007 +0000 (2007-02-06)
parents 625aa1547cb6
children ac465fc7c78f
files linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S	Tue Feb 06 23:14:21 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S	Tue Feb 06 23:36:53 2007 +0000
     1.3 @@ -747,7 +747,7 @@ ENTRY(hypervisor_callback)
     1.4  	jb   11f
     1.5  	cmpl $sysexit_ecrit,%eax
     1.6  	ja   11f
     1.7 -	addl $0x34,%esp			# Remove cs...ebx from stack frame.
     1.8 +	addl $OLDESP,%esp		# Remove eflags...ebx from stack frame.
     1.9  11:	push %esp
    1.10  	call evtchn_do_upcall
    1.11  	add  $4,%esp
    1.12 @@ -777,18 +777,13 @@ ecrit:  /**** END OF CRITICAL REGION ***
    1.13  # provides the number of bytes which have already been popped from the
    1.14  # interrupted stack frame.
    1.15  critical_region_fixup:
    1.16 -	addl $critical_fixup_table-scrit,%eax
    1.17 -	movzbl (%eax),%eax		# %eax contains num bytes popped
    1.18 -	cmpb $0xff,%al                  # 0xff => vcpu_info critical region
    1.19 +	movzbl critical_fixup_table-scrit(%eax),%ecx # %eax contains num bytes popped
    1.20 +	cmpb $0xff,%cl                  # 0xff => vcpu_info critical region
    1.21  	jne  15f
    1.22 -	GET_THREAD_INFO(%ebp)
    1.23 -        xorl %eax,%eax
    1.24 -15:	mov  %esp,%esi
    1.25 -	add  %eax,%esi			# %esi points at end of src region
    1.26 -	mov  %esp,%edi
    1.27 -	add  $0x34,%edi			# %edi points at end of dst region
    1.28 -	mov  %eax,%ecx
    1.29 -	shr  $2,%ecx			# convert words to bytes
    1.30 +	xorl %ecx,%ecx
    1.31 +15:	leal (%esp,%ecx),%esi		# %esi points at end of src region
    1.32 +	leal OLDESP(%esp),%edi		# %edi points at end of dst region
    1.33 +	shrl $2,%ecx			# convert words to bytes
    1.34  	je   17f			# skip loop if nothing to copy
    1.35  16:	subl $4,%esi			# pre-decrementing copy loop
    1.36  	subl $4,%edi
    1.37 @@ -798,6 +793,7 @@ 16:	subl $4,%esi			# pre-decrementing co
    1.38  17:	movl %edi,%esp			# final %edi is top of merged stack
    1.39  	jmp  11b
    1.40  
    1.41 +.section .rodata,"a"
    1.42  critical_fixup_table:
    1.43  	.byte 0xff,0xff,0xff		# testb $0xff,(%esi) = __TEST_PENDING
    1.44  	.byte 0xff,0xff			# jnz  14f
    1.45 @@ -814,6 +810,7 @@ critical_fixup_table:
    1.46  	.byte 0x28			# iret
    1.47  	.byte 0xff,0xff,0xff,0xff	# movb $1,1(%esi)
    1.48  	.byte 0x00,0x00			# jmp  11b
    1.49 +.previous
    1.50  
    1.51  # Hypervisor uses this for application faults while it executes.
    1.52  # We get here for two reasons:
    1.53 @@ -1194,6 +1191,7 @@ ENTRY(fixup_4gb_segment)
    1.54  	jmp error_code
    1.55  
    1.56  .section .rodata,"a"
    1.57 +.align 4
    1.58  #include "syscall_table.S"
    1.59  
    1.60  syscall_table_size=(.-sys_call_table)