diff options
author | Paul Clothier <Paul.Clothier@imgtec.com> | 2013-03-19 12:04:43 +0000 |
---|---|---|
committer | James Hogan <james.hogan@imgtec.com> | 2013-03-27 14:37:47 +0000 |
commit | 876d6dcdf26a2e860801ec61195e580d03f7b204 (patch) | |
tree | 33f1145d6f524c75128747c90206ea70487f3b09 /arch/metag/kernel | |
parent | 2b8660ed3bfe95523561e6d6a6f1ce91389006b1 (diff) | |
download | blackbird-op-linux-876d6dcdf26a2e860801ec61195e580d03f7b204.tar.gz blackbird-op-linux-876d6dcdf26a2e860801ec61195e580d03f7b204.zip |
metag: ptrace: Implement NT_METAG_TLS
Implement functionality to get the TLS pointer for the metag
architecture using regsets.
This provides multi-threaded debug support for GDB.
Signed-off-by: Paul Clothier <Paul.Clothier@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Diffstat (limited to 'arch/metag/kernel')
-rw-r--r-- | arch/metag/kernel/ptrace.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c index 47a8828615a5..7563628822bd 100644 --- a/arch/metag/kernel/ptrace.c +++ b/arch/metag/kernel/ptrace.c @@ -288,10 +288,36 @@ static int metag_rp_state_set(struct task_struct *target, return metag_rp_state_copyin(regs, pos, count, kbuf, ubuf); } +static int metag_tls_get(struct task_struct *target, + const struct user_regset *regset, + unsigned int pos, unsigned int count, + void *kbuf, void __user *ubuf) +{ + void __user *tls = target->thread.tls_ptr; + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); +} + +static int metag_tls_set(struct task_struct *target, + const struct user_regset *regset, + unsigned int pos, unsigned int count, + const void *kbuf, const void __user *ubuf) +{ + int ret; + void __user *tls; + + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); + if (ret) + return ret; + + target->thread.tls_ptr = tls; + return ret; +} + enum metag_regset { REGSET_GENERAL, REGSET_CBUF, REGSET_READPIPE, + REGSET_TLS, }; static const struct user_regset metag_regsets[] = { @@ -319,6 +345,14 @@ static const struct user_regset metag_regsets[] = { .get = metag_rp_state_get, .set = metag_rp_state_set, }, + [REGSET_TLS] = { + .core_note_type = NT_METAG_TLS, + .n = 1, + .size = sizeof(void *), + .align = sizeof(void *), + .get = metag_tls_get, + .set = metag_tls_set, + }, }; static const struct user_regset_view user_metag_view = { |