flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 14 Feb 2019, 09:41
This is a follow up to another topic for WIndows.
The default memory allocation in Linux is 16384kB. It's hardcoded in the source. The user can always override with the -m setting. But there are two main problems with this
Code: ;.. init_memory: mov eax,esp and eax,not 0FFFh add eax,1000h-10000h mov [stack_limit],eax xor ebx,ebx mov eax,45 int 0x80 mov [additional_memory],eax mov ecx,[memory_setting] shl ecx,10 jz allocate_max_memory add ecx,eax jnc allocate_memory allocate_max_memory: mov ecx,-1 shl 10 allocate_memory: mov ebx,ecx allocate_memory_loop: mov eax,45 int 0x80 cmp eax,ecx jae allocate_memory_okay cmp eax,ebx jae allocate_memory_end_okay mov ecx,ebx ;adjust the end point allocate_memory_end_okay: mov edx,ecx sub edx,eax dec edx bsr edx,edx xor ebx,ebx bts ebx,edx add ebx,eax cmp dl,12 jae allocate_memory_loop allocate_memory_okay: mov [memory_end],eax sub eax,[additional_memory] shr eax,2 add eax,[additional_memory] mov [additional_memory_end],eax mov [memory_start],eax ret ;... I got this result with the x64 version of fasm I posted in another thread Code: flat assembler version 1.73.08 (4182188 kilobytes memory) Code: flat assembler version 1.73.08 (3917052 kilobytes memory) Code: 0 1000 29281 10566 20 0 4167544 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29300 10566 20 0 4178820 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29307 10566 20 0 4170244 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29318 10566 20 0 4174980 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29327 10566 20 0 4189256 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29334 10566 20 0 4180716 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29341 10566 20 0 4173552 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29348 10566 20 0 4163380 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29355 10566 20 0 4165800 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29362 10566 20 0 4176976 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29369 10566 20 0 4181436 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29376 10566 20 0 4182996 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29383 10566 20 0 4178572 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29390 10566 20 0 4175316 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29397 10566 20 0 4171436 4 signal t pts/8 0:00 ./fasm fasm.asm 0 1000 29404 10566 20 0 4192836 4 signal t pts/8 0:00 ./fasm fasm.asm The difference in the allocation size is due to the randomisation of memory allocation addresses in the kernel. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.