2 * Copyright (C) 2008-2019 HPDCS Group
3 * https://hpdcs.github.io
6 * This file is part of ROOT-Sim (ROme OpTimistic Simulator).
8 * ROOT-Sim is free software; you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software
10 * Foundation; only version 3 of the License applies.
12 * ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with
17 * ROOT-Sim; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * @brief This hook is dynamically attached to Linux Kernel's finish_task_switch
22 * to call a module-provided function at the end of the reschedule operation.
23 * @author Alessandro Pellegrini
24 * @date February, 2016
27 .file "preempt_callback.S"
35 .type schedule_hook, @function
36 .globl schedule_hook_2
37 .type schedule_hook_2, @function
38 .globl schedule_hook_end
39 .type schedule_hook_end, @function
40 .globl schedule_hook_patch_point
41 .type schedule_hook_patch_point, @function
42 .globl schedule_hook_patch_point_2
43 .type schedule_hook_patch_point_2, @function
50 # This is here just for audit and could be commented out
51 incl audit_counter(%rip)
53 movq the_hook(%rip), %rax
55 # jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
60 schedule_hook_patch_point:
61 nop # Five nops to leave place to dynamically patch this function
76 # This is here just for audit and could be commented out
77 incl audit_counter(%rip)
79 movq the_hook(%rip), %rax
81 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
83 schedule_hook_patch_point_2:
84 nop # Five nops to leave place to dynamically patch this function
99 # This is here just for audit and could be commented out
100 incl audit_counter(%rip)
102 movq the_hook(%rip), %rax
104 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
106 schedule_hook_patch_point_3:
107 nop # Five nops to leave place to dynamically patch this function
117 lock decl count(%rip)
120 lock incl count(%rip)
122 # This is here just for audit and could be commented out
123 incl audit_counter(%rip)
125 movq the_hook(%rip), %rax
127 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
129 schedule_hook_patch_point_4:
130 nop # Five nops to leave place to dynamically patch this function
140 lock decl count(%rip)
143 lock incl count(%rip)
145 # This is here just for audit and could be commented out
146 incl audit_counter(%rip)
148 movq the_hook(%rip), %rax
150 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
152 schedule_hook_patch_point_5:
153 nop # Five nops to leave place to dynamically patch this function
163 lock decl count(%rip)
166 lock incl count(%rip)
168 # This is here just for audit and could be commented out
169 incl audit_counter(%rip)
171 movq the_hook(%rip), %rax
173 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
175 schedule_hook_patch_point_6:
176 nop # Five nops to leave place to dynamically patch this function
186 lock decl count(%rip)
189 lock incl count(%rip)
191 # This is here just for audit and could be commented out
192 incl audit_counter(%rip)
194 movq the_hook(%rip), %rax
196 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
198 schedule_hook_patch_point_7:
199 nop # Five nops to leave place to dynamically patch this function
209 lock decl count(%rip)
212 lock incl count(%rip)
214 # This is here just for audit and could be commented out
215 incl audit_counter(%rip)
217 movq the_hook(%rip), %rax
219 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
221 schedule_hook_patch_point_8:
222 nop # Five nops to leave place to dynamically patch this function
232 lock decl count(%rip)
235 lock incl count(%rip)
237 # This is here just for audit and could be commented out
238 incl audit_counter(%rip)
240 movq the_hook(%rip), %rax
242 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
244 schedule_hook_patch_point_9:
245 nop # Five nops to leave place to dynamically patch this function
255 lock decl count(%rip)
258 lock incl count(%rip)
260 # This is here just for audit and could be commented out
261 incl audit_counter(%rip)
263 movq the_hook(%rip), %rax
265 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
267 schedule_hook_patch_point_10:
268 nop # Five nops to leave place to dynamically patch this function
278 lock decl count(%rip)
281 lock incl count(%rip)
283 # This is here just for audit and could be commented out
284 incl audit_counter(%rip)
286 movq the_hook(%rip), %rax
288 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
290 schedule_hook_patch_point_11:
291 nop # Five nops to leave place to dynamically patch this function
301 lock decl count(%rip)
304 lock incl count(%rip)
306 # This is here just for audit and could be commented out
307 incl audit_counter(%rip)
309 movq the_hook(%rip), %rax
311 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
313 schedule_hook_patch_point_12:
314 nop # Five nops to leave place to dynamically patch this function
324 lock decl count(%rip)
327 lock incl count(%rip)
329 # This is here just for audit and could be commented out
330 incl audit_counter(%rip)
332 movq the_hook(%rip), %rax
334 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
336 schedule_hook_patch_point_13:
337 nop # Five nops to leave place to dynamically patch this function
347 lock decl count(%rip)
350 lock incl count(%rip)
352 # This is here just for audit and could be commented out
353 incl audit_counter(%rip)
355 movq the_hook(%rip), %rax
357 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
359 schedule_hook_patch_point_14:
360 nop # Five nops to leave place to dynamically patch this function
370 lock decl count(%rip)
373 lock incl count(%rip)
375 # This is here just for audit and could be commented out
376 incl audit_counter(%rip)
378 movq the_hook(%rip), %rax
380 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
382 schedule_hook_patch_point_15:
383 nop # Five nops to leave place to dynamically patch this function
393 lock decl count(%rip)
396 lock incl count(%rip)
398 # This is here just for audit and could be commented out
399 incl audit_counter(%rip)
401 movq the_hook(%rip), %rax
403 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
405 schedule_hook_patch_point_16:
406 nop # Five nops to leave place to dynamically patch this function
416 lock decl count(%rip)
419 lock incl count(%rip)
421 # This is here just for audit and could be commented out
422 incl audit_counter(%rip)
424 movq the_hook(%rip), %rax
426 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
428 schedule_hook_patch_point_17:
429 nop # Five nops to leave place to dynamically patch this function
439 lock decl count(%rip)
442 lock incl count(%rip)
444 # This is here just for audit and could be commented out
445 incl audit_counter(%rip)
447 movq the_hook(%rip), %rax
449 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
451 schedule_hook_patch_point_18:
452 nop # Five nops to leave place to dynamically patch this function
462 lock decl count(%rip)
465 lock incl count(%rip)
467 # This is here just for audit and could be commented out
468 incl audit_counter(%rip)
470 movq the_hook(%rip), %rax
472 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
474 schedule_hook_patch_point_19:
475 nop # Five nops to leave place to dynamically patch this function
485 lock decl count(%rip)
488 lock incl count(%rip)
490 # This is here just for audit and could be commented out
491 incl audit_counter(%rip)
493 movq the_hook(%rip), %rax
495 jz .+4 # location counter points to jz. jz is 2 bytes, callq is 2 bytes.
497 schedule_hook_patch_point_20:
498 nop # Five nops to leave place to dynamically patch this function
508 lock decl count(%rip)