2 /*--------------------------------------------------------------------*/
3 /*--- The dispatcher. pub_core_dispatch.h ---*/
4 /*--------------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2000-2017 Julian Seward
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_DISPATCH_H
30 #define __PUB_CORE_DISPATCH_H
32 //--------------------------------------------------------------------
33 // PURPOSE: This module contains the inner loop of the execution
34 // mechanism, which is: find next basic block, execute it, repeat until
35 // the next bb isn't found in the fast-cache; or if the current bb
36 // exited with a request for some special action before continuing; or
37 // if the current thread has used up its scheduling quantum.
38 //--------------------------------------------------------------------
40 #include "pub_core_dispatch_asm.h"
41 #include "pub_core_basics.h" // Addr
43 /* Run translations, with the given guest state, and starting by
44 running the host code at 'host_addr'. It is almost always the case
45 that host_addr is the translation for guest_state.guest_IP, that
46 is, host_addr is what it would be if we looked up the address of
47 the translation corresponding to guest_state.guest_IP.
49 The only case where this isn't true is where we're running a
50 no-redir translation. In this case host_addr is the address of the
51 alternative (non-redirected) translation for guest_state.guest_IP.
53 The return value must indicate why it returned back to the scheduler.
54 It can also be exited if the executing code throws a non-resumable
55 signal, for example SIGSEGV, in which case control longjmp()s back past
58 two_words holds the return values (two words). First is
59 a TRC value. Second is generally unused, except in the case
60 where we have to return a chain-me request.
62 void VG_(disp_run_translations
)( HWord
* two_words
,
63 volatile void* guest_state
,
66 /* We need to know addresses of the continuation-point (cp_) labels so
67 we can tell VEX what they are. They will get baked into the code
68 VEX generates. The type is entirely mythical, but we need to
69 state _some_ type, so as to keep gcc happy. */
70 void VG_(disp_cp_chain_me_to_slowEP
)(void);
71 void VG_(disp_cp_chain_me_to_fastEP
)(void);
72 void VG_(disp_cp_xindir
)(void);
73 void VG_(disp_cp_xassisted
)(void);
74 void VG_(disp_cp_evcheck_fail
)(void);
76 #endif // __PUB_CORE_DISPATCH_H
78 /*--------------------------------------------------------------------*/
80 /*--------------------------------------------------------------------*/