如何将执行重定向到堆上的代码? 操作系统:64位linux
我尝试将rip
设置为我的数组,但我无法编译它。我的代码:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int len = 0;
char *t;
int chr;
printf("Input code length: ");
scanf("%d", &len);
t = (char*)malloc(len+1);
for (int i = 0; i < len; ++i) {
scanf("%x", &chr);
t[i] = chr;
}
t[len] = 0;
asm("movl %%rip, [%0]" : "=g"(t));
}