Subject: Re: kernel: supervisor trap asynchronous system trap, code=0
To: None <bouyer@antioche.eu.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: port-xen
Date: 06/30/2007 20:09:47
> Index: i386/locore.S
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/xen/i386/locore.S,v
> retrieving revision 1.25
> diff -u -r1.25 locore.S
> --- i386/locore.S	17 May 2007 14:51:35 -0000	1.25
> +++ i386/locore.S	28 Jun 2007 13:27:49 -0000
> @@ -663,6 +663,7 @@
>  	 * Switch to newlwp's stack.
>  	 */
>  
> +	CLI(%ebx)
>  	movl	L_ADDR(%edi),%ebx
>  	movl	PCB_EBP(%ebx),%ebp
>  	movl	PCB_ESP(%ebx),%esp

can you explain why it's necessary?

anyway, please don't call ras_lookup with interrupt disabled.

> @@ -780,9 +789,29 @@
>  	call	_C_LABEL(trap)
>  	addl	$4,%esp
>  	jmp	.Lsyscall_checkast
> -1:	STI(%eax)
> -	CHECK_DEFERRED_SWITCH(%eax)
> +1:	CHECK_DEFERRED_SWITCH(%eax)
>  	jnz	9f
> +	STIC(%eax)
> +	jz	14f
> +	call	_C_LABEL(stipending)
> +	testl	%eax,%eax
> +	jz	14f
> +	/* process pending interrupts */
> +	CLI(%eax)
> +	movl	CPUVAR(ILEVEL), %ebx
> +	movl	$.Lsyscall_resume, %esi # address to resume loop at
> +.Lsyscall_resume:
> +	movl	%ebx,%eax		# get cpl
> +	movl	CPUVAR(IUNMASK)(,%eax,4),%eax
> +	andl	CPUVAR(IPENDING),%eax	# any non-masked bits left?
> +	jz	17f
> +	bsrl	%eax,%eax
> +	btrl	%eax,CPUVAR(IPENDING)
> +	movl	CPUVAR(ISOURCES)(,%eax,4),%eax
> +	jmp	*IS_RESUME(%eax)
> +17:	movl	%ebx, CPUVAR(ILEVEL)	#restore cpl
> +	jmp	.Lsyscall_checkast
> +14:
>  #ifndef DIAGNOSTIC
>  	INTRFASTEXIT
>  #else /* DIAGNOSTIC */

can't these duplicated code be shared?

i'm not sure why stipending() was needed in the first place,
in addition to __sti() and do_hypervisor_callback().

YAMAMOTO Takashi