Date: Thu, 14 Jun 2007 14:11:10 -0700 From: "Patil, Kiran" <kiran.patil@intel.com> To: <freebsd-questions@freebsd.org> Cc: "Patil, Kiran" <kiran.patil@intel.com> Subject: Need help with GNU assembly Message-ID: <4AFE4AEEFA305C4BB82F73F4D819506001B50C43@orsmsx420.amr.corp.intel.com>
next in thread | raw e-mail | index | archive | help
Hi All,
=20
I am trying to use GNU assembly. I am trying simple thing such as ,
moving content of memory location into general purpose register (ax).
=20
I have following code :
=20
struct context {
=20
unsigned long mask[8];
} CONTEXT;
=20
int main()
{
CONTEXT sr;
sr.mask[5] =3D 0x8FED;
=20
__asm ( "movw %0, %ax" : : "m" (*(unsigned
short*)sr.mask[5]) );
return 0;
}
=20
Compiler complains with error "bad substitution directive in asm
instruction".
=20
I tried changing the code something like this :
=20
__asm ( "movw %0, %ax" : : "m" (*(unsigned short*)sr.mask+5) );
=20
Still error is same, then I tried following:
=20
Unsigned short* ptemp =3D &sr.mask[5];
__asm ( "movw %0, %ax" : : "m" (*(unsigned short*)ptemp) );
But still no luck, compiler reported same error as mentioned above
=20
Any help is appreciated. Please let me know where I am mistake.
=20
Thanks,
-- Kiran P.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AFE4AEEFA305C4BB82F73F4D819506001B50C43>
