Re: varibles define

Sofiane Akermoun <[email protected]> Fri, 15 Feb 2013 02:21:51 +0100
Newsgroups org.kernel.vger.linux-assembly
Message-ID <CAN0_x-+7VX83L19-oFXXut-YFQOFjCiUv4-QdnGVp+OrJavNaw@mail.gmail.com>
Definition in .text will stay in .text at the same position you defined it.
Of course when the code is executed the cpu doesn't know at all that
he is reading a string for example or an executable code

You can do this:

...execution flow started...
jmp lb1:                                    // jump to avoid the cpu
to interpret the variable definition as code
mystrind db "hello world!", 0h      // definition of a variable here
lb1:
....execution flow continues here

else the best is to store you data after the exit of the program

Never do something like this below:

some instruction
some instruction
mystring db "Hello world!", 0h  // definition here
some instruction

In the example above the hexa version of "hello world!",0h will be
read and executed by the cpu and it is not what we want

regards,

Sofiane Akermoun
[email protected]
[email protected]

2013/2/13 horseriver <[email protected]>:
> hi:)
>
>    If define a byte in .text. then ,does this byte located into .data section in object file?
>
> thanks!
> --
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Sofiane AKERMOUN
[email protected]