Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344060
b: refs/heads/master
c: 185034e
h: refs/heads/master
v: v3
  • Loading branch information
Matt Fleming committed Oct 30, 2012
1 parent e6cb858 commit 8538cf3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53b87cf088e2ea68d7c59619d0214cc15bb76133
refs/heads/master: 185034e72d591f9465e5e18f937ed642e7ea0070
28 changes: 21 additions & 7 deletions trunk/arch/x86/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,37 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
(u64)(a4), (u64)(a5), (u64)(a6))

extern unsigned long efi_call_virt_prelog(void);
extern void efi_call_virt_epilog(unsigned long);

#define efi_callx(x, func, ...) \
({ \
efi_status_t __status; \
unsigned long __pgd; \
\
__pgd = efi_call_virt_prelog(); \
__status = efi_call##x(func, __VA_ARGS__); \
efi_call_virt_epilog(__pgd); \
__status; \
})

#define efi_call_virt0(f) \
efi_call0((void *)(efi.systab->runtime->f))
efi_callx(0, (void *)(efi.systab->runtime->f))
#define efi_call_virt1(f, a1) \
efi_call1((void *)(efi.systab->runtime->f), (u64)(a1))
efi_callx(1, (void *)(efi.systab->runtime->f), (u64)(a1))
#define efi_call_virt2(f, a1, a2) \
efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2))
efi_callx(2, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2))
#define efi_call_virt3(f, a1, a2, a3) \
efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
efi_callx(3, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
(u64)(a3))
#define efi_call_virt4(f, a1, a2, a3, a4) \
efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
efi_callx(4, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
(u64)(a3), (u64)(a4))
#define efi_call_virt5(f, a1, a2, a3, a4, a5) \
efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
efi_callx(5, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
(u64)(a3), (u64)(a4), (u64)(a5))
#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
efi_callx(6, (void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
(u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))

extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
Expand Down
15 changes: 15 additions & 0 deletions trunk/arch/x86/platform/efi/efi_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ static void __init early_code_mapping_set_exec(int executable)
}
}

unsigned long efi_call_virt_prelog(void)
{
unsigned long saved;

saved = read_cr3();
write_cr3(real_mode_header->trampoline_pgd);

return saved;
}

void efi_call_virt_epilog(unsigned long saved)
{
write_cr3(saved);
}

void __init efi_call_phys_prelog(void)
{
unsigned long vaddress;
Expand Down

0 comments on commit 8538cf3

Please sign in to comment.