.iopb = X86_TSS_INVALID_IO_BITMAP,
};
-int xtf_set_idte(unsigned int vector, struct xtf_idte *idte)
+int xtf_set_idte(unsigned int vector, const struct xtf_idte *idte)
{
pack_intr_gate(&idt[vector], idte->cs, idte->addr, idte->dpl, 0);
* @returns 0 for HVM guests, hypercall result for PV guests.
*/
int xtf_set_idte(unsigned int vector,
- struct xtf_idte *idte);
+ const struct xtf_idte *idte);
#endif /* __ASSEMBLY__ */
{ 0, 0, 0, 0 }, /* Sentinel. */
};
-int xtf_set_idte(unsigned int vector, struct xtf_idte *idte)
+int xtf_set_idte(unsigned int vector, const struct xtf_idte *idte)
{
struct xen_trap_info ti[2] =
{
#endif
);
+static const struct xtf_idte idte = {
+ .addr = _u(test_idte_handler),
+ /* PV guests need DPL1, HVM need DPL0. */
+ .dpl = IS_DEFINED(CONFIG_PV) ? 1 : 0,
+ .cs = __KERN_CS,
+};
+
static void test_custom_idte(void)
{
- struct xtf_idte idte =
- {
- .addr = _u(test_idte_handler),
- /* PV guests need DPL1, HVM need DPL0. */
- .dpl = IS_DEFINED(CONFIG_PV) ? 1 : 0,
- .cs = __KERN_CS,
- };
-
printk("Test: Custom IDT entry\n");
int rc = xtf_set_idte(X86_VEC_AVAIL, &idte);
"iret"
);
+static const struct xtf_idte idte = {
+ .addr = _u(test_int_handler),
+ .cs = __KERN_CS,
+};
+
/* Stub instruction buffer. */
asm(".align 16;"
"insn_stub_start:;"
void test_main(void)
{
- struct xtf_idte idte =
- {
- .addr = _u(test_int_handler),
- .cs = __KERN_CS,
- };
-
/* Hook test_int_handler() into the real IDT. */
xtf_set_idte(X86_VEC_AVAIL, &idte);
"jmp .Ltss_ret_point;"
);
+static const struct xtf_idte idte = {
+ .addr = _u(ret_from_vm86),
+ .cs = __KERN_CS,
+ .dpl = 3,
+};
+
/* Virtual 8068 task. */
env_tss vm86_tss __aligned(16) =
{
void test_main(void)
{
- struct xtf_idte idte =
- {
- .addr = _u(ret_from_vm86),
- .cs = __KERN_CS,
- .dpl = 3,
- };
-
/* Hook ret_from_vm86(). */
xtf_set_idte(X86_VEC_AVAIL, &idte);
"iretq;"
);
+static const struct xtf_idte idte = {
+ .addr = _u(custom_doublefault_handler),
+ .cs = __KERN_CS,
+};
+
unsigned long compat_userspace(void)
{
exinfo_t fault = 0;
ASSERT(idt[X86_EXC_OF].dpl == 3);
ASSERT(idt[X86_EXC_DF].dpl == 0);
- struct xtf_idte idte =
- {
- .addr = _u(custom_doublefault_handler),
- .cs = __KERN_CS,
- .dpl = 0,
- };
-
/* Hook the custom doublefault handler. */
xtf_set_idte(X86_EXC_DF, &idte);
"jmp multicall_return;"
);
+static const struct xtf_idte idte = {
+ .addr = _u(recover_from_iret),
+ .cs = __KERN_CS,
+ .dpl = 3,
+};
+
/* Target of the __HYPERVISOR_iret hypercall. */
void iret_entry(void);
asm (".pushsection .text.user;"
},
};
-static struct xtf_idte idte =
-{
- .addr = (unsigned long)recover_from_iret,
- .cs = __KERN_CS,
- .dpl = 3,
-};
-
void test_main(void)
{
long rc, xen_version = hypercall_xen_version(XENVER_version, NULL);