Rev 161 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
162 | holmgren | 1 | Description: Rename enum constants in src/code/ia32.c |
2 | They conflict with /usr/include/i386-linux-gnu/sys/ucontext.h of newer eglibc |
||
3 | Author: Magnus Holmgren |
||
4 | Bug-Debian: http://bugs.debian.org/708366 |
||
5 | Forwarded: yes |
||
6 | |||
161 | holmgren | 7 | --- a/src/code/ia32.c |
8 | +++ b/src/code/ia32.c |
||
162 | holmgren | 9 | @@ -14,14 +14,9 @@ |
10 | #include "object.h" |
||
11 | #include "builtin_functions.h" |
||
12 | |||
13 | -/* This is defined on windows */ |
||
14 | -#ifdef REG_NONE |
||
15 | -#undef REG_NONE |
||
16 | -#endif |
||
17 | - |
||
18 | -enum ia32_reg {REG_EAX = 0, REG_EBX = 3, REG_ECX = 1, REG_EDX = 2, REG_NONE = 4}; |
||
19 | +enum ia32_reg {PIKE_REG_EAX = 0, PIKE_REG_EBX = 3, PIKE_REG_ECX = 1, PIKE_REG_EDX = 2, PIKE_REG_NONE = 4}; |
||
20 | |||
21 | -#define REG_BITMASK ((1 << REG_NONE) - 1) |
||
22 | +#define REG_BITMASK ((1 << PIKE_REG_NONE) - 1) |
||
23 | |||
24 | /* #define REGISTER_DEBUG */ |
||
25 | |||
26 | @@ -71,7 +66,7 @@ static int alloc_regs = 0, valid_regs = |
||
27 | #define MOV_ABSADDR_TO_REG(ADDR, REG) do { \ |
||
28 | MAKE_VALID_REG (REG); \ |
||
29 | /* movl addr,%reg */ \ |
||
30 | - if ((REG) == REG_EAX) \ |
||
31 | + if ((REG) == PIKE_REG_EAX) \ |
||
32 | add_to_program (0xa1); /* Move dword at address to EAX. */ \ |
||
33 | else { \ |
||
34 | add_to_program (0x8b); /* Move r/m32 to r32. */ \ |
||
35 | @@ -83,7 +78,7 @@ static int alloc_regs = 0, valid_regs = |
||
36 | #define MOV_REG_TO_ABSADDR(REG, ADDR) do { \ |
||
37 | CHECK_VALID_REG (REG); \ |
||
38 | /* movl %reg,addr */ \ |
||
39 | - if ((REG) == REG_EAX) \ |
||
40 | + if ((REG) == PIKE_REG_EAX) \ |
||
41 | add_to_program (0xa3); /* Move EAX to dword at address. */ \ |
||
42 | else { \ |
||
43 | add_to_program (0x89); /* Move r32 to r/m32. */ \ |
||
44 | @@ -217,7 +212,7 @@ static int alloc_regs = 0, valid_regs = |
||
45 | add_to_program (0x48 | (REG)); /* Decrement r32. */ \ |
||
46 | else if (val_ < -128 || val_ > 127) { \ |
||
47 | /* addl $val,%reg */ \ |
||
48 | - if ((REG) == REG_EAX) \ |
||
49 | + if ((REG) == PIKE_REG_EAX) \ |
||
50 | add_to_program (0x05); /* Add imm32 to EAX. */ \ |
||
51 | else { \ |
||
52 | add_to_program (0x81); /* Add imm32 to r/m32. */ \ |
||
53 | @@ -334,8 +329,8 @@ ptrdiff_t ia32_prev_stored_pc; /* PROG_P |
||
54 | |||
55 | void ia32_flush_code_generator(void) |
||
56 | { |
||
57 | - next_reg = REG_EAX; |
||
58 | - sp_reg = fp_reg = mark_sp_reg = REG_NONE; |
||
59 | + next_reg = PIKE_REG_EAX; |
||
60 | + sp_reg = fp_reg = mark_sp_reg = PIKE_REG_NONE; |
||
61 | CLEAR_REGS(); |
||
62 | ia32_prev_stored_pc = -1; |
||
63 | } |
||
64 | @@ -351,7 +346,7 @@ static enum ia32_reg alloc_reg (int avoi |
||
65 | /* There's a free register. */ |
||
66 | |||
67 | for (reg = next_reg; (1 << reg) & used_regs;) { |
||
68 | - reg = (reg + 1) % REG_NONE; |
||
69 | + reg = (reg + 1) % PIKE_REG_NONE; |
||
70 | #ifdef PIKE_DEBUG |
||
71 | if (reg == next_reg) Pike_fatal ("Failed to find a free register.\n"); |
||
161 | holmgren | 72 | #endif |
162 | holmgren | 73 | @@ -364,15 +359,15 @@ static enum ia32_reg alloc_reg (int avoi |
74 | * probably be replaced with an LRU strategy. */ |
||
161 | holmgren | 75 | |
162 | holmgren | 76 | for (reg = next_reg; (1 << reg) & avoid_regs;) { |
77 | - reg = (reg + 1) % REG_NONE; |
||
78 | + reg = (reg + 1) % PIKE_REG_NONE; |
||
79 | #ifdef PIKE_DEBUG |
||
80 | if (reg == next_reg) Pike_fatal ("Failed to find a non-excluded register.\n"); |
||
81 | #endif |
||
82 | } |
||
161 | holmgren | 83 | |
162 | holmgren | 84 | - if (sp_reg == reg) {sp_reg = REG_NONE; DEALLOC_REG (reg);} |
85 | - else if (fp_reg == reg) {fp_reg = REG_NONE; DEALLOC_REG (reg);} |
||
86 | - else if (mark_sp_reg == reg) {mark_sp_reg = REG_NONE; DEALLOC_REG (reg);} |
||
87 | + if (sp_reg == reg) {sp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);} |
||
88 | + else if (fp_reg == reg) {fp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);} |
||
89 | + else if (mark_sp_reg == reg) {mark_sp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);} |
||
90 | } |
||
91 | |||
92 | #ifdef REGISTER_DEBUG |
||
93 | @@ -386,11 +381,11 @@ static enum ia32_reg alloc_reg (int avoi |
||
94 | #define DEF_LOAD_REG(REG, SET) \ |
||
95 | static void PIKE_CONCAT(load_,REG) (int avoid_regs) \ |
||
96 | { \ |
||
97 | - if (REG == REG_NONE) { \ |
||
98 | + if (REG == PIKE_REG_NONE) { \ |
||
99 | REG = alloc_reg (avoid_regs); \ |
||
100 | /* Update the round robin pointer here so that we disregard */ \ |
||
101 | /* the direct calls to alloc_reg for temporary registers. */ \ |
||
102 | - next_reg = (REG + 1) % REG_NONE; \ |
||
103 | + next_reg = (REG + 1) % PIKE_REG_NONE; \ |
||
104 | {SET;} \ |
||
105 | } \ |
||
106 | else \ |
||
107 | @@ -410,8 +405,8 @@ DEF_LOAD_REG (mark_sp_reg, { |
||
108 | static void ia32_call_c_function(void *addr) |
||
109 | { |
||
110 | CALL_RELATIVE(addr); |
||
111 | - next_reg = REG_EAX; |
||
112 | - sp_reg = fp_reg = mark_sp_reg = REG_NONE; |
||
113 | + next_reg = PIKE_REG_EAX; |
||
114 | + sp_reg = fp_reg = mark_sp_reg = PIKE_REG_NONE; |
||
115 | CLEAR_REGS(); |
||
116 | } |
||
117 |