- store_unsigned_integer (buf, xstormy16_pc_size, entry_point_address ());
- write_memory (sp, buf, xstormy16_pc_size);
- return sp + xstormy16_pc_size;
-}
-
-/* Function: xstormy16_pop_frame
- Destroy the innermost (Top-Of-Stack) stack frame, restoring the
- machine state that was in effect before the frame was created.
- Used in the contexts of the "return" command, and of
- target function calls from the debugger.
-*/
-
-static void
-xstormy16_pop_frame (void)
-{
- struct frame_info *fi = get_current_frame ();
- int i;
-
- if (fi == NULL)
- return; /* paranoia */
-
- if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
- {
- deprecated_pop_dummy_frame ();
- }
- else
- {
- /* Restore the saved regs. */
- for (i = 0; i < NUM_REGS; i++)
- if (deprecated_get_frame_saved_regs (fi)[i])
- {
- if (i == SP_REGNUM)
- write_register (i, deprecated_get_frame_saved_regs (fi)[i]);
- else if (i == E_PC_REGNUM)
- write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i],
- xstormy16_pc_size));
- else
- write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i],
- xstormy16_reg_size));
- }
- /* Restore the PC */
- write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi));
- flush_cached_frames ();
- }
- return;
-}
-
-/* Function: xstormy16_store_struct_return
- Copy the (struct) function return value to its destined location.
- Called only in the context of a target function call from the debugger.
-*/
-
-static void
-xstormy16_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
- write_register (E_PTR_RET_REGNUM, addr);
-}
-
-/* Function: xstormy16_store_return_value
- Copy the function return value from VALBUF into the
- proper location for a function return.
- Called only in the context of the "return" command.
-*/
-
-static void
-xstormy16_store_return_value (struct type *type, char *valbuf)
-{
- CORE_ADDR return_buffer;
- char buf[xstormy16_reg_size];
-
- if (xstormy16_type_is_scalar (type) && TYPE_LENGTH (type) == 1)
- {
- /* Add leading zeros to the value. */
- memset (buf, 0, xstormy16_reg_size);
- memcpy (buf, valbuf, 1);
- deprecated_write_register_gen (E_1ST_ARG_REGNUM, buf);
- }
- else if (xstormy16_type_is_scalar (type) &&
- TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
- deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (E_1ST_ARG_REGNUM),
- valbuf, TYPE_LENGTH (type));
- else
- {
- return_buffer = read_register (E_PTR_RET_REGNUM);
- write_memory (return_buffer, valbuf, TYPE_LENGTH (type));
- }
-}
-
-/* Function: xstormy16_extract_struct_value_address
- Returns the address in which a function should return a struct value.
- Used in the contexts of the "return" command, and of
- target function calls from the debugger.
-*/
-
-static CORE_ADDR
-xstormy16_extract_struct_value_address (struct regcache *regcache)
-{
- /* FIXME: cagney/2004-01-17: Does the ABI guarantee that the return
- address regster is preserved across function calls? Probably
- not, making this function wrong. */
- ULONGEST val;
- regcache_raw_read_unsigned (regcache, E_PTR_RET_REGNUM, &val);
- return val;
-}
-
-/* Function: xstormy16_use_struct_convention
- Returns non-zero if the given struct type will be returned using
- a special convention, rather than the normal function return method.
- 7sed in the contexts of the "return" command, and of
- target function calls from the debugger.
-*/
-
-static int
-xstormy16_use_struct_convention (int gcc_p, struct type *type)
-{
- return !xstormy16_type_is_scalar (type)
- || TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
-}
-
-/* Function: frame_saved_register
- Returns the value that regnum had in frame fi
- (saved in fi or in one of its children).
-*/
-
-static CORE_ADDR
-xstormy16_frame_saved_register (struct frame_info *fi, int regnum)
-{
- int size = xstormy16_register_raw_size (regnum);
- char *buf = (char *) alloca (size);
-
- xstormy16_get_saved_register (buf, NULL, NULL, fi, regnum, NULL);
- return (CORE_ADDR) extract_unsigned_integer (buf, size);