History log of /drivers/lguest/x86/core.c
Revision Date Author Comments
1cf8343f55525c09c88da0a494a96e1b034f84e2 06-Dec-2011 Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com> x86: Fix rflags in FAKE_STACK_FRAME

The x86_64 kernel pushes the fake kernel stack in
arch/x86/kernel/entry_64.S:FAKE_STACK_FRAME, and
rflags register in it does not conform to the specification.

Although Intel's manual[1] says bit 1 of it shall be set to 1,
this bit is cleared to 0 on pushing the fake stack.

[1] Intel(R) 64 and IA-32 Architectures Software Developer's Manual
Vol.1 3-21 Figure 3-8. EFLAGS Register

If it is not on purpose, it is better to be fixed, because
it can lead some tools misunderstanding the stack frame. For example,
"crash" utility[2] actually detects it and warns you like
below:

RIP: ffffffff8005dfa2 RSP: ffff8104ce0c7f58 RFLAGS: 00000200
[...]

bt: WARNING: possibly bogus exception frame

Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Tested-by: Masayoshi MIZUMA <m.mizuma@jp.fujitsu.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
996ba96a97f7406052486682846d68935a60e986 22-Jul-2011 Rusty Russell <rusty@rustcorp.com.au> lguest: Fix in/out emulation

We were blatting too much of the register. Linux didn't care, but in
theory it might.

Reported-by: Jonas Maebe <jonas.maebe@elis.ugent.be>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9f54288def3f92b7805eb6d4b1ddcd73ecf6e889 22-Jul-2011 Rusty Russell <rusty@rustcorp.com.au> lguest: update comments

Also removes a long-unused #define and an extraneous semicolon.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6d7a5d1ea34495ecb1d608f0e40afba7776ee408 22-Jul-2011 Rusty Russell <rusty@rustcorp.com.au> lguest: don't rewrite vmcall instructions

Now we no longer use vmcall, we don't need to rewrite it in the Guest.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ced05dd741779986861fe7369fe002f542d6fa34 21-Jan-2011 Rusty Russell <rusty@rustcorp.com.au> lguest: compile fixes

arch/x86/lguest/boot.c: In function ‘lguest_init_IRQ’:
arch/x86/lguest/boot.c:824: error: macro "__this_cpu_write" requires 2 arguments, but only 1 given
arch/x86/lguest/boot.c:824: error: ‘__this_cpu_write’ undeclared (first use in this function)
arch/x86/lguest/boot.c:824: error: (Each undeclared identifier is reported only once
arch/x86/lguest/boot.c:824: error: for each function it appears in.)

drivers/lguest/x86/core.c: In function ‘copy_in_guest_info’:
drivers/lguest/x86/core.c:94: error: lvalue required as left operand of assignment

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
c9f2954964df1490373065558f3156379c7a2454 30-Nov-2010 Christoph Lameter <cl@linux.com> lguest: Use this_cpu_ops

Use this_cpu_ops in a couple of places in lguest.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
5094aeafbbd500509f648e3cd102b053bc7926b3 15-Apr-2010 Rusty Russell <rusty@rustcorp.com.au> lguest: workaround cmpxchg8b_emu by ignoring cli in the guest.

It's only used by cmpxchg8b_emu (see db677ffa5f5a for the gory
details), and fixing that to be paravirt aware would be more work than
simply ignoring it (and AFAICT only help lguest). This makes lguest
work on machines which have cmpxchg8b, for kernels compiled for older
processors.

(We can't emulate it properly: the popf which expects to restore interrupts
does not trap).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: virtualization@lists.osdl.org
390dfd95c5df1ab3921dd388d11b2aee332c3f2c 29-Oct-2009 Tejun Heo <tj@kernel.org> percpu: make misc percpu symbols unique

This patch updates misc percpu related symbols such that percpu
symbols are unique and don't clash with local symbols. This serves
two purposes of decreasing the possibility of global percpu symbol
collision and allowing dropping per_cpu__ prefix from percpu symbols.

* drivers/crypto/padlock-aes.c: s/last_cword/paes_last_cword/

* drivers/lguest/x86/core.c: s/last_cpu/lg_last_cpu/

* drivers/s390/net/netiucv.c: rename the variable used in a macro to
avoid clashing with percpu symbol

* arch/mn10300/kernel/kprobes.c: replace current_ prefix with cur_ for
static variables. Please note that percpu symbol current_kprobe
can't be changed as it's used by generic code.

Partly based on Rusty Russell's "alloc_percpu: rename percpu vars
which cause name clashes" patch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Chuck Ebbert <cebbert@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
a91d74a3c4de8115295ee87350c13a329164aaaf 31-Jul-2009 Rusty Russell <rusty@rustcorp.com.au> lguest: update commentry

Every so often, after code shuffles, I need to go through and unbitrot
the Lguest Journey (see drivers/lguest/README). Since we now use RCU in
a simple form in one place I took the opportunity to expand that explanation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
2e04ef76916d1e29a077ea9d0f2003c8fd86724d 31-Jul-2009 Rusty Russell <rusty@rustcorp.com.au> lguest: fix comment style

I don't really notice it (except to begrudge the extra vertical
space), but Ingo does. And he pointed out that one excuse of lguest
is as a teaching tool, it should set a good example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@redhat.com>
564346224daaa8f7222d7a92cdbb7bafde59ae6e 26-May-2009 Rusty Russell <rusty@rustcorp.com.au> lguest: fix on Intel when KVM loaded (unhandled trap 13)

When KVM is loaded, and hence VT set up, the vmcall instruction in an
lguest guest causes a #GP, not #UD.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a489f0b555b753f9df8ddc24c7e74f657ef7ee7b 20-Apr-2009 Rusty Russell <rusty@rustcorp.com.au> lguest: fix guest crash on non-linear addresses in gdt pvops

Fixes guest crash 'lguest: bad read address 0x4800000 len 256'

The new per-cpu allocator ends up handing a non-linear address to
write_gdt_entry. We do __pa() on it, and hand it to the host, which
kills us.

I've long wanted to make the hypercall "LOAD_GDT_ENTRY" to match the IDT
code, but had no pressing reason until now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: lguest@ozlabs.org
88df781afb788fa588dbf2e77f205214022a8893 08-Apr-2009 Matias Zabaljauregui <zabaljauregui@gmail.com> lguest: fix crash on vmlinux images

Typical message: 'lguest: unhandled trap 6 at 0x418726 (0x0)'

vmlinux guests were broken by 4cd8b5e2a159f18a1507f1187b44a1acbfa6341b
'lguest: use KVM hypercalls', which rewrites guest text from kvm hypercalls
to trap 31.

The Launcher mmaps the kernel image. The Guest executes and
immediately faults in the first text page (read-only). Then it hits a
hypercall, and we rewrite that hypercall, causing a copy-on-write.
But the Guest pagetables still refer to the old page: we fault again,
but as Host we see the hypercall already rewritten, and pass the fault
back to the Guest. The Guest hasn't set up an IDT yet, so we kill it.

This doesn't happen with bzImages: they unpack themselves and so the
text pages are already read-write.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Tested-by: Patrick McHardy <kaber@trash.net>
4cd8b5e2a159f18a1507f1187b44a1acbfa6341b 14-Mar-2009 Matias Zabaljauregui <zabaljauregui@gmail.com> lguest: use KVM hypercalls

Impact: cleanup

This patch allow us to use KVM hypercalls

Signed-off-by: Matias Zabaljauregui <zabaljauregui at gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cf485e566bc4a8098680162e1cc2ac1dfbef8a3c 10-Jun-2008 Andrew Morton <akpm@linux-foundation.org> lguest: use cpu capability accessors

To support my little make-x86-bitops-use-proper-typechecking projectlet.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrea Arcangeli <andrea@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15c8b6c1aaaf1c4edd67e2f02e4d8e1bd1a51c0d 09-May-2008 Jens Axboe <jens.axboe@oracle.com> on_each_cpu(): kill unused 'retry' parameter

It's not even passed on to smp_call_function() anymore, since that
was removed. So kill it.

Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
54481cf88bc59923ea30f2ca345a73c60155e901 19-Jun-2008 Suresh Siddha <suresh.b.siddha@intel.com> x86: fix NULL pointer deref in __switch_to

I am able to reproduce the oops reported by Simon in __switch_to() with
lguest.

My debug showed that there is at least one lguest specific
issue (which should be present in 2.6.25 and before aswell) and it got
exposed with a kernel oops with the recent fpu dynamic allocation patches.

In addition to the previous possible scenario (with fpu_counter), in the
presence of lguest, it is possible that the cpu's TS bit it still set and the
lguest launcher task's thread_info has TS_USEDFPU still set.

This is because of the way the lguest launcher handling the guest's TS bit.
(look at lguest_set_ts() in lguest_arch_run_guest()). This can result
in a DNA fault while doing unlazy_fpu() in __switch_to(). This will
end up causing a DNA fault in the context of new process thats
getting context switched in (as opossed to handling DNA fault in the context
of lguest launcher/helper process).

This is wrong in both pre and post 2.6.25 kernels. In the recent
2.6.26-rc series, this is showing up as NULL pointer dereferences or
sleeping function called from atomic context(__switch_to()), as
we free and dynamically allocate the FPU context for the newly
created threads. Older kernels might show some FPU corruption for processes
running inside of lguest.

With the appended patch, my test system is running for more than 50 mins
now. So atleast some of your oops (hopefully all!) should get fixed.
Please give it a try. I will spend more time with this fix tomorrow.

Reported-by: Simon Holm Thøgersen <odie@cs.aau.dk>
Reported-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
a6bd8e13034dd7d60b6f14217096efa192d0adc1 28-Mar-2008 Rusty Russell <rusty@rustcorp.com.au> lguest: comment documentation update.

Took some cycles to re-read the Lguest Journey end-to-end, fix some
rot and tighten some phrases.

Only comments change. No new jokes, but a couple of recycled old jokes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
e95035c61a4c3dae1aa543a5bf5b39846daca061 31-Jan-2008 Rusty Russell <rusty@rustcorp.com.au> lguest: fix mis-merge against hpa's TSS renaming

drivers/lguest/x86/core.c: In function ‘copy_in_guest_info’:
drivers/lguest/x86/core.c:97: error: ‘struct x86_hw_tss’ has no member named ‘esp1’

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
faca62273b602ab482fb7d3d940dbf41ef08b00e 30-Jan-2008 H. Peter Anvin <hpa@zytor.com> x86: use generic register name in the thread and tss structures

This changes size-specific register names (eip/rip, esp/rsp, etc.) to
generic names in the thread and tss structures.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
382ac6b3fbc0ea6a5697fc6caaf7e7de12fa8b96 17-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: get rid of lg variable assignments

We can save some lines of code by getting rid of
*lg = cpu... lines of code spread everywhere by now.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ae3749dcd8c31dcfbab14ea28c68a944c93f418f 17-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: move changed bitmap to lg_cpu

events represented in the 'changed' bitmap are per-cpu, not per-guest.
move it to the lg_cpu structure

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
f34f8c5fea079065671163c37d98328cff31980b 17-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: move last_pages to lg_cpu

in our new model, pages are assigned to a virtual cpu, not to a guest.
We move it to the lg_cpu structure.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
c40a9f4719d36841a2d7ff4fe866dce7bfb454b7 17-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: change last_guest to last_cpu

in our model, a guest does not run in a cpu anymore: a virtual cpu
does. So we change last_guest to last_cpu

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1713608f280002d9ffc6de89d7de5cf367072d63 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: per-vcpu lguest pgdir management

this patch makes the pgdir management per-vcpu. The pgdirs pool
is still guest-wide (although it'll probably need to grow when we
are really executing more vcpus), but the pgdidx index is gone,
since it makes no sense anymore. Instead, we use a per-vcpu
index.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
4665ac8e28c30c2a015c617c55783c0bf3a49c05 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: makes special fields be per-vcpu

lguest struct have room for some fields, namely, cr2, ts, esp1
and ss1, that are not really guest-wide, but rather, vcpu-wide.

This patch puts it in the vcpu struct

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
fc708b3e407dfd2e12ba9a6cf35bd0bffad1796d 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: replace lguest_arch with lg_cpu_arch.

The fields found in lguest_arch are not really per-guest,
but per-cpu (gdt, idt, etc). So this patch turns lguest_arch
into lg_cpu_arch.

It makes sense to have a per-guest per-arch struct, but this
can be addressed later, when the need arrives.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
a53a35a8b485b9c16b73e5177bddaa4321971199 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: make registers per-vcpu

This is the most obvious per-vcpu field: registers.

So this patch moves it from struct lguest to struct vcpu,
and patch the places in which they are used, accordingly

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
a3863f68b0d7fe2073c0f4efe534ec87a685c4fa 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: make emulate_insn receive a vcpu struct.

emulate_insn() needs to know about current eip, which will be,
in the future, a per-vcpu thing. So in this patch, the function
prototype is modified to receive a vcpu struct

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
0c78441cf4dd66f66e23dc085f0cc1e3e8669b96 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: map_switcher_in_guest() per-vcpu

The switcher needs to be mapped per-vcpu, because different vcpus
will potentially have different page tables (they don't have to,
because threads will share the same).

So our first step is the make the function receive a vcpu struct

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
177e449dc5bd4cf8dc48d66abee61ddf34b126b9 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: per-vcpu interrupt processing.

This patch adapts interrupt processing for using the vcpu struct.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
73044f05a4ac65f2df42753e9566444b9d2a660f 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: make hypercalls use the vcpu struct

this patch changes do_hcall() and do_async_hcall() interfaces (and obviously their
callers) to get a vcpu struct. Again, a vcpu services the hypercall, not the whole
guest

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
d0953d42c3445a120299fac9ad70e672d77898e9 07-Jan-2008 Glauber de Oliveira Costa <gcosta@redhat.com> lguest: per-cpu run guest

This patch makes the run_guest() routine use the lg_cpu struct.
This is required since in a smp guest environment, there's no
more the notion of "running the guest", but rather, it is "running the vcpu"

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
86ef5c9a8edd78e6bf92879f32329d89b2d55b5a 25-Jan-2008 Gautham R Shenoy <ego@in.ibm.com> cpu-hotplug: replace lock_cpu_hotplug() with get_online_cpus()

Replace all lock_cpu_hotplug/unlock_cpu_hotplug from the kernel and use
get_online_cpus and put_online_cpus instead as it highlights the
refcount semantics in these operations.

The new API guarantees protection against the cpu-hotplug operation, but
it doesn't guarantee serialized access to any of the local data
structures. Hence the changes needs to be reviewed.

In case of pseries_add_processor/pseries_remove_processor, use
cpu_maps_update_begin()/cpu_maps_update_done() as we're modifying the
cpu_present_map there.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
e1e72965ec2c02db99b415cd06c17ea90767e3a4 25-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> lguest: documentation update

Went through the documentation doing typo and content fixes. This
patch contains only comment and whitespace changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
25c47bb35355c1e1b2ae325b49441b2c8b201ece 25-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> lguest: use defines from x86 headers instead of magic numbers

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2d37f94a28170ca656438758fca577acb49a7932 22-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> generalize lgread_u32/lgwrite_u32.

Jes complains that page table code still uses lgread_u32 even though
it now uses general kernel pte types. The best thing to do is to
generalize lgread_u32 and lgwrite_u32.

This means we lose the efficiency of getuser(). We could potentially
regain it if we used __copy_from_user instead of copy_from_user, but
I'm not certain that our range check is equivalent to access_ok() on
all platforms.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Jes Sorensen <jes@sgi.com>
0ca49ca946409f87a8cd0b14d5acb6dea58de6f3 22-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> Remove old lguest bus and drivers.

This gets rid of the lguest bus, drivers and DMA mechanism, to make
way for a generic virtio mechanism.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
47436aa4ad054c1c7c8231618e86ebd9305308dc 22-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> Boot with virtual == physical to get closer to native Linux.

1) This allows us to get alot closer to booting bzImages.

2) It means we don't have to know page_offset.

3) The Guest needs to modify the boot pagetables to create the
PAGE_OFFSET mapping before jumping to C code.

4) guest_pa() walks the page tables rather than using page_offset.

5) We don't use page_offset to figure out whether to emulate: it was
always kinda quesationable, and won't work for instructions done
before remapping (bzImage unpacking in particular).

6) We still want the kernel address for tlb flushing: have the initial
hypercall give us that, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
c18acd73ffc209def08003a1927473096f66c5ad 22-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> Allow guest to specify syscall vector to use.

(Based on Ron Minnich's LGUEST_PLAN9_SYSCALL patch).

This patch allows Guests to specify what system call vector they want,
and we try to reserve it. We only allow one non-Linux system call
vector, to try to avoid DoS on the Host.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
d612cde060a005c1effb13d0f665448a04ce5f67 22-Oct-2007 Jes Sorensen <jes@sgi.com> Move register setup into i386_core.c

Move setup_regs() to lguest_arch_setup_regs() in i386_core.c given
that this is very architecture specific.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
b410e7b1499c49513cab18275db8a8ab549d9e09 22-Oct-2007 Jes Sorensen <jes@sgi.com> Make hypercalls arch-independent.

Clean up the hypercall code to make the code in hypercalls.c
architecture independent. First process the common hypercalls and
then call lguest_arch_do_hcall() if the call hasn't been handled.
Rename struct hcall_ring to hcall_args.

This patch requires the previous patch which reorganize the layout of
struct lguest_regs on i386 so they match the layout of struct
hcall_args.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cc6d4fbcef328acdc9fa7023e69f39f753f72fe1 22-Oct-2007 Rusty Russell <rusty@rustcorp.com.au> Introduce "hcall" pointer to indicate pending hypercall.

Currently we look at the "trapnum" to see if the Guest wants a
hypercall. But once the hypercall is done we have to reset trapnum to
a bogus value, otherwise if we exit to userspace and return, we'd run
the same hypercall twice (that was a nasty bug to find!).

This has two main effects:

1) When Jes's patch changes the hypercall args to be a generic "struct
hcall_args" we simply change the type of "lg->hcall". It's set by
arch code, so if it has to copy args or something it can do so, and
point "hcall" into lg->arch somewhere.

2) Async hypercalls only get run when an actual hypercall is pending.
This simplfies the code a little and is a more logical semantic.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
625efab1cd3d4da4634dfe26df6b4005385397e2 22-Oct-2007 Jes Sorensen <jes@sgi.com> Move i386 part of core.c to x86/core.c.

Separate i386 architecture specific from core.c and move it to
x86/core.c and add x86/lguest.h header file to match.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>