search for: vmi_wrap_call

Displaying 20 results from an estimated 20 matches for "vmi_wrap_call".

2007 Apr 18
0
[RFC, PATCH 13/24] i386 Vmi system header
...ong with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + + +#ifndef _MACH_SYSTEM_H +#define _MACH_SYSTEM_H + +#include <vmi.h> + +static inline void write_cr0(const u32 val) +{ + vmi_wrap_call( + SetCR0, "mov %0, %%cr0", + VMI_NO_OUTPUT, + 1, VMI_IREG1(val), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +static inline void write_cr2(const u32 val) +{ + vmi_wrap_call( + SetCR2, "mov %0, %%cr2", + VMI_NO_OUTPUT, + 1, VMI_IREG1(val), + VMI_CLOBB...
2007 Apr 18
0
[RFC, PATCH 13/24] i386 Vmi system header
...ong with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + + +#ifndef _MACH_SYSTEM_H +#define _MACH_SYSTEM_H + +#include <vmi.h> + +static inline void write_cr0(const u32 val) +{ + vmi_wrap_call( + SetCR0, "mov %0, %%cr0", + VMI_NO_OUTPUT, + 1, VMI_IREG1(val), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +static inline void write_cr2(const u32 val) +{ + vmi_wrap_call( + SetCR2, "mov %0, %%cr2", + VMI_NO_OUTPUT, + 1, VMI_IREG1(val), + VMI_CLOBB...
2007 Apr 18
1
[RFC, PATCH 16/24] i386 Vmi io header
...+ * clobber is not an effect of the VMI call, but is used to + * serialize memory writes by the compiler before an I/O + * instruction. In addition, even input operations may clobber + * hardware mapped memory. + */ + +static inline void vmi_outl(const VMI_UINT32 value, const VMI_UINT16 port) +{ + vmi_wrap_call( + OUT, "out %0, %w1", + VMI_NO_OUTPUT, + 2, XCONC("a"(value), "d"(port)), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +static inline void vmi_outb(const VMI_UINT8 value, const VMI_UINT16 port) +{ + vmi_wrap_call( + OUTB, "outb %b0, %w1&qu...
2007 Apr 18
1
[RFC, PATCH 16/24] i386 Vmi io header
...+ * clobber is not an effect of the VMI call, but is used to + * serialize memory writes by the compiler before an I/O + * instruction. In addition, even input operations may clobber + * hardware mapped memory. + */ + +static inline void vmi_outl(const VMI_UINT32 value, const VMI_UINT16 port) +{ + vmi_wrap_call( + OUT, "out %0, %w1", + VMI_NO_OUTPUT, + 2, XCONC("a"(value), "d"(port)), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +static inline void vmi_outb(const VMI_UINT8 value, const VMI_UINT16 port) +{ + vmi_wrap_call( + OUTB, "outb %b0, %w1&qu...
2007 Apr 18
3
[RFC, PATCH 10/24] i386 Vmi descriptor changes
...nc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + +#ifndef __MACH_DESC_H +#define __MACH_DESC_H + +#include <vmi.h> + +#if !defined(CONFIG_X86_VMI) +# error invalid sub-arch include +#endif + +static inline void load_gdt(VMI_DTR *const dtr) +{ + vmi_wrap_call( + SetGDT, "lgdt (%0)", + VMI_NO_OUTPUT, + 1, VMI_IREG1 (dtr), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +static inline void load_idt(VMI_DTR *const dtr) +{ + vmi_wrap_call( + SetIDT, "lidt (%0)", + VMI_NO_OUTPUT, + 1, VMI_IREG1 (dtr), + VMI_CLOBBER...
2007 Apr 18
3
[RFC, PATCH 10/24] i386 Vmi descriptor changes
...nc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + +#ifndef __MACH_DESC_H +#define __MACH_DESC_H + +#include <vmi.h> + +#if !defined(CONFIG_X86_VMI) +# error invalid sub-arch include +#endif + +static inline void load_gdt(VMI_DTR *const dtr) +{ + vmi_wrap_call( + SetGDT, "lgdt (%0)", + VMI_NO_OUTPUT, + 1, VMI_IREG1 (dtr), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +static inline void load_idt(VMI_DTR *const dtr) +{ + vmi_wrap_call( + SetIDT, "lidt (%0)", + VMI_NO_OUTPUT, + 1, VMI_IREG1 (dtr), + VMI_CLOBBER...
2007 Apr 18
2
[RFC, PATCH 17/24] i386 Vmi msr patch
...i386/mach-vmi/mach_msr.h 2006-03-08 10:32:07.000000000 -0800 +++ linux-2.6.16-rc5/include/asm-i386/mach-vmi/mach_msr.h 2006-03-08 10:32:30.000000000 -0800 @@ -0,0 +1,79 @@ +#ifndef MACH_MSR_H +#define MACH_MSR_H + +#include <vmi.h> + +static inline u64 vmi_rdmsr(const u32 msr) +{ + u64 ret; + vmi_wrap_call( + RDMSR, "rdmsr", + VMI_OREG64 (ret), + 1, "c" (msr), + VMI_CLOBBER(TWO_RETURNS)); + return ret; +} + +#define rdmsr(msr,val1,val2) \ +do { \ + u64 _val = vmi_rdmsr(msr); \ + val1 = (u32)_val; \ + val2 = (u32)(_val >> 32); \ +} while (0) + +static inline void wrmsr(co...
2007 Apr 18
2
[RFC, PATCH 17/24] i386 Vmi msr patch
...i386/mach-vmi/mach_msr.h 2006-03-08 10:32:07.000000000 -0800 +++ linux-2.6.16-rc5/include/asm-i386/mach-vmi/mach_msr.h 2006-03-08 10:32:30.000000000 -0800 @@ -0,0 +1,79 @@ +#ifndef MACH_MSR_H +#define MACH_MSR_H + +#include <vmi.h> + +static inline u64 vmi_rdmsr(const u32 msr) +{ + u64 ret; + vmi_wrap_call( + RDMSR, "rdmsr", + VMI_OREG64 (ret), + 1, "c" (msr), + VMI_CLOBBER(TWO_RETURNS)); + return ret; +} + +#define rdmsr(msr,val1,val2) \ +do { \ + u64 _val = vmi_rdmsr(msr); \ + val1 = (u32)_val; \ + val2 = (u32)(_val >> 32); \ +} while (0) + +static inline void wrmsr(co...
2007 Apr 18
1
[RFC, PATCH 12/24] i386 Vmi processor header
...ree Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + + +#ifndef _MACH_PROCESSOR_H +#define _MACH_PROCESSOR_H + +#include <vmi.h> + +static inline void vmi_cpuid(const int op, int *eax, int *ebx, int *ecx, int *edx) +{ + vmi_wrap_call( + CPUID, "cpuid", + XCONC("=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)), + 1, "a" (op), + VMI_CLOBBER(FOUR_RETURNS)); +} + +/* + * Generic CPUID function + */ +static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *...
2007 Apr 18
1
[RFC, PATCH 12/24] i386 Vmi processor header
...ree Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + + +#ifndef _MACH_PROCESSOR_H +#define _MACH_PROCESSOR_H + +#include <vmi.h> + +static inline void vmi_cpuid(const int op, int *eax, int *ebx, int *ecx, int *edx) +{ + vmi_wrap_call( + CPUID, "cpuid", + XCONC("=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)), + 1, "a" (op), + VMI_CLOBBER(FOUR_RETURNS)); +} + +/* + * Generic CPUID function + */ +static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *...
2007 Apr 18
0
[RFC, PATCH 18/24] i386 Vmi tlbflush header
...along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + + +#ifndef _MACH_TLBFLUSH_H +#define _MACH_TLBFLUSH_H + +#include <vmi.h> + +static inline void __flush_tlb(void) +{ + vmi_wrap_call( + FlushTLB, "mov %%cr3, %%eax; mov %%eax, %%cr3", + VMI_NO_OUTPUT, + 1, VMI_IREG1(VMI_FLUSH_TLB), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "eax", "memory")); +} + +static inline void __flush_tlb_global(void) +{ + vmi_wrap_call( + FlushTLB, "mov %%cr4, %%eax; \n&...
2007 Apr 18
0
[RFC, PATCH 18/24] i386 Vmi tlbflush header
...along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to zach@vmware.com + * + */ + + +#ifndef _MACH_TLBFLUSH_H +#define _MACH_TLBFLUSH_H + +#include <vmi.h> + +static inline void __flush_tlb(void) +{ + vmi_wrap_call( + FlushTLB, "mov %%cr3, %%eax; mov %%eax, %%cr3", + VMI_NO_OUTPUT, + 1, VMI_IREG1(VMI_FLUSH_TLB), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "eax", "memory")); +} + +static inline void __flush_tlb_global(void) +{ + vmi_wrap_call( + FlushTLB, "mov %%cr4, %%eax; \n&...
2007 Apr 18
0
[RFC, PATCH 23/24] i386 Vmi timer patch
...+ * 'ready' state. Available time is the remaining time -- the vcpu is + * either 'running' or 'halted'. + * + * All three views of time are accessible through the VMI cycle + * counters. + */ + +static inline VMI_CYCLES vmi_get_cycle_frequency(void) +{ + VMI_CYCLES ret; + vmi_wrap_call( + GetCycleFrequency, "xor %%eax, %%eax;" + "xor %%edx, %%edx;", + VMI_OREG64 (ret), + 0, VMI_NO_INPUT, + VMI_CLOBBER(TWO_RETURNS)); + return ret; +} + +static inline VMI_CYCLES vmi_get_real_cycles(void) +{ + VMI_CYCLES ret; + vmi_wrap_call( + GetCycleCounter, "r...
2007 Apr 18
0
[RFC, PATCH 23/24] i386 Vmi timer patch
...+ * 'ready' state. Available time is the remaining time -- the vcpu is + * either 'running' or 'halted'. + * + * All three views of time are accessible through the VMI cycle + * counters. + */ + +static inline VMI_CYCLES vmi_get_cycle_frequency(void) +{ + VMI_CYCLES ret; + vmi_wrap_call( + GetCycleFrequency, "xor %%eax, %%eax;" + "xor %%edx, %%edx;", + VMI_OREG64 (ret), + 0, VMI_NO_INPUT, + VMI_CLOBBER(TWO_RETURNS)); + return ret; +} + +static inline VMI_CYCLES vmi_get_real_cycles(void) +{ + VMI_CYCLES ret; + vmi_wrap_call( + GetCycleCounter, "r...
2007 Apr 18
0
[RFC, PATCH 15/24] i386 Vmi apic header
...APICs. Calls into VMI + * to perform operations. + */ + +#ifndef __ASM_MACH_APICOPS_H +#define __ASM_MACH_APICOPS_H + +#ifdef CONFIG_X86_LOCAL_APIC +#include <vmi.h> + +static inline void apic_write(unsigned long reg, unsigned long value) +{ + void *addr = (void *)(APIC_BASE + reg); + vmi_wrap_call( + APICWrite, "movl %1, (%0)", + VMI_NO_OUTPUT, + 2, XCONC(VMI_IREG1(addr), VMI_IREG2(value)), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +#define apic_write_atomic(r,v) apic_write(r,v) + +static inline unsigned long apic_read(unsigned long reg) +{ + unsigned long...
2007 Apr 18
0
[RFC, PATCH 15/24] i386 Vmi apic header
...APICs. Calls into VMI + * to perform operations. + */ + +#ifndef __ASM_MACH_APICOPS_H +#define __ASM_MACH_APICOPS_H + +#ifdef CONFIG_X86_LOCAL_APIC +#include <vmi.h> + +static inline void apic_write(unsigned long reg, unsigned long value) +{ + void *addr = (void *)(APIC_BASE + reg); + vmi_wrap_call( + APICWrite, "movl %1, (%0)", + VMI_NO_OUTPUT, + 2, XCONC(VMI_IREG1(addr), VMI_IREG2(value)), + VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory")); +} + +#define apic_write_atomic(r,v) apic_write(r,v) + +static inline unsigned long apic_read(unsigned long reg) +{ + unsigned long...
2007 Apr 18
3
[RFC, PATCH 4/24] i386 Vmi inline implementation
...ies: + * Input and output must be wrapped using XCONC(...) + * Best is to use constraints that are fixed size (like (%1) ... "r") + * If you use variable sized constraints like "m" or "g" in the + * replacement make sure to pad to the worst case length. + */ + +#define vmi_wrap_call(call, native, output, num_inputs, input, clobber) \ +do { \ + asm volatile (XCSTR(vmi_native_start) "\n\t" \ + native "\n\t" \ + XCSTR(vmi_native_finish) "\n\t" \ + \ + XCSTR(vmi_translation_start) "\n\t"...
2007 Apr 18
3
[RFC, PATCH 4/24] i386 Vmi inline implementation
...ies: + * Input and output must be wrapped using XCONC(...) + * Best is to use constraints that are fixed size (like (%1) ... "r") + * If you use variable sized constraints like "m" or "g" in the + * replacement make sure to pad to the worst case length. + */ + +#define vmi_wrap_call(call, native, output, num_inputs, input, clobber) \ +do { \ + asm volatile (XCSTR(vmi_native_start) "\n\t" \ + native "\n\t" \ + XCSTR(vmi_native_finish) "\n\t" \ + \ + XCSTR(vmi_translation_start) "\n\t"...
2007 Apr 18
1
[RFC, PATCH 19/24] i386 Vmi mmu changes
...define mach_setup_pgd(pfn, root, base, count) \ + vmi_allocate_page(pfn, VMI_PAGE_PDP, root, base, count) +#define mach_release_pgd(pfn) vmi_release_page(pfn, VMI_PAGE_PDP) +#endif + +static inline void vmi_set_linear_mapping(const int slot, const u32 va, const u32 pages, const u32 ppn) +{ + vmi_wrap_call( + SetLinearMapping, "", + VMI_NO_OUTPUT, + 4, XCONC(VMI_IREG1(slot), VMI_IREG2(va), VMI_IREG3(pages), VMI_IREG4(ppn)), + VMI_CLOBBER(ZERO_RETURNS)); +} + +#define mach_map_linear_pt(num, ptep, pfn) \ + vmi_set_linear_mapping(num+1, (uint32_t)ptep, 1, pfn) +#define mach_map_linear_ran...
2007 Apr 18
1
[RFC, PATCH 19/24] i386 Vmi mmu changes
...define mach_setup_pgd(pfn, root, base, count) \ + vmi_allocate_page(pfn, VMI_PAGE_PDP, root, base, count) +#define mach_release_pgd(pfn) vmi_release_page(pfn, VMI_PAGE_PDP) +#endif + +static inline void vmi_set_linear_mapping(const int slot, const u32 va, const u32 pages, const u32 ppn) +{ + vmi_wrap_call( + SetLinearMapping, "", + VMI_NO_OUTPUT, + 4, XCONC(VMI_IREG1(slot), VMI_IREG2(va), VMI_IREG3(pages), VMI_IREG4(ppn)), + VMI_CLOBBER(ZERO_RETURNS)); +} + +#define mach_map_linear_pt(num, ptep, pfn) \ + vmi_set_linear_mapping(num+1, (uint32_t)ptep, 1, pfn) +#define mach_map_linear_ran...