diff options
author | Huang, Ying <ying.huang@intel.com> | 2008-01-30 07:31:19 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:19 -0500 |
commit | 5b83683f32b113d07edfb67a33ce389fc624423d (patch) | |
tree | 03efde0750c9d7e477ab695aeee26173ffcc4abf /arch/x86/kernel/efi_stub_64.S | |
parent | 8c8b8859b64baf6d7c33900e8720c7bafe775b2c (diff) |
x86: EFI runtime service support
This patch adds basic runtime services support for EFI x86_64 system. The
main file of the patch is the addition of efi_64.c for x86_64. This file is
modeled after the EFI IA32 avatar. EFI runtime services initialization are
implemented in efi_64.c. Some x86_64 specifics are worth noting here. On
x86_64, parameters passed to EFI firmware services need to follow the EFI
calling convention. For this purpose, a set of functions named efi_call<x>
(<x> is the number of parameters) are implemented. EFI function calls are
wrapped before calling the firmware service. The duplicated code between
efi_32.c and efi_64.c is placed in efi.c to remove them from efi_32.c.
Signed-off-by: Chandramouli Narayanan <mouli@linux.intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/efi_stub_64.S')
-rw-r--r-- | arch/x86/kernel/efi_stub_64.S | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/arch/x86/kernel/efi_stub_64.S b/arch/x86/kernel/efi_stub_64.S new file mode 100644 index 000000000000..99b47d48c9f4 --- /dev/null +++ b/arch/x86/kernel/efi_stub_64.S | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Function calling ABI conversion from Linux to EFI for x86_64 | ||
3 | * | ||
4 | * Copyright (C) 2007 Intel Corp | ||
5 | * Bibo Mao <bibo.mao@intel.com> | ||
6 | * Huang Ying <ying.huang@intel.com> | ||
7 | */ | ||
8 | |||
9 | #include <linux/linkage.h> | ||
10 | |||
11 | #define SAVE_XMM \ | ||
12 | mov %rsp, %rax; \ | ||
13 | subq $0x70, %rsp; \ | ||
14 | and $~0xf, %rsp; \ | ||
15 | mov %rax, (%rsp); \ | ||
16 | mov %cr0, %rax; \ | ||
17 | clts; \ | ||
18 | mov %rax, 0x8(%rsp); \ | ||
19 | movaps %xmm0, 0x60(%rsp); \ | ||
20 | movaps %xmm1, 0x50(%rsp); \ | ||
21 | movaps %xmm2, 0x40(%rsp); \ | ||
22 | movaps %xmm3, 0x30(%rsp); \ | ||
23 | movaps %xmm4, 0x20(%rsp); \ | ||
24 | movaps %xmm5, 0x10(%rsp) | ||
25 | |||
26 | #define RESTORE_XMM \ | ||
27 | movaps 0x60(%rsp), %xmm0; \ | ||
28 | movaps 0x50(%rsp), %xmm1; \ | ||
29 | movaps 0x40(%rsp), %xmm2; \ | ||
30 | movaps 0x30(%rsp), %xmm3; \ | ||
31 | movaps 0x20(%rsp), %xmm4; \ | ||
32 | movaps 0x10(%rsp), %xmm5; \ | ||
33 | mov 0x8(%rsp), %rsi; \ | ||
34 | mov %rsi, %cr0; \ | ||
35 | mov (%rsp), %rsp | ||
36 | |||
37 | ENTRY(efi_call0) | ||
38 | SAVE_XMM | ||
39 | subq $32, %rsp | ||
40 | call *%rdi | ||
41 | addq $32, %rsp | ||
42 | RESTORE_XMM | ||
43 | ret | ||
44 | |||
45 | ENTRY(efi_call1) | ||
46 | SAVE_XMM | ||
47 | subq $32, %rsp | ||
48 | mov %rsi, %rcx | ||
49 | call *%rdi | ||
50 | addq $32, %rsp | ||
51 | RESTORE_XMM | ||
52 | ret | ||
53 | |||
54 | ENTRY(efi_call2) | ||
55 | SAVE_XMM | ||
56 | subq $32, %rsp | ||
57 | mov %rsi, %rcx | ||
58 | call *%rdi | ||
59 | addq $32, %rsp | ||
60 | RESTORE_XMM | ||
61 | ret | ||
62 | |||
63 | ENTRY(efi_call3) | ||
64 | SAVE_XMM | ||
65 | subq $32, %rsp | ||
66 | mov %rcx, %r8 | ||
67 | mov %rsi, %rcx | ||
68 | call *%rdi | ||
69 | addq $32, %rsp | ||
70 | RESTORE_XMM | ||
71 | ret | ||
72 | |||
73 | ENTRY(efi_call4) | ||
74 | SAVE_XMM | ||
75 | subq $32, %rsp | ||
76 | mov %r8, %r9 | ||
77 | mov %rcx, %r8 | ||
78 | mov %rsi, %rcx | ||
79 | call *%rdi | ||
80 | addq $32, %rsp | ||
81 | RESTORE_XMM | ||
82 | ret | ||
83 | |||
84 | ENTRY(efi_call5) | ||
85 | SAVE_XMM | ||
86 | subq $48, %rsp | ||
87 | mov %r9, 32(%rsp) | ||
88 | mov %r8, %r9 | ||
89 | mov %rcx, %r8 | ||
90 | mov %rsi, %rcx | ||
91 | call *%rdi | ||
92 | addq $48, %rsp | ||
93 | RESTORE_XMM | ||
94 | ret | ||
95 | |||
96 | ENTRY(efi_call6) | ||
97 | SAVE_XMM | ||
98 | mov (%rsp), %rax | ||
99 | mov 8(%rax), %rax | ||
100 | subq $48, %rsp | ||
101 | mov %r9, 32(%rsp) | ||
102 | mov %rax, 40(%rsp) | ||
103 | mov %r8, %r9 | ||
104 | mov %rcx, %r8 | ||
105 | mov %rsi, %rcx | ||
106 | call *%rdi | ||
107 | addq $48, %rsp | ||
108 | RESTORE_XMM | ||
109 | ret | ||