]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | struct _subtable_data { |
2 | int usecount; | |
3 | }; | |
4 | struct _table_data { | |
5 | unsigned char *table; | |
6 | struct _subtable_data subtable[64]; | |
7 | }; | |
8 | void reallocate_subtable(struct _table_data *tabledata, unsigned char subentry) { | |
9 | unsigned char subindex = subentry - (256 - 64); | |
10 | if (tabledata->subtable[subindex].usecount <= 0) osd_die(); | |
11 | } | |
12 | void release_subtable(struct _table_data *tabledata, unsigned char subentry) { | |
13 | unsigned char subindex = subentry - (256 - 64); | |
14 | if (tabledata->subtable[subindex].usecount <= 0) osd_die(); | |
15 | } | |
16 | void install_mem_handler( int end, char *handler_name) { | |
17 | int lmirrorbits; | |
18 | int hmirrorbits; | |
19 | int lmirrorcount; | |
20 | int hmirrorcount; | |
21 | struct _table_data *tabledata; | |
22 | char prev_entry; | |
23 | int cur_index; | |
24 | int prev_index; | |
25 | for (; | |
26 | hmirrorcount < (1 << hmirrorbits); | |
27 | hmirrorcount++) { | |
28 | int hmirrorbase = 0; | |
29 | if (cur_index == ((end + hmirrorbase) >> (32 - 18))) { | |
30 | if (hmirrorcount != 0 && prev_entry == tabledata->table[cur_index]) { | |
31 | if (tabledata->table[cur_index] >= (256 - 64)) release_subtable(tabledata, tabledata-> table[cur_index]); | |
32 | if (tabledata->table[prev_index] >= (256 - 64)) reallocate_subtable(tabledata, tabledata-> table[prev_index]); | |
33 | } | |
34 | } | |
35 | for (lmirrorcount = 0; | |
36 | lmirrorcount < (1 << lmirrorbits); | |
37 | lmirrorcount++) ; | |
38 | } | |
39 | } |