1 /* 2 * This file is part of libbdplus 3 * Copyright (C) 2008-2010 Accident 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library. If not, see 17 * <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef DLX_H_INCLUDED 21 #define DLX_H_INCLUDED 22 23 #include "util/attributes.h" 24 25 #include <stdint.h> 26 27 #define BD_STEP_I 1 // Step one instruction 28 #define BD_STEP_TRAP 2 // Step until next trap 29 30 31 typedef struct VM_s VM; 32 33 struct bdplus_s; 34 35 BD_PRIVATE VM * dlx_initVM ( struct bdplus_s * ); 36 BD_PRIVATE void dlx_freeVM ( VM ** ); 37 BD_PRIVATE struct bdplus_s *dlx_getApp ( VM * ); 38 39 BD_PRIVATE uint32_t dlx_getPC ( VM * ); 40 BD_PRIVATE int32_t dlx_getWD ( VM * ); 41 BD_PRIVATE uint32_t dlx_getIF ( VM * ); 42 BD_PRIVATE uint8_t * dlx_getAddr ( VM * ); 43 BD_PRIVATE uint32_t dlx_getAddrSize ( VM * ); 44 BD_PRIVATE int32_t dlx_run ( VM *, int32_t ); 45 BD_PRIVATE uint32_t dlx_num_breaks ( VM * ); 46 BD_PRIVATE uint32_t dlx_num_traps ( VM * ); 47 BD_PRIVATE uint32_t dlx_num_instructions ( VM * ); 48 49 #endif 50