Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360645
b: refs/heads/master
c: bc3966b
h: refs/heads/master
i:
  360643: d6cb6b1
v: v3
  • Loading branch information
James Hogan committed Mar 2, 2013
1 parent 574cb33 commit c4c43b4
Show file tree
Hide file tree
Showing 5 changed files with 556 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29dd78cf0b526d24063364a8c634b3e92514c1a2
refs/heads/master: bc3966bf1583a6c22b76397535174445c43952de
60 changes: 60 additions & 0 deletions trunk/arch/metag/include/asm/ptrace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#ifndef _METAG_PTRACE_H
#define _METAG_PTRACE_H

#include <linux/compiler.h>
#include <uapi/asm/ptrace.h>
#include <asm/tbx.h>

#ifndef __ASSEMBLY__

/* this struct defines the way the registers are stored on the
stack during a system call. */

struct pt_regs {
TBICTX ctx;
TBICTXEXTCB0 extcb0[5];
};

#define user_mode(regs) (((regs)->ctx.SaveMask & TBICTX_PRIV_BIT) > 0)

#define instruction_pointer(regs) ((unsigned long)(regs)->ctx.CurrPC)
#define profile_pc(regs) instruction_pointer(regs)

#define task_pt_regs(task) \
((struct pt_regs *)(task_stack_page(task) + \
sizeof(struct thread_info)))

#define current_pt_regs() \
((struct pt_regs *)((char *)current_thread_info() + \
sizeof(struct thread_info)))

int syscall_trace_enter(struct pt_regs *regs);
void syscall_trace_leave(struct pt_regs *regs);

/* copy a struct user_gp_regs out to user */
int metag_gp_regs_copyout(const struct pt_regs *regs,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf);
/* copy a struct user_gp_regs in from user */
int metag_gp_regs_copyin(struct pt_regs *regs,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf);
/* copy a struct user_cb_regs out to user */
int metag_cb_regs_copyout(const struct pt_regs *regs,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf);
/* copy a struct user_cb_regs in from user */
int metag_cb_regs_copyin(struct pt_regs *regs,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf);
/* copy a struct user_rp_state out to user */
int metag_rp_state_copyout(const struct pt_regs *regs,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf);
/* copy a struct user_rp_state in from user */
int metag_rp_state_copyin(struct pt_regs *regs,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf);

#endif /* __ASSEMBLY__ */
#endif /* _METAG_PTRACE_H */
113 changes: 113 additions & 0 deletions trunk/arch/metag/include/uapi/asm/ptrace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#ifndef _UAPI_METAG_PTRACE_H
#define _UAPI_METAG_PTRACE_H

#ifndef __ASSEMBLY__

/*
* These are the layouts of the regsets returned by the GETREGSET ptrace call
*/

/* user_gp_regs::status */

/* CBMarker bit (indicates catch state / catch replay) */
#define USER_GP_REGS_STATUS_CATCH_BIT (1 << 22)
#define USER_GP_REGS_STATUS_CATCH_S 22
/* LSM_STEP field (load/store multiple step) */
#define USER_GP_REGS_STATUS_LSM_STEP_BITS (0x7 << 8)
#define USER_GP_REGS_STATUS_LSM_STEP_S 8
/* SCC bit (indicates split 16x16 condition flags) */
#define USER_GP_REGS_STATUS_SCC_BIT (1 << 4)
#define USER_GP_REGS_STATUS_SCC_S 4

/* normal condition flags */
/* CF_Z bit (Zero flag) */
#define USER_GP_REGS_STATUS_CF_Z_BIT (1 << 3)
#define USER_GP_REGS_STATUS_CF_Z_S 3
/* CF_N bit (Negative flag) */
#define USER_GP_REGS_STATUS_CF_N_BIT (1 << 2)
#define USER_GP_REGS_STATUS_CF_N_S 2
/* CF_V bit (oVerflow flag) */
#define USER_GP_REGS_STATUS_CF_V_BIT (1 << 1)
#define USER_GP_REGS_STATUS_CF_V_S 1
/* CF_C bit (Carry flag) */
#define USER_GP_REGS_STATUS_CF_C_BIT (1 << 0)
#define USER_GP_REGS_STATUS_CF_C_S 0

/* split 16x16 condition flags */
/* SCF_LZ bit (Low Zero flag) */
#define USER_GP_REGS_STATUS_SCF_LZ_BIT (1 << 3)
#define USER_GP_REGS_STATUS_SCF_LZ_S 3
/* SCF_HZ bit (High Zero flag) */
#define USER_GP_REGS_STATUS_SCF_HZ_BIT (1 << 2)
#define USER_GP_REGS_STATUS_SCF_HZ_S 2
/* SCF_HC bit (High Carry flag) */
#define USER_GP_REGS_STATUS_SCF_HC_BIT (1 << 1)
#define USER_GP_REGS_STATUS_SCF_HC_S 1
/* SCF_LC bit (Low Carry flag) */
#define USER_GP_REGS_STATUS_SCF_LC_BIT (1 << 0)
#define USER_GP_REGS_STATUS_SCF_LC_S 0

/**
* struct user_gp_regs - User general purpose registers
* @dx: GP data unit regs (dx[reg][unit] = D{unit:0-1}.{reg:0-7})
* @ax: GP address unit regs (ax[reg][unit] = A{unit:0-1}.{reg:0-3})
* @pc: PC register
* @status: TXSTATUS register (condition flags, LSM_STEP etc)
* @rpt: TXRPT registers (branch repeat counter)
* @bpobits: TXBPOBITS register ("branch prediction other" bits)
* @mode: TXMODE register
* @_pad1: Reserved padding to make sizeof obviously 64bit aligned
*
* This is the user-visible general purpose register state structure.
*
* It can be accessed through PTRACE_GETREGSET with NT_PRSTATUS.
*
* It is also used in the signal context.
*/
struct user_gp_regs {
unsigned long dx[8][2];
unsigned long ax[4][2];
unsigned long pc;
unsigned long status;
unsigned long rpt;
unsigned long bpobits;
unsigned long mode;
unsigned long _pad1;
};

/**
* struct user_cb_regs - User catch buffer registers
* @flags: TXCATCH0 register (fault flags)
* @addr: TXCATCH1 register (fault address)
* @data: TXCATCH2 and TXCATCH3 registers (low and high data word)
*
* This is the user-visible catch buffer register state structure containing
* information about a failed memory access, and allowing the access to be
* modified and replayed.
*
* It can be accessed through PTRACE_GETREGSET with NT_METAG_CBUF.
*/
struct user_cb_regs {
unsigned long flags;
unsigned long addr;
unsigned long long data;
};

/**
* struct user_rp_state - User read pipeline state
* @entries: Read pipeline entries
* @mask: Mask of valid pipeline entries (RPMask from TXDIVTIME register)
*
* This is the user-visible read pipeline state structure containing the entries
* currently in the read pipeline and the mask of valid entries.
*
* It can be accessed through PTRACE_GETREGSET with NT_METAG_RPIPE.
*/
struct user_rp_state {
unsigned long long entries[6];
unsigned long mask;
};

#endif /* __ASSEMBLY__ */

#endif /* _UAPI_METAG_PTRACE_H */
Loading

0 comments on commit c4c43b4

Please sign in to comment.