Assembly x86 brk() call use

后端 未结 4 1826
孤城傲影
孤城傲影 2020-12-10 16:36

i am trying to dynamically allocate memory into the heap and then assign values in those memory addresses. I understand how to allocate the memory but how would i assign for

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-10 17:05

    int 80h is only for 32 bit system calls. Use syscall for 64 bit instead.

    Calling sys_brk twice is redundant - in assembly you always know where your program data ends. Simply put a label there and you will have the address.

    Allocating this way memory less than one page is pointless, it will be allocated in blocks of 4KB anyway.

    It is important to be understood - sys_brk is not heap management function. It is low level memory management.

提交回复
热议问题