Subject: Re: CLI and STI for XEN
To: David Laight <david@l8s.co.uk>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-amd64
Date: 12/03/2007 23:05:49
On Sun, Dec 02, 2007 at 10:34:28PM +0000, David Laight wrote:
> sys/arch/amd64/include/frameasm.h defines macros for STI and CLI
> for XEN that use 2 temp registers.
> I think the patch below is equivalent - but only uses 1.
>
> --- frameasm.h 22 Nov 2007 16:16:45 -0000 1.8
> +++ frameasm.h 2 Dec 2007 22:00:04 -0000
> @@ -140,15 +140,13 @@
> #define CLI(reg1,reg2) \
> movl CPUVAR(CPUID),%e/**/reg1 ; \
> shlq $6,%r/**/reg1 ; \
> - movq _C_LABEL(HYPERVISOR_shared_info),%r/**/reg2 ; \
> - addq %r/**/reg1,%r/**/reg2 ; \
> - movb $1,EVTCHN_UPCALL_MASK(%r/**/reg2)
> + addq _C_LABEL(HYPERVISOR_shared_info),%r/**/reg1 ; \
> + movb $1,EVTCHN_UPCALL_MASK(%r/**/reg1)
> #define STI(reg1,reg2) \
> movl CPUVAR(CPUID),%e/**/reg1 ; \
> shlq $6,%r/**/reg1 ; \
> - movq _C_LABEL(HYPERVISOR_shared_info),%r/**/reg2 ; \
> - addq %r/**/reg1,%r/**/reg2 ; \
> - movb $0,EVTCHN_UPCALL_MASK(%r/**/reg2)
> + addq _C_LABEL(HYPERVISOR_shared_info),%r/**/reg1 ; \
> + movb $0,EVTCHN_UPCALL_MASK(%r/**/reg1)
> #else /* XEN */
> #define CLI(reg1,reg2) cli
> #define STI(reg1,reg2) sti
>
> However I don't have a XEN install so can't test it.
It works. But please keep the 2 registers as macro arguments, even if only
one is used for now: I may need a STIC() in the future, and this one would
need 2 arguments.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--