Subject: Re: help with assembly (2)
To: None <port-xen@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: port-xen
Date: 01/21/2005 12:04:58
On Thu, Jan 20, 2005 at 08:52:00PM +0100, Manuel Bouyer wrote:
> Hi,
> Again I'm stuck with some assembly code (I don't know much about i386 assembly,
> and I've never mixed assembly and C). I have this code in xen/i386/vector.S:
> #define hypervisor_asm_unmask(num) \
> movl irq_to_evtchn + (num) * 4,%ecx ;\
> movl HYPERVISOR_shared_info,%eax ;\
> lock ;\
> btrl %ecx,EVENTS_MASK(%eax)
> (BTW, what does the "lock" instruction ?)
> I need to add a call to this C function at the end of this asm
> statement:
> pirq_notify(num)
> num being a constant. The prototype for the function is:
> void pirq_notify(int irq);
>
> I tried
> pushl $(num) ;\
> call _C_LABEL(pirq_notify)
> but I get a page fault trap at the first call, with something that doesn't
> make much sense on the stack. So I guess I missed something, but I don't
> know what ... I assume registers are callee-saved, but maybe I'm wrong
> on this.
I've not been able to figure out how to call pirq_notify, however I've
been able to inline the needed hypercall here. Now I need to figure out
how to test a bit in a int32_t array, and avoid the hypercall when not
needed ...
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--