/* Native-dependent code for SPARC.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
This file is part of GDB.
#ifndef SPARC_NAT_H
#define SPARC_NAT_H 1
+#include "target.h"
+
struct sparc_gregmap;
struct sparc_fpregmap;
extern int sparc32_gregset_supplies_p (struct gdbarch *gdbarch, int regnum);
extern int sparc32_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum);
-/* Create a prototype generic SPARC target. The client can override
+extern void sparc_fetch_inferior_registers (struct regcache *, int);
+extern void sparc_store_inferior_registers (struct regcache *, int);
+
+extern target_xfer_status sparc_xfer_wcookie (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset,
+ ULONGEST len,
+ ULONGEST *xfered_len);
+
+/* A prototype generic SPARC target. The client can override
it with local methods. */
-extern struct target_ops *sparc_target (void);
+template<typename BaseTarget>
+struct sparc_target : public BaseTarget
+{
+ void fetch_registers (struct regcache *regcache, int regnum) override
+ { sparc_fetch_inferior_registers (regcache, regnum); }
+
+ void store_registers (struct regcache *regcache, int regnum) override
+ { sparc_store_inferior_registers (regcache, regnum); }
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) override
+ {
+ if (object == TARGET_OBJECT_WCOOKIE)
+ return sparc_xfer_wcookie (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
-extern void sparc_fetch_inferior_registers (struct target_ops *,
- struct regcache *, int);
-extern void sparc_store_inferior_registers (struct target_ops *,
- struct regcache *, int);
+ return BaseTarget (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
+ }
+};
#endif /* sparc-nat.h */