+/*
+ * These are our native regset flavors.
+ * XXX ioperm? vm86?
+ */
+static const struct utrace_regset native_regsets[] = {
+ {
+ .n = sizeof(struct user_regs_struct)/8, .size = 8, .align = 8,
+ .get = genregs_get, .set = genregs_set
+ },
+ {
+ .n = sizeof(struct user_i387_struct) / sizeof(long),
+ .size = sizeof(long), .align = sizeof(long),
+ .active = fpregs_active,
+ .get = fpregs_get, .set = fpregs_set
+ },
+ {
+ .n = 2, .size = sizeof(long), .align = sizeof(long),
+ .active = fsgs_active,
+ .get = fsgs_get, .set = fsgs_set
+ },
+ {
+ .n = 8, .size = sizeof(long), .align = sizeof(long),
+ .active = dbregs_active,
+ .get = dbregs_get, .set = dbregs_set
+ },
+};
+
+const struct utrace_regset_view utrace_x86_64_native = {
+ .name = "x86-64", .e_machine = EM_X86_64,
+ .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
+};
+EXPORT_SYMBOL_GPL(utrace_x86_64_native);
+
+
+#ifdef CONFIG_PTRACE
+static const struct ptrace_layout_segment x86_64_uarea[] = {
+ {0, sizeof(struct user_regs_struct), 0, 0},
+ {sizeof(struct user_regs_struct),
+ offsetof(struct user, u_debugreg[0]), -1, 0},
+ {offsetof(struct user, u_debugreg[0]),
+ offsetof(struct user, u_debugreg[8]), 3, 0},
+ {0, 0, -1, 0}
+};
+
+int arch_ptrace(long *req, struct task_struct *child,
+ struct utrace_attached_engine *engine,
+ unsigned long addr, unsigned long data, long *val)
+{
+ switch (*req) {
+ case PTRACE_PEEKUSR:
+ return ptrace_peekusr(child, engine, x86_64_uarea, addr, data);
+ case PTRACE_POKEUSR:
+ return ptrace_pokeusr(child, engine, x86_64_uarea, addr, data);
+ case PTRACE_GETREGS:
+ return ptrace_whole_regset(child, engine, data, 0, 0);
+ case PTRACE_SETREGS:
+ return ptrace_whole_regset(child, engine, data, 0, 1);
+ case PTRACE_GETFPREGS:
+ return ptrace_whole_regset(child, engine, data, 1, 0);
+ case PTRACE_SETFPREGS:
+ return ptrace_whole_regset(child, engine, data, 1, 1);
+#ifdef CONFIG_IA32_EMULATION
+ case PTRACE_GET_THREAD_AREA:
+ case PTRACE_SET_THREAD_AREA:
+ return ptrace_onereg_access(child, engine,
+ &utrace_ia32_view, 3,
+ addr, (void __user *)data,
+ *req == PTRACE_SET_THREAD_AREA);