Rev 115 | Rev 379 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 115 | Rev 237 | ||
---|---|---|---|
Line 125... | Line 125... | ||
125 | call get_debuggee_slot |
125 | call get_debuggee_slot |
126 | jc .ret |
126 | jc .ret |
127 | imul eax, tss_step/32 |
127 | imul eax, tss_step/32 |
128 | add eax, tss_data |
128 | add eax, tss_data |
129 | mov edi, edx |
129 | mov edi, edx |
130 | cmp [l.cs - tss_sceleton + eax], app_code |
130 | cmp [eax+TSS._cs], app_code |
131 | jnz .ring0 |
131 | jnz .ring0 |
132 | lea esi, [l.eip - tss_sceleton + eax] |
132 | lea esi, [eax+TSS._eip] |
133 | shr ecx, 2 |
133 | shr ecx, 2 |
134 | rep movsd |
134 | rep movsd |
135 | jmp .ret |
135 | jmp .ret |
136 | .ring0: |
136 | .ring0: |
137 | ; note that following code assumes that all interrupt/exception handlers |
137 | ; note that following code assumes that all interrupt/exception handlers |
138 | ; saves ring-3 context by push ds es, pushad in this order |
138 | ; saves ring-3 context by push ds es, pushad in this order |
139 | mov esi, [l.esp0 - tss_sceleton + eax] |
139 | mov esi, [eax+TSS._esp0] |
140 | ; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), ds, es, pushad |
140 | ; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), ds, es, pushad |
141 | sub esi, 8+12+8+20h |
141 | sub esi, 8+12+8+20h |
142 | lodsd |
142 | lodsd |
143 | mov [edi+24h], eax |
143 | mov [edi+24h], eax |
144 | lodsd |
144 | lodsd |
Line 184... | Line 184... | ||
184 | call get_debuggee_slot |
184 | call get_debuggee_slot |
185 | jc .stiret |
185 | jc .stiret |
186 | imul eax, tss_step/32 |
186 | imul eax, tss_step/32 |
187 | add eax, tss_data |
187 | add eax, tss_data |
188 | mov esi, edx |
188 | mov esi, edx |
189 | cmp [l.cs - tss_sceleton + eax], app_code |
189 | cmp [eax+TSS._cs], app_code |
190 | jnz .ring0 |
190 | jnz .ring0 |
191 | lea edi, [l.eip - tss_sceleton + eax] |
191 | lea edi, [eax+TSS._eip] |
192 | shr ecx, 2 |
192 | shr ecx, 2 |
193 | rep movsd |
193 | rep movsd |
194 | jmp .stiret |
194 | jmp .stiret |
195 | .ring0: |
195 | .ring0: |
196 | mov edi, [l.esp0 - tss_sceleton + eax] |
196 | mov edi, [eax+TSS._esp0] |
197 | sub edi, 8+12+8+20h |
197 | sub edi, 8+12+8+20h |
198 | mov eax, [esi+24h] |
198 | mov eax, [esi+24h] |
199 | stosd |
199 | stosd |
200 | mov eax, [esi+20h] |
200 | mov eax, [esi+20h] |
201 | stosd |
201 | stosd |
Line 247... | Line 247... | ||
247 | and dword [eax+ecx*2], 0 ; clear DR |
247 | and dword [eax+ecx*2], 0 ; clear DR |
248 | btr dword [eax+10h], ecx ; clear L bit |
248 | btr dword [eax+10h], ecx ; clear L bit |
249 | test byte [eax+10h], 55h |
249 | test byte [eax+10h], 55h |
250 | jnz .okret |
250 | jnz .okret |
251 | imul eax, ebp, tss_step/32 |
251 | imul eax, ebp, tss_step/32 |
252 | and byte [eax + tss_data + l.trap - tss_sceleton], not 1 |
252 | and byte [eax + tss_data + TSS._trap], not 1 |
253 | .okret: |
253 | .okret: |
254 | and dword [esp+36], 0 |
254 | and dword [esp+36], 0 |
255 | sti |
255 | sti |
256 | ret |
256 | ret |
257 | .errret: |
257 | .errret: |
Line 289... | Line 289... | ||
289 | shl edx, cl |
289 | shl edx, cl |
290 | not edx |
290 | not edx |
291 | and [eax+10h+2], dx |
291 | and [eax+10h+2], dx |
292 | or [eax+10h+2], bx ; set R/W and LEN fields |
292 | or [eax+10h+2], bx ; set R/W and LEN fields |
293 | imul eax, ebp, tss_step/32 |
293 | imul eax, ebp, tss_step/32 |
294 | or byte [eax + tss_data + l.trap - tss_sceleton], 1 |
294 | or byte [eax + tss_data + TSS._trap], 1 |
295 | jmp .okret |
295 | jmp .okret |
Line 296... | Line 296... | ||
296 | 296 | ||
297 | debug_read_process_memory: |
297 | debug_read_process_memory: |
298 | ; in: |
298 | ; in: |