Subversion Repositories Kolibri OS

Rev

Rev 4866 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4866 Rev 5963
Line 1... Line 1...
1
/* Definitions for Dwarf2 EH unwind support for Windows32 targets
1
/* Definitions for Dwarf2 EH unwind support for Windows32 targets
2
   Copyright (C) 2007, 2009
-
 
3
   Free Software Foundation, Inc.
2
   Copyright (C) 2007-2013 Free Software Foundation, Inc.
4
   Contributed by Pascal Obry  
3
   Contributed by Pascal Obry  
Line 5... Line 4...
5
 
4
 
Line 6... Line 5...
6
This file is part of GCC.
5
This file is part of GCC.
Line 128... Line 127...
128
  void * ctx_cfa_ = (void *)(context->cfa); /* context frame address */
127
  void * ctx_cfa_ = (void *)(context->cfa); /* context frame address */
129
  unsigned char * pc_ = (unsigned char *) ctx_ra_;
128
  unsigned char * pc_ = (unsigned char *) ctx_ra_;
Line 130... Line 129...
130
 
129
 
131
  /* In the test below we look for two specific patterns found
130
  /* In the test below we look for two specific patterns found
132
     experimentally to be in the Windows signal handler.  */
-
 
133
 
131
     experimentally to be in the Windows signal handler.  */
134
  if (SIG_PAT1 || SIG_PAT2 || SIG_SEH1 || SIG_SEH2)
132
  if (SIG_PAT1 || SIG_PAT2 || SIG_SEH1 || SIG_SEH2)
135
    {
133
    {
136
      PEXCEPTION_POINTERS weinfo_;
134
      PEXCEPTION_POINTERS weinfo_;
137
      PCONTEXT proc_ctx_;
135
      PCONTEXT proc_ctx_;
Line 146... Line 144...
146
	  weinfo_ = (PEXCEPTION_POINTERS) (*(int*)ctx_cfa_);
144
	  weinfo_ = (PEXCEPTION_POINTERS) (*(int*)ctx_cfa_);
147
	  proc_ctx_ = weinfo_->ContextRecord;
145
	  proc_ctx_ = weinfo_->ContextRecord;
148
	}
146
	}
Line 149... Line 147...
149
 
147
 
150
      /* The new context frame address is the stack pointer.  */
-
 
151
 
148
      /* The new context frame address is the stack pointer.  */
152
      new_cfa_ = proc_ctx_->Esp;
149
      new_cfa_ = proc_ctx_->Esp;
153
      fs->regs.cfa_how = CFA_REG_OFFSET;
150
      fs->regs.cfa_how = CFA_REG_OFFSET;
154
      fs->regs.cfa_reg = __builtin_dwarf_sp_column();
151
      fs->regs.cfa_reg = __builtin_dwarf_sp_column();
Line 155... Line 152...
155
      fs->regs.cfa_offset = new_cfa_ - (long) ctx_cfa_;
152
      fs->regs.cfa_offset = new_cfa_ - (long) ctx_cfa_;
156
 
-
 
157
      /* Save some registers.  */
153
 
158
 
154
      /* Restore registers.  */
159
      fs->regs.reg[0].how = REG_SAVED_OFFSET;
155
      fs->regs.reg[0].how = REG_SAVED_OFFSET;
160
      fs->regs.reg[0].loc.offset = (long)&proc_ctx_->Eax - new_cfa_;
156
      fs->regs.reg[0].loc.offset = (long)&proc_ctx_->Eax - new_cfa_;
161
      fs->regs.reg[3].how = REG_SAVED_OFFSET;
157
      fs->regs.reg[3].how = REG_SAVED_OFFSET;
Line 166... Line 162...
166
      fs->regs.reg[2].loc.offset = (long)&proc_ctx_->Edx - new_cfa_;
162
      fs->regs.reg[2].loc.offset = (long)&proc_ctx_->Edx - new_cfa_;
167
      fs->regs.reg[6].how = REG_SAVED_OFFSET;
163
      fs->regs.reg[6].how = REG_SAVED_OFFSET;
168
      fs->regs.reg[6].loc.offset = (long)&proc_ctx_->Esi - new_cfa_;
164
      fs->regs.reg[6].loc.offset = (long)&proc_ctx_->Esi - new_cfa_;
169
      fs->regs.reg[7].how = REG_SAVED_OFFSET;
165
      fs->regs.reg[7].how = REG_SAVED_OFFSET;
170
      fs->regs.reg[7].loc.offset = (long)&proc_ctx_->Edi - new_cfa_;
166
      fs->regs.reg[7].loc.offset = (long)&proc_ctx_->Edi - new_cfa_;
171
      fs->regs.reg[9].how = REG_SAVED_OFFSET;
-
 
172
      fs->regs.reg[9].loc.offset = (long)&proc_ctx_->Eip - new_cfa_;
-
 
173
      fs->regs.reg[4].how = REG_SAVED_OFFSET;
167
      fs->regs.reg[5].how = REG_SAVED_OFFSET;
174
      fs->regs.reg[4].loc.offset = (long)&proc_ctx_->Ebp - new_cfa_;
168
      fs->regs.reg[5].loc.offset = (long)&proc_ctx_->Ebp - new_cfa_;
175
 
-
 
176
      /* Set the return address to Eip + 1. As we can be called multiple
-
 
177
	 times we use another register for this.  */
-
 
178
 
-
 
179
      proc_ctx_->Dr0 = proc_ctx_->Eip + 1;
-
 
180
      fs->regs.reg[8].how = REG_SAVED_OFFSET;
169
      fs->regs.reg[8].how = REG_SAVED_OFFSET;
181
      fs->regs.reg[8].loc.offset = (long)&proc_ctx_->Dr0 - new_cfa_;
170
      fs->regs.reg[8].loc.offset = (long)&proc_ctx_->Eip - new_cfa_;
182
      fs->retaddr_column = 8;
171
      fs->retaddr_column = 8;
-
 
172
      fs->signal_frame = 1;
-
 
173
 
183
      return _URC_NO_REASON;
174
      return _URC_NO_REASON;
184
    }
175
    }
Line 185... Line 176...
185
 
176
 
186
  /* Unwinding through _alloca, propagating from a trap triggered by
177
  /* Unwinding through _alloca, propagating from a trap triggered by
187
     one of it's probes prior to the real SP adjustment. The only
178
     one of it's probes prior to the real SP adjustment. The only
188
     operations of interest performed is "pushl %ecx", followed by
179
     operations of interest performed is "pushl %ecx", followed by
189
     ecx clobbering.  */
-
 
190
 
180
     ecx clobbering.  */
191
  else if (SIG_ALLOCA)
181
  else if (SIG_ALLOCA) 
192
    {
182
    {
193
      /* Only one push between entry in _alloca and the probe trap.  */
183
      /* Only one push between entry in _alloca and the probe trap.  */ 
Line 203... Line 193...
203
 
193
 
204
      /* and what is stored at the CFA is the return address.  */
194
      /* and what is stored at the CFA is the return address.  */
205
      fs->retaddr_column = 8;
195
      fs->retaddr_column = 8;
206
      fs->regs.reg[8].how = REG_SAVED_OFFSET;
196
      fs->regs.reg[8].how = REG_SAVED_OFFSET;
-
 
197
      fs->regs.reg[8].loc.offset = 0;
Line 207... Line 198...
207
      fs->regs.reg[8].loc.offset = 0;
198
      fs->signal_frame = 1;
208
 
199
 
209
      return _URC_NO_REASON;
200
      return _URC_NO_REASON;
210
    }
201
    }