flat assembler
Message board for the users of flat assembler.

Index > Windows > reloc, fixups, and some other questions...

Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
I noticed some people have a ".reloc" section with "fixups" as a flag describing it... Since it seems empty, exactly why should one have it or include it?

Also, why do people put "executeable" in the main section of code when conflicts with "writeable" and we end up having to use long pointers for our variables?

And last random question, what is the main difference between the win32a and win32ax inc files, so i know which one to use on a regular basis?
Post 15 Dec 2006, 01:44
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
fixups are needed in DLL files. EXE files are always loaded at address 400000h. DLL files can be loaded anywhere, so the code inside them need to be "relocated". "fixups" flag says fasm to declare relocation data for you
Post 15 Dec 2006, 02:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
So is there any point to putting executable as a flag to a section that's executed?
Post 15 Dec 2006, 04:39
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
yes, processor allows you to protect some paga against executing. Sections marked as "executable" can be executed, and other can't. But unfortunatelly most processors today doesn't support this feature
Post 15 Dec 2006, 11:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Paga?
Post 15 Dec 2006, 20:49
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
pages
Post 15 Dec 2006, 21:10
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
So, i'm assuming that as long as i stick with the 80x86 systems, i don't NEED the executable, but for some odd reson it's included in many sources anyway?
Post 15 Dec 2006, 21:12
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you are assuming wrong.
http://en.wikipedia.org/wiki/NX_bit
Post 15 Dec 2006, 22:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Which means.... I have to start putting my variables in seperate sections adding another 1024 byte (at the least) to my code... Will i have to worry about this when i'm codding in a no OS invironment to make a kernel, or does the processor use this function without the request of the OS?
Post 16 Dec 2006, 03:18
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
1024 byte (at the least) to my code...

more precisely: at most 4095

you can keep variables in same section as code, you just have to declater it as "readable" and "writeable"
Post 17 Dec 2006, 02:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
executable and writeable conflict. if you include executable, you can't have it writeable, unless you found a way to do otherwise, last time i tried it i got an error, but i'll try again real quick.

EDIT: Odd, it's working now. Any time before now and it crashed the program with an access violation...
Post 17 Dec 2006, 03:56
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP
If you need to modify anything within executable pages area of your module, than you can use VirtualProtect function to make it writable:


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualprotect.asp

Secondly to clear things up a bit: ImageBase can be setup to other value than 400000 but usually there is no point in doing it.
Post 23 Dec 2006, 21:48
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Executable and writable don't conflict.

But don't keep writable data near your code - it can give massive slowdowns on some processors. So, be smart and safe, and use separate .data and .text sections, unless you're writing 4k intros.
Post 24 Dec 2006, 21:06
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Yea, after some rechecking apparently i must have spelled it wrong or something, because before they did conflict.
Post 27 Dec 2006, 05:37
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.