]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | struct _subtable_data { |
2 | unsigned int usecount; | |
3 | }; | |
4 | struct _table_data { | |
5 | unsigned char *table; | |
6 | struct _subtable_data subtable[64]; | |
7 | }; | |
8 | struct _addrspace_data { | |
9 | struct _table_data read; | |
10 | struct _table_data write; | |
11 | }; | |
12 | void reallocate_subtable(struct _table_data *tabledata, unsigned char subentry); | |
13 | void release_subtable(struct _table_data *tabledata, unsigned char subentry); | |
14 | void install_mem_handler(struct _addrspace_data *space, int iswrite, | |
15 | int databits, int ismatchmask, unsigned int start, | |
16 | unsigned int end, unsigned int mask, | |
17 | unsigned int mirror, void **handler, int isfixed, | |
18 | const char *handler_name) | |
19 | { | |
20 | unsigned int lmirrorbits; | |
21 | unsigned int hmirrorbits; | |
22 | unsigned int lmirrorcount; | |
23 | unsigned int hmirrorcount; | |
24 | struct _table_data *tabledata = iswrite ? &space->write : &space->read; | |
25 | unsigned char prev_entry = 0; | |
26 | int cur_index; | |
27 | int prev_index = 0; | |
28 | int i; | |
29 | for (i = (32 - 18); hmirrorcount < (1 << hmirrorbits); hmirrorcount++) { | |
30 | unsigned int hmirrorbase = 0; | |
31 | if (cur_index == ((end + hmirrorbase) >> (32 - 18))) { | |
32 | if (hmirrorcount != 0 | |
33 | && prev_entry == tabledata->table[cur_index]) { | |
34 | if (tabledata->table[cur_index] >= (256 - 64)) | |
35 | release_subtable(tabledata, | |
36 | tabledata-> | |
37 | table[cur_index]); | |
38 | if (tabledata->table[prev_index] >= (256 - 64)) | |
39 | reallocate_subtable(tabledata, | |
40 | tabledata-> | |
41 | table[prev_index]); | |
42 | } | |
43 | prev_entry = tabledata->table[cur_index]; | |
44 | } | |
45 | for (lmirrorcount = 0; | |
46 | lmirrorcount < (1 << lmirrorbits); lmirrorcount++) { | |
47 | } | |
48 | } | |
49 | } | |
50 | void reallocate_subtable(struct _table_data *tabledata, unsigned char subentry) | |
51 | { | |
52 | unsigned char subindex = subentry - (256 - 64); | |
53 | if (tabledata->subtable[subindex].usecount <= 0) | |
54 | osd_die(); | |
55 | } | |
56 | void release_subtable(struct _table_data *tabledata, unsigned char subentry) | |
57 | { | |
58 | unsigned char subindex = subentry - (256 - 64); | |
59 | if (tabledata->subtable[subindex].usecount <= 0) | |
60 | osd_die(); | |
61 | } |