i want read ebp address to ebg_reg, and to offset +4 +8, archive argc and argv. when i compiler on macOS use gcc version 13.0.0.
gcc -c -fno-builtin -nostdlib -fno-stack-protector entry.c malloc.c stdio.c string.c printf.c
compiler failed:
entry.c:51:9: error: invalid operand for instruction
asm("movl %%ebp, %0 \n":"=r"(ebp_reg));
^
<inline asm>:1:13: note: instantiated into assembly here
movl %ebp, %rax
void test(void)
{
int ret;
int argc = 0;
char **argv;
char *ebp_reg = 0;
asm("movl %%ebp, %0 \n":"=r"(ebp_reg));
argc = *(int *)(ebp_reg + 4);
argv = (char **)(ebp_reg + 8);
}