flat assembler
Message board for the users of flat assembler.

Index > Main > using sections vs not

Author
Thread Post new topic Reply to topic
nerd_boy



Joined: 07 Oct 2007
Posts: 4
nerd_boy
Apologies if this is a noob question, but I didn't see it in the forum anywhere nor in the docs(though I'm sure I could have overlooked it).

Various code examples differ in using sections for data,code,import, etc., and not using them.

On a simple program that just displays a window, using sections to separate data,code, and imports made the the executable about 2KB in size. Removing the section areas and using data import ... end data, etc., reduced the file size down to 1.5KB.

In the grand scheme of things, I'm sure this minor reduction isn't worth jack squat, but I was curious as to the whys and wherefors and if there was any actual benefit to using sections.

Thanks!

_________________
--nerd_boy
Post 08 Oct 2007, 03:50
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
sections have different attributes
Quote:
Available flags are: code, data, readable, writeable, executable,
shareable, discardable, notpageable.

as a result specific behaviour of system on each section.
Basically they're used to divide different types of data & code. They also may prevent from obvious errors such as writing to read-only section of data or code.

_________________
Any offers?
Post 08 Oct 2007, 06:00
View user's profile Send private message Reply with quote
nerd_boy



Joined: 07 Oct 2007
Posts: 4
nerd_boy
asmfan wrote:
They also may prevent from obvious errors such as writing to read-only section of data or code.


Ah! A professor once said in class that most systems implemented something to prevent code pages in memory to be written to. Is this actually what he meant, or is there yet another part of the hardware that can tell the difference?

Also, thanks.

_________________
--nerd_boy
Post 08 Oct 2007, 07:03
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
Have a look at this Data Execution Prevention
NX bit

_________________
Any offers?
Post 08 Oct 2007, 14:33
View user's profile Send private message 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 GitHub, YouTube, Twitter.

Website powered by rwasa.