blob: 4abef243d5ee7bd58d2093af4031aee1fdd523fc [file] [log] [blame]
njn36b66df2005-05-12 05:13:04 +00001
2/*--------------------------------------------------------------------*/
3/*--- The dispatcher. pub_core_dispatch.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
Elliott Hughesed398002017-06-21 14:41:24 -070010 Copyright (C) 2000-2017 Julian Seward
njn36b66df2005-05-12 05:13:04 +000011 jseward@acm.org
12
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.
17
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.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __PUB_CORE_DISPATCH_H
32#define __PUB_CORE_DISPATCH_H
33
34//--------------------------------------------------------------------
sewardj64182912005-05-12 08:27:04 +000035// PURPOSE: This module contains the inner loop of the execution
36// mechanism, which is: find next basic block, execute it, repeat until
37// the next bb isn't found in the fast-cache; or if the current bb
38// exited with a request for some special action before continuing; or
39// if the current thread has used up its scheduling quantum.
njn36b66df2005-05-12 05:13:04 +000040//--------------------------------------------------------------------
41
njna733b5f2005-05-12 13:15:38 +000042#include "pub_core_dispatch_asm.h"
florian535fb1b2013-09-15 13:54:34 +000043#include "pub_core_basics.h" // Addr
njna733b5f2005-05-12 13:15:38 +000044
sewardj291849f2012-04-20 23:58:55 +000045/* Run translations, with the given guest state, and starting by
46 running the host code at 'host_addr'. It is almost always the case
47 that host_addr is the translation for guest_state.guest_IP, that
48 is, host_addr is what it would be if we looked up the address of
49 the translation corresponding to guest_state.guest_IP.
50
51 The only case where this isn't true is where we're running a
52 no-redir translation. In this case host_addr is the address of the
53 alternative (non-redirected) translation for guest_state.guest_IP.
54
njn36b66df2005-05-12 05:13:04 +000055 The return value must indicate why it returned back to the scheduler.
56 It can also be exited if the executing code throws a non-resumable
57 signal, for example SIGSEGV, in which case control longjmp()s back past
58 here.
59
sewardj291849f2012-04-20 23:58:55 +000060 two_words holds the return values (two words). First is
61 a TRC value. Second is generally unused, except in the case
62 where we have to return a chain-me request.
njn36b66df2005-05-12 05:13:04 +000063*/
sewardj291849f2012-04-20 23:58:55 +000064void VG_(disp_run_translations)( HWord* two_words,
florian8eebf232014-09-18 18:35:47 +000065 volatile void* guest_state,
sewardj291849f2012-04-20 23:58:55 +000066 Addr host_addr );
njn36b66df2005-05-12 05:13:04 +000067
sewardj291849f2012-04-20 23:58:55 +000068/* We need to know addresses of the continuation-point (cp_) labels so
69 we can tell VEX what they are. They will get baked into the code
70 VEX generates. The type is entirely mythical, but we need to
71 state _some_ type, so as to keep gcc happy. */
72void VG_(disp_cp_chain_me_to_slowEP)(void);
73void VG_(disp_cp_chain_me_to_fastEP)(void);
74void VG_(disp_cp_xindir)(void);
75void VG_(disp_cp_xassisted)(void);
76void VG_(disp_cp_evcheck_fail)(void);
sewardj0ec07f32006-01-12 12:32:32 +000077
njn36b66df2005-05-12 05:13:04 +000078#endif // __PUB_CORE_DISPATCH_H
79
80/*--------------------------------------------------------------------*/
81/*--- end ---*/
82/*--------------------------------------------------------------------*/