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

UTCB struct added, syscall codes, updated arch-dep code (untested).

(forgot to git add utcb header)

Syscall (hypercall?) codes are in include/lcd-domains/syscall.h.

Added syscall code accessor macro to lcd-domains-arch.h.

Fixed capability register accessor macros to use %rbx.
parent b8e5e2e4
......@@ -247,6 +247,11 @@ int lcd_arch_ept_map_gpa_to_hpa(struct lcd_arch *vcpu, u64 gpa, u64 hpa,
#define LCD_ARCH_STACK_TOP 0x0000000000004000UL
#define LCD_ARCH_FREE LCD_ARCH_STACK_TOP
/*
* Accessor Macro for syscalls
* ===========================
*/
#define LCD_ARCH_GET_SYSCALL_NUM(vcpu) (vcpu->regs[LCD_ARCH_REGS_RAX])
/*
* Accessor Macros for IPC
......@@ -256,7 +261,7 @@ int lcd_arch_ept_map_gpa_to_hpa(struct lcd_arch *vcpu, u64 gpa, u64 hpa,
*
* See seL4 manual, 4.1.
*/
#define LCD_ARCH_GET_CAP_REG(vcpu) (vcpu->regs[LCD_ARCH_REGS_RAX])
#define LCD_ARCH_GET_CAP_REG(vcpu) (vcpu->regs[LCD_ARCH_REGS_RBX])
#define LCD_ARCH_GET_BDG_REG(vcpu) (vcpu->regs[LCD_ARCH_REGS_RBX])
#define LCD_ARCH_GET_TAG_REG(vcpu) (vcpu->regs[LCD_ARCH_REGS_RSI])
#define LCD_ARCH_GET_MSG_REG(vcpu, idx) (__lcd_arch_get_msg_reg(vcpu, idx))
......@@ -280,7 +285,7 @@ static inline u64 __lcd_arch_get_msg_reg(lcd_arch *vcpu, unsigned int idx)
}
#define LCD_ARCH_SET_CAP_REG(vcpu, val) ({ \
vcpu->regs[LCD_ARCH_REGS_RAX] = val; \
vcpu->regs[LCD_ARCH_REGS_RBX] = val; \
})
#define LCD_ARCH_SET_BDG_REG(vcpu, val) ({ \
vcpu->regs[LCD_ARCH_REGS_RBX] = val; \
......
......@@ -2068,11 +2068,12 @@ static void vmx_step_instruction(void)
/**
* Processes a vmcall. For now, the only reason the lcd
* would execute a vmcall is for ipc.
* would execute a vmcall is for a syscall to the
* hypervisor.
*/
static int vmx_handle_vmcall(struct lcd_arch *vcpu)
{
return LCD_ARCH_STATUS_IPC;
return LCD_ARCH_STATUS_SYSCALL;
}
/**
......
#ifndef LCD_DOMAINS_SYSCALL_H
#define LCD_DOMAINS_SYSCALL_H
enum lcd_syscall {
LCD_SYSCALL_SEND = 0,
LCD_SYSCALL_NBSEND = 1,
LCD_SYSCALL_CALL = 2,
LCD_SYSCALL_WAIT = 3,
LCD_SYSCALL_REPLY = 4,
LCD_SYSCALL_REPLYWAIT = 5,
LCD_SYSCALL_YIELD = 6,
};
#endif /* LCD_DOMAINS_SYSCALL_H */
#ifndef LCD_DOMAINS_UTCB_H
#define LCD_DOMAINS_UTCB_H
/*
* User thread control block
* =========================
*
* This is accessible (mapped) inside the lcd.
*/
struct lcd_utcb {
/*
* IPC 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 the ipc.mr array. 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 {
u64 mr[6];
} ipc;
};
#endif /* LCD_DOMAINS_UTCB_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