1 /**********************************************************************/
2 /* File generated by src/simix/simcalls.py from src/simix/simcalls.in */
4 /* DO NOT EVER CHANGE THIS FILE */
6 /* change simcalls specification in src/simix/simcalls.in */
7 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
8 /**********************************************************************/
11 * Note that the name comes from http://en.wikipedia.org/wiki/Popping
12 * Indeed, the control flow is doing a strange dance in there.
14 * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
17 #include "smx_private.hpp"
20 #include "src/mc/mc_forward.hpp"
22 #include "src/kernel/activity/ConditionVariableImpl.hpp"
24 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
26 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
27 const char* simcall_names[] = {
29 "SIMCALL_PROCESS_SUSPEND",
30 "SIMCALL_PROCESS_JOIN",
31 "SIMCALL_PROCESS_SLEEP",
32 "SIMCALL_EXECUTION_WAIT",
33 "SIMCALL_EXECUTION_TEST",
38 "SIMCALL_COMM_WAITANY",
41 "SIMCALL_COMM_TESTANY",
43 "SIMCALL_MUTEX_TRYLOCK",
44 "SIMCALL_MUTEX_UNLOCK",
46 "SIMCALL_COND_WAIT_TIMEOUT",
47 "SIMCALL_SEM_ACQUIRE",
48 "SIMCALL_SEM_ACQUIRE_TIMEOUT",
52 "SIMCALL_RUN_BLOCKING",
56 * @brief (in kernel mode) unpack the simcall and activate the handler
58 * This function is generated from src/simix/simcalls.in
60 void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
61 XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
62 SIMCALL_SET_MC_VALUE(simcall, value);
63 if (simcall->issuer->context_->iwannadie)
65 switch (simcall->call) {
66 case SIMCALL_PROCESS_SUSPEND:
67 simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
70 case SIMCALL_PROCESS_JOIN:
71 simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
74 case SIMCALL_PROCESS_SLEEP:
75 simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal<double>(simcall->args[0]));
78 case SIMCALL_EXECUTION_WAIT:
79 simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]));
82 case SIMCALL_EXECUTION_TEST:
83 simcall_HANDLER_execution_test(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]));
86 case SIMCALL_COMM_SEND:
87 simcall_HANDLER_comm_send(
88 simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]),
89 simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]),
90 simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<unsigned char*>(simcall->args[4]),
91 simgrid::simix::unmarshal<size_t>(simcall->args[5]),
92 simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]),
93 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[7]),
94 simgrid::simix::unmarshal<void*>(simcall->args[8]), simgrid::simix::unmarshal<double>(simcall->args[9]));
97 case SIMCALL_COMM_ISEND:
98 simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
99 simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]),
100 simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]),
101 simgrid::simix::unmarshal<double>(simcall->args[2]),
102 simgrid::simix::unmarshal<double>(simcall->args[3]),
103 simgrid::simix::unmarshal<unsigned char*>(simcall->args[4]),
104 simgrid::simix::unmarshal<size_t>(simcall->args[5]),
105 simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]),
106 simgrid::simix::unmarshal<simix_clean_func_t>(simcall->args[7]),
107 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[8]),
108 simgrid::simix::unmarshal<void*>(simcall->args[9]),
109 simgrid::simix::unmarshal<bool>(simcall->args[10])));
110 SIMIX_simcall_answer(simcall);
113 case SIMCALL_COMM_RECV:
114 simcall_HANDLER_comm_recv(
115 simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]),
116 simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]),
117 simgrid::simix::unmarshal<unsigned char*>(simcall->args[2]), simgrid::simix::unmarshal<size_t*>(simcall->args[3]),
118 simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]),
119 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]),
120 simgrid::simix::unmarshal<void*>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7]),
121 simgrid::simix::unmarshal<double>(simcall->args[8]));
124 case SIMCALL_COMM_IRECV:
125 simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
126 simcall->result, simcall_HANDLER_comm_irecv(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]),
127 simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]),
128 simgrid::simix::unmarshal<unsigned char*>(simcall->args[2]),
129 simgrid::simix::unmarshal<size_t*>(simcall->args[3]),
130 simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]),
131 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]),
132 simgrid::simix::unmarshal<void*>(simcall->args[6]),
133 simgrid::simix::unmarshal<double>(simcall->args[7])));
134 SIMIX_simcall_answer(simcall);
137 case SIMCALL_COMM_WAITANY:
138 simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall->args[0]), simgrid::simix::unmarshal<size_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]));
141 case SIMCALL_COMM_WAIT:
142 simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
145 case SIMCALL_COMM_TEST:
146 simcall_HANDLER_comm_test(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall->args[0]));
149 case SIMCALL_COMM_TESTANY:
150 simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall->args[0]), simgrid::simix::unmarshal<size_t>(simcall->args[1]));
153 case SIMCALL_MUTEX_LOCK:
154 simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
157 case SIMCALL_MUTEX_TRYLOCK:
158 simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0])));
159 SIMIX_simcall_answer(simcall);
162 case SIMCALL_MUTEX_UNLOCK:
163 simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
164 SIMIX_simcall_answer(simcall);
167 case SIMCALL_COND_WAIT:
168 simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]));
171 case SIMCALL_COND_WAIT_TIMEOUT:
172 simcall_HANDLER_cond_wait_timeout(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]));
175 case SIMCALL_SEM_ACQUIRE:
176 simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
179 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
180 simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
183 case SIMCALL_IO_WAIT:
184 simcall_HANDLER_io_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::IoImpl*>(simcall->args[0]));
187 case SIMCALL_MC_RANDOM:
188 simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1])));
189 SIMIX_simcall_answer(simcall);
192 case SIMCALL_RUN_KERNEL:
193 SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
194 SIMIX_simcall_answer(simcall);
197 case SIMCALL_RUN_BLOCKING:
198 SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
203 THROWF(arg_error, 0, "Asked to do the noop syscall on %s@%s", simcall->issuer->get_cname(),
204 sg_host_get_name(simcall->issuer->get_host()));