Line 31... |
Line 31... |
|
|
#include "server.h"
|
#include "server.h"
|
#include "regdef.h"
|
#include "regdef.h"
|
#include "linux-low.h"
|
#include "linux-low.h"
|
|
|
|
#include <asm/ptrace.h> /* For openrisc kernel ptrace register offsets */
|
|
|
#ifdef HAVE_SYS_REG_H
|
#ifdef HAVE_SYS_REG_H
|
#include <sys/reg.h>
|
#include <sys/reg.h>
|
#endif
|
#endif
|
|
|
|
|
Line 46... |
Line 48... |
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
static void
|
static void
|
init_registers_or32 ()
|
init_registers_or32 ()
|
{
|
{
|
struct reg regs_or32[] = {
|
struct reg regs_or32[] = {
|
{ "r0", 0, 32 },
|
{ "npc", PC * 8, 32 },
|
{ "sp", 32, 32 },
|
{ "sr", SR * 8, 32 },
|
{ "fp", 64, 32 },
|
{ "sp", SP * 8, 32 },
|
{ "r3", 96, 32 },
|
{ "fp", GPR2 * 8, 32 },
|
{ "r4", 128, 32 },
|
{ "r3", GPR3 * 8, 32 },
|
{ "r5", 160, 32 },
|
{ "r4", GPR4 * 8, 32 },
|
{ "r6", 192, 32 },
|
{ "r5", GPR5 * 8, 32 },
|
{ "r7", 224, 32 },
|
{ "r6", GPR6 * 8, 32 },
|
{ "r8", 256, 32 },
|
{ "r7", GPR7 * 8, 32 },
|
{ "lr", 288, 32 },
|
{ "r8", GPR8 * 8, 32 },
|
{ "r10", 320, 32 },
|
{ "lr", GPR9 * 8, 32 },
|
{ "r11", 352, 32 },
|
{ "r10", GPR10 * 8, 32 },
|
{ "r12", 384, 32 },
|
{ "r11", GPR11 * 8, 32 },
|
{ "r13", 416, 32 },
|
{ "r12", GPR12 * 8, 32 },
|
{ "r14", 448, 32 },
|
{ "r13", GPR13 * 8, 32 },
|
{ "r15", 480, 32 },
|
{ "r14", GPR14 * 8, 32 },
|
{ "r16", 512, 32 },
|
{ "r15", GPR15 * 8, 32 },
|
{ "r17", 544, 32 },
|
{ "r16", GPR16 * 8, 32 },
|
{ "r18", 576, 32 },
|
{ "r17", GPR17 * 8, 32 },
|
{ "r19", 608, 32 },
|
{ "r18", GPR18 * 8, 32 },
|
{ "r20", 640, 32 },
|
{ "r19", GPR19 * 8, 32 },
|
{ "r21", 672, 32 },
|
{ "r20", GPR20 * 8, 32 },
|
{ "r22", 704, 32 },
|
{ "r21", GPR21 * 8, 32 },
|
{ "r23", 736, 32 },
|
{ "r22", GPR22 * 8, 32 },
|
{ "r24", 768, 32 },
|
{ "r23", GPR23 * 8, 32 },
|
{ "r25", 800, 32 },
|
{ "r24", GPR24 * 8, 32 },
|
{ "r26", 832, 32 },
|
{ "r25", GPR25 * 8, 32 },
|
{ "r27", 864, 32 },
|
{ "r26", GPR26 * 8, 32 },
|
{ "r28", 896, 32 },
|
{ "r27", GPR27 * 8, 32 },
|
{ "r29", 928, 32 },
|
{ "r28", GPR28 * 8, 32 },
|
{ "r30", 960, 32 },
|
{ "r29", GPR29 * 8, 32 },
|
{ "r31", 992, 32 },
|
{ "r30", GPR30 * 8, 32 },
|
{ "ppc", 1024, 32 },
|
{ "r31", GPR31 * 8, 32 },
|
{ "npc", 1056, 32 },
|
|
{ "sr", 1088, 32 },
|
|
};
|
};
|
static const char *expedite_regs_or32[] = { "sp", "lr", "npc", 0 };
|
static const char *expedite_regs_or32[] = { "sp", "lr", "npc", 0 };
|
|
|
set_register_cache (regs_or32, sizeof (regs_or32) / sizeof (regs_or32[0]));
|
set_register_cache (regs_or32, sizeof (regs_or32) / sizeof (regs_or32[0]));
|
gdbserver_expedite_regs = expedite_regs_or32;
|
gdbserver_expedite_regs = expedite_regs_or32;
|
gdbserver_xmltarget = NULL;
|
gdbserver_xmltarget = NULL;
|
}
|
}
|
|
|
|
|
/*! OpenRISC has 32 general purpose registers followed by PPC, NPC and SR in
|
/*! OpenRISC Linux ptrace provides NPC, SR, then GPRS 1 to 31 */
|
that order. */
|
#define or32_num_regs (2 + 31)
|
#define or32_num_regs (32 + 3)
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
/*!Provide the ptrace "address" of a register.
|
/*!Provide the ptrace "address" of a register.
|
|
*/
|
Not properly supported by uClibc/Linux just yet. The register offsets are
|
|
pure guesswork. */
|
|
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
static int or32_regmap[] = {
|
static int or32_regmap[] = {
|
#ifdef PT_R0
|
#ifdef PC
|
PT_R0, PT_SP, PT_FP, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7,
|
PC , SR , SP , GPR2 , GPR3 , GPR4 , GPR5 , GPR6 ,
|
PT_R8, PT_LR, PT_R10, PT_R11, PT_R12, PT_R13, PT_R14, PT_R15,
|
GPR7 , GPR8 , GPR9 , GPR10, GPR11, GPR12, GPR13, GPR14,
|
PT_R16, PT_R17, PT_R18, PT_R19, PT_R20, PT_R21, PT_R22, PT_R23,
|
GPR15, GPR16, GPR17, GPR18, GPR19, GPR20, GPR21, GPR22,
|
PT_R24, PT_R25, PT_R26, PT_R27, PT_R28, PT_R29, PT_R30, PT_R31,
|
GPR23, GPR24, GPR25, GPR26, GPR27, GPR28, GPR29, GPR30,
|
PT_PPC, PT_NPC, PT_SR
|
GPR31
|
#else
|
#else
|
4 * 0, 4 * 1, 4 * 2, 4 * 3, 4 * 4, 4 * 5, 4 * 6, 4 * 7,
|
4 * 0, 4 * 1, 4 * 2, 4 * 3, 4 * 4, 4 * 5, 4 * 6, 4 * 7,
|
4 * 8, 4 * 9, 4 * 10, 4 * 11, 4 * 12, 4 * 13, 4 * 14, 4 * 15,
|
4 * 8, 4 * 9, 4 * 10, 4 * 11, 4 * 12, 4 * 13, 4 * 14, 4 * 15,
|
4 * 16, 4 * 17, 4 * 18, 4 * 19, 4 * 20, 4 * 21, 4 * 22, 4 * 23,
|
4 * 16, 4 * 17, 4 * 18, 4 * 19, 4 * 20, 4 * 21, 4 * 22, 4 * 23,
|
4 * 24, 4 * 25, 4 * 26, 4 * 27, 4 * 28, 4 * 29, 4 * 30, 4 * 31,
|
4 * 24, 4 * 25, 4 * 26, 4 * 27, 4 * 28, 4 * 29, 4 * 30, 4 * 31,
|
Line 192... |
Line 189... |
static void
|
static void
|
or32_set_pc (struct regcache *regcache,
|
or32_set_pc (struct regcache *regcache,
|
CORE_ADDR pc)
|
CORE_ADDR pc)
|
{
|
{
|
unsigned long int npc = pc;
|
unsigned long int npc = pc;
|
supply_register_by_name (regcache, "pc", &npc);
|
supply_register_by_name (regcache, "npc", &npc);
|
|
|
} /* or32_set_pc () */
|
} /* or32_set_pc () */
|
|
|
|
|
/*! The value of a breakpoint instruction (l.trap 1). */
|
/*! The value of a breakpoint instruction (l.trap 1). */
|