removed 32 bits register names that didn't exist, instead use corresponding 64 bits register and mask the last 32 bits
This commit is contained in:
parent
6414474ce0
commit
5f996dd661
1 changed files with 10 additions and 10 deletions
20
srcs/utils.c
20
srcs/utils.c
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/11 04:31:15 by thrieg #+# #+# */
|
/* Created: 2025/12/11 04:31:15 by thrieg #+# #+# */
|
||||||
/* Updated: 2025/12/11 23:27:01 by thrieg ### ########.fr */
|
/* Updated: 2025/12/12 00:17:04 by thrieg ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -73,12 +73,12 @@ static void fill_args(long long args[6], struct user_regs_struct *regs, size_t b
|
||||||
}
|
}
|
||||||
else if (binary_type == 32)
|
else if (binary_type == 32)
|
||||||
{
|
{
|
||||||
args[0] = (long long)(long)regs->ebx;
|
args[0] = (long long)(regs->rbx & 0xFFFFFFFF);
|
||||||
args[1] = (long long)(long)regs->ecx;
|
args[1] = (long long)(regs->rcx & 0xFFFFFFFF);
|
||||||
args[2] = (long long)(long)regs->edx;
|
args[2] = (long long)(regs->rdx & 0xFFFFFFFF);
|
||||||
args[3] = (long long)(long)regs->esi;
|
args[3] = (long long)(regs->rsi & 0xFFFFFFFF);
|
||||||
args[4] = (long long)(long)regs->edi;
|
args[4] = (long long)(regs->rdi & 0xFFFFFFFF);
|
||||||
args[5] = (long long)(long)regs->ebp;
|
args[5] = (long long)(regs->rbp & 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,8 +92,8 @@ static const char *get_syscall_name(size_t binary_type, struct user_regs_struct
|
||||||
}
|
}
|
||||||
else if (binary_type == 32 && regs->orig_eax < g_syscalls_32_len)
|
else if (binary_type == 32 && regs->orig_eax < g_syscalls_32_len)
|
||||||
{
|
{
|
||||||
*argc = g_syscalls_32[regs->orig_eax].argc;
|
*argc = g_syscalls_32[regs->orig_rax & 0xFFFFFFFF].argc;
|
||||||
return (g_syscalls_32[regs->orig_eax].name);
|
return (g_syscalls_32[regs->orig_rax & 0xFFFFFFFF].name);
|
||||||
}
|
}
|
||||||
*argc = 6;
|
*argc = 6;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
@ -200,7 +200,7 @@ void read_regs_and_print_exit(pid_t pid, size_t binary_type)
|
||||||
if (binary_type == 64)
|
if (binary_type == 64)
|
||||||
ret = (long)regs.rax;
|
ret = (long)regs.rax;
|
||||||
else
|
else
|
||||||
ret = (long)regs.eax;
|
ret = (long)regs.rax & 0xFFFFFFFF;
|
||||||
printf(" = %ld\n", ret);
|
printf(" = %ld\n", ret);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue