Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334672
b: refs/heads/master
c: 7797d17
h: refs/heads/master
v: v3
  • Loading branch information
Will Deacon authored and Catalin Marinas committed Oct 18, 2012
1 parent f36d822 commit 81c771e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16dd46bb781a1d37eeb2377e8e48276e9d14d15d
refs/heads/master: 7797d17c591ae62c6f43c6de4fdb8beeb50eb692
3 changes: 2 additions & 1 deletion trunk/arch/arm64/include/uapi/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ struct user_fpsimd_state {

struct user_hwdebug_state {
__u32 dbg_info;
__u32 pad;
struct {
__u64 addr;
__u32 ctrl;
__u32 pad;
} dbg_regs[16];
};


#endif /* __ASSEMBLY__ */

#endif /* _UAPI__ASM_PTRACE_H */
36 changes: 30 additions & 6 deletions trunk/arch/arm64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ static int ptrace_hbp_set_addr(unsigned int note_type,

#define PTRACE_HBP_ADDR_SZ sizeof(u64)
#define PTRACE_HBP_CTRL_SZ sizeof(u32)
#define PTRACE_HBP_REG_OFF sizeof(u32)
#define PTRACE_HBP_PAD_SZ sizeof(u32)

static int hw_break_get(struct task_struct *target,
const struct user_regset *regset,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf)
{
unsigned int note_type = regset->core_note_type;
int ret, idx = 0, offset = PTRACE_HBP_REG_OFF, limit;
int ret, idx = 0, offset, limit;
u32 info, ctrl;
u64 addr;

Expand All @@ -389,11 +389,20 @@ static int hw_break_get(struct task_struct *target,
if (ret)
return ret;

ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &info, 0, 4);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &info, 0,
sizeof(info));
if (ret)
return ret;

/* Pad */
offset = offsetof(struct user_hwdebug_state, pad);
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, offset,
offset + PTRACE_HBP_PAD_SZ);
if (ret)
return ret;

/* (address, ctrl) registers */
offset = offsetof(struct user_hwdebug_state, dbg_regs);
limit = regset->n * regset->size;
while (count && offset < limit) {
ret = ptrace_hbp_get_addr(note_type, target, idx, &addr);
Expand All @@ -413,6 +422,13 @@ static int hw_break_get(struct task_struct *target,
if (ret)
return ret;
offset += PTRACE_HBP_CTRL_SZ;

ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
offset,
offset + PTRACE_HBP_PAD_SZ);
if (ret)
return ret;
offset += PTRACE_HBP_PAD_SZ;
idx++;
}

Expand All @@ -425,12 +441,13 @@ static int hw_break_set(struct task_struct *target,
const void *kbuf, const void __user *ubuf)
{
unsigned int note_type = regset->core_note_type;
int ret, idx = 0, offset = PTRACE_HBP_REG_OFF, limit;
int ret, idx = 0, offset, limit;
u32 ctrl;
u64 addr;

/* Resource info */
ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, 4);
/* Resource info and pad */
offset = offsetof(struct user_hwdebug_state, dbg_regs);
ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset);
if (ret)
return ret;

Expand All @@ -454,6 +471,13 @@ static int hw_break_set(struct task_struct *target,
if (ret)
return ret;
offset += PTRACE_HBP_CTRL_SZ;

ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
offset,
offset + PTRACE_HBP_PAD_SZ);
if (ret)
return ret;
offset += PTRACE_HBP_PAD_SZ;
idx++;
}

Expand Down

0 comments on commit 81c771e

Please sign in to comment.