Mercurial > repos > blastem
comparison backend.h @ 557:acec5464fa1e
Rename x86_backend.h and x86_backend.c to backend.h and backend.c respectively
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 24 Feb 2014 00:50:15 -0800 |
parents | x86_backend.h@34dfa9b24c7b |
children | dc9f178085a0 |
comparison
equal
deleted
inserted
replaced
556:34dfa9b24c7b | 557:acec5464fa1e |
---|---|
1 /* | |
2 Copyright 2013 Michael Pavone | |
3 This file is part of BlastEm. | |
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. | |
5 */ | |
6 #ifndef BACKEND_H_ | |
7 #define BACKEND_H_ | |
8 | |
9 #include <stdint.h> | |
10 #include <stdio.h> | |
11 | |
12 #define INVALID_OFFSET 0xFFFFFFFF | |
13 #define EXTENSION_WORD 0xFFFFFFFE | |
14 | |
15 typedef struct { | |
16 int32_t disp; | |
17 uint8_t mode; | |
18 uint8_t base; | |
19 uint8_t index; | |
20 uint8_t cycles; | |
21 } x86_ea; | |
22 | |
23 typedef struct { | |
24 uint8_t *base; | |
25 int32_t *offsets; | |
26 } native_map_slot; | |
27 | |
28 typedef struct deferred_addr { | |
29 struct deferred_addr *next; | |
30 uint8_t *dest; | |
31 uint32_t address; | |
32 } deferred_addr; | |
33 | |
34 typedef enum { | |
35 READ_16, | |
36 READ_8, | |
37 WRITE_16, | |
38 WRITE_8 | |
39 } ftype; | |
40 | |
41 typedef struct { | |
42 uint32_t flags; | |
43 native_map_slot *native_code_map; | |
44 deferred_addr *deferred; | |
45 uint8_t *cur_code; | |
46 uint8_t *code_end; | |
47 uint8_t **ram_inst_sizes; | |
48 FILE *address_log; | |
49 uint8_t *save_context; | |
50 uint8_t *load_context; | |
51 uint8_t *handle_cycle_limit; | |
52 uint8_t *handle_cycle_limit_int; | |
53 uint8_t context_reg; | |
54 uint8_t scratch1; | |
55 uint8_t scratch2; | |
56 } cpu_options; | |
57 | |
58 | |
59 #define MMAP_READ 0x01 | |
60 #define MMAP_WRITE 0x02 | |
61 #define MMAP_CODE 0x04 | |
62 #define MMAP_PTR_IDX 0x08 | |
63 #define MMAP_ONLY_ODD 0x10 | |
64 #define MMAP_ONLY_EVEN 0x20 | |
65 #define MMAP_FUNC_NULL 0x40 | |
66 | |
67 typedef uint16_t (*read_16_fun)(uint32_t address, void * context); | |
68 typedef uint8_t (*read_8_fun)(uint32_t address, void * context); | |
69 typedef void * (*write_16_fun)(uint32_t address, void * context, uint16_t value); | |
70 typedef void * (*write_8_fun)(uint32_t address, void * context, uint8_t value); | |
71 | |
72 typedef struct { | |
73 uint32_t start; | |
74 uint32_t end; | |
75 uint32_t mask; | |
76 uint16_t ptr_index; | |
77 uint16_t flags; | |
78 void * buffer; | |
79 read_16_fun read_16; | |
80 write_16_fun write_16; | |
81 read_8_fun read_8; | |
82 write_8_fun write_8; | |
83 } memmap_chunk; | |
84 | |
85 typedef uint8_t * (*native_addr_func)(void * context, uint32_t address); | |
86 | |
87 deferred_addr * defer_address(deferred_addr * old_head, uint32_t address, uint8_t *dest); | |
88 void remove_deferred_until(deferred_addr **head_ptr, deferred_addr * remove_to); | |
89 void process_deferred(deferred_addr ** head_ptr, void * context, native_addr_func get_native); | |
90 | |
91 #endif //BACKEND_H_ | |
92 |