On 4/18/2012 7:58 AM, Daniel Hilst wrote:
Is possible to declare strings on stack? I'm using mov + ebp offsets to do something like that.. Is there an easier way to do it?Basically, you're asking if the compiler/assembler can initialize the stack to some known value. Since memory on the stack is dynamically allocated by the instructions:Here is an sample off how I'm doing it: http://sprunge.us/UUZI The hex numbers are a "Hello World" string.. I have tried .assci without success :( Thanks in advance!
doit: push %ebp ; Save caller's base pointer mov %esp, %ebp ; Establish our base pointer sub $12, %esp ; Allocate memory on the stackthe answer is 'no.' After you allocate stack memory (which now has garbage values), you need to copy known values there. Write your code in C and use the '-S' gcc option to see how the compiler does this. The '-S' option will generate the assembly language file foo.s from the C source file foo.c.
--Bob -- 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
- Follow-Ups:
- Re: [linux-assembly] Declare strings on stack, gas
- From: Daniel Hilst
- Re: [linux-assembly] Declare strings on stack, gas
- References:
- [linux-assembly] Declare strings on stack, gas
- From: Daniel Hilst
- [linux-assembly] Declare strings on stack, gas
- Prev by Date: Re: [linux-assembly] Declare strings on stack, gas
- Next by Date: Re: [linux-assembly] Declare strings on stack, gas
- Previous by thread: Re: [linux-assembly] Declare strings on stack, gas
- Next by thread: Re: [linux-assembly] Declare strings on stack, gas
- Index(es):