Commit Graph
16497 Commits
Author SHA1 Message Date
Keir Fraser 9f0c829d98 domain builder: make mmap() failure message more verbose.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-12-04 10:13:04 +00:00
Keir Fraser 85b3f5270f mini-os: No -fpic when building for x86.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-12-04 10:11:54 +00:00
Keir Fraser 385f8d1811 vnet: Fix compilation on x86/64 which erroneously asserts
__ARCH_WANT_SYS_SOCKETCALL.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-12-04 10:10:23 +00:00
Keir Fraser d909ee8778 vnet: Fix compilation.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-12-04 10:04:00 +00:00
Keir Fraser bc6eac95a7 x86: Move get_page/put_page out of header file, and only print on
get_page() failure if the domain is not dying.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-12-04 09:56:10 +00:00
Keir Fraser 86ca9c3f61 x86_emulate: Fix POPA. Few other cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-29 19:30:33 +00:00
Keir Fraser e29c63f1fe vmx: Better tracing in vmcs_dump_vcpu() -- grab RIP/RSP/RFLAGS from
cpu_user_regs structure as well as VMCS.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 22:36:33 +00:00
Keir Fraser 0afc34ab47 x86_emulate: Emulate SHLD and SHRD instructions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 22:09:19 +00:00
Keir Fraser 327252d365 domctl: Fix handling of size parameter in ext_vcpucontext domctl commands.
Original patch by Stefan Berger.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 13:36:56 +00:00
Keir Fraser 9b08de03e8 xsm: Fix linker script integration for xsm initcall list.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 13:28:49 +00:00
Keir Fraser ea99e85d53 hvm: Fix 2 type mismatches in vlapic.h and hpet.c for 32-bit build Xen
For 32-bit build of Xen:
1) the first mismatch (in hpet_read(), length is 4)  makes guest think
the HPET DM is buggy (we return 0 for HPET_CFG.COUNTER_CLK_PERIOD to
guest), so guest wouldn't use HPET at all.
2) the second one: if tmict is 62500000 and timer_divisor is 16
(Fedoar7's installer uses the values at some time), 10 * 62500000 * 16
= 0x2540BE400 -- it's too big to be held in uint32_t.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>=20
2007-11-28 13:13:51 +00:00
Keir Fraser fc900cc7d9 hvm: Inject #UD for un-emulated instructions rather than crash guest
The CrashMe stress test (a process repeatedly forks child processes, and
the child processes initialize a buffer with random numbers, then treat
the buffer as code, and execute it) can crash 32-bit HVM RHEL5.1 guest
easily; this is because we haven't emulated all the instructions in
handle_mmio() yet.

The CrashMe process runs with root rights, and can access MMIO space in
an unknown way ("strace -f" shows the random codes running at CPL=3D3
don't call mmap(), and don't open any special files in /dev/ "); the gpa
may look like 0xa**** or  0xb****, or 0xfee0****. =20

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 13:04:47 +00:00
Keir Fraser ec0ce3927b Fix string length check for vsnprintf() in debugtrace_printk().
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-11-28 12:50:24 +00:00
Keir Fraser 278d76c2a6 x86_emulate: Emulate RDTSC instruction.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 12:44:46 +00:00
Keir Fraser 911bdb1bf5 x86_emulate: Emulate ENTER and LEAVE instructions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-28 12:44:19 +00:00
Keir Fraser 040d9d2287 [Mini-OS] Catch NULL dereferences
Unmap page 0 (only used early at boot) so as to catch NULL dereferences.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-11-28 12:42:17 +00:00
Keir Fraser c0a00d42f4 [Mini-OS] Fix strrchr() when string doesn't contain the character.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-11-28 12:41:41 +00:00
Keir Fraser 1c0c172695 [Mini-OS] Make gnttab allocation/free safe
Add a semaphore to protect gnttab_list from exhaustion, and disable
callbacks during allocation/free.  Fix the network frontend accordingly.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-11-28 12:40:57 +00:00
Keir Fraser 7f4955ee5f vt-d: Some fixes and cleanup of Intel iommu
This patch modifies domain id in __iommu_flush_context() and
__iommu_flush_iotlb() to be consistent consist with domain id set by
context_set_domain_id(), avoids setting NULL to  address space root
and corrects macro cap_ndoms.

Signed-off-by: Weidong Han <weidong.han@intel.com>
2007-11-28 12:34:11 +00:00
Keir Fraser 70db19da26 minios: Revert 16206:7b5b65fbaf61 (xenbus wait fixup)
Already fixed by 14432:f40079acf646.
2007-11-27 12:49:16 +00:00
Keir Fraser 25bcada5cc x86_emulate: Fix use-before-initialise warning.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-27 12:45:08 +00:00
Keir Fraser 9693f55633 vmx realmode: Slight finessing of an error path.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 22:28:48 +00:00
Keir Fraser 5f91fd624f vmx realmode: When returning to protected mode we have to massage the
segment state to pass VMENTER's stringent 'sanity checks'.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 22:20:21 +00:00
Keir Fraser 8e5fe76bbc vmx realmode: Emulate writes to control registers.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 17:55:23 +00:00
Keir Fraser 70d9b1077f x86_emulate: Emulate LMSW and SMSW.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 17:54:54 +00:00
Keir Fraser a209260781 x86 emulate: Emulate atomic read-modify-write instructions as a
straightforward write. Hopefully multiprocessor synchronisation is not
relied upon in real mode!
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 16:57:57 +00:00
Keir Fraser a96dfd9bf5 vmx realmode: Fix emulation of exception delivery (stack pointer must
be adjusted for FLAGS push), and fix up vmx_realmode() exit protocol
now that it is called from asm stub context.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 16:47:10 +00:00
Keir Fraser edfee9bba5 x86_emulate: Emulate RETF and RETF imm16.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 16:46:22 +00:00
Keir Fraser dbccb328c8 x86_emulate: Emulate CPUID and HLT.
vmx realmode: Fix decode & emulate loop, add hooks for CPUID, HLT and
WBINVD. Also do not hook realmode entry off of vmentry failure any
more.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 15:32:54 +00:00
Keir Fraser cfb9675b68 x86_emulate: Emulate LDS/LES/LFS/LGS/LSS.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-26 13:54:45 +00:00
Keir Fraser 93bae2aebc vmx realmode: Detect and correctly plumb mmio accesses from emulated
realmode. Also correctly handle debug output to I/O port 0xe9.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 21:24:48 +00:00
Keir Fraser 0d0e0d8cc0 x86_emulate: Emulate CMPS and SCAS string-compare instructions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 18:07:33 +00:00
Keir Fraser 4abb21480a x86_emulate: Emulate IRET.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 18:06:30 +00:00
Keir Fraser f96485f010 x86_emulate: Decode and emulate PUSHF/POPF.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 18:05:56 +00:00
Keir Fraser b8e219e001 x86_emulate: Allow emulated injection of exceptions and interrupts.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 18:05:10 +00:00
Keir Fraser d0b01f6dd8 x86_emulate: Emulate far call/jmp. This completes emulation of Grp5.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 12:43:13 +00:00
Keir Fraser 3c7c7376b6 vmx realmode: Support privileged EFLAGS updates in emulated realmode.
Also tweak debug tracing to be much less noisy. We can emulates tens
of thousands of instructions in rombios now.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 11:45:02 +00:00
Keir Fraser a2b5673b00 vmx realmode: Plumb through I/O port accesses in emulated realmode.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-25 11:43:53 +00:00
Keir Fraser 727f3fd5fa vt-d: Fix iommu_map_page().
Signed-off-by: Weidong Han <weidong.han@intel.com>
2007-11-25 09:23:02 +00:00
Keir Fraser 6335a36da1 Remove unused bcopy() implementation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-24 22:33:38 +00:00
Keir Fraser e88b181bba Revert 16450:5e8e82e80. Instead remove all arch-specific handling of
memcmp() and hence always use common/lib.c version.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-24 22:19:03 +00:00
Keir Fraser cbbb95478e vmx: Initial framework for real-mode emulation (disabled by default).
Still plenty to do:
 - i/o emulation
 - more instructions
 - interrupt/exception delivery
 - vm86 fast path
At this stage we can get three instructions into the rombios.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-24 21:46:14 +00:00
Keir Fraser dabf515e00 x86_emulate: Support most common segment load/save instructions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-24 21:40:19 +00:00
Keir Fraser 183d8f663f x86: Fix read/write control-register in x86_emulate().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-24 16:16:57 +00:00
Keir Fraser 1f0fd2f1a4 vt-d: Some fixes of Intel iommu
This patch removes a wrong if condition judgement to setup rmrr
identify mapping for guests, and passes page count rather than address
size to iommu_flush_iotlb_psi().

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Anthony Xu <Anthony.xu@intel.com>
2007-11-24 13:40:23 +00:00
Keir Fraser fdcf346d71 [ACM] Remove aggregate set calculations for Domain-0
Since the pre_domain_create hook is called also for Dom-0, this
special case handling is not necessary any more.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-11-24 13:39:13 +00:00
Keir Fraser 4224d67524 Fix non-optimized compilation of Xen's memcmp
Even when using __builtin_memcmp, gcc may emit external references to
memcmp (when not optimizing for instance), so this #define does not
always provide a completely suitable memcmp().

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-11-24 13:37:26 +00:00
Keir Fraser 32946b60f1 [Mini-OS] Fix domain blocking race
A callback which wakes a thread may happen between the moment
schedule() gives hand to the idle thread and the latter blocks the
domain.  Idle hence needs to atomically check that no thread is
running and block, else awoken threads may have to wait up to 10
seconds.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-11-24 13:31:39 +00:00
Keir Fraser 153bf11814 [Mini-OS] Permit x86_64 trap handlers to return
Trap handlers sometimes fix the problem, so they need to be able to
return.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-11-24 13:31:01 +00:00
Keir Fraser 26aa688655 [Mini-OS] Make sure schedule() is called safely
If a thread tries to sleep from a callback or with callbacks disabled,
Mini-OS will completely lock, so make sure this never happens.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-11-24 13:29:20 +00:00