2 * @file arch/x86/ecs_callback.S
4 * @brief Userspace callback for preƫmptive Time Warp
6 * This callback is used to transfer back control from kernel space to
7 * platform space when an artificial page fault due to ECS is faced.
10 * Copyright (C) 2008-2019 HPDCS Group
11 * https://hpdcs.github.io
13 * This file is part of ROOT-Sim (ROme OpTimistic Simulator).
15 * ROOT-Sim is free software; you can redistribute it and/or modify it under the
16 * terms of the GNU General Public License as published by the Free Software
17 * Foundation; only version 3 of the License applies.
19 * ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY
20 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along with
24 * ROOT-Sim; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 * @author Alessandro Pellegrini
29 * @date December, 2015
32 .file "ecs_callback.S"
36 #include <arch/asm_defines.h>
42 .globl rootsim_cross_state_dependency_handler
43 .type rootsim_cross_state_dependency_handler, @function
45 # This function is called by the kernel upon a page fault.
46 # This is the organization of the stack after the various push:
48 # _______________________
50 # |---------------------|
52 # |---------------------|
53 # | RETURN ADDRESS | -> Placed by kernel module
54 # |---------------------|
56 # This function accepts no arguments
58 rootsim_cross_state_dependency_handler:
69 # Access to current->context
71 addq $offsetof_LP_State_context, %rsi
72 leaq (%rsi, %rdi, 8), %rdi
79 // Fake frame to support printf in ECS
91 addb $0x7f, %al # Overflow if OF was set
97 .size rootsim_cross_state_dependency_handler, .-rootsim_cross_state_dependency_handler