+ /*
+ * KSS_* are offsets from the top of the kernel stack (cpu_kernel_stack)
+ */
+#if defined(__i386__)
+ DECLARE("KSS_EBX", offsetof(struct x86_kernel_state *, k_ebx));
+ DECLARE("KSS_ESP", offsetof(struct x86_kernel_state *, k_esp));
+ DECLARE("KSS_EBP", offsetof(struct x86_kernel_state *, k_ebp));
+ DECLARE("KSS_EDI", offsetof(struct x86_kernel_state *, k_edi));
+ DECLARE("KSS_ESI", offsetof(struct x86_kernel_state *, k_esi));
+ DECLARE("KSS_EIP", offsetof(struct x86_kernel_state *, k_eip));
+#elif defined(__x86_64__)
+ DECLARE("KSS_RBX", offsetof(struct x86_kernel_state *, k_rbx));
+ DECLARE("KSS_RSP", offsetof(struct x86_kernel_state *, k_rsp));
+ DECLARE("KSS_RBP", offsetof(struct x86_kernel_state *, k_rbp));
+ DECLARE("KSS_R12", offsetof(struct x86_kernel_state *, k_r12));
+ DECLARE("KSS_R13", offsetof(struct x86_kernel_state *, k_r13));
+ DECLARE("KSS_R14", offsetof(struct x86_kernel_state *, k_r14));
+ DECLARE("KSS_R15", offsetof(struct x86_kernel_state *, k_r15));
+ DECLARE("KSS_RIP", offsetof(struct x86_kernel_state *, k_rip));
+#else
+#error Unsupported architecture
+#endif
+