njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 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 | |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame^] | 10 | Copyright (C) 2000-2017 Julian Seward |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 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 | //-------------------------------------------------------------------- |
sewardj | 6418291 | 2005-05-12 08:27:04 +0000 | [diff] [blame] | 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. |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 40 | //-------------------------------------------------------------------- |
| 41 | |
njn | a733b5f | 2005-05-12 13:15:38 +0000 | [diff] [blame] | 42 | #include "pub_core_dispatch_asm.h" |
florian | 535fb1b | 2013-09-15 13:54:34 +0000 | [diff] [blame] | 43 | #include "pub_core_basics.h" // Addr |
njn | a733b5f | 2005-05-12 13:15:38 +0000 | [diff] [blame] | 44 | |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 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 | |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 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 | |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 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. |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 63 | */ |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 64 | void VG_(disp_run_translations)( HWord* two_words, |
florian | 8eebf23 | 2014-09-18 18:35:47 +0000 | [diff] [blame] | 65 | volatile void* guest_state, |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 66 | Addr host_addr ); |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 67 | |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 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); |
sewardj | 0ec07f3 | 2006-01-12 12:32:32 +0000 | [diff] [blame] | 77 | |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 78 | #endif // __PUB_CORE_DISPATCH_H |
| 79 | |
| 80 | /*--------------------------------------------------------------------*/ |
| 81 | /*--- end ---*/ |
| 82 | /*--------------------------------------------------------------------*/ |