1 #include <dlfcn.h>
2 #include <stdio.h>
5 {
7 /*
8 void * h1;
9 void (*SetKernelBaseStack) (int);
10 void (*Init) (void);
11 */
16 /*
17 h1 = dlsym(h, "SetKernelBaseStack");
18 if (h1 != NULL) {
19 *(void **) (&SetKernelBaseStack) = h1;
20 h1 = dlsym(h, "Init");
21 if (h1 != NULL) {
22 *(void **) (&Init) = h1;
24 asm ("movl %%esp, %[res]" : [res] "=m" (res) );
25 SetKernelBaseStack(res - 8);
27 printf("before Init()\n");
28 Init();
29 printf("after Init()\n");
31 res = 0;
32 } else {
33 perror(dlerror());
34 res = 3;
35 }
36 } else {
37 perror(dlerror());
38 res = 2;
39 }
40 */
45 }
48 }