2 * Regular Pattern Analyzer Toolkit (RPA/Tk)
3 * Copyright (c) 2009-2012 Martin Stoilov
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * Martin Stoilov <martin@rpasearch.com>
21 #ifndef _RVMRELOCMAP_H_
22 #define _RVMRELOCMAP_H_
25 #include "rlib/rarray.h"
26 #include "rlib/rhash.h"
27 #include "rlib/rstring.h"
28 #include "rvm/rvmcpu.h"
29 #include "rvm/rvmcodemap.h"
36 RVM_RELOC_DEFAULT = 0,
50 typedef struct rvm_relocrecord_s {
51 rvm_reloctarget_t target;
58 typedef struct rvm_relocmap_s {
63 rvm_relocmap_t *rvm_relocmap_create();
64 void rvm_relocmap_destroy(rvm_relocmap_t *relocmap);
65 void rvm_relocmap_clear(rvm_relocmap_t *relocmap);
66 long rvm_relocmap_add(rvm_relocmap_t *relocmap, rvm_reloctarget_t target, rvm_reloctype_t type, unsigned long offset, unsigned long label);
67 rvm_relocrecord_t *rvm_relocmap_get(rvm_relocmap_t *relocmap, unsigned long index);
68 unsigned long rvm_relocmap_length(rvm_relocmap_t *relocmap);
69 int rvm_relocmap_relocate(rvm_relocmap_t *relocmap, rvm_codemap_t *codemap, rvm_asmins_t *code, rvm_codelabel_t **err);