pub_core_dispatch.h revision 2d3c75979dd0bbf2606bf1a8e11b72ae6220e5db
1
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
10   Copyright (C) 2000-2012 Julian Seward
11      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//--------------------------------------------------------------------
35// 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.
40//--------------------------------------------------------------------
41
42#include "pub_core_dispatch_asm.h"
43
44/* Run translations, with the given guest state, and starting by
45   running the host code at 'host_addr'.  It is almost always the case
46   that host_addr is the translation for guest_state.guest_IP, that
47   is, host_addr is what it would be if we looked up the address of
48   the translation corresponding to guest_state.guest_IP.
49
50   The only case where this isn't true is where we're running a
51   no-redir translation.  In this case host_addr is the address of the
52   alternative (non-redirected) translation for guest_state.guest_IP.
53
54   The return value must indicate why it returned back to the scheduler.
55   It can also be exited if the executing code throws a non-resumable
56   signal, for example SIGSEGV, in which case control longjmp()s back past
57   here.
58
59   two_words holds the return values (two words).  First is
60   a TRC value.  Second is generally unused, except in the case
61   where we have to return a chain-me request.
62*/
63void VG_(disp_run_translations)( HWord* two_words,
64                                 void*  guest_state,
65                                 Addr   host_addr );
66
67/* We need to know addresses of the continuation-point (cp_) labels so
68   we can tell VEX what they are.  They will get baked into the code
69   VEX generates.  The type is entirely mythical, but we need to
70   state _some_ type, so as to keep gcc happy. */
71void VG_(disp_cp_chain_me_to_slowEP)(void);
72void VG_(disp_cp_chain_me_to_fastEP)(void);
73void VG_(disp_cp_xindir)(void);
74void VG_(disp_cp_xassisted)(void);
75void VG_(disp_cp_evcheck_fail)(void);
76
77#endif   // __PUB_CORE_DISPATCH_H
78
79/*--------------------------------------------------------------------*/
80/*--- end                                                          ---*/
81/*--------------------------------------------------------------------*/
82