I'm confused about this; I don't think that there should be any difference in both cases , the program ends up as exe file. Please help if you think a differ....
Let me clarify my question: Is there is a difference in the data segment definition or handling
between when I create an assembly program 'stand alone' and when I call for an assembly routine from a C program?
Who is defining the location or size of the date segment in both cases? Is this the compiler, or the operating system? And how the value of the data segment determined in both cases?
Depend of operating system!
If we are looking for windows operating system under IA32 then API reserve virtual memory address space of some application and:
Exsample of accessing 'Win32 Thread Information Block' via FS segment:
function GetThreadId: integer;
//result := GetCurrentThreadId;
asm
mov eax, fs:[$18] //eax := thread information block
mov eax, [eax + $24] //eax := thread id
end; { GetThreadId }
Sheck also: x86 memory segmentation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.