English 中文(简体)
作为在组装上的回顾
原标题:Linux sbrk() as a syscall in assembly

因此,作为一个挑战,对于业绩而言,我撰写了一台简单的机装机。 我知道的唯一途径是通过系统电话。 (通过0x80) 显然,我需要比在组装或装货时分配更多的记忆,因此,我读了,决定我要使用刀子,主要因为我不理解 mm():p

不管怎么说,六氯环己烷只能提供 br(rk)的中断。

因此,我如何发现目前的方案中断使用彩票? 我想到的是使用权宜之计,但我不知道如何获得资源(这一过程使我gues想到)来加以限制。 或者,我是否应当找到其他办法执行rk子?

最佳回答

可通过获得现值和人工减去所需数额来履行母机功能。 有些系统允许你将现值带上brk(0),另一些系统则将现值追踪到变数中[与_end<>/code>的地址一起初步形成,由联系人设立,以指明最初的破损价值]。

这是一个非常具体的平台问题,例如YMMV。

EDIT: On linux:

然而,实际的六氯环己烷系统把新方案的成功称为回报。 在失败时,该系统把目前的中断称为回报。 平衡包装功能为提供上述0和1个回报值做了一些工作(即检查新休息时间是否少于添加)。

因此,从大会来看,你可以将其称作零或-1等荒谬价值,以获得现值。

了解你不能通过彩虹获得“免费”的记忆,你可能希望在C所写的小型功能中仅仅联系。

问题回答

资料来源:

#include <unistd.h>
#define SOME_NUMBER  8
int main() {
  void *ptr = sbrk(8);
  return 0;
}

采用大会产出选择的能力

gcc -S -o test.S test.c

然后看一下阿马斯法典

_main:
Leh_func_begin1:
    pushq   %rbp
Ltmp0:
    movq    %rsp, %rbp
Ltmp1:
    subq    $16, %rsp
Ltmp2:
    movl    $8, %eax
    movl    %eax, %edi
    callq   _sbrk
    movq    %rax, -16(%rbp)
    movl    $0, -8(%rbp)
    movl    -8(%rbp), %eax
    movl    %eax, -4(%rbp)
    movl    -4(%rbp), %eax
    addq    $16, %rsp
    popq    %rbp
    ret
Leh_func_end1:

没有任何制度需要,但请should。 能够继续发出呼吁





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...