+/*
+ * These are our native regset flavors.
+ * XXX ioperm? vm86?
+ */
+static const struct utrace_regset native_regsets[] = {
+ {
+ .n = FRAME_SIZE, .size = sizeof(long), .align = sizeof(long),
+ .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 = sizeof(struct user_fxsr_struct) / sizeof(long),
+ .size = sizeof(long), .align = sizeof(long),
+ .active = fpxregs_active,
+ .get = fpxregs_get, .set = fpxregs_set
+ },
+ {
+ .n = GDT_ENTRY_TLS_ENTRIES,
+ .bias = GDT_ENTRY_TLS_MIN,
+ .size = sizeof(struct user_desc),
+ .align = sizeof(struct user_desc),
+ .active = tls_active, .get = tls_get, .set = tls_set
+ },
+ {
+ .n = 8, .size = sizeof(long), .align = sizeof(long),
+ .active = dbregs_active,
+ .get = dbregs_get, .set = dbregs_set
+ },
+};
+
+const struct utrace_regset_view utrace_i386_native = {
+ .name = "i386", .e_machine = EM_386,
+ .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
+};
+EXPORT_SYMBOL_GPL(utrace_i386_native);
+
+#ifdef CONFIG_PTRACE
+static const struct ptrace_layout_segment i386_uarea[] = {
+ {0, FRAME_SIZE*4, 0, 0},
+ {FRAME_SIZE*4, offsetof(struct user, u_debugreg[0]), -1, 0},
+ {offsetof(struct user, u_debugreg[0]),
+ offsetof(struct user, u_debugreg[8]), 4, 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, i386_uarea, addr, data);
+ case PTRACE_POKEUSR:
+ return ptrace_pokeusr(child, engine, i386_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);
+ case PTRACE_GETFPXREGS:
+ return ptrace_whole_regset(child, engine, data, 2, 0);
+ case PTRACE_SETFPXREGS:
+ return ptrace_whole_regset(child, engine, data, 2, 1);
+ case PTRACE_GET_THREAD_AREA: