1/*
2 * GPR context switch between host and guest.
3 * Used by IO-port-access emulation stub.
4 *
5 * Copyright (c) 2006, Novell, Inc.
6 */
7
8        .file __FILE__
9
10#include <asm/asm_defns.h>
11
12/* Load guest GPRs.  Parameter in %rdi, clobbers all registers. */
13ENTRY(load_guest_gprs)
14        movq  UREGS_rdx(%rdi), %rdx
15        movq  UREGS_rax(%rdi), %rax
16        movq  UREGS_rbx(%rdi), %rbx
17        movq  UREGS_rsi(%rdi), %rsi
18        movq  UREGS_rbp(%rdi), %rbp
19        movq  UREGS_r8 (%rdi), %r8
20        movq  UREGS_r12(%rdi), %r12
21        movq  UREGS_r9 (%rdi), %r9
22        movq  UREGS_r13(%rdi), %r13
23        movq  UREGS_r10(%rdi), %r10
24        movq  UREGS_r14(%rdi), %r14
25        movq  UREGS_r11(%rdi), %r11
26        movq  UREGS_r15(%rdi), %r15
27        movq  UREGS_rcx(%rdi), %rcx
28        movq  UREGS_rdi(%rdi), %rdi
29        ret
30
31        .size load_guest_gprs, . - load_guest_gprs
32        .type load_guest_gprs, STT_FUNC
33
34
35/* Save guest GPRs.  Parameter on the stack above the return address. */
36ENTRY(save_guest_gprs)
37        pushq %rdi
38        movq  2*8(%rsp), %rdi
39        movq  %rax, UREGS_rax(%rdi)
40        popq        UREGS_rdi(%rdi)
41        movq  %r15, UREGS_r15(%rdi)
42        movq  %r11, UREGS_r11(%rdi)
43        movq  %r14, UREGS_r14(%rdi)
44        movq  %r10, UREGS_r10(%rdi)
45        movq  %r13, UREGS_r13(%rdi)
46        movq  %r9,  UREGS_r9 (%rdi)
47        movq  %r12, UREGS_r12(%rdi)
48        movq  %r8,  UREGS_r8 (%rdi)
49        movq  %rbp, UREGS_rbp(%rdi)
50        movq  %rsi, UREGS_rsi(%rdi)
51        movq  %rbx, UREGS_rbx(%rdi)
52        movq  %rdx, UREGS_rdx(%rdi)
53        movq  %rcx, UREGS_rcx(%rdi)
54        ret
55
56        .size save_guest_gprs, . - save_guest_gprs
57        .type save_guest_gprs, STT_FUNC
58