Skip to content

Commit

Permalink
kvx: Directly use the linux headers for the register definitions
Browse files Browse the repository at this point in the history
Summary:
In musl we defined a user_regs_struct that contains the registers
structure as provided by the kernel via ptrace. But the same define is
already in the Linux kernel (and the header is already provided via the
linux-headers package). So, no need to re-define it in musl (in user.h).

Ref T18986

Test Plan: CI

Reviewers: O51 Linux Coolidge!

Subscribers: #linux_coolidge_cc

Maniphest Tasks: T18986

Differential Revision: https://phab.kalray.eu/D26038
  • Loading branch information
d3athjest3r committed Oct 17, 2023
1 parent dcd29d2 commit 5ccf778
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/linux/kvx/arch_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
static struct user_regs_struct kvx_regs;
#define ARCH_REGS_FOR_GETREGSET kvx_regs
#define ARCH_PC_REG kvx_regs.spc
#define ARCH_SP_REG kvx_regs.gpr_regs[12]
#define ARCH_SP_REG kvx_regs.sp
6 changes: 3 additions & 3 deletions src/linux/kvx/get_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
static void
arch_get_error(struct tcb *tcp, const bool check_errno)
{
if (check_errno && is_negated_errno(kvx_regs.gpr_regs[0])) {
if (check_errno && is_negated_errno(kvx_regs.r0)) {
tcp->u_rval = -1;
tcp->u_error = -kvx_regs.gpr_regs[0];
tcp->u_error = -kvx_regs.r0;
} else {
tcp->u_rval = kvx_regs.gpr_regs[0];
tcp->u_rval = kvx_regs.r0;
}
}
2 changes: 1 addition & 1 deletion src/linux/kvx/get_scno.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
static int
arch_get_scno(struct tcb *tcp)
{
tcp->scno = kvx_regs.gpr_regs[6];
tcp->scno = kvx_regs.r6;
return 1;
}
12 changes: 6 additions & 6 deletions src/linux/kvx/get_syscall_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
static int
arch_get_syscall_args(struct tcb *tcp)
{
tcp->u_arg[0] = kvx_regs.gpr_regs[0];
tcp->u_arg[1] = kvx_regs.gpr_regs[1];
tcp->u_arg[2] = kvx_regs.gpr_regs[2];
tcp->u_arg[3] = kvx_regs.gpr_regs[3];
tcp->u_arg[4] = kvx_regs.gpr_regs[4];
tcp->u_arg[5] = kvx_regs.gpr_regs[5];
tcp->u_arg[0] = kvx_regs.r0;
tcp->u_arg[1] = kvx_regs.r1;
tcp->u_arg[2] = kvx_regs.r2;
tcp->u_arg[3] = kvx_regs.r3;
tcp->u_arg[4] = kvx_regs.r4;
tcp->u_arg[5] = kvx_regs.r5;

return 1;
}
4 changes: 2 additions & 2 deletions src/linux/kvx/set_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
static int
arch_set_error(struct tcb *tcp)
{
kvx_regs.gpr_regs[0] = -tcp->u_error;
kvx_regs.r0 = -tcp->u_error;
return set_regs(tcp->pid);
}

static int
arch_set_success(struct tcb *tcp)
{
kvx_regs.gpr_regs[0] = tcp->u_rval;
kvx_regs.r0 = tcp->u_rval;
return set_regs(tcp->pid);
}
2 changes: 1 addition & 1 deletion src/linux/kvx/set_scno.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
kvx_regs.gpr_regs[6] = scno;
kvx_regs.r6 = scno;
return set_regs(tcp->pid);
}

0 comments on commit 5ccf778

Please sign in to comment.