|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * m68k -> i386 compiler
5: *
6: * (c) 1995 Bernd Schmidt
7: */
8:
9: typedef CPTR (*code_execfunc)(void);
10:
11: struct code_page {
12: struct code_page *next;
13: ULONG allocmask;
14: };
15:
16: struct hash_block {
17: struct hash_block *lru_next, *lru_prev;
18: struct hash_entry *he_first;
19:
20: struct code_page *cpage;
21: int alloclen;
22: ULONG page_allocmask;
23: char *compile_start;
24:
25: int nrefs;
26:
27: int translated:1;
28: int untranslatable:1;
29: int allocfailed:1;
30: };
31:
32: struct hash_entry {
33: struct hash_entry *next,*prev;
34: struct hash_entry *next_same_block, *lru_next, *lru_prev;
35: struct hash_block *block;
36:
37: code_execfunc execute;
38: CPTR addr;
39: ULONG matchword;
40: int ncalls:8;
41: int locked:1;
42: int cacheflush:1;
43: };
44:
45: extern int nr_bbs_start;
46: extern UBYTE nr_bbs_to_run;
47: extern code_execfunc exec_me;
48:
49: #ifdef USE_COMPILER
50: static __inline__ void run_compiled_code(void)
51: {
52: if (regs.spcflags == SPCFLAG_EXEC) {
53: while (regs.spcflags == SPCFLAG_EXEC) {
54: CPTR newpc;
55: regs.spcflags = 0;
56: /* newpc = (*exec_me)();*/
57: __asm__ __volatile__ ("pushl %%ebp; call *%1; popl %%ebp" : "=a" (newpc) : "r" (exec_me) :
58: "%eax", "%edx", "%ecx", "%ebx",
59: "%edi", "%esi", "memory", "cc");
60: if (nr_bbs_to_run == 0) {
61: struct hash_entry *h = (struct hash_entry *)newpc;
62: regs.spcflags = SPCFLAG_EXEC;
63: exec_me = h->execute;
64: regs.pc = h->addr;
65: regs.pc_p = regs.pc_oldp = get_real_address(h->addr);
66: nr_bbs_to_run = nr_bbs_start;
67: } else
68: m68k_setpc_fast(newpc);
69: do_cycles();
70: }
71: } else
72: regs.spcflags &= ~SPCFLAG_EXEC;
73: }
74:
75: extern void compiler_init(void);
76: extern void possible_loadseg(void);
77:
78: #else
79:
80: static __inline__ void run_compiled_code(void)
81: {
82: }
83:
84: static __inline__ void compiler_init(void)
85: {
86: }
87:
88: static __inline__ void possible_loadseg(void)
89: {
90: }
91:
92: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.