* symtab.c (find_pc_symtab): some object file formats, notably mips,
[deliverable/binutils-gdb.git] / gdb / tm-h8300.h
index 8185e409dae506eea0ae1c69718ebab1b8ce45ec..a583ecc5a5237cf9148a9eacf5e876818eb0b26e 100644 (file)
@@ -1,5 +1,5 @@
 /* Parameters for execution on a H8/300 series machine.
-   Copyright (C) 1992 Free Software Foundation, Inc.
+   Copyright 1992, 1993 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -19,18 +19,37 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* Contributed by Steve Chamberlain sac@cygnus.com */
 
-#define IEEE_FLOAT 1
 
+#define UNSIGNED_SHORT(X) ((X) & 0xffff)
+
+
+#define EXTRA_FRAME_INFO       \
+       struct frame_saved_regs *fsr;   \
+       CORE_ADDR from_pc; \
+       CORE_ADDR args_pointer;\
+        CORE_ADDR locals_pointer ;
+
+
+
+/* Zero the frame_saved_regs pointer when the frame is initialized,
+   so that FRAME_FIND_SAVED_REGS () will know to allocate and
+   initialize a frame_saved_regs struct the first time it is called.
+   Set the arg_pointer to -1, which is not valid; 0 and other values
+   indicate real, cached values.  */
+
+#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
+       init_extra_frame_info (fromleaf, fi)
+
+extern void init_extra_frame_info ();
+
+
+#define IEEE_FLOAT
 /* Define the bit, byte, and word ordering of the machine.  */
 #define TARGET_BYTE_ORDER BIG_ENDIAN
-
-#define TARGET_CHAR_BIT 8
-#define TARGET_SHORT_BIT 16
+#undef TARGET_INT_BIT
 #define TARGET_INT_BIT 16
-#define TARGET_LONG_BIT 32
-#define TARGET_LONG_LONG_BIT 64
-#define TARGET_FLOAT_BIT 32
-#define TARGET_DOUBLE_BIT 64
+#undef TARGET_PTR_BIT
+#define TARGET_PTR_BIT 16
 
 
 /* Offset from address of function to start of its code.
@@ -52,30 +71,21 @@ extern CORE_ADDR h8300_skip_prologue ();
    some instructions.  */
 
 #define SAVED_PC_AFTER_CALL(frame) \
-read_memory_integer (read_register (SP_REGNUM), 2)
+UNSIGNED_SHORT(read_memory_integer (read_register (SP_REGNUM), 2))
 
 /* Stack grows downward.  */
 
 #define INNER_THAN <
 
-/* Sequence of bytes for breakpoint instruction.
-   This is a TRAP instruction.  The last 4 bits (0xf below) is the
-   vector.  Systems which don't use 0xf should define BPT_VECTOR
-   themselves before including this file.  */
-
-
-#define BPT_VECTOR 0xf
 
-
-
-#define BREAKPOINT {0x4e, (0x40 | BPT_VECTOR)}
+#define BREAKPOINT {0x53, 0x00}
 
 
 /* If your kernel resets the pc after the trap happens you may need to
    define this before including this file.  */
 
 
-#define DECR_PC_AFTER_BREAK 2
+#define DECR_PC_AFTER_BREAK 0
 
 
 /* Nonzero if instruction at PC is a return instruction.  */
@@ -90,10 +100,11 @@ read_memory_integer (read_register (SP_REGNUM), 2)
 
 /* Say how long registers are.  */
 
-#define REGISTER_TYPE short
+#define REGISTER_TYPE  unsigned short
 
-#  define NUM_REGS 10 
-#  define REGISTER_BYTES (10*2)
+/*#  define NUM_REGS 20 /* 20 for fake HW support */
+#  define NUM_REGS 11
+#  define REGISTER_BYTES (NUM_REGS*2)
 
 
 /* Index within `registers' of the first byte of the space for
@@ -122,30 +133,36 @@ read_memory_integer (read_register (SP_REGNUM), 2)
 /* Nonzero if register N requires conversion
    from raw format to virtual format.  */
 
-#define REGISTER_CONVERTIBLE(N) 0
+#define REGISTER_CONVERTIBLE(N) 1
 
 /* Convert data from raw format for register REGNUM
    to virtual format for register REGNUM.  */
 
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO)  bcopy ((FROM), (TO), 2);
+/*#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO)  */
 
 /* Convert data from virtual format for register REGNUM
    to raw format for register REGNUM.  */
 
-#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)  bcopy ((FROM), (TO), 2);
+/*#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)  */
 
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
 
-#define REGISTER_VIRTUAL_TYPE(N)  builtin_type_int
+#define REGISTER_VIRTUAL_TYPE(N)  builtin_type_unsigned_short
 
 
 /* Initializer for an array of names of registers.
    Entries beyond the first NUM_REGS are ignored.  */
 
+#if NUM_REGS==20
 #define REGISTER_NAMES  \
- {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp","ccr","pc"} 
-
+ {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp",\
+  "ccr","pc","cycles","hcheck","tier","tcsr","frc",\
+   "ocra","ocrb","tcr","tocr","icra"} 
+#else
+#define REGISTER_NAMES \
+  {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles"}
+#endif
 
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
@@ -163,19 +180,15 @@ read_memory_integer (read_register (SP_REGNUM), 2)
 /* Store the address of the place in which to copy the structure the
    subroutine will return.  This is called from call_function. */
 
-#define STORE_STRUCT_RETURN(ADDR, SP) \
-  { write_register (0, (ADDR)); abort(); }
+/*#define STORE_STRUCT_RETURN(ADDR, SP) \
+  { write_register (0, (ADDR)); abort(); }*/
 
 /* 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.  This is assuming that floating point values are returned
-   as doubles in d0/d1.  */
-
+   into VALBUF.  */
 
 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-  bcopy ((char *)(REGBUF) +                                            \
-                (TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)),  \
-        VALBUF, TYPE_LENGTH(TYPE))
+  bcopy ((char *)(REGBUF), VALBUF, TYPE_LENGTH(TYPE))
 
 
 /* Write into appropriate registers a function return value
@@ -205,18 +218,11 @@ read_memory_integer (read_register (SP_REGNUM), 2)
 /* In the case of the H8/300, the frame's nominal address
    is the address of a 2-byte word containing the calling frame's address.  */
 
-
-
-
 /* Use the alternate method of avoiding running up off the end of
    the frame chain or following frames back into the startup code.
-   See the comments in blockframe.c */
-   
-#define FRAME_CHAIN_VALID(chain, thisframe)    \
-  (chain != 0                                  \
-   && !(inside_main_scope ((thisframe)->pc))   \
-   && !(inside_entry_scope ((thisframe)->pc)))
+   See the comments in objfile.h */
 
+#define FRAME_CHAIN_VALID_ALTERNATE   
 
 /* Define other aspects of the stack frame.  */
 
@@ -226,11 +232,22 @@ read_memory_integer (read_register (SP_REGNUM), 2)
 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
   (FRAMELESS) = frameless_look_for_prologue(FI)
 
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 2, 2))
+/* Any function with a frame looks like this
+   SECOND ARG
+   FIRST ARG
+   RET PC
+   SAVED R2
+   SAVED R3
+   SAVED FP   <-FP POINTS HERE
+   LOCALS0
+   LOCALS1    <-SP POINTS HERE
+   
+   */
+#define FRAME_SAVED_PC(FRAME) frame_saved_pc(FRAME)
 
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_ARGS_ADDRESS(fi) frame_args_address(fi)
 
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_LOCALS_ADDRESS(fi) frame_locals_address(fi);
 
 /* Set VAL to the number of args passed to frame described by FI.
    Can set VAL to -1, meaning no way to tell.  */
@@ -243,7 +260,7 @@ read_memory_integer (read_register (SP_REGNUM), 2)
 
 /* Return number of bytes at start of arglist that are not really args.  */
 
-#define FRAME_ARGS_SKIP 4
+#define FRAME_ARGS_SKIP 0
 
 /* Put here the code to store, into a struct frame_saved_regs,
    the addresses of the saved registers of frame described by FRAME_INFO.
@@ -251,14 +268,38 @@ read_memory_integer (read_register (SP_REGNUM), 2)
    ways in the stack frame.  sp is even more special:
    the address we return for it IS the sp for the next frame.  */
 
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)          abort();
+#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)        \
+   frame_find_saved_regs(frame_info, &(frame_saved_regs))
 \f
 
 /* Push an empty stack frame, to record the current PC, etc.  */
 
-#define PUSH_DUMMY_FRAME       { h8300_push_dummy_frame (); }
+/*#define PUSH_DUMMY_FRAME     { h8300_push_dummy_frame (); }*/
 
 /* Discard from the stack the innermost frame, restoring all registers.  */
 
 #define POP_FRAME              { h8300_pop_frame (); }
 
+#define SHORT_INT_MAX 32767
+#define SHORT_INT_MIN -32768
+
+
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
+{ memcpy((TO), (FROM),  2); }
+#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)        \
+{ memcpy((TO), (FROM),  2); }
+
+#define        BEFORE_MAIN_LOOP_HOOK   \
+  hms_before_main_loop();
+
+typedef unsigned short INSN_WORD;
+
+#define ADDR_BITS_REMOVE(addr) ((addr) & 0xffff)
+#define ADDR_BITS_SET(addr) (((addr)))
+
+#define read_memory_short(x)  (read_memory_integer(x,2) & 0xffff)
+#define DONT_USE_REMOTE
+
+
+#define        PRINT_REGISTER_HOOK(regno) print_register_hook(regno)
+
This page took 0.026126 seconds and 4 git commands to generate.