How to get c code to execute hex machine code?

前端 未结 6 1716
南旧
南旧 2020-12-01 05:36

I want a simple C method to be able to run hex bytecode on a Linux 64 bit machine. Here\'s the C program that I have:

char code[] = \"\\x48\\x31\\xc0\";
#in         


        
6条回答
  •  日久生厌
    2020-12-01 06:15

    You need to include the assembly in-line via a special compiler directive so that it'll properly end up in a code segment. See this guide, for example: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

提交回复
热议问题