+#include <arch/x86/idt.h>
#include <arch/x86/processor.h>
#include <arch/x86/segment.h>
#include <xtf/asm_macros.h>
ENDFUNC(handle_exception)
-ENTRY(entry_ret_to_kernel) /* int $0x20 (return to kernel) */
+ENTRY(entry_ret_to_kernel) /* int $X86_VEC_RET2KERN */
/* User required to ensure this is called from CPL > KERNEL_RPL */
1:
call *4(%esp) /* fn() */
- int $0x20 /* Return to kernel privilege. */
+ int $X86_VEC_RET2KERN /* Return to kernel privilege. */
ret
ENDFUNC(exec_user)
+#include <arch/x86/idt.h>
#include <arch/x86/processor.h>
#include <arch/x86/segment.h>
#include <xtf/asm_macros.h>
ENDFUNC(handle_exception)
-ENTRY(entry_ret_to_kernel) /* int $0x20 (return to kernel) */
+ENTRY(entry_ret_to_kernel) /* int $X86_VEC_RET2KERN */
env_ADJUST_FRAME
mov 0*8(%rsp), %rax /* Stash %rip from iret frame */
1:
call *%rdi /* fn() */
- int $0x20 /* Return to kernel privilege. */
+ int $X86_VEC_RET2KERN /* Return to kernel privilege. */
ret
ENDFUNC(exec_user)
#include <xtf/traps.h>
#include <xtf/lib.h>
+#include <arch/x86/idt.h>
#include <arch/x86/lib.h>
#include <arch/x86/processor.h>
#include <arch/x86/desc.h>
setup_gate(X86_EXC_XM, &entry_XM, 0);
setup_gate(X86_EXC_VE, &entry_VE, 0);
- setup_gate(0x20, &entry_ret_to_kernel, 3);
+ setup_gate(X86_VEC_RET2KERN, &entry_ret_to_kernel, 3);
asm volatile ("lidt idt_ptr");
#include <xtf/hypercall.h>
#include <xtf/test.h>
+#include <arch/x86/idt.h>
#include <arch/x86/lib.h>
#include <arch/x86/processor.h>
#include <arch/x86/segment.h>
{ X86_EXC_XM, 0|4, __KERN_CS, (unsigned long)&entry_XM },
{ X86_EXC_VE, 0|4, __KERN_CS, (unsigned long)&entry_VE },
- { 0x20, 3|4, __KERN_CS, (unsigned long)&entry_ret_to_kernel },
+ { X86_VEC_RET2KERN, 3|4, __KERN_CS, (unsigned long)&entry_ret_to_kernel },
{ 0, 0, 0, 0 }, /* Sentinel. */
};
--- /dev/null
+/**
+ * @file include/arch/x86/idt.h
+ *
+ * %x86 IDT vector infrastructure.
+ */
+
+#ifndef XTF_X86_IDT_H
+#define XTF_X86_IDT_H
+
+/**
+ * Return to kernel mode.
+ *
+ * To enable easy transition between user and kernel mode for tests.
+ */
+#define X86_VEC_RET2KERN 0x20
+
+#endif /* XTF_X86_IDT_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */