小编use*_*262的帖子

汇编 x86 brk() 调用使用

我正在尝试将内存动态分配到堆中,然后在这些内存地址中分配值。我了解如何分配内存,但我如何将例如寄存器中的值分配给第一个动态内存地址?这是我到目前为止:

    push rbp
    mov rbp, rsp            ;initialize an empy stack to create activation records for the rest of the subroutines                                                                                                                        

    mov rax, 0x2d           ;linux system call for brk()                                                                                                                                                                                  
    mov rbx, 0x0            ;to get the adress of the first adress we are allocating we must have 0 in rbx                                                                                                                                
    int 0x80                ;calls the linux operating system kernel for assistance                                                                                                                                                       
    mov [brk_firstLocation], rax ;the first position in the heap will be returned in rax thus i save the first loaction in a …
Run Code Online (Sandbox Code Playgroud)

linux assembly x86-64 dynamic-memory-allocation brk

8
推荐指数
2
解决办法
4803
查看次数

标签 统计

assembly ×1

brk ×1

dynamic-memory-allocation ×1

linux ×1

x86-64 ×1