Current break round up
Kircsi Tibor <[email protected]> Tue, 30 Sep 2008 21:26:24 +0200
| Newsgroups | org.kernel.vger.linux-assembly |
|---|---|
| Message-ID | <1222802784.8421.10.camel@kirilla-desktop> |
Hi,
Sorry for my english. I started learn assembly again after 15 years.
Now, I'm learning about memory management and sys_brk system call. I've
created a really simple program, which try to extend the heap size. I've
read, when sys_brk is called with the new break address(last usable
address of the heap or data segment), it will be rounded up to the next
nearest page, but it didn't. Am I misundestand somthing?
# meminf.s
# 2008.09.25.
# PURPOSE: Test current_break address round up at sys_brk call
.include "../sharedlibs/linux.s"
.section .text
.globl _start
_start:
movl %esp, %ebp
movl $0, %ebx # %ebx = 0, get the current
curret_break
movl $SYS_BRK, %eax
int $INT # %eax = address of
current_break
addl $0x1002, %eax # add 4098 to current
current_break
movl %eax, %ebx # %ebx = the address of the new
current_break
movl $SYS_BRK, %eax
int $INT
movl $0, %ebx # set the return value of the
program
movl $SYS_EXIT, %eax
int $INT
regards,
Kiri