Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jun 2007 22:43:56 -0700
From:      "Ted Mittelstaedt" <tedm@toybox.placo.com>
To:        "Patil, Kiran" <kiran.patil@intel.com>, <freebsd-questions@freebsd.org>
Subject:   RE: Need help with GNU assembly
Message-ID:  <BMEDLGAENEKCJFGODFOCGECICAAA.tedm@toybox.placo.com>
In-Reply-To: <4AFE4AEEFA305C4BB82F73F4D819506001B50C43@orsmsx420.amr.corp.intel.com>

next in thread | previous in thread | raw e-mail | index | archive | help

http://asm.sourceforge.net/intro.html



> -----Original Message-----
> From: owner-freebsd-questions@freebsd.org
> [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Patil, Kiran
> Sent: Thursday, June 14, 2007 2:11 PM
> To: freebsd-questions@freebsd.org
> Cc: Patil, Kiran
> Subject: Need help with GNU assembly
> 
> 
> Hi All,
> 
>  
> 
> I am trying to use GNU assembly. I am trying simple thing such as ,
> moving content of memory location into general purpose register (ax).
> 
>  
> 
> I have following code :
> 
>  
> 
> struct context {
> 
>  
> 
>             unsigned long mask[8];
> 
> } CONTEXT;
> 
>  
> 
> int main()
> 
> {
> 
>             CONTEXT sr;
> 
>             sr.mask[5] = 0x8FED;
> 
>  
> 
>             __asm ( "movw %0, %ax" : : "m" (*(unsigned
> short*)sr.mask[5]) );
> 
>             return 0;
> 
> }
> 
>  
> 
> Compiler complains with error "bad substitution directive in asm
> instruction".
> 
>  
> 
> I tried changing the code something like this :
> 
>  
> 
> __asm ( "movw %0, %ax" : : "m" (*(unsigned short*)sr.mask+5) );
> 
>  
> 
> Still error is same, then I tried following:
> 
>  
> 
>             Unsigned short* ptemp = &sr.mask[5];
> 
>             __asm ( "movw %0, %ax" : : "m" (*(unsigned short*)ptemp) );
> 
> But still no luck, compiler reported same error as mentioned above
> 
>  
> 
> Any help is appreciated. Please let me know where I am mistake.
> 
>  
> 
> Thanks,
> 
> -- Kiran P.
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe@freebsd.org"
> 
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BMEDLGAENEKCJFGODFOCGECICAAA.tedm>