Replacing one esp process value with another to get a local variable

I am trying to copy the current current esp value of a process to other esp processes running on a different terminal.

I get a segmentation error.

But I can not correctly understand the reason, because I use the built-in assembly.

p1.c

int main()
{
    int a=5;
    int b =8;
    unsigned int esp =0;
    asm("mov %%esp,%0":"=r"(esp)::);
    printf("esp:[%x] \n",esp);
    while(1);
}

P2.c

int main()
{
    int a=5;
    int espoth=0;
    asm("mov 0xbfda8008,%%esp"::);
}

First I ran p1.c, which gave me the 0xbfda8008current stack pointer. Then I used it in p2.c, which gave me Segmentation fault.

I just write the value in esp. Why am I getting this error? Need a little hint ...; - (

+4
source share
1 answer

, . , , , . , , , .

, "" "". "mmu", " " " ".

, MS-DOS, , MMU ( , , , DOS4GW, GO32-V2)

0

Source: https://habr.com/ru/post/1630013/


All Articles