Look:
My linux OS is CentOS 5.3,and I install it in vmware,Code:/* machine code is: push %ebp mov %esp,%ebp pop %ebp ret */ unsigned char code[]= "\x55\x89\xe5\x5d\xc3"; typedef void (*PF)(); int main(void) { PF pf=(PF)&code; (*pf)(); return 0; }
I can run it using vc6,but it can't be run in linux,
it said:Segmentation fault,and I debug it using gdb,
it display the line (*pf)() is error:Segmentation fault,
why?how to correct it?