Home | History | Annotate | Download | only in coregrind
      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-2017 Julian Seward
     11       jseward (at) 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 #include "pub_core_basics.h"        // Addr
     44 
     45 /* 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 
     55    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 
     60    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.
     63 */
     64 void VG_(disp_run_translations)( HWord* two_words,
     65                                  volatile void*  guest_state,
     66                                  Addr   host_addr );
     67 
     68 /* 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. */
     72 void VG_(disp_cp_chain_me_to_slowEP)(void);
     73 void VG_(disp_cp_chain_me_to_fastEP)(void);
     74 void VG_(disp_cp_xindir)(void);
     75 void VG_(disp_cp_xassisted)(void);
     76 void VG_(disp_cp_evcheck_fail)(void);
     77 
     78 #endif   // __PUB_CORE_DISPATCH_H
     79 
     80 /*--------------------------------------------------------------------*/
     81 /*--- end                                                          ---*/
     82 /*--------------------------------------------------------------------*/
     83