Commit ff9f3d7a authored by Qing Zhang's avatar Qing Zhang Committed by Huacai Chen

LoongArch: Adjust user_watch_state for explicit alignment

This is done in order to easily calculate the number of breakpoints in
hw_break_get()/hw_break_set().
Signed-off-by: default avatarQing Zhang <zhangqing@loongson.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 93eb1215
...@@ -47,11 +47,12 @@ struct user_fp_state { ...@@ -47,11 +47,12 @@ struct user_fp_state {
}; };
struct user_watch_state { struct user_watch_state {
uint16_t dbg_info; uint64_t dbg_info;
struct { struct {
uint64_t addr; uint64_t addr;
uint64_t mask; uint64_t mask;
uint32_t ctrl; uint32_t ctrl;
uint32_t pad;
} dbg_regs[8]; } dbg_regs[8];
}; };
......
...@@ -391,10 +391,10 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned int note_type, ...@@ -391,10 +391,10 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned int note_type,
return 0; return 0;
} }
static int ptrace_hbp_get_resource_info(unsigned int note_type, u16 *info) static int ptrace_hbp_get_resource_info(unsigned int note_type, u64 *info)
{ {
u8 num; u8 num;
u16 reg = 0; u64 reg = 0;
switch (note_type) { switch (note_type) {
case NT_LOONGARCH_HW_BREAK: case NT_LOONGARCH_HW_BREAK:
...@@ -524,15 +524,16 @@ static int ptrace_hbp_set_addr(unsigned int note_type, ...@@ -524,15 +524,16 @@ static int ptrace_hbp_set_addr(unsigned int note_type,
return modify_user_hw_breakpoint(bp, &attr); return modify_user_hw_breakpoint(bp, &attr);
} }
#define PTRACE_HBP_CTRL_SZ sizeof(u32)
#define PTRACE_HBP_ADDR_SZ sizeof(u64) #define PTRACE_HBP_ADDR_SZ sizeof(u64)
#define PTRACE_HBP_MASK_SZ sizeof(u64) #define PTRACE_HBP_MASK_SZ sizeof(u64)
#define PTRACE_HBP_CTRL_SZ sizeof(u32)
#define PTRACE_HBP_PAD_SZ sizeof(u32)
static int hw_break_get(struct task_struct *target, static int hw_break_get(struct task_struct *target,
const struct user_regset *regset, const struct user_regset *regset,
struct membuf to) struct membuf to)
{ {
u16 info; u64 info;
u32 ctrl; u32 ctrl;
u64 addr, mask; u64 addr, mask;
int ret, idx = 0; int ret, idx = 0;
...@@ -562,6 +563,7 @@ static int hw_break_get(struct task_struct *target, ...@@ -562,6 +563,7 @@ static int hw_break_get(struct task_struct *target,
membuf_store(&to, addr); membuf_store(&to, addr);
membuf_store(&to, mask); membuf_store(&to, mask);
membuf_store(&to, ctrl); membuf_store(&to, ctrl);
membuf_zero(&to, sizeof(u32));
idx++; idx++;
} }
...@@ -620,6 +622,11 @@ static int hw_break_set(struct task_struct *target, ...@@ -620,6 +622,11 @@ static int hw_break_set(struct task_struct *target,
if (ret) if (ret)
return ret; return ret;
offset += PTRACE_HBP_CTRL_SZ; offset += PTRACE_HBP_CTRL_SZ;
user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
offset, offset + PTRACE_HBP_PAD_SZ);
offset += PTRACE_HBP_PAD_SZ;
idx++; idx++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment