>A D wrote: > I'm having strange problem accessing a variable in a gnu assembly language program. > When i write a code: > > .section .data > x = 4 > mm: > .int 1, 2 > > .section .text > .globl _start > _start: > nop > movl x, %ecx #can't do this > > > > Kotler wrote: >>You're trying to access memory at address 4, not move the immediate >>value 4. Try "movl $x, %ecx". >> >> >> Plantz wrote: >>So this instruction: >> movl x, %ecx #can't do this >> >>is trying to move the 4 bytes stored at memory location 4 into the ecx >>register. As the OS told you, you cannot do that. >> >>The way to allocate an initialized 32-bit int in the .data section is: >> >>x: .long 4 This problem is resolved now. Thanks for clarifying this. --DC _________________________________________________________________ Send a smile, make someone laugh, have some fun! Start now! http://www.freemessengeremoticons.ca/?icid=EMENCA122- To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
- References:
- Unable to use a variable in instruction
- From: A D
- Re: Unable to use a variable in instruction
- From: Robert Plantz
- Unable to use a variable in instruction
- Prev by Date: Re: Unable to use a variable in instruction
- Next by Date: what is faster offsets or pointers?
- Previous by thread: Re: Unable to use a variable in instruction
- Next by thread: what is faster offsets or pointers?
- Index(es):