- /* And that should do it. Return the new stack pointer. */
- return stack_dest;
-}
-
-/* Function: xstormy16_push_return_address (pc)
- Setup the return address for GDB to call a function in the inferior.
- Called only in the context of a target function call from the debugger.
- Returns the value of the SP register when the operation is finished
- (which may or may not be the same as before).
-*/
-
-static CORE_ADDR
-xstormy16_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
- unsigned char buf[xstormy16_pc_size];
-
- 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), get_frame_base (fi),
- get_frame_base (fi)))
- {
- generic_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.
-*/