URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/or1k/trunk/gdb-5.0/gdb/config/a29k
- from Rev 107 to Rev 1765
- ↔ Reverse comparison
Rev 107 → Rev 1765
/a29k-kern.mt
0,0 → 1,13
# Target: Remote AMD 29000 that runs Unix kernel on NYU Ultra3 processor board |
|
# This builds a gdb that should run on a host (we use sun3os4) that |
# then communicates over the serial line to either an Adapt or MiniMon, |
# for use in debugging Unix kernels. |
# As compared to ordinary remote 29K debugging, this changes the register |
# numbering a bit, to hold kernel regs, and adds support for looking at |
# the upage. |
|
TDEPFILES= a29k-tdep.o remote-mm.o remote-adapt.o |
TM_FILE= tm-ultra3.h |
|
MT_CFLAGS = -DKERNEL_DEBUGGING -DNO_HIF_SUPPORT |
/vx29k.mt
0,0 → 1,4
# Target: AMD 29k running VxWorks |
TDEPFILES= a29k-tdep.o remote-vx.o remote-vx29k.o xdr_ld.o xdr_ptrace.o xdr_rdb.o |
TM_FILE= tm-vx29k.h |
MT_CFLAGS = -DNO_HIF_SUPPORT |
/xm-ultra3.h
0,0 → 1,53
/* Host definitions for GDB running on an a29k NYU Ultracomputer |
Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. |
Contributed by David Wood (wood@lab.ultra.nyu.edu). |
|
This file is part of GDB. |
|
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
|
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, |
Boston, MA 02111-1307, USA. */ |
|
/* Here at NYU we have what we call an ULTRA3 PE board. So |
ifdefs for ULTRA3 are my doing. At this point in time, |
I don't know of any other Unixi running on the a29k. */ |
|
#define HOST_BYTE_ORDER BIG_ENDIAN |
|
#define HAVE_WAIT_STRUCT |
|
#ifndef L_SET |
#define L_SET 0 /* set the seek pointer */ |
#define L_INCR 1 /* increment the seek pointer */ |
#define L_XTND 2 /* extend the file size */ |
#endif |
|
#ifndef O_RDONLY |
#define O_RDONLY 0 |
#define O_WRONLY 1 |
#define O_RDWR 2 |
#endif |
|
#ifndef F_OK |
#define R_OK 4 |
#define W_OK 2 |
#define X_OK 1 |
#define F_OK 0 |
#endif |
|
/* System doesn't provide siginterrupt(). */ |
#define NO_SIGINTERRUPT |
|
/* System uses a `short' to hold a process group ID. */ |
#define SHORT_PGRP |
/a29k-udi.mt
0,0 → 1,5
# Target: AMD 29000 on EB29K board over a serial line |
TDEPFILES= a29k-tdep.o remote-udi.o udip2soc.o udr.o udi2go32.o |
TM_FILE= tm-a29k.h |
|
MT_CFLAGS = $(HOST_IPC) |
/a29k.mt
0,0 → 1,5
# Target: AMD 29000 |
TDEPFILES= a29k-tdep.o remote-eb.o remote-adapt.o |
TM_FILE= tm-a29k.h |
|
MT_CFLAGS = -DNO_HIF_SUPPORT |
/tm-vx29k.h
0,0 → 1,227
/* Target machine description for VxWorks on the 29k, for GDB, the GNU debugger. |
Copyright 1994, 1999 Free Software Foundation, Inc. |
Contributed by Cygnus Support. |
|
This file is part of GDB. |
|
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
|
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, |
Boston, MA 02111-1307, USA. */ |
|
#include "a29k/tm-a29k.h" |
#include "tm-vxworks.h" |
|
/* Number of registers in a ptrace_getregs call. */ |
|
#define VX_NUM_REGS (NUM_REGS) |
|
/* Number of registers in a ptrace_getfpregs call. */ |
|
/* #define VX_SIZE_FPREGS */ |
|
/* This is almost certainly the wrong place for this: */ |
#define LR2_REGNUM 34 |
|
|
/* Vxworks has its own CALL_DUMMY since it manages breakpoints in the kernel */ |
|
#undef CALL_DUMMY |
|
/* Replace the breakpoint instruction in the CALL_DUMMY with a nop. |
For Vxworks, the breakpoint is set and deleted by calls to |
CALL_DUMMY_BREAK_SET and CALL_DUMMY_BREAK_DELETE. */ |
|
#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER |
#define CALL_DUMMY {0x0400870f,\ |
0x36008200|(MSP_HW_REGNUM), \ |
0x15000040|(MSP_HW_REGNUM<<8)|(MSP_HW_REGNUM<<16), \ |
0x03ff80ff, 0x02ff80ff, 0xc8008080, 0x70400101, 0x70400101} |
#else /* Byte order differs. */ |
#define CALL_DUMMY {0x0f870004,\ |
0x00820036|(MSP_HW_REGNUM << 24), \ |
0x40000015|(MSP_HW_REGNUM<<8)|(MSP_HW_REGNUM<<16), \ |
0xff80ff03, 0xff80ff02, 0x808000c8, 0x01014070, 0x01014070} |
#endif /* Byte order differs. */ |
|
|
/* For the basic CALL_DUMMY definitions, see "tm-29k.h." We use the |
same CALL_DUMMY code, but define FIX_CALL_DUMMY (and related macros) |
locally to handle remote debugging of VxWorks targets. The difference |
is in the setting and clearing of the breakpoint at the end of the |
CALL_DUMMY code fragment; under VxWorks, we can't simply insert a |
breakpoint instruction into the code, since that would interfere with |
the breakpoint management mechanism on the target. |
Note that CALL_DUMMY is a piece of code that is used to call any C function |
thru VxGDB */ |
|
/* The offset of the instruction within the CALL_DUMMY code where we |
want the inferior to stop after the function call has completed. |
call_function_by_hand () sets a breakpoint here (via CALL_DUMMY_BREAK_SET), |
which POP_FRAME later deletes (via CALL_DUMMY_BREAK_DELETE). */ |
|
#define CALL_DUMMY_STOP_OFFSET (7 * 4) |
|
/* The offset of the first instruction of the CALL_DUMMY code fragment |
relative to the frame pointer for a dummy frame. This is equal to |
the size of the CALL_DUMMY plus the arg_slop area size (see the diagram |
in "tm-29k.h"). */ |
/* PAD : the arg_slop area size doesn't appear to me to be useful since, the |
call dummy code no longer modify the msp. See below. This must be checked. */ |
|
#define CALL_DUMMY_OFFSET_IN_FRAME (CALL_DUMMY_LENGTH + 16 * 4) |
|
/* Insert the specified number of args and function address |
into a CALL_DUMMY sequence stored at DUMMYNAME, replace the third |
instruction (add msp, msp, 16*4) with a nop, and leave the final nop. |
We can't keep using a CALL_DUMMY that modify the msp since, for VxWorks, |
CALL_DUMMY is stored in the Memory Stack. Adding 16 words to the msp |
would then make possible for the inferior to overwrite the CALL_DUMMY code, |
thus creating a lot of trouble when exiting the inferior to come back in |
a CALL_DUMMY code that no longer exists... Furthermore, ESF are also stored |
from the msp in the memory stack. If msp is set higher than the dummy code, |
an ESF may clobber this code. */ |
|
#if TARGET_BYTE_ORDER == BIG_ENDIAN |
#define NOP_INSTR 0x70400101 |
#else /* Target is little endian */ |
#define NOP_INSTR 0x01014070 |
#endif |
|
#undef FIX_CALL_DUMMY |
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ |
{ \ |
*(int *)((char *)dummyname + 8) = NOP_INSTR; \ |
STUFF_I16((char *)dummyname + CONST_INSN, fun); \ |
STUFF_I16((char *)dummyname + CONST_INSN + 4, fun >> 16); \ |
} |
|
/* For VxWorks, CALL_DUMMY must be stored in the stack of the task that is |
being debugged and executed "in the context of" this task */ |
|
#undef CALL_DUMMY_LOCATION |
#define CALL_DUMMY_LOCATION ON_STACK |
|
/* Set or delete a breakpoint at the location within a CALL_DUMMY code |
fragment where we want the target program to stop after the function |
call is complete. CALL_DUMMY_ADDR is the address of the first |
instruction in the CALL_DUMMY. DUMMY_FRAME_ADDR is the value of the |
frame pointer in the dummy frame. |
|
NOTE: in the both of the following definitions, we take advantage of |
knowledge of the implementation of the target breakpoint operation, |
in that we pass a null pointer as the second argument. It seems |
reasonable to assume that any target requiring the use of |
CALL_DUMMY_BREAK_{SET,DELETE} will not store the breakpoint |
shadow contents in GDB; in any case, this assumption is vaild |
for all VxWorks-related targets. */ |
|
#define CALL_DUMMY_BREAK_SET(call_dummy_addr) \ |
target_insert_breakpoint ((call_dummy_addr) + CALL_DUMMY_STOP_OFFSET, \ |
(char *) 0) |
|
#define CALL_DUMMY_BREAK_DELETE(dummy_frame_addr) \ |
target_remove_breakpoint ((dummy_frame_addr) - (CALL_DUMMY_OFFSET_IN_FRAME \ |
- CALL_DUMMY_STOP_OFFSET), \ |
(char *) 0) |
|
/* Return nonzero if the pc is executing within a CALL_DUMMY frame. */ |
|
#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \ |
((pc) >= (sp) \ |
&& (pc) <= (sp) + CALL_DUMMY_OFFSET_IN_FRAME + CALL_DUMMY_LENGTH) |
|
/* Defining this prevents us from trying to pass a structure-valued argument |
to a function called via the CALL_DUMMY mechanism. This is not handled |
properly in call_function_by_hand (), and the fix might require re-writing |
the CALL_DUMMY handling for all targets (at least, a clean solution |
would probably require this). Arguably, this should go in "tm-29k.h" |
rather than here. */ |
|
#define STRUCT_VAL_ARGS_UNSUPPORTED |
|
#define BKPT_OFFSET (7 * 4) |
#define BKPT_INSTR 0x72500101 |
|
#undef FIX_CALL_DUMMY |
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ |
{\ |
STUFF_I16((char *)dummyname + CONST_INSN, fun);\ |
STUFF_I16((char *)dummyname + CONST_INSN + 4, fun >> 16);\ |
*(int *)((char *)dummyname + BKPT_OFFSET) = BKPT_INSTR;\ |
} |
|
|
/* Offsets into jmp_buf. They are derived from VxWorks' REG_SET struct |
(see VxWorks' setjmp.h). Note that Sun2, Sun3 and SunOS4 and VxWorks have |
different REG_SET structs, hence different layouts for the jmp_buf struct. |
Only JB_PC is needed for getting the saved PC value. */ |
|
#define JB_ELEMENT_SIZE 4 /* size of each element in jmp_buf */ |
#define JB_PC 3 /* offset of pc (pc1) in jmp_buf */ |
|
/* Figure out where the longjmp will land. We expect that we have just entered |
longjmp and haven't yet setup the stack frame, so the args are still in the |
output regs. lr2 (LR2_REGNUM) points at the jmp_buf structure from which we |
extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. |
This routine returns true on success */ |
|
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) |
extern int get_longjmp_target PARAMS ((CORE_ADDR *)); |
|
/* VxWorks adjusts the PC after a breakpoint has been hit. */ |
|
#undef DECR_PC_AFTER_BREAK |
#define DECR_PC_AFTER_BREAK 0 |
|
/* Do whatever promotions are appropriate on a value being returned |
from a function. VAL is the user-supplied value, and FUNC_TYPE |
is the return type of the function if known, else 0. |
|
For the Am29k, as far as I understand, if the function return type is known, |
cast the value to that type; otherwise, ensure that integer return values |
fill all of gr96. |
|
This definition really belongs in "tm-29k.h", since it applies |
to most Am29K-based systems; but once moved into that file, it might |
need to be redefined for all Am29K-based targets that also redefine |
STORE_RETURN_VALUE. For now, to be safe, we define it here. */ |
|
#define PROMOTE_RETURN_VALUE(val, func_type) \ |
do { \ |
if (func_type) \ |
val = value_cast (func_type, val); \ |
if ((TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT \ |
|| TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_ENUM) \ |
&& TYPE_LENGTH (VALUE_TYPE (val)) < REGISTER_RAW_SIZE (0)) \ |
val = value_cast (builtin_type_int, val); \ |
} while (0) |
|
extern int vx29k_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); |
#define FRAME_CHAIN_VALID(chain, thisframe) vx29k_frame_chain_valid (chain, thisframe) |
|
extern CORE_ADDR frame_saved_call_site (); |
|
#undef PREPARE_TO_INIT_FRAME_INFO |
#define PREPARE_TO_INIT_FRAME_INFO(fci) do { \ |
long current_msp = read_register (MSP_REGNUM); \ |
if (PC_IN_CALL_DUMMY (fci->pc, current_msp, 0)) \ |
{ \ |
fci->rsize = DUMMY_FRAME_RSIZE; \ |
fci->msize = 0; \ |
fci->saved_msp = \ |
read_register_stack_integer (fci->frame + DUMMY_FRAME_RSIZE - 4, 4); \ |
fci->flags |= (TRANSPARENT|MFP_USED); \ |
return; \ |
} \ |
} while (0) |
/nm-ultra3.h
0,0 → 1,27
/* Host definitions for GDB running on an a29k NYU Ultracomputer |
Copyright (C) 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. |
Contributed by David Wood (wood@lab.ultra.nyu.edu). |
|
This file is part of GDB. |
|
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
|
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, |
Boston, MA 02111-1307, USA. */ |
|
/* If we ever *do* end up using the standard fetch_inferior_registers, |
this is the right value for U_REGS_OFFSET. */ |
#define U_REGS_OFFSET 0 |
|
/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ |
#define FETCH_INFERIOR_REGISTERS |
/ultra3.mt
0,0 → 1,6
# Target: AMD 29000 running Unix on New York University processor board |
TDEPFILES= a29k-tdep.o |
TM_FILE= tm-ultra3.h |
|
# SYM1 is some OS they have. |
MT_CFLAGS = -DSYM1 |
/tm-a29k.h
0,0 → 1,716
/* Parameters for target machine AMD 29000, for GDB, the GNU debugger. |
Copyright 1990, 1991, 1993, 1994 Free Software Foundation, Inc. |
Contributed by Cygnus Support. Written by Jim Kingdon. |
|
This file is part of GDB. |
|
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
|
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, |
Boston, MA 02111-1307, USA. */ |
|
/* Parameters for an EB29K (a board which plugs into a PC and is |
accessed through EBMON software running on the PC, which we |
use as we'd use a remote stub (see remote-eb.c). |
|
If gdb is ported to other a29k machines/systems, the |
machine/system-specific parts should be removed from this file (a |
la tm-m68k.h). */ |
|
/* Byte order is configurable, but this machine runs big-endian. */ |
#define TARGET_BYTE_ORDER BIG_ENDIAN |
|
/* Floating point uses IEEE representations. */ |
#define IEEE_FLOAT |
|
/* Recognize our magic number. */ |
#define BADMAG(x) ((x).f_magic != 0572) |
|
/* Offset from address of function to start of its code. |
Zero on most machines. */ |
|
#define FUNCTION_START_OFFSET 0 |
|
/* Advance PC across any function entry prologue instructions |
to reach some "real" code. */ |
|
#define SKIP_PROLOGUE(pc) (a29k_skip_prologue (pc)) |
CORE_ADDR a29k_skip_prologue (); |
|
/* Immediately after a function call, return the saved pc. |
Can't go through the frames for this because on some machines |
the new frame is not set up until the new function executes |
some instructions. */ |
|
#define SAVED_PC_AFTER_CALL(frame) ((frame->flags & TRANSPARENT_FRAME) \ |
? read_register (TPC_REGNUM) \ |
: read_register (LR0_REGNUM)) |
|
/* Stack grows downward. */ |
|
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) |
|
/* Stack must be aligned on 32-bit boundaries when synthesizing |
function calls. */ |
|
#define STACK_ALIGN(ADDR) (((ADDR) + 3) & ~3) |
|
/* Sequence of bytes for breakpoint instruction. */ |
/* ASNEQ 0x50, gr1, gr1 |
The trap number 0x50 is chosen arbitrarily. |
We let the command line (or previously included files) override this |
setting. */ |
#ifndef BREAKPOINT |
#if TARGET_BYTE_ORDER == BIG_ENDIAN |
#define BREAKPOINT {0x72, 0x50, 0x01, 0x01} |
#else /* Target is little-endian. */ |
#define BREAKPOINT {0x01, 0x01, 0x50, 0x72} |
#endif /* Target is little-endian. */ |
#endif /* BREAKPOINT */ |
|
/* Amount PC must be decremented by after a breakpoint. |
This is often the number of bytes in BREAKPOINT |
but not always. */ |
|
#define DECR_PC_AFTER_BREAK 0 |
|
/* Say how long (ordinary) registers are. This is a piece of bogosity |
used in push_word and a few other places; REGISTER_RAW_SIZE is the |
real way to know how big a register is. */ |
|
#define REGISTER_SIZE 4 |
|
/* Allow the register declarations here to be overridden for remote |
kernel debugging. */ |
#if !defined (REGISTER_NAMES) |
|
/* Number of machine registers */ |
|
#define NUM_REGS 205 |
|
/* Initializer for an array of names of registers. |
There should be NUM_REGS strings in this initializer. |
|
FIXME, add floating point registers and support here. |
|
Also note that this list does not attempt to deal with kernel |
debugging (in which the first 32 registers are gr64-gr95). */ |
|
#define REGISTER_NAMES \ |
{"gr96", "gr97", "gr98", "gr99", "gr100", "gr101", "gr102", "gr103", "gr104", \ |
"gr105", "gr106", "gr107", "gr108", "gr109", "gr110", "gr111", "gr112", \ |
"gr113", "gr114", "gr115", "gr116", "gr117", "gr118", "gr119", "gr120", \ |
"gr121", "gr122", "gr123", "gr124", "gr125", "gr126", "gr127", \ |
"lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", "lr8", "lr9", \ |
"lr10", "lr11", "lr12", "lr13", "lr14", "lr15", "lr16", "lr17", "lr18", \ |
"lr19", "lr20", "lr21", "lr22", "lr23", "lr24", "lr25", "lr26", "lr27", \ |
"lr28", "lr29", "lr30", "lr31", "lr32", "lr33", "lr34", "lr35", "lr36", \ |
"lr37", "lr38", "lr39", "lr40", "lr41", "lr42", "lr43", "lr44", "lr45", \ |
"lr46", "lr47", "lr48", "lr49", "lr50", "lr51", "lr52", "lr53", "lr54", \ |
"lr55", "lr56", "lr57", "lr58", "lr59", "lr60", "lr61", "lr62", "lr63", \ |
"lr64", "lr65", "lr66", "lr67", "lr68", "lr69", "lr70", "lr71", "lr72", \ |
"lr73", "lr74", "lr75", "lr76", "lr77", "lr78", "lr79", "lr80", "lr81", \ |
"lr82", "lr83", "lr84", "lr85", "lr86", "lr87", "lr88", "lr89", "lr90", \ |
"lr91", "lr92", "lr93", "lr94", "lr95", "lr96", "lr97", "lr98", "lr99", \ |
"lr100", "lr101", "lr102", "lr103", "lr104", "lr105", "lr106", "lr107", \ |
"lr108", "lr109", "lr110", "lr111", "lr112", "lr113", "lr114", "lr115", \ |
"lr116", "lr117", "lr118", "lr119", "lr120", "lr121", "lr122", "lr123", \ |
"lr124", "lr125", "lr126", "lr127", \ |
"AI0", "AI1", "AI2", "AI3", "AI4", "AI5", "AI6", "AI7", "AI8", "AI9", \ |
"AI10", "AI11", "AI12", "AI13", "AI14", "AI15", "FP", \ |
"bp", "fc", "cr", "q", \ |
"vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr", \ |
"pc0", "pc1", "pc2", "mmu", "lru", "fpe", "inte", "fps", "exo", "gr1", \ |
"alu", "ipc", "ipa", "ipb" } |
|
/* |
* Converts an sdb register number to an internal gdb register number. |
* Currently under epi, gr96->0...gr127->31...lr0->32...lr127->159, or... |
* gr64->0...gr95->31, lr0->32...lr127->159. |
*/ |
#define SDB_REG_TO_REGNUM(value) \ |
(((value) >= 96 && (value) <= 127) ? ((value) - 96) : \ |
((value) >= 128 && (value) <= 255) ? ((value) - 128 + LR0_REGNUM) : \ |
(value)) |
|
/* |
* Provide the processor register numbers of some registers that are |
* expected/written in instructions that might change under different |
* register sets. Namely, gcc can compile (-mkernel-registers) so that |
* it uses gr64-gr95 in stead of gr96-gr127. |
*/ |
#define MSP_HW_REGNUM 125 /* gr125 */ |
#define RAB_HW_REGNUM 126 /* gr126 */ |
|
/* Convert Processor Special register #x to REGISTER_NAMES register # */ |
#define SR_REGNUM(x) \ |
((x) < 15 ? VAB_REGNUM + (x) \ |
: (x) >= 128 && (x) < 131 ? IPC_REGNUM + (x) - 128 \ |
: (x) == 131 ? Q_REGNUM \ |
: (x) == 132 ? ALU_REGNUM \ |
: (x) >= 133 && (x) < 136 ? BP_REGNUM + (x) - 133 \ |
: (x) >= 160 && (x) < 163 ? FPE_REGNUM + (x) - 160 \ |
: (x) == 164 ? EXO_REGNUM \ |
: (error ("Internal error in SR_REGNUM"), 0)) |
#define GR96_REGNUM 0 |
|
/* Define the return register separately, so it can be overridden for |
kernel procedure calling conventions. */ |
#define RETURN_REGNUM GR96_REGNUM |
#define GR1_REGNUM 200 |
/* This needs to be the memory stack pointer, not the register stack pointer, |
to make call_function work right. */ |
#define SP_REGNUM MSP_REGNUM |
#define FP_REGNUM 33 /* lr1 */ |
|
/* Return register for transparent calling convention (gr122). */ |
#define TPC_REGNUM (122 - 96 + GR96_REGNUM) |
|
/* Large Return Pointer (gr123). */ |
#define LRP_REGNUM (123 - 96 + GR96_REGNUM) |
|
/* Static link pointer (gr124). */ |
#define SLP_REGNUM (124 - 96 + GR96_REGNUM) |
|
/* Memory Stack Pointer (gr125). */ |
#define MSP_REGNUM (125 - 96 + GR96_REGNUM) |
|
/* Register allocate bound (gr126). */ |
#define RAB_REGNUM (126 - 96 + GR96_REGNUM) |
|
/* Register Free Bound (gr127). */ |
#define RFB_REGNUM (127 - 96 + GR96_REGNUM) |
|
/* Register Stack Pointer. */ |
#define RSP_REGNUM GR1_REGNUM |
#define LR0_REGNUM 32 |
#define BP_REGNUM 177 |
#define FC_REGNUM 178 |
#define CR_REGNUM 179 |
#define Q_REGNUM 180 |
#define VAB_REGNUM 181 |
#define OPS_REGNUM (VAB_REGNUM + 1) |
#define CPS_REGNUM (VAB_REGNUM + 2) |
#define CFG_REGNUM (VAB_REGNUM + 3) |
#define CHA_REGNUM (VAB_REGNUM + 4) |
#define CHD_REGNUM (VAB_REGNUM + 5) |
#define CHC_REGNUM (VAB_REGNUM + 6) |
#define RBP_REGNUM (VAB_REGNUM + 7) |
#define TMC_REGNUM (VAB_REGNUM + 8) |
#define TMR_REGNUM (VAB_REGNUM + 9) |
#define NPC_REGNUM (VAB_REGNUM + 10) /* pc0 */ |
#define PC_REGNUM (VAB_REGNUM + 11) /* pc1 */ |
#define PC2_REGNUM (VAB_REGNUM + 12) |
#define MMU_REGNUM (VAB_REGNUM + 13) |
#define LRU_REGNUM (VAB_REGNUM + 14) |
#define FPE_REGNUM (VAB_REGNUM + 15) |
#define INTE_REGNUM (VAB_REGNUM + 16) |
#define FPS_REGNUM (VAB_REGNUM + 17) |
#define EXO_REGNUM (VAB_REGNUM + 18) |
/* gr1 is defined above as 200 = VAB_REGNUM + 19 */ |
#define ALU_REGNUM (VAB_REGNUM + 20) |
#define PS_REGNUM ALU_REGNUM |
#define IPC_REGNUM (VAB_REGNUM + 21) |
#define IPA_REGNUM (VAB_REGNUM + 22) |
#define IPB_REGNUM (VAB_REGNUM + 23) |
|
#endif /* !defined(REGISTER_NAMES) */ |
|
/* Total amount of space needed to store our copies of the machine's |
register state, the array `registers'. */ |
#define REGISTER_BYTES (NUM_REGS * 4) |
|
/* Index within `registers' of the first byte of the space for |
register N. */ |
#define REGISTER_BYTE(N) ((N)*4) |
|
/* Number of bytes of storage in the actual machine representation |
for register N. */ |
|
/* All regs are 4 bytes. */ |
|
#define REGISTER_RAW_SIZE(N) (4) |
|
/* Number of bytes of storage in the program's representation |
for register N. */ |
|
/* All regs are 4 bytes. */ |
|
#define REGISTER_VIRTUAL_SIZE(N) (4) |
|
/* Largest value REGISTER_RAW_SIZE can have. */ |
|
#define MAX_REGISTER_RAW_SIZE (4) |
|
/* Largest value REGISTER_VIRTUAL_SIZE can have. */ |
|
#define MAX_REGISTER_VIRTUAL_SIZE (4) |
|
/* Return the GDB type object for the "standard" data type |
of data in register N. */ |
|
#define REGISTER_VIRTUAL_TYPE(N) \ |
(((N) == PC_REGNUM || (N) == LRP_REGNUM || (N) == SLP_REGNUM \ |
|| (N) == MSP_REGNUM || (N) == RAB_REGNUM || (N) == RFB_REGNUM \ |
|| (N) == GR1_REGNUM || (N) == FP_REGNUM || (N) == LR0_REGNUM \ |
|| (N) == NPC_REGNUM || (N) == PC2_REGNUM) \ |
? lookup_pointer_type (builtin_type_void) : builtin_type_int) |
|
/* Store the address of the place in which to copy the structure the |
subroutine will return. This is called from call_function. */ |
/* On the a29k the LRP points to the part of the structure beyond the first |
16 words. */ |
#define STORE_STRUCT_RETURN(ADDR, SP) \ |
write_register (LRP_REGNUM, (ADDR) + 16 * 4); |
|
/* Should call_function allocate stack space for a struct return? */ |
/* On the a29k objects over 16 words require the caller to allocate space. */ |
extern use_struct_convention_fn a29k_use_struct_convention; |
#define USE_STRUCT_CONVENTION(gcc_p, type) a29k_use_struct_convention (gcc_p, type) |
|
/* Extract from an array REGBUF containing the (raw) register state |
a function return value of type TYPE, and copy that, in virtual format, |
into VALBUF. */ |
|
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ |
{ \ |
int reg_length = TYPE_LENGTH (TYPE); \ |
if (reg_length > 16 * 4) \ |
{ \ |
reg_length = 16 * 4; \ |
read_memory (*((int *)(REGBUF) + LRP_REGNUM), (VALBUF) + 16 * 4, \ |
TYPE_LENGTH (TYPE) - 16 * 4); \ |
} \ |
memcpy ((VALBUF), ((int *)(REGBUF))+RETURN_REGNUM, reg_length); \ |
} |
|
/* Write into appropriate registers a function return value |
of type TYPE, given in virtual format. */ |
|
#define STORE_RETURN_VALUE(TYPE,VALBUF) \ |
{ \ |
int reg_length = TYPE_LENGTH (TYPE); \ |
if (reg_length > 16 * 4) \ |
{ \ |
reg_length = 16 * 4; \ |
write_memory (read_register (LRP_REGNUM), \ |
(char *)(VALBUF) + 16 * 4, \ |
TYPE_LENGTH (TYPE) - 16 * 4); \ |
} \ |
write_register_bytes (REGISTER_BYTE (RETURN_REGNUM), (char *)(VALBUF), \ |
TYPE_LENGTH (TYPE)); \ |
} |
/* *INDENT-OFF* */ |
/* The a29k user's guide documents well what the stacks look like. |
But what isn't so clear there is how this interracts with the |
symbols, or with GDB. |
In the following saved_msp, saved memory stack pointer (which functions |
as a memory frame pointer), means either |
a register containing the memory frame pointer or, in the case of |
functions with fixed size memory frames (i.e. those who don't use |
alloca()), the result of the calculation msp + msize. |
|
LOC_ARG, LOC_LOCAL - For GCC, these are relative to saved_msp. |
For high C, these are relative to msp (making alloca impossible). |
LOC_REGISTER, LOC_REGPARM - The register number is the number at the |
time the function is running (after the prologue), or in the case |
of LOC_REGPARM, may be a register number in the range 160-175. |
|
The compilers do things like store an argument into memory, and then put out |
a LOC_ARG for it, or put it into global registers and put out a |
LOC_REGPARM. Thus is it important to execute the first line of |
code (i.e. the line of the open brace, i.e. the prologue) of a function |
before trying to print arguments or anything. |
|
The following diagram attempts to depict what is going on in memory |
(see also the _a29k user's guide_) and also how that interacts with |
GDB frames. We arbitrarily pick fci->frame to point the same place |
as the register stack pointer; since we set it ourself in |
INIT_EXTRA_FRAME_INFO, and access it only through the FRAME_* |
macros, it doesn't really matter exactly how we |
do it. However, note that FRAME_FP is used in two ways in GDB: |
(1) as a "magic cookie" which uniquely identifies frames (even over |
calls to the inferior), (2) (in PC_IN_CALL_DUMMY [ON_STACK]) |
as the value of SP_REGNUM before the dummy frame was pushed. These |
two meanings would be incompatible for the a29k if we defined |
CALL_DUMMY_LOCATION == ON_STACK (but we don't, so don't worry about it). |
Also note that "lr1" below, while called a frame pointer |
in the user's guide, has only one function: To determine whether |
registers need to be filled in the function epilogue. |
|
Consider the code: |
< call bar> |
loc1: . . . |
bar: sub gr1,gr1,rsize_b |
. . . |
add mfp,msp,0 |
sub msp,msp,msize_b |
. . . |
< call foo > |
loc2: . . . |
foo: sub gr1,gr1,rsize_f |
. . . |
add mfp,msp,0 |
sub msp,msp,msize_f |
. . . |
loc3: < suppose the inferior stops here > |
|
memory stack register stack |
| | |____________| |
| | |____loc1____| |
+------->|___________| | | ^ |
| | ^ | | locals_b | | |
| | | | |____________| | |
| | | | | | | rsize_b |
| | | msize_b | | args_to_f | | |
| | | | |____________| | |
| | | | |____lr1_____| V |
| | V | |____loc2____|<----------------+ |
| +--->|___________|<---------mfp | ^ | |
| | | ^ | | locals_f | | | |
| | | | msize_f | |____________| | | |
| | | | | | | | rsize_f | |
| | | V | | args | | | |
| | |___________|<msp |____________| | | |
| | |_____lr1____| V | |
| | |___garbage__| <- gr1 <----+ | |
| | | | |
| | | | |
| | pc=loc3 | | |
| | | | |
| | | | |
| | frame cache | | |
| | |_________________| | | |
| | |rsize=rsize_b | | | |
| | |msize=msize_b | | | |
+---|--------saved_msp | | | |
| |frame------------------------------------|---+ |
| |pc=loc2 | | |
| |_________________| | |
| |rsize=rsize_f | | |
| |msize=msize_f | | |
+--------saved_msp | | |
|frame------------------------------------+ |
|pc=loc3 | |
|_________________| |
|
So, is that sufficiently confusing? Welcome to the 29000. |
Notes: |
* The frame for foo uses a memory frame pointer but the frame for |
bar does not. In the latter case the saved_msp is |
computed by adding msize to the saved_msp of the |
next frame. |
* msize is in the frame cache only for high C's sake. */ |
/* *INDENT-ON* */ |
|
|
void read_register_stack (); |
long read_register_stack_integer (); |
|
#define FRAME_INIT_SAVED_REGS(fi) /*no-op */ |
|
#define EXTRA_FRAME_INFO \ |
CORE_ADDR saved_msp; \ |
unsigned int rsize; \ |
unsigned int msize; \ |
unsigned char flags; |
|
/* Bits for flags in EXTRA_FRAME_INFO */ |
#define TRANSPARENT_FRAME 0x1 /* This is a transparent frame */ |
#define MFP_USED 0x2 /* A memory frame pointer is used */ |
|
/* Because INIT_FRAME_PC gets passed fromleaf, that's where we init |
not only ->pc and ->frame, but all the extra stuff, when called from |
get_prev_frame, that is. */ |
#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci) |
void init_extra_frame_info (); |
|
#define INIT_FRAME_PC(fromleaf, fci) init_frame_pc(fromleaf, fci) |
void init_frame_pc (); |
|
|
/* FRAME_CHAIN takes a FRAME |
and produces the frame's chain-pointer. |
|
However, if FRAME_CHAIN_VALID returns zero, |
it means the given frame is the outermost one and has no caller. */ |
|
/* On the a29k, the nominal address of a frame is the address on the |
register stack of the return address (the one next to the incoming |
arguments, not down at the bottom so nominal address == stack pointer). |
|
GDB expects "nominal address" to equal contents of FP_REGNUM, |
at least when it comes time to create the innermost frame. |
However, that doesn't work for us, so when creating the innermost |
frame we set ->frame ourselves in INIT_EXTRA_FRAME_INFO. */ |
|
/* These are mostly dummies for the a29k because INIT_FRAME_PC |
sets prev->frame instead. */ |
/* If rsize is zero, we must be at end of stack (or otherwise hosed). |
If we don't check rsize, we loop forever if we see rsize == 0. */ |
#define FRAME_CHAIN(thisframe) \ |
((thisframe)->rsize == 0 \ |
? 0 \ |
: (thisframe)->frame + (thisframe)->rsize) |
|
/* Determine if the frame has a 'previous' and back-traceable frame. */ |
#define FRAME_IS_UNCHAINED(frame) ((frame)->flags & TRANSPARENT_FRAME) |
|
/* Find the previous frame of a transparent routine. |
* For now lets not try and trace through a transparent routine (we might |
* have to assume that all transparent routines are traps). |
*/ |
#define FIND_PREV_UNCHAINED_FRAME(frame) 0 |
|
/* Define other aspects of the stack frame. */ |
|
/* An expression that tells us whether the function invocation represented |
by FI does not have a frame on the stack associated with it. */ |
#define FRAMELESS_FUNCTION_INVOCATION(FI) \ |
(frameless_look_for_prologue (FI)) |
|
/* Saved pc (i.e. return address). */ |
#define FRAME_SAVED_PC(fraim) \ |
(read_register_stack_integer ((fraim)->frame + (fraim)->rsize, 4)) |
|
/* Local variables (i.e. LOC_LOCAL) are on the memory stack, with their |
offsets being relative to the memory stack pointer (high C) or |
saved_msp (gcc). */ |
|
#define FRAME_LOCALS_ADDRESS(fi) frame_locals_address (fi) |
extern CORE_ADDR frame_locals_address (); |
|
/* Return number of args passed to a frame. |
Can return -1, meaning no way to tell. */ |
/* We tried going to the effort of finding the tags word and getting |
the argcount field from it, to support debugging assembler code. |
Problem was, the "argcount" field never did hold the argument |
count. */ |
#define FRAME_NUM_ARGS(fi) (-1) |
|
#define FRAME_ARGS_ADDRESS(fi) FRAME_LOCALS_ADDRESS (fi) |
|
/* Return number of bytes at start of arglist that are not really args. */ |
|
#define FRAME_ARGS_SKIP 0 |
|
/* Provide our own get_saved_register. HAVE_REGISTER_WINDOWS is insufficient |
because registers get renumbered on the a29k without getting saved. */ |
|
struct frame_info; |
void a29k_get_saved_register PARAMS ((char *raw_buffer, int *optimized, CORE_ADDR * addrp, struct frame_info * frame, int regnum, enum lval_type * lvalp)); |
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ |
a29k_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) |
|
/* Call function stuff. */ |
/* *INDENT-OFF* */ |
/* The dummy frame looks like this (see also the general frame picture |
above): |
|
register stack |
|
| | frame for function |
| locals_sproc | executing at time |
|________________| of call_function. |
| | We must not disturb |
| args_out_sproc | it. |
memory stack |________________| |
|____lr1_sproc___|<-+ |
| | |__retaddr_sproc_| | <-- gr1 (at start) |
|____________|<-msp 0 <-----------mfp_dummy_____| | |
| | (at start) | save regs | | |
| arg_slop | | pc0,pc1 | | |
| | | pc2,lr0 sproc | | |
| (16 words) | | gr96-gr124 | | |
|____________|<-msp 1--after | sr160-sr162 | | |
| | PUSH_DUMMY_FRAME| sr128-sr135 | | |
| struct ret | |________________| | |
| 17+ | | | | |
|____________|<- lrp | args_out_dummy | | |
| struct ret | | (16 words) | | |
| 16 | |________________| | |
| (16 words) | |____lr1_dummy___|--+ |
|____________|<- msp 2--after |_retaddr_dummy__|<- gr1 after |
| | struct ret | | PUSH_DUMMY_FRAME |
| margs17+ | area allocated | locals_inf | |
| | |________________| called |
|____________|<- msp 4--when | | function's |
| | inf called | args_out_inf | frame (set up |
| margs16 | |________________| by called |
| (16 words) | |_____lr1_inf____| function). |
|____________|<- msp 3--after | . | |
| | args pushed | . | |
| | | . | |
| | |
|
arg_slop: This area is so that when the call dummy adds 16 words to |
the msp, it won't end up larger than mfp_dummy (it is needed in the |
case where margs and struct_ret do not add up to at least 16 words). |
struct ret: This area is allocated by GDB if the return value is more |
than 16 words. struct ret_16 is not used on the a29k. |
margs: Pushed by GDB. The call dummy copies the first 16 words to |
args_out_dummy. |
retaddr_sproc: Contains the PC at the time we call the function. |
set by PUSH_DUMMY_FRAME and read by POP_FRAME. |
retaddr_dummy: This points to a breakpoint instruction in the dummy. */ |
/* *INDENT-ON* */ |
|
|
|
/* Rsize for dummy frame, in bytes. */ |
|
/* Bytes for outgoing args, lr1, and retaddr. */ |
#define DUMMY_ARG (2 * 4 + 16 * 4) |
|
/* Number of special registers (sr128-) to save. */ |
#define DUMMY_SAVE_SR128 8 |
/* Number of special registers (sr160-) to save. */ |
#define DUMMY_SAVE_SR160 3 |
/* Number of general (gr96- or gr64-) registers to save. */ |
#define DUMMY_SAVE_GREGS 29 |
|
#define DUMMY_FRAME_RSIZE \ |
(4 /* mfp_dummy */ \ |
+ 4 * 4 /* pc0, pc1, pc2, lr0 */ \ |
+ DUMMY_SAVE_GREGS * 4 \ |
+ DUMMY_SAVE_SR160 * 4 \ |
+ DUMMY_SAVE_SR128 * 4 \ |
+ DUMMY_ARG \ |
+ 4 /* pad to doubleword */ ) |
|
/* Push an empty stack frame, to record the current PC, etc. */ |
|
#define PUSH_DUMMY_FRAME push_dummy_frame() |
extern void push_dummy_frame (); |
|
/* Discard from the stack the innermost frame, |
restoring all saved registers. */ |
|
#define POP_FRAME pop_frame() |
extern void pop_frame (); |
|
/* This sequence of words is the instructions |
mtsrim cr, 15 |
loadm 0, 0, lr2, msp ; load first 16 words of arguments into registers |
add msp, msp, 16 * 4 ; point to the remaining arguments |
CONST_INSN: |
const lr0,inf ; (replaced by half of target addr) |
consth lr0,inf ; (replaced by other half of target addr) |
calli lr0, lr0 |
aseq 0x40,gr1,gr1 ; nop |
BREAKPT_INSN: |
asneq 0x50,gr1,gr1 ; breakpoint (replaced by local breakpoint insn) |
*/ |
|
#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER |
#define BS(const) const |
#else |
#define BS(const) (((const) & 0xff) << 24) | \ |
(((const) & 0xff00) << 8) | \ |
(((const) & 0xff0000) >> 8) | \ |
(((const) & 0xff000000) >> 24) |
#endif |
|
/* Position of the "const" and blkt instructions within CALL_DUMMY in bytes. */ |
#define CONST_INSN (3 * 4) |
#define BREAKPT_INSN (7 * 4) |
#define CALL_DUMMY { \ |
BS(0x0400870f),\ |
BS(0x36008200|(MSP_HW_REGNUM)), \ |
BS(0x15000040|(MSP_HW_REGNUM<<8)|(MSP_HW_REGNUM<<16)), \ |
BS(0x03ff80ff), \ |
BS(0x02ff80ff), \ |
BS(0xc8008080), \ |
BS(0x70400101), \ |
BS(0x72500101)} |
#define CALL_DUMMY_LENGTH (8 * 4) |
|
#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */ |
|
/* Helper macro for FIX_CALL_DUMMY. WORDP is a long * which points to a |
word in target byte order; bits 0-7 and 16-23 of *WORDP are replaced with |
bits 0-7 and 8-15 of DATA (which is in host byte order). */ |
|
#if TARGET_BYTE_ORDER == BIG_ENDIAN |
#define STUFF_I16(WORDP, DATA) \ |
{ \ |
*((char *)(WORDP) + 3) = ((DATA) & 0xff);\ |
*((char *)(WORDP) + 1) = (((DATA) >> 8) & 0xff);\ |
} |
#else /* Target is little endian. */ |
#define STUFF_I16(WORDP, DATA) \ |
{ |
*(char *) (WORDP) = ((DATA) & 0xff); |
*((char *) (WORDP) + 2) = (((DATA) >> 8) & 0xff); |
} |
#endif /* Target is little endian. */ |
|
/* Insert the specified number of args and function address |
into a call sequence of the above form stored at DUMMYNAME. */ |
|
/* Currently this stuffs in the address of the function that we are calling. |
Since different a29k systems use different breakpoint instructions, it |
also stuffs BREAKPOINT in the right place (to avoid having to |
duplicate CALL_DUMMY in each tm-*.h file). */ |
|
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ |
{\ |
STUFF_I16((char *)dummyname + CONST_INSN, fun); \ |
STUFF_I16((char *)dummyname + CONST_INSN + 4, fun >> 16); \ |
/* FIXME memcpy ((char *)(dummyname) + BREAKPT_INSN, break_insn, 4); */ \ |
} |
|
/* a29k architecture has separate data & instruction memories -- wired to |
different pins on the chip -- and can't execute the data memory. |
Also, there should be space after text_end; |
we won't get a SIGSEGV or scribble on data space. */ |
|
#define CALL_DUMMY_LOCATION AFTER_TEXT_END |
|
/* Because of this, we need (as a kludge) to know the addresses of the |
text section. */ |
|
#define NEED_TEXT_START_END 1 |
|
/* How to translate register numbers in the .stab's into gdb's internal register |
numbers. We don't translate them, but we warn if an invalid register |
number is seen. Note that FIXME, we use the value "sym" as an implicit |
argument in printing the error message. It happens to be available where |
this macro is used. (This macro definition appeared in a late revision |
of gdb-3.91.6 and is not well tested. Also, it should be a "complaint".) */ |
|
#define STAB_REG_TO_REGNUM(num) \ |
(((num) > LR0_REGNUM + 127) \ |
? fprintf(stderr, \ |
"Invalid register number %d in symbol table entry for %s\n", \ |
(num), SYMBOL_SOURCE_NAME (sym)), (num) \ |
: (num)) |
|
extern enum a29k_processor_types |
{ |
a29k_unknown, |
|
/* Bit 0x400 of the CPS does *not* identify freeze mode, i.e. 29000, |
29030, etc. */ |
a29k_no_freeze_mode, |
|
/* Bit 0x400 of the CPS does identify freeze mode, i.e. 29050. */ |
a29k_freeze_mode |
} |
processor_type; |
|
/* We need three arguments for a general frame specification for the |
"frame" or "info frame" command. */ |
|
#define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) |
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *)); |
/ultra3.mh
0,0 → 1,13
# Host: NYU Ultracomputer (AMD 29000 running Unix) |
|
CC=u3cc |
|
XM_FILE= xm-ultra3.h |
XDEPFILES= ultra3-xdep.o |
|
MH_CFLAGS = -DSYM1 |
XM_CLIBS = -lsysv -ljobs -ltermlib |
|
NAT_FILE= nm-ultra3.h |
NATDEPFILES= infptrace.o inftarg.o fork-child.o ultra3-nat.o |
|
/tm-ultra3.h
0,0 → 1,227
/* Parameters for NYU Ultracomputer 29000 target, for GDB, the GNU debugger. |
Copyright 1990, 1991 Free Software Foundation, Inc. |
Contributed by David Wood @ New York University (wood@nyu.edu). |
|
This file is part of GDB. |
|
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2 of the License, or |
(at your option) any later version. |
|
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
|
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, |
Boston, MA 02111-1307, USA. */ |
|
/* This file includes tm-a29k.h, but predefines REGISTER_NAMES and |
related macros. The file supports a a29k running our flavor of |
Unix on our Ultra3 PE Boards. */ |
|
/* Byte order is configurable, but this machine runs big-endian. */ |
#define TARGET_BYTE_ORDER BIG_ENDIAN |
|
/* Initializer for an array of names of registers. |
There should be NUM_REGS strings in this initializer. |
*/ |
#define NUM_REGS (EXO_REGNUM + 1) |
|
#define REGISTER_NAMES { \ |
"gr1", \ |
"gr64", "gr65", "gr66", "gr67", "gr68", "gr69", "gr70", "gr71", "gr72", \ |
"gr73", "gr74", "gr75", "gr76", "gr77", "gr78", "gr79", "gr80", "gr81", \ |
"gr82", "gr83", "gr84", "gr85", "gr86", "gr87", "gr88", "gr89", "gr90", \ |
"gr91", "gr92", "gr93", "gr94", "gr95", \ |
"gr96", "gr97", "gr98", "gr99", "gr100", "gr101", "gr102", "gr103", "gr104", \ |
"gr105", "gr106", "gr107", "gr108", "gr109", "gr110", "gr111", "gr112", \ |
"gr113", "gr114", "gr115", "gr116", "gr117", "gr118", "gr119", "gr120", \ |
"gr121", "gr122", "gr123", "gr124", "gr125", "gr126", "gr127", \ |
"lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", "lr8", "lr9", \ |
"lr10", "lr11", "lr12", "lr13", "lr14", "lr15", "lr16", "lr17", "lr18", \ |
"lr19", "lr20", "lr21", "lr22", "lr23", "lr24", "lr25", "lr26", "lr27", \ |
"lr28", "lr29", "lr30", "lr31", "lr32", "lr33", "lr34", "lr35", "lr36", \ |
"lr37", "lr38", "lr39", "lr40", "lr41", "lr42", "lr43", "lr44", "lr45", \ |
"lr46", "lr47", "lr48", "lr49", "lr50", "lr51", "lr52", "lr53", "lr54", \ |
"lr55", "lr56", "lr57", "lr58", "lr59", "lr60", "lr61", "lr62", "lr63", \ |
"lr64", "lr65", "lr66", "lr67", "lr68", "lr69", "lr70", "lr71", "lr72", \ |
"lr73", "lr74", "lr75", "lr76", "lr77", "lr78", "lr79", "lr80", "lr81", \ |
"lr82", "lr83", "lr84", "lr85", "lr86", "lr87", "lr88", "lr89", "lr90", \ |
"lr91", "lr92", "lr93", "lr94", "lr95", "lr96", "lr97", "lr98", "lr99", \ |
"lr100", "lr101", "lr102", "lr103", "lr104", "lr105", "lr106", "lr107", \ |
"lr108", "lr109", "lr110", "lr111", "lr112", "lr113", "lr114", "lr115", \ |
"lr116", "lr117", "lr118", "lr119", "lr120", "lr121", "lr122", "lr123", \ |
"lr124", "lr125", "lr126", "lr127", \ |
"vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr", \ |
"pc0", "pc1", "pc2", "mmu", "lru", \ |
"ipc", "ipa", "ipb", "q", "alu", "bp", "fc", "cr", \ |
"fpe", "int", "fps", "exo" } |
|
|
#ifdef KERNEL_DEBUGGING |
#define PADDR_U_REGNUM 22 /* gr86 */ |
#define RETURN_REGNUM GR64_REGNUM |
#else |
#define RETURN_REGNUM GR96_REGNUM |
#endif /* KERNEL_DEBUGGING */ |
|
|
/* Should rename all GR96_REGNUM to RETURN_REGNUM */ |
#define GR1_REGNUM (0) |
#define GR64_REGNUM 1 |
#define GR96_REGNUM (GR64_REGNUM + 32) |
/* This needs to be the memory stack pointer, not the register stack pointer, |
to make call_function work right. */ |
#define SP_REGNUM MSP_REGNUM |
|
#define FP_REGNUM (LR0_REGNUM + 1) /* lr1 */ |
/* Large Return Pointer */ |
#define LRP_REGNUM (123 - 96 + RETURN_REGNUM) |
/* Static link pointer */ |
#define SLP_REGNUM (124 - 96 + RETURN_REGNUM) |
/* Memory Stack Pointer. */ |
#define MSP_REGNUM (125 - 96 + RETURN_REGNUM) |
/* Register allocate bound. */ |
#define RAB_REGNUM (126 - 96 + RETURN_REGNUM) |
/* Register Free Bound. */ |
#define RFB_REGNUM (127 - 96 + RETURN_REGNUM) |
/* Register Stack Pointer. */ |
#define RSP_REGNUM GR1_REGNUM |
#define LR0_REGNUM ( 32 + GR96_REGNUM) |
|
/* Protected Special registers */ |
#define VAB_REGNUM (LR0_REGNUM + 128) |
#define OPS_REGNUM (VAB_REGNUM + 1) |
#define CPS_REGNUM (VAB_REGNUM + 2) |
#define CFG_REGNUM (VAB_REGNUM + 3) |
#define CHA_REGNUM (VAB_REGNUM + 4) |
#define CHD_REGNUM (VAB_REGNUM + 5) |
#define CHC_REGNUM (VAB_REGNUM + 6) |
#define RBP_REGNUM (VAB_REGNUM + 7) |
#define TMC_REGNUM (VAB_REGNUM + 8) |
#define TMR_REGNUM (VAB_REGNUM + 9) |
#define NPC_REGNUM (VAB_REGNUM + 10) /* pc0 */ |
#define PC_REGNUM (VAB_REGNUM + 11) /* pc1 */ |
#define PC2_REGNUM (VAB_REGNUM + 12) /* pc2 */ |
#define MMU_REGNUM (VAB_REGNUM + 13) |
#define LRU_REGNUM (VAB_REGNUM + 14) |
/* Register sequence gap */ |
/* Unprotected Special registers */ |
#define IPC_REGNUM (LRU_REGNUM + 1) |
#define IPA_REGNUM (IPC_REGNUM + 1) |
#define IPB_REGNUM (IPC_REGNUM + 2) |
#define Q_REGNUM (IPC_REGNUM + 3) |
#define ALU_REGNUM (IPC_REGNUM + 4) |
#define PS_REGNUM ALU_REGNUM |
#define BP_REGNUM (IPC_REGNUM + 5) |
#define FC_REGNUM (IPC_REGNUM + 6) |
#define CR_REGNUM (IPC_REGNUM + 7) |
/* Register sequence gap */ |
#define FPE_REGNUM (CR_REGNUM + 1) |
#define INT_REGNUM (FPE_REGNUM + 1) |
#define FPS_REGNUM (FPE_REGNUM + 2) |
/* Register sequence gap */ |
#define EXO_REGNUM (FPS_REGNUM + 1) |
|
/* Special register #x. */ |
#define SR_REGNUM(x) \ |
((x) < 15 ? VAB_REGNUM + (x) \ |
: (x) >= 128 && (x) < 136 ? IPC_REGNUM + (x-128) \ |
: (x) >= 160 && (x) < 163 ? FPE_REGNUM + (x-160) \ |
: (x) == 164 ? EXO_REGNUM \ |
: (error ("Internal error in SR_REGNUM"), 0)) |
|
#ifndef KERNEL_DEBUGGING |
/* |
* This macro defines the register numbers (from REGISTER_NAMES) that |
* are effectively unavailable to the user through ptrace(). It allows |
* us to include the whole register set in REGISTER_NAMES (inorder to |
* better support remote debugging). If it is used in |
* fetch/store_inferior_registers() gdb will not complain about I/O errors |
* on fetching these registers. If all registers in REGISTER_NAMES |
* are available, then return false (0). |
*/ |
#define CANNOT_STORE_REGISTER(regno) \ |
(((regno)>=GR64_REGNUM && (regno)<GR64_REGNUM+32) || \ |
((regno)==VAB_REGNUM) || \ |
((regno)==OPS_REGNUM) || \ |
((regno)>=CFG_REGNUM && (regno)<=TMR_REGNUM) || \ |
((regno)==MMU_REGNUM) || \ |
((regno)==LRU_REGNUM) || \ |
((regno)>=ALU_REGNUM) || \ |
((regno)==CR_REGNUM) || \ |
((regno)==EXO_REGNUM)) |
#define CANNOT_FETCH_REGISTER(regno) CANNOT_STORE_REGISTER(regno) |
#endif /* KERNEL_DEBUGGING */ |
|
/* |
* Converts an sdb register number to an internal gdb register number. |
* Currently under gcc, gr96->0...gr128->31...lr0->32...lr127->159, or... |
* gr64->0...gr95->31, lr0->32...lr127->159. |
*/ |
#define SDB_REG_TO_REGNUM(value) (((value)<32) ? ((value)+RETURN_REGNUM) : \ |
((value)-32+LR0_REGNUM)) |
|
#ifdef KERNEL_DEBUGGING |
/* ublock virtual address as defined in our sys/param.h */ |
/* FIXME: Should get this from sys/param.h */ |
#define UVADDR ((32*0x100000)-8192) |
#endif |
|
/* |
* Are we in sigtramp(), needed in infrun.c. Specific to ultra3, because |
* we take off the leading '_'. |
*/ |
#if !defined(KERNEL_DEBUGGING) |
#ifdef SYM1 |
#define IN_SIGTRAMP(pc, name) (name && STREQ ("sigtramp", name)) |
#else |
Need to define |
IN_SIGTRAMP () for sym2. |
#endif |
#endif /* !KERNEL_DEBUGGING */ |
|
#include "a29k/tm-a29k.h" |
|
/**** The following are definitions that override those in tm-a29k.h ****/ |
|
/* This sequence of words is the instructions |
mtsrim cr, 15 |
loadm 0, 0, lr2, msp ; load first 16 words of arguments into registers |
add msp, msp, 16 * 4 ; point to the remaining arguments |
CONST_INSN: |
const gr96,inf |
consth gr96,inf |
calli lr0, gr96 |
aseq 0x40,gr1,gr1 ; nop |
asneq 0x50,gr1,gr1 ; breakpoint |
When KERNEL_DEBUGGIN is defined, msp -> gr93, gr96 -> gr64, |
7d -> 5d, 60 -> 40 |
*/ |
|
/* Position of the "const" instruction within CALL_DUMMY in bytes. */ |
#undef CALL_DUMMY |
#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER |
#ifdef KERNEL_DEBUGGING /* gr96 -> gr64 */ |
#define CALL_DUMMY {0x0400870f, 0x3600825d, 0x155d5d40, 0x03ff40ff, \ |
0x02ff40ff, 0xc8008040, 0x70400101, 0x72500101} |
#else |
#define CALL_DUMMY {0x0400870f, 0x3600827d, 0x157d7d40, 0x03ff60ff, \ |
0x02ff60ff, 0xc8008060, 0x70400101, 0x72500101} |
#endif /* KERNEL_DEBUGGING */ |
#else /* Byte order differs. */ |
you lose |
#endif /* Byte order differs. */ |
|
#if !defined(KERNEL_DEBUGGING) |
#ifdef SYM1 |
#undef DECR_PC_AFTER_BREAK |
#define DECR_PC_AFTER_BREAK 0 /* Sym1 kernel does the decrement */ |
#else |
->"ULTRA3 running other than sym1 OS" !; |
#endif |
#endif /* !KERNEL_DEBUGGING */ |