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#include <asm/segment.h> 11#include <asm/msr.h> 12#include <asm/processor-flags.h> 13#include <asm/page_types.h> 14 15#define SAVE_XMM \ 16 mov %rsp, %rax; \ 17 subq $0x70, %rsp; \ 18 and $~0xf, %rsp; \ 19 mov %rax, (%rsp); \ 20 mov %cr0, %rax; \ 21 clts; \ 22 mov %rax, 0x8(%rsp); \ 23 movaps %xmm0, 0x60(%rsp); \ 24 movaps %xmm1, 0x50(%rsp); \ 25 movaps %xmm2, 0x40(%rsp); \ 26 movaps %xmm3, 0x30(%rsp); \ 27 movaps %xmm4, 0x20(%rsp); \ 28 movaps %xmm5, 0x10(%rsp) 29 30#define RESTORE_XMM \ 31 movaps 0x60(%rsp), %xmm0; \ 32 movaps 0x50(%rsp), %xmm1; \ 33 movaps 0x40(%rsp), %xmm2; \ 34 movaps 0x30(%rsp), %xmm3; \ 35 movaps 0x20(%rsp), %xmm4; \ 36 movaps 0x10(%rsp), %xmm5; \ 37 mov 0x8(%rsp), %rsi; \ 38 mov %rsi, %cr0; \ 39 mov (%rsp), %rsp 40 41ENTRY(efi_call) 42 pushq %rbp 43 movq %rsp, %rbp 44 SAVE_XMM 45 mov 16(%rbp), %rax 46 subq $48, %rsp 47 mov %r9, 32(%rsp) 48 mov %rax, 40(%rsp) 49 mov %r8, %r9 50 mov %rcx, %r8 51 mov %rsi, %rcx 52 call *%rdi 53 addq $48, %rsp 54 RESTORE_XMM 55 popq %rbp 56 ret 57ENDPROC(efi_call) 58