+/* See gdbarch.sh 'infcall_munmap'. */
+
+static void
+linux_infcall_munmap (CORE_ADDR addr, CORE_ADDR size)
+{
+ struct objfile *objf;
+ struct value *munmap_val = find_function_in_inferior ("munmap", &objf);
+ struct value *retval_val;
+ struct gdbarch *gdbarch = get_objfile_arch (objf);
+ LONGEST retval;
+ enum
+ {
+ ARG_ADDR, ARG_LENGTH, ARG_LAST
+ };
+ struct value *arg[ARG_LAST];
+
+ arg[ARG_ADDR] = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr,
+ addr);
+ /* Assuming sizeof (unsigned long) == sizeof (size_t). */
+ arg[ARG_LENGTH] = value_from_ulongest
+ (builtin_type (gdbarch)->builtin_unsigned_long, size);
+ retval_val = call_function_by_hand (munmap_val, ARG_LAST, arg);
+ retval = value_as_long (retval_val);
+ if (retval != 0)
+ warning (_("Failed inferior munmap call at %s for %s bytes, "
+ "errno is changed."),
+ hex_string (addr), pulongest (size));
+}
+
+/* See linux-tdep.h. */
+
+CORE_ADDR
+linux_displaced_step_location (struct gdbarch *gdbarch)
+{
+ CORE_ADDR addr;
+ int bp_len;
+
+ /* Determine entry point from target auxiliary vector. This avoids
+ the need for symbols. Also, when debugging a stand-alone SPU
+ executable, entry_point_address () will point to an SPU
+ local-store address and is thus not usable as displaced stepping
+ location. The auxiliary vector gets us the PowerPC-side entry
+ point address instead. */
+ if (target_auxv_search (¤t_target, AT_ENTRY, &addr) <= 0)
+ error (_("Cannot find AT_ENTRY auxiliary vector entry."));
+
+ /* Make certain that the address points at real code, and not a
+ function descriptor. */
+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
+ ¤t_target);
+
+ /* Inferior calls also use the entry point as a breakpoint location.
+ We don't want displaced stepping to interfere with those
+ breakpoints, so leave space. */
+ gdbarch_breakpoint_from_pc (gdbarch, &addr, &bp_len);
+ addr += bp_len * 2;
+
+ return addr;
+}
+