Commit 93be900b authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Simple stack initialization code (untested).

Stack / ipc registers buffer initialized and mapped
in guest physical.
parent 543ccab0
......@@ -65,7 +65,6 @@ struct lcd_arch_tss {
u8 io_bitmap[1];
} __attribute__((packed));
struct lcd_arch {
/*
* Public Data
......@@ -86,6 +85,7 @@ struct lcd_arch {
struct lcd_arch_ept ept;
struct desc_struct *gdt;
struct lcd_arch_tss *tss;
u8 *ipc_regs;
u8 fail;
u64 exit_reason;
......
......@@ -1871,6 +1871,49 @@ fail:
return ret
}
/**
* Allocates and maps stack / ipc registers memory.
*
* %rsp not set until guest virtual address space initialized.
*/
static int vmx_init_stack(struct lcd_arch *vcpu)
{
int ret;
/*
* Alloc zero'd page for stack.
*
* Bottom of stack will contain ipc buffer.
*/
vcpu->ipc_regs = (u8 *)get_zeroed_page(GFP_KERNEL);
if (!vcpu->ipc_regs) {
ret = -ENOMEM;
goto fail;
}
/*
*===--- Map stack in guest physical address space ---===
*/
ret = lcd_arch_ept_map_gpa_to_hpa(vcpu,
/* gpa */
LCD_ARCH_IPC_REGS,
/* hpa */
__pa(vcpu->ipc_regs),
/* create paging structs as needed */
1,
/* no overwrite */
0);
if (ret)
goto fail_map;
return 0;
fail_map:
free_page((u64)vcpu->ipc_regs);
fail:
return ret
}
/**
* Reserves a vpid and sets it in the vcpu.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment