00001 // Copyright 2009-2010 Sandia Corporation. Under the terms 00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. 00003 // Government retains certain rights in this software. 00004 // 00005 // Copyright (c) 2009-2010, Sandia Corporation 00006 // All rights reserved. 00007 // 00008 // This file is part of the SST software package. For license 00009 // information, see the LICENSE file in the top level directory of the 00010 // distribution. 00011 00012 #ifndef _VM_IFACE_H 00013 /*----------------------------------------------------------+----------------\ 00014 | C VM Interface for Psst | Chad D. Kersey | 00015 +-----------------------------------------------------------+----------------+ 00016 | This is an interface that a VM module written in C (in this case Qemu) can | 00017 | use to communicate with the Psst system. These functions are currently | 00018 | implemented in model.cpp. | 00019 \---------------------------------------------------------------------------*/ 00020 #define _VM_IFACE_H 00021 00022 #include <sst_stdint.h> 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 // The VM can check the following to prevent having to send events 00029 // unnecessarily. Eventually they'll be implemented. 00030 static inline int memOps_enabled() { return 1; } 00031 static inline int instructions_enabled() { return 1; } 00032 static inline int magicInsts_enabled() { return 1; } 00033 00034 // The VM is responsible for _calling_ the following, to enqueue "events" for 00035 // appropriate models to process: 00036 void send_memOp(uint64_t vaddr, uint64_t paddr, uint8_t size, int type); 00037 void send_instruction( 00038 uint64_t vaddress, uint64_t padress, uint8_t len, uint8_t inst[] 00039 ); 00040 void send_magicInst(uint64_t rax); 00041 void discard_instruction(); 00042 00043 // The VM is responsible for _implementing_ the following asynchronous 00044 // function calls from models: 00045 uint8_t memRead(uint64_t addr); 00046 void memWrite(uint64_t addr, uint8_t data); 00047 uint64_t memSize(); 00048 00049 #ifdef __cplusplus 00050 } 00051 #endif 00052 00053 #endif