L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ipc-invoke.h
1
9/*
10 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
11 * Alexander Warg <warg@os.inf.tu-dresden.de>,
12 * Björn Döbel <doebel@os.inf.tu-dresden.de>
13 * economic rights: Technische Universität Dresden (Germany)
14 *
15 * License: see LICENSE.spdx (in this directory or the directories above)
16 */
17
18#pragma once
19
20/*
21 * Some words about the sysenter entry frame: Since the sysenter instruction
22 * automatically reloads the instruction pointer (eip) and the stack pointer
23 * (esp) after kernel entry, we have to save both registers preliminary to
24 * that instruction. We use ecx to store the user-level esp and save eip onto
25 * the stack. The ecx register contains the IPC timeout and has to be saved
26 * onto the stack, too. The ebp register is saved for compatibility reasons
27 * with the Hazelnut kernel. Both the esp and the ss register are also pushed
28 * onto the stack to be able to return using the "lret" instruction from the
29 * sysexit trampoline page if Small Address Spaces are enabled.
30 */
31
32#ifdef __PIC__
33# define L4S_PIC_SAVE "push %%ebx; "
34# define L4S_PIC_RESTORE "pop %%ebx; "
35# define L4S_PIC_CLOBBER
36# define L4S_PIC_SYSCALL , [func] "m" (__l4sys_invoke_indirect)
37# if 1
38extern void (*__l4sys_invoke_indirect)(void);
39# define IPC_SYSENTER "# indirect sys invoke \n\t" \
40 "call *%[func] \n\t"
41# else
42# define L4S_PIC_SYSCALL
43# define IPC_SYSENTER "call __l4sys_invoke_direct@plt \n\t"
44# endif
45# define IPC_SYSENTER_ASM call __l4sys_invoke_direct@plt
46#else
51#define IPC_SYSENTER "call __l4sys_invoke_direct \n\t"
56#define IPC_SYSENTER_ASM call __l4sys_invoke_direct
61# define L4S_PIC_SAVE
66# define L4S_PIC_RESTORE
71# define L4S_PIC_CLOBBER ,"ebx"
72# define L4S_PIC_SYSCALL
73
74#endif
79#define L4_ENTER_KERNEL L4S_PIC_SAVE "push %%ebp; " \
80 IPC_SYSENTER \
81 " pop %%ebp; " L4S_PIC_RESTORE
82