+}
+
+/* Helper function to generate mappings flags for a single VM map
+ entry in 'info proc mappings'. */
+
+static const char *
+nbsd_vm_map_entry_flags (int kve_flags, int kve_protection)
+{
+ static char vm_flags[9];
+
+ vm_flags[0] = (kve_protection & KINFO_VME_PROT_READ) ? 'r' : '-';
+ vm_flags[1] = (kve_protection & KINFO_VME_PROT_WRITE) ? 'w' : '-';
+ vm_flags[2] = (kve_protection & KINFO_VME_PROT_EXEC) ? 'x' : '-';
+ vm_flags[3] = ' ';
+ vm_flags[4] = (kve_flags & KINFO_VME_FLAG_COW) ? 'C' : '-';
+ vm_flags[5] = (kve_flags & KINFO_VME_FLAG_NEEDS_COPY) ? 'N' : '-';
+ vm_flags[6] = (kve_flags & KINFO_VME_FLAG_PAGEABLE) ? 'P' : '-';
+ vm_flags[7] = (kve_flags & KINFO_VME_FLAG_GROWS_UP) ? 'U'
+ : (kve_flags & KINFO_VME_FLAG_GROWS_DOWN) ? 'D' : '-';
+ vm_flags[8] = '\0';
+
+ return vm_flags;
+}
+
+void
+nbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
+ ULONGEST kve_end, ULONGEST kve_offset,
+ int kve_flags, int kve_protection,
+ const char *kve_path)
+{
+ if (addr_bit == 64)
+ {
+ printf_filtered (" %18s %18s %10s %10s %9s %s\n",
+ hex_string (kve_start),
+ hex_string (kve_end),
+ hex_string (kve_end - kve_start),
+ hex_string (kve_offset),
+ nbsd_vm_map_entry_flags (kve_flags, kve_protection),
+ kve_path);
+ }
+ else
+ {
+ printf_filtered ("\t%10s %10s %10s %10s %9s %s\n",
+ hex_string (kve_start),
+ hex_string (kve_end),
+ hex_string (kve_end - kve_start),
+ hex_string (kve_offset),
+ nbsd_vm_map_entry_flags (kve_flags, kve_protection),
+ kve_path);
+ }
+}
+
+/* Implement the "get_syscall_number" gdbarch method. */
+
+static LONGEST
+nbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
+{
+
+ /* NetBSD doesn't use gdbarch_get_syscall_number since NetBSD
+ native targets fetch the system call number from the
+ 'si_sysnum' member of siginfo_t in nbsd_nat_target::wait.
+ However, system call catching requires this function to be
+ set. */
+
+ internal_error (__FILE__, __LINE__, _("nbsd_get_sycall_number called"));
+}
+
+/* See nbsd-tdep.h. */
+
+void
+nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ set_gdbarch_gdb_signal_from_target (gdbarch, nbsd_gdb_signal_from_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch, nbsd_gdb_signal_to_target);
+ set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver);
+ set_gdbarch_auxv_parse (gdbarch, svr4_auxv_parse);