flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Quantum
Quote:
Why not use TLS? |
|||
![]() |
|
LocoDelAssembly
If I remember well the TLS slot for the EXE module is 0 so doing "mov dword [fs:0], something" should be enough. For DLLs you should use the API function to get a slot.
Regards |
|||
![]() |
|
Thaorius
you could set the CF to 1 and do something like this:
Code: lea eax,ERROR_OOOPPS ERROR_OOOPPS db 'Something is wrong...',13,10,0 then you return from the procedure and that is, you should have the memory address of the message and even you can use something like putting on ah the memory address and in al some error number. Bye |
|||
![]() |
|
vid
Thaorious - that's way i use already, but i also need some strings created dynamically (like "Error in procedure %s: arg1 = %8X, arg2 = %8X" etc...), so i need memory for this
what's that TLS? i am not familiar with it |
|||
![]() |
|
Reverend
TLS is only in PE files. FASMLIB is supposed to be OS-independent, and so error handling must be the same on all OSes.
|
|||
![]() |
|
shoorick
it is possible with additional optional parameter. if caller wish to get error info - it allocates space for error structure and pass pointer as parameter to the function (it has to be able to fill it) - if there is no error - it simply deleted, otherwise - used (filled by called function, of course). if caller do not care about error - 0 passed as this parameter. that structure can be created even in stack as local var, so, no problems with multythreading.
|
|||
![]() |
|
LocoDelAssembly
You have Thread Local Store (TLS) on Windows and Thread Specific Data (TSD) on Linux. Again if I remember well on Linux you can use "mov [fs:0], something" but I'd never used it on Linux so you must Google it.
|
|||
![]() |
|
LocoDelAssembly
locodelassembly wrote: If I remember well the TLS slot for the EXE module is 0 so doing "mov dword [fs:0], something" should be enough. For DLLs you should use the API function to get a slot. Absolutelly wrong. Microsoft systems journal - Under The Hood [MATT PIETREK] wrote:
http://www.microsoft.com/msj/0298/hood0298.aspx |
|||
![]() |
|
jbojarczuk
[fs:0] is the head of the exception handling linked list.
If you want more info, contact me. |
|||
![]() |
|
LocoDelAssembly
There was a big mess yesterday for that http://board.flatassembler.net/topic.php?t=5807
Thanks anyway. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.