/* 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.
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 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. */
/* Say how long registers are. */
-#define REGISTER_TYPE unsigned short
+#define REGISTER_TYPE unsigned short
# define NUM_REGS 10
# define REGISTER_BYTES (10*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.
/* 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
/* 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. */
#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. */
/* 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.
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();
+
+
+#define NAMES_HAVE_UNDERSCORE
+
+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
+