Commit b8e5e2e4 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

UTCB struct, collapsed IPC registers into utcb (untested).

Simple name changes and slightly different access pattern
for ipc registers. Updated headers and code. Removed ipc.h
header for now.
parent 617b1f6e
......@@ -3,7 +3,7 @@
#include <asm/vmx.h>
#include <linux/spinlock.h>
#include <lcd-domains/ipc.h>
#include <lcd-domains/utcb.h>
struct lcd_arch_vmcs {
u32 revision_id;
......@@ -86,7 +86,7 @@ struct lcd_arch {
struct lcd_arch_ept ept;
struct desc_struct *gdt;
struct lcd_arch_tss *tss;
struct lcd_ipc_regs *ipc_regs;
struct lcd_utcb *utcb;
u8 fail;
u64 exit_reason;
......@@ -231,8 +231,8 @@ int lcd_arch_ept_map_gpa_to_hpa(struct lcd_arch *vcpu, u64 gpa, u64 hpa,
* : (grows down) : (4 KBs)
* : :
* | |
* | IPC Message Registers |
* LCD_ARCH_IPC_REGS-----> +---------------------------+ 0x0000 0000 0000 3000
* | User Thread Ctrl Block |
* LCD_ARCH_UTCB---------> +---------------------------+ 0x0000 0000 0000 3000
* | TSS |
* | only sizeof(tss) is | (4 KBs)
* | used |
......@@ -243,7 +243,7 @@ int lcd_arch_ept_map_gpa_to_hpa(struct lcd_arch *vcpu, u64 gpa, u64 hpa,
* | (not mapped) | (4 KBs)
* +---------------------------+ 0x0000 0000 0000 0000
*/
#define LCD_ARCH_IPC_REGS 0x0000000000003000UL
#define LCD_ARCH_UTCB 0x0000000000003000UL
#define LCD_ARCH_STACK_TOP 0x0000000000004000UL
#define LCD_ARCH_FREE LCD_ARCH_STACK_TOP
......@@ -267,16 +267,16 @@ static inline u64 __lcd_arch_get_msg_reg(lcd_arch *vcpu, unsigned int idx)
*
* Message regs 2, ... always use the mr's in struct lcd_ipc_regs.
*
* (The first two mr's in struct lcd_ipc_regs are reserved for
* (The first two mr's in utcb are reserved for
* mr's 0 and 1. If the caller wishes to explicitly use those mr's,
* they should do so by manually accessing struct lcd_ipc_regs.)
* they should do so by manually accessing the mr's in utcb.)
*/
if (idx == 0)
return vcpu->regs[LCD_ARCH_REGS_EDI];
else if (idx == 1)
return vcpu->regs[LCD_ARCH_REGS_EBP];
else
return vcpu->ipc_regs->mr[idx];
return vcpu->utcb->ipc.mr[idx];
}
#define LCD_ARCH_SET_CAP_REG(vcpu, val) ({ \
......@@ -299,16 +299,16 @@ static inline void __lcd_arch_set_msg_reg(lcd_arch *vcpu, unsigned int idx,
*
* Message regs 2, ... always use the mr's in struct lcd_ipc_regs.
*
* (The first two mr's in struct lcd_ipc_regs are reserved for
* (The first two mr's in utcb are reserved for
* mr's 0 and 1. If the caller wishes to explicitly use those mr's,
* they should do so by manually accessing struct lcd_ipc_regs.)
* they should do so by manually accessing the mr's in utcb.)
*/
if (idx == 0)
vcpu->regs[LCD_ARCH_REGS_EDI] = val;
else if (idx == 1)
vcpu->regs[LCD_ARCH_REGS_EBP] = val;
else
vcpu->ipc_regs->mr[idx] = val;
vcpu->utcb->ipc.mr[idx] = val;
}
#endif /* LCD_DOMAINS_ARCH_H */
......@@ -1872,7 +1872,7 @@ fail:
}
/**
* Allocates and maps stack / ipc registers memory.
* Allocates and maps stack / utcb.
*
* %rsp not set until guest virtual address space initialized.
*/
......@@ -1883,10 +1883,10 @@ static int vmx_init_stack(struct lcd_arch *vcpu)
/*
* Alloc zero'd page for stack.
*
* Bottom of stack will contain ipc buffer.
* Bottom of stack will contain utcb.
*/
vcpu->ipc_regs = (struct lcd_ipc_regs *)get_zeroed_page(GFP_KERNEL);
if (!vcpu->ipc_regs) {
vcpu->utcb = (struct lcd_utcb *)get_zeroed_page(GFP_KERNEL);
if (!vcpu->utcb) {
ret = -ENOMEM;
goto fail;
}
......@@ -1909,7 +1909,7 @@ static int vmx_init_stack(struct lcd_arch *vcpu)
return 0;
fail_map:
free_page((u64)vcpu->ipc_regs);
free_page((u64)vcpu->utcb);
fail:
return ret
}
......@@ -1986,7 +1986,7 @@ struct lcd_arch* lcd_arch_create(void)
goto fail_tss;
/*
* Initialize stack / ipc registers
* Initialize stack / utcb
*/
if (vmx_init_stack(vcpu))
goto fail_stack;
......
#ifndef LCD_DOMAINS_IPC_H
#define LCD_DOMAINS_IPC_H
/*
* Message Registers
* =================
*
* Capability Register machine register (arch-dep)
* Badge Register machine register (arch-dep)
* Message tag machine register (arch-dep)
* Message registers 6 total. All message registers are available in
* struct lcd_ipc_regs. Some message registers may
* also be accessible via machine registers. Use
* arch-dep macros for guaranteed fast and portable
* access.
*
* For portability, use the arch-dep macros provided by the arch code
* to access ipc registers.
*
* Based on seL4 message register design. See seL4 Manual, 4.1.
*/
struct lcd_ipc_regs {
/*
* Capability, badge, and message tag are always machine regs.
*
* Message registers
*/
u64 mr[6];
};
#endif /* LCD_DOMAINS_IPC_H */
......@@ -2,7 +2,7 @@
#define LCD_DOMAINS_LCD_DOMAINS_H
#include <asm/lcd-domains-arch.h>
#include <lcd-domains/ipc.h>
#include <lcd-domains/utcb.h>
struct lcd {
/*
......@@ -10,10 +10,11 @@ struct lcd {
*/
struct lcd_arch *lcd_arch;
/*
* IPC registers. Points to memory allocated by
* arch-dep code for IPC registers (inside struct lcd_arch).
* User thread control block. This is the data accessible
* inside the lcd (ipc registers, ...). Points to memory allocated by
* arch-dep code (inside struct lcd_arch).
*/
struct lcd_ipc_regs *ipc_regs;
struct lcd_utcb *utcb;
};
#endif /* LCD_DOMAINS_LCD_DOMAINS_H */
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