flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
pete 08 May 2009, 08:22
r22 wrote at the "data moved…"-topic that reserved data belongs at the end of the section. This first made me guess that the reserved data doesn't get reserved at all, just the names of these reserved bytes point to the end of the data section which is sort of seperated from the code-section so when the yet uninit. data gets initialized while execution, the sections don't intersect with each other.
Something like: Code: ... str1 db "Huhu",0 ; end of initialized data, start of uninit. data: str2 equ $ ; 50 Byte Buffer str3 equ $+50 ; 50 Byte Buffer str4 equ $+100 ... Well, i pushed my reserved bytes at the end of the data section and expected my exe-file to get smaller, but it didn't, of course because these bytes get "really" reserved… So why does it make sense to put uninitialized data at the end of the section? I have a lot of dd's in my data section to store often used window-handles. Are those too reserved bytes when i define them with "?", f.i.: Code: handle dd ? Should'nt those too be moved at the end of the data section? My last two questions are: Where can i find some info about how Win32 separates the sections of an application and where those sections seat in memory? Thank you in advance. |
|||
![]() |
|
pete 08 May 2009, 09:04
Aha; i think i got the thing about the 512-Byte-Pages.
But what's a VM page? It's 4096 bytes in size? Does it hold the whole program? And why is it important to define uninit. data at the end of the section? |
|||
![]() |
|
revolution 08 May 2009, 09:35
Code: rb 1000000 ;force the OS the allocate 1000000 bytes at startup The x86 architecture has a standard 4kB paging granularity (it has other sizes also, but Windows usually only uses 4kb), so the smallest amount of virtual memory (VM) that can be allocated is 4kB. Code: db 123 ;force the OS to allocate 4kB of memory If you define uninitialised data at the start and follow it with initialised data then you have wasted space in your disk file. Code: rb 1000000 db 123 ;this byte MUST be in the disk file, so fasm has to put 1000000 bytes of padding |
|||
![]() |
|
pete 08 May 2009, 10:06
Aha! So when my data section is:
Code: db 123 rb 1000000 … then only the first 4 kB get written on disk, while the rest gets allocated at application startup? |
|||
![]() |
|
revolution 08 May 2009, 10:13
Only 512 bytes written to disk, but the rest is correct.
|
|||
![]() |
|
pete 08 May 2009, 10:24
Thank you a lot, revolution!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.