How to write self-modifying code in x86 assembly

后端 未结 7 1597
醉酒成梦
醉酒成梦 2020-11-28 18:38

I\'m looking at writing a JIT compiler for a hobby virtual machine I\'ve been working on recently. I know a bit of assembly, (I\'m mainly a C programmer. I can read most ass

7条回答
  •  死守一世寂寞
    2020-11-28 19:10

    I've never written self-modifying code, although I have a basic understanding about how it works. Basically you write on memory the instructions you want to execute then jump there. The processor interpret those bytes you've written an instructions and (tries) to execute them. For example, viruses and anti-copy programs may use this technique.
    Regarding the system calls, you were right, arguments are passed via registers. For a reference of linux system calls and their argument just check here.

提交回复
热议问题