1 |
1452 |
nogj |
/* dyn_rec.h -- Recompiler specific definitions
|
2 |
|
|
Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
#ifndef DYN_REC_H
|
22 |
|
|
#define DYN_REC_H
|
23 |
|
|
|
24 |
|
|
struct x_ref {
|
25 |
|
|
void *dyn_addr; /* Recompiled address */
|
26 |
|
|
oraddr_t or_addr; /* The or address of the x-ref (physical) */
|
27 |
|
|
unsigned int ref; /* How many times the x-ref is referenced */
|
28 |
|
|
struct x_ref *next;
|
29 |
|
|
};
|
30 |
|
|
|
31 |
|
|
/* Each dynamically recompiled page has one of these */
|
32 |
|
|
struct dyn_page {
|
33 |
|
|
oraddr_t or_page;
|
34 |
|
|
void *host_page;
|
35 |
|
|
unsigned int host_len;
|
36 |
|
|
int carrys_delay_slot; /* Is the delay-slot of the last insn on the next page?*/
|
37 |
|
|
int dirty; /* Is recompiled page invalid? */
|
38 |
|
|
struct x_ref *xrefs; /* what's referenced in this page */
|
39 |
|
|
struct x_ref **held_xrefs; /* The xrefs that this page holds */
|
40 |
|
|
int delayr; /* delayr of memory backing this page */
|
41 |
|
|
uint16_t ts[4096]; /* What registers the temporaries back */
|
42 |
|
|
struct dyn_page *next;
|
43 |
|
|
};
|
44 |
|
|
|
45 |
|
|
struct dyn_page *find_dynd_page(oraddr_t addr);
|
46 |
|
|
struct x_ref *find_host_x_ref(struct x_ref *x_refs, oraddr_t addr);
|
47 |
|
|
struct x_ref *add_to_xrefs(struct dyn_page *dp, oraddr_t addr);
|
48 |
|
|
void recompile_page(struct dyn_page *dyn);
|
49 |
|
|
struct dyn_page *new_dp(oraddr_t page);
|
50 |
|
|
void add_to_held_xrefs(struct dyn_page *dp, struct x_ref *xref);
|
51 |
|
|
void add_to_opq(struct op_queue *opq, int end, int op);
|
52 |
|
|
void add_to_op_params(struct op_queue *opq, int end, unsigned long param);
|
53 |
|
|
void *enough_host_page(struct dyn_page *dp, void *cur, unsigned int *len,
|
54 |
|
|
unsigned int amount);
|
55 |
|
|
void dirtyfy_page(struct dyn_page *dp);
|
56 |
|
|
struct x_ref *find_held_x_ref(struct x_ref **held_xrefs, oraddr_t or_addr);
|
57 |
|
|
void init_dyn_recomp(void);
|
58 |
|
|
void jump_dyn_code(oraddr_t addr);
|
59 |
|
|
void dump_xrefs(struct dyn_page *dp, FILE *f);
|
60 |
|
|
void run_sched_out_of_line(int add_normal);
|
61 |
|
|
void recheck_immu(int got_en_dis);
|
62 |
|
|
|
63 |
|
|
#define IMMU_GOT_ENABLED 1
|
64 |
|
|
#define IMMU_GOT_DISABLED 2
|
65 |
|
|
|
66 |
|
|
#define NUM_RFE_HELD 100
|
67 |
|
|
|
68 |
|
|
#endif
|