[MPlayer-dev-eng] amd64 -sws 0 fix (iow: playing with NX bit)
xyzzy at speakeasy.org
Fri Jan 21 00:05:06 CET 2005
On Thu, 20 Jan 2005, Aurelien Jacobs wrote:
> new feature introduced by amd64, which is called NX bit....
> Yes, you've got it. The CPU simply prevent the execution of
> this code which is in a data segment, causing a segfault.
> Now the question is how to solve this, cleanly ?
> I can see few options :
> (5) Probably other solutions, maybe better...
Maybe it is possible to load the generated code via dlopen() or something like
The following script works for me on ia32, does it work with NX?
cat > dl.s <<EOF
.type foo, at function
.byte 184, 42, 0, 0, 0, 195
as -o dl.o dl.s
ld -Bshareable -o dl.so dl.o
mv dl.so /tmp # need to know absolute path
cat > dl_test.c <<EOF
void *dl = dlopen("/tmp/dl.so", RTLD_LAZY);
int (*foo)(void) = dlsym(dl, "foo");
printf("%d should be 42\n", foo()); }
gcc dl_test.c -ldl
More information about the MPlayer-dev-eng