c8b132b647a37fa0483770702c0b8c02bf6d7fae
[reactos.git] / freeldr / freeldr / arch / i386 / i386trap.S
1 /*
2 * FreeLoader
3 * Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 .text
21 .code16
22
23 #define ASM
24 #include <arch.h>
25 #include <version.h>
26
27 #define SCREEN_ATTR 0x1f /* Bright white on blue background */
28
29 .macro SAVE_CPU_REGS
30 movl %eax,i386_EAX
31 movl %ebx,i386_EBX
32 movl %ecx,i386_ECX
33 movl %edx,i386_EDX
34 movl %esp,i386_ESP
35 movl %ebp,i386_EBP
36 movl %esi,i386_ESI
37 movl %edi,i386_EDI
38 movw %ds,%ax
39 movw %ax,i386_DS
40 movw %es,%ax
41 movw %ax,i386_ES
42 movw %fs,%ax
43 movw %ax,i386_FS
44 movw %gs,%ax
45 movw %ax,i386_GS
46 movw %ss,%ax
47 movw %ax,i386_SS
48 popl %eax
49 movl %eax,i386_EIP
50 popl %eax
51 movw %ax,i386_CS
52 popl %eax
53 movl %eax,i386_EFLAGS
54 movl %cr0,%eax
55 movl %eax,i386_CR0
56 //movl %cr1,%eax
57 //movl %eax,i386_CR1
58 movl %cr2,%eax
59 movl %eax,i386_CR2
60 movl %cr3,%eax
61 movl %eax,i386_CR3
62 movl %dr0,%eax
63 movl %eax,i386_DR0
64 movl %dr1,%eax
65 movl %eax,i386_DR1
66 movl %dr2,%eax
67 movl %eax,i386_DR2
68 movl %dr3,%eax
69 movl %eax,i386_DR3
70 movl %dr6,%eax
71 movl %eax,i386_DR6
72 movl %dr7,%eax
73 movl %eax,i386_DR7
74 sgdt i386_GDTR
75 sidt i386_IDTR
76 sldt i386_LDTR
77 str i386_TR
78 .endm
79
80
81
82 i386ExceptionHandlerText:
83 .ascii "An error occured in FreeLoader\n"
84 .ascii VERSION
85 .ascii "\n"
86 .asciz "Report this error to the ReactOS Development mailing list <ros-dev@reactos.com>\n\n"
87
88 i386DivideByZeroText:
89 .asciz "Exception 00: DIVIDE BY ZERO\n\n"
90 i386DebugExceptionText:
91 .asciz "Exception 01: DEBUG EXCEPTION\n\n"
92 i386NMIExceptionText:
93 .asciz "Exception 02: NON-MASKABLE INTERRUPT EXCEPTION\n\n"
94 i386BreakpointText:
95 .asciz "Exception 03: BREAKPOINT (INT 3)\n\n"
96 i386OverflowText:
97 .asciz "Exception 04: OVERFLOW\n\n"
98 i386BoundExceptionText:
99 .asciz "Exception 05: BOUND EXCEPTION\n\n"
100 i386InvalidOpcodeText:
101 .asciz "Exception 06: INVALID OPCODE\n\n"
102 i386FPUNotAvailableText:
103 .asciz "Exception 07: FPU NOT AVAILABLE\n\n"
104 i386DoubleFaultText:
105 .asciz "Exception 08: DOUBLE FAULT\n\n"
106 i386CoprocessorSegmentText:
107 .asciz "Exception 09: COPROCESSOR SEGMENT OVERRUN\n\n"
108 i386InvalidTSSText:
109 .asciz "Exception 0A: INVALID TSS\n\n"
110 i386SegmentNotPresentText:
111 .asciz "Exception 0B: SEGMENT NOT PRESENT\n\n"
112 i386StackExceptionText:
113 .asciz "Exception 0C: STACK EXCEPTION\n\n"
114 i386GeneralProtectionFaultText:
115 .asciz "Exception 0D: GENERAL PROTECTION FAULT\n\n"
116 i386PageFaultText:
117 .asciz "Exception 0E: PAGE FAULT\n\n"
118 i386CoprocessorErrorText:
119 .asciz "Exception 10: COPROCESSOR ERROR\n\n"
120 i386AlignmentCheckText:
121 .asciz "Exception 11: ALIGNMENT CHECK\n\n"
122 i386MachineCheckText:
123 .asciz "Exception 12: MACHINE CHECK\n\n"
124
125 i386_EAX_Text:
126 .asciz "EAX: "
127 i386_EBX_Text:
128 .asciz "EBX: "
129 i386_ECX_Text:
130 .asciz "ECX: "
131 i386_EDX_Text:
132 .asciz "EDX: "
133 i386_ESP_Text:
134 .asciz " ESP: "
135 i386_EBP_Text:
136 .asciz " EBP: "
137 i386_ESI_Text:
138 .asciz " ESI: "
139 i386_EDI_Text:
140 .asciz " EDI: "
141 i386_CS_Text:
142 .asciz "CS: "
143 i386_DS_Text:
144 .asciz "DS: "
145 i386_ES_Text:
146 .asciz "ES: "
147 i386_FS_Text:
148 .asciz "FS: "
149 i386_GS_Text:
150 .asciz "GS: "
151 i386_SS_Text:
152 .asciz "SS: "
153 i386_EFLAGS_Text:
154 .asciz " EFLAGS: "
155 i386_EIP_Text:
156 .asciz " EIP: "
157 i386_ERROR_CODE_Text:
158 .asciz " ERROR CODE: "
159 i386_CR0_Text:
160 .asciz " CR0: "
161 i386_CR1_Text:
162 .asciz " CR1: "
163 i386_CR2_Text:
164 .asciz " CR2: "
165 i386_CR3_Text:
166 .asciz " CR3: "
167 i386_DR0_Text:
168 .asciz " DR0: "
169 i386_DR1_Text:
170 .asciz " DR1: "
171 i386_DR2_Text:
172 .asciz " DR2: "
173 i386_DR3_Text:
174 .asciz " DR3: "
175 i386_DR6_Text:
176 .asciz " DR6: "
177 i386_DR7_Text:
178 .asciz " DR7: "
179 i386_GDTR_Text:
180 .asciz " GDTR Base: "
181 i386_IDTR_Text:
182 .asciz " IDTR Base: "
183 i386_Limit_Text:
184 .asciz " Limit: "
185 i386_LDTR_Text:
186 .asciz " LDTR: "
187 i386_TR_Text:
188 .asciz " TR: "
189
190 i386FramesText:
191 .asciz "Frames:\n"
192
193 /* Set by each exception handler to the address of the description text */
194 i386ExceptionDescriptionText:
195 .long 0
196
197 /* Used to store the contents of all the registers when an exception occurs */
198 i386_EAX:
199 .long 0
200 i386_EBX:
201 .long 0
202 i386_ECX:
203 .long 0
204 i386_EDX:
205 .long 0
206 i386_ESP:
207 .long 0
208 i386_EBP:
209 .long 0
210 i386_ESI:
211 .long 0
212 i386_EDI:
213 .long 0
214 i386_CS:
215 .word 0
216 i386_DS:
217 .word 0
218 i386_ES:
219 .word 0
220 i386_FS:
221 .word 0
222 i386_GS:
223 .word 0
224 i386_SS:
225 .word 0
226 i386_EFLAGS:
227 .long 0
228 i386_EIP:
229 .long 0
230 i386_ERROR_CODE:
231 .long 0
232 i386_CR0:
233 .long 0
234 i386_CR1:
235 .long 0
236 i386_CR2:
237 .long 0
238 i386_CR3:
239 .long 0
240 i386_DR0:
241 .long 0
242 i386_DR1:
243 .long 0
244 i386_DR2:
245 .long 0
246 i386_DR3:
247 .long 0
248 i386_DR6:
249 .long 0
250 i386_DR7:
251 .long 0
252 i386_GDTR:
253 .word 0
254 .long 0
255 i386_IDTR:
256 .word 0
257 .long 0
258 i386_LDTR:
259 .word 0
260 i386_TR:
261 .word 0
262
263 /* Used to store the current X and Y position on the screen */
264 i386_ScreenPosX:
265 .long 0
266 i386_ScreenPosY:
267 .long 0
268
269 /************************************************************************/
270 i386CommonExceptionHandler:
271 .code32
272
273 SAVE_CPU_REGS
274
275 pushl $SCREEN_ATTR
276 call _MachVideoClearScreen
277 add $4,%esp
278
279 movl $i386ExceptionHandlerText,%esi
280 call i386PrintText
281
282 movl i386ExceptionDescriptionText,%esi
283 call i386PrintText
284
285 movl $i386_EAX_Text,%esi
286 call i386PrintText
287 movl i386_EAX,%eax
288 call i386PrintHexDword // Display EAX
289 movl $i386_ESP_Text,%esi
290 call i386PrintText
291 movl i386_ESP,%eax
292 call i386PrintHexDword // Display ESP
293 movl $i386_CR0_Text,%esi
294 call i386PrintText
295 movl i386_CR0,%eax
296 call i386PrintHexDword // Display CR0
297 movl $i386_DR0_Text,%esi
298 call i386PrintText
299 movl i386_DR0,%eax
300 call i386PrintHexDword // Display DR0
301 movl $0,i386_ScreenPosX
302 incl i386_ScreenPosY
303 movl $i386_EBX_Text,%esi
304 call i386PrintText
305 movl i386_EBX,%eax
306 call i386PrintHexDword // Display EBX
307 movl $i386_EBP_Text,%esi
308 call i386PrintText
309 movl i386_EBP,%eax
310 call i386PrintHexDword // Display EBP
311 movl $i386_CR1_Text,%esi
312 call i386PrintText
313 movl i386_CR1,%eax
314 call i386PrintHexDword // Display CR1
315 movl $i386_DR1_Text,%esi
316 call i386PrintText
317 movl i386_DR1,%eax
318 call i386PrintHexDword // Display DR1
319 movl $0,i386_ScreenPosX
320 incl i386_ScreenPosY
321 movl $i386_ECX_Text,%esi
322 call i386PrintText
323 movl i386_ECX,%eax
324 call i386PrintHexDword // Display ECX
325 movl $i386_ESI_Text,%esi
326 call i386PrintText
327 movl i386_ESI,%eax
328 call i386PrintHexDword // Display ESI
329 movl $i386_CR2_Text,%esi
330 call i386PrintText
331 movl i386_CR2,%eax
332 call i386PrintHexDword // Display CR2
333 movl $i386_DR2_Text,%esi
334 call i386PrintText
335 movl i386_DR2,%eax
336 call i386PrintHexDword // Display DR2
337 movl $0,i386_ScreenPosX
338 incl i386_ScreenPosY
339 movl $i386_EDX_Text,%esi
340 call i386PrintText
341 movl i386_EDX,%eax
342 call i386PrintHexDword // Display EDX
343 movl $i386_EDI_Text,%esi
344 call i386PrintText
345 movl i386_EDI,%eax
346 call i386PrintHexDword // Display EDI
347 movl $i386_CR3_Text,%esi
348 call i386PrintText
349 movl i386_CR3,%eax
350 call i386PrintHexDword // Display CR3
351 movl $i386_DR3_Text,%esi
352 call i386PrintText
353 movl i386_DR3,%eax
354 call i386PrintHexDword // Display DR3
355 incl i386_ScreenPosY
356 movl $55,i386_ScreenPosX
357 movl $i386_DR6_Text,%esi
358 call i386PrintText
359 movl i386_DR6,%eax
360 call i386PrintHexDword // Display DR6
361 incl i386_ScreenPosY
362 movl $55,i386_ScreenPosX
363 movl $i386_DR7_Text,%esi
364 call i386PrintText
365 movl i386_DR7,%eax
366 call i386PrintHexDword // Display DR7
367 movl $0,i386_ScreenPosX
368 incl i386_ScreenPosY
369 incl i386_ScreenPosY
370 movl $i386_CS_Text,%esi
371 call i386PrintText
372 movw i386_CS,%ax
373 call i386PrintHexWord // Display CS
374 movl $i386_EIP_Text,%esi
375 call i386PrintText
376 movl i386_EIP,%eax
377 call i386PrintHexDword // Display EIP
378 movl $0,i386_ScreenPosX
379 incl i386_ScreenPosY
380 movl $i386_DS_Text,%esi
381 call i386PrintText
382 movw i386_DS,%ax
383 call i386PrintHexWord // Display DS
384 movl $i386_ERROR_CODE_Text,%esi
385 call i386PrintText
386 movl i386_ERROR_CODE,%eax
387 call i386PrintHexDword // Display ERROR CODE
388 movl $0,i386_ScreenPosX
389 incl i386_ScreenPosY
390 movl $i386_ES_Text,%esi
391 call i386PrintText
392 movw i386_ES,%ax
393 call i386PrintHexWord // Display ES
394 movl $i386_EFLAGS_Text,%esi
395 call i386PrintText
396 movl i386_EFLAGS,%eax
397 call i386PrintHexDword // Display EFLAGS
398 movl $0,i386_ScreenPosX
399 incl i386_ScreenPosY
400 movl $i386_FS_Text,%esi
401 call i386PrintText
402 movw i386_FS,%ax
403 call i386PrintHexWord // Display FS
404 movl $i386_GDTR_Text,%esi
405 call i386PrintText
406 movl i386_GDTR+2,%eax
407 call i386PrintHexDword // Display GDTR Base
408 movl $i386_Limit_Text,%esi
409 call i386PrintText
410 movw i386_GDTR,%ax
411 call i386PrintHexWord // Display GDTR Limit
412 movl $0,i386_ScreenPosX
413 incl i386_ScreenPosY
414 movl $i386_GS_Text,%esi
415 call i386PrintText
416 movw i386_GS,%ax
417 call i386PrintHexWord // Display GS
418 movl $i386_IDTR_Text,%esi
419 call i386PrintText
420 movl i386_IDTR+2,%eax
421 call i386PrintHexDword // Display IDTR Base
422 movl $i386_Limit_Text,%esi
423 call i386PrintText
424 movw i386_IDTR,%ax
425 call i386PrintHexWord // Display IDTR Limit
426 movl $0,i386_ScreenPosX
427 incl i386_ScreenPosY
428 movl $i386_SS_Text,%esi
429 call i386PrintText
430 movw i386_SS,%ax
431 call i386PrintHexWord // Display SS
432 movl $i386_LDTR_Text,%esi
433 call i386PrintText
434 movw i386_LDTR,%ax
435 call i386PrintHexWord // Display LDTR
436 movl $i386_TR_Text,%esi
437 call i386PrintText
438 movw i386_TR,%ax
439 call i386PrintHexWord // Display TR
440 movl $0,i386_ScreenPosX
441 incl i386_ScreenPosY
442 incl i386_ScreenPosY
443 call i386PrintFrames // Display frames
444 incl i386_ScreenPosY
445 incl i386_ScreenPosY
446
447 cli
448 i386ExceptionHandlerHang:
449 hlt
450 jmp i386ExceptionHandlerHang
451
452 iret
453
454 i386PrintFrames:
455 movl $0,i386_ScreenPosX
456 movl $i386FramesText,%esi
457 call i386PrintText
458
459 movl i386_EBP,%edi
460 printnextframe:
461 test %edi,%edi
462 je nomoreframes
463 movl $STACK32ADDR,%eax
464 cmpl %edi,%eax
465 jbe nomoreframes
466 movl 4(%edi),%eax
467 pushl %edi
468 call i386PrintHexDword // Display frame
469 popl %edi
470 incl i386_ScreenPosX
471 incl i386_ScreenPosX
472 movl 0(%edi),%edi
473 jmp printnextframe
474 nomoreframes:
475 ret
476
477 /************************************************************************/
478 /* AL = Char to display */
479 /************************************************************************/
480 i386PrintChar:
481 .code32
482
483 pushl i386_ScreenPosY
484 pushl i386_ScreenPosX
485 pushl $SCREEN_ATTR
486 andl $0xff,%eax
487 pushl %eax
488 call _MachVideoPutChar
489 addl $16,%esp
490
491 ret
492
493 /************************************************************************/
494 /* ESI = Address of text to display */
495 /************************************************************************/
496 i386PrintText:
497 .code32
498
499 i386PrintTextLoop:
500 lodsb
501
502 // Check for end of string char
503 cmp $0,%al
504 je i386PrintTextDone
505
506 // Check for newline char
507 cmp $0x0a,%al
508 jne i386PrintTextLoop2
509 incl i386_ScreenPosY
510 movl $0,i386_ScreenPosX
511 jmp i386PrintTextLoop
512
513 i386PrintTextLoop2:
514 call i386PrintChar
515 incl i386_ScreenPosX
516
517 jmp i386PrintTextLoop
518
519 i386PrintTextDone:
520
521 ret
522
523 /************************************************************************/
524 /* Prints the value in EAX on the screen in hex */
525 /************************************************************************/
526 i386PrintHexDword:
527 .code32
528
529 call i386PrintHex1
530
531 i386PrintHex1:
532 call i386PrintHex2
533 i386PrintHex2:
534 call i386PrintHex3
535 i386PrintHex3:
536 movb $4,%cl
537 rol %cl,%eax
538 push %eax
539 andb $0x0f,%al
540 movl $i386PrintHexTable,%ebx
541 xlat /*$i386PrintHexTable*/
542 call i386PrintChar
543 incl i386_ScreenPosX
544 pop %eax
545
546 ret
547
548 i386PrintHexTable:
549 .ascii "0123456789ABCDEF"
550
551 /************************************************************************/
552 /* Prints the value in AX on the screen in hex */
553 /************************************************************************/
554 i386PrintHexWord:
555 .code32
556
557 call i386PrintHexWord1
558 i386PrintHexWord1:
559 call i386PrintHexWord2
560 i386PrintHexWord2:
561 movb $4,%cl
562 rol %cl,%ax
563 push %eax
564 andb $0x0f,%al
565 movl $i386PrintHexTable,%ebx
566 xlat /*$i386PrintHexTable*/
567 call i386PrintChar
568 incl i386_ScreenPosX
569 pop %eax
570
571 ret
572
573 /************************************************************************/
574 /* Prints the value in AL on the screen in hex */
575 /************************************************************************/
576 i386PrintHexByte:
577 .code32
578
579 call i386PrintHexByte1
580 i386PrintHexByte1:
581 movb $4,%cl
582 rol %cl,%al
583 push %eax
584 andb $0x0f,%al
585 movl $i386PrintHexTable,%ebx
586 xlat /*$i386PrintHexTable*/
587 call i386PrintChar
588 incl i386_ScreenPosX
589 pop %eax
590
591 ret
592
593 /************************************************************************/
594 EXTERN(i386DivideByZero)
595 .code32
596
597 movl $i386DivideByZeroText,i386ExceptionDescriptionText
598 jmp i386CommonExceptionHandler
599
600 /************************************************************************/
601 EXTERN(i386DebugException)
602 .code32
603
604 movl $i386DebugExceptionText,i386ExceptionDescriptionText
605 jmp i386CommonExceptionHandler
606
607 /************************************************************************/
608 EXTERN(i386NMIException)
609 .code32
610
611 movl $i386NMIExceptionText,i386ExceptionDescriptionText
612 jmp i386CommonExceptionHandler
613
614 /************************************************************************/
615 EXTERN(i386Breakpoint)
616 .code32
617
618 movl $i386BreakpointText,i386ExceptionDescriptionText
619 jmp i386CommonExceptionHandler
620
621 /************************************************************************/
622 EXTERN(i386Overflow)
623 .code32
624
625 movl $i386OverflowText,i386ExceptionDescriptionText
626 jmp i386CommonExceptionHandler
627
628 /************************************************************************/
629 EXTERN(i386BoundException)
630 .code32
631
632 movl $i386BoundExceptionText,i386ExceptionDescriptionText
633 jmp i386CommonExceptionHandler
634
635 /************************************************************************/
636 EXTERN(i386InvalidOpcode)
637 .code32
638
639 movl $i386InvalidOpcodeText,i386ExceptionDescriptionText
640 jmp i386CommonExceptionHandler
641
642 /************************************************************************/
643 EXTERN(i386FPUNotAvailable)
644 .code32
645
646 movl $i386FPUNotAvailableText,i386ExceptionDescriptionText
647 jmp i386CommonExceptionHandler
648
649 /************************************************************************/
650 EXTERN(i386DoubleFault)
651 .code32
652
653 popl %eax
654 movl %eax,i386_ERROR_CODE
655
656 movl $i386DoubleFaultText,i386ExceptionDescriptionText
657 jmp i386CommonExceptionHandler
658
659 /************************************************************************/
660 EXTERN(i386CoprocessorSegment)
661 .code32
662
663 movl $i386CoprocessorSegmentText,i386ExceptionDescriptionText
664 jmp i386CommonExceptionHandler
665
666 /************************************************************************/
667 EXTERN(i386InvalidTSS)
668 .code32
669
670 popl %eax
671 movl %eax,i386_ERROR_CODE
672
673 movl $i386InvalidTSSText,i386ExceptionDescriptionText
674 jmp i386CommonExceptionHandler
675
676 /************************************************************************/
677 EXTERN(i386SegmentNotPresent)
678 .code32
679
680 popl %eax
681 movl %eax,i386_ERROR_CODE
682
683 movl $i386SegmentNotPresentText,i386ExceptionDescriptionText
684 jmp i386CommonExceptionHandler
685
686 /************************************************************************/
687 EXTERN(i386StackException)
688 .code32
689
690 popl %eax
691 movl %eax,i386_ERROR_CODE
692
693 movl $i386StackExceptionText,i386ExceptionDescriptionText
694 jmp i386CommonExceptionHandler
695
696 /************************************************************************/
697 EXTERN(i386GeneralProtectionFault)
698 .code32
699
700 popl %eax
701 movl %eax,i386_ERROR_CODE
702
703 movl $i386GeneralProtectionFaultText,i386ExceptionDescriptionText
704 jmp i386CommonExceptionHandler
705
706 /************************************************************************/
707 EXTERN(i386PageFault)
708 .code32
709
710 popl %eax
711 movl %eax,i386_ERROR_CODE
712
713 movl $i386PageFaultText,i386ExceptionDescriptionText
714 jmp i386CommonExceptionHandler
715
716 /************************************************************************/
717 EXTERN(i386CoprocessorError)
718 .code32
719
720 movl $i386CoprocessorErrorText,i386ExceptionDescriptionText
721 jmp i386CommonExceptionHandler
722
723 /************************************************************************/
724 EXTERN(i386AlignmentCheck)
725 .code32
726
727 movl $i386AlignmentCheckText,i386ExceptionDescriptionText
728 jmp i386CommonExceptionHandler
729
730 /************************************************************************/
731 EXTERN(i386MachineCheck)
732 .code32
733
734 movl $i386MachineCheckText,i386ExceptionDescriptionText
735 jmp i386CommonExceptionHandler
736
737 /************************************************************************
738 * DEBUGGING SUPPORT FUNCTIONS
739 ************************************************************************/
740 EXTERN(_INSTRUCTION_BREAKPOINT1)
741 .code32
742
743 pushl %eax
744
745 movl 8(%esp),%eax
746
747 movl %eax,%dr0
748 movl %dr7,%eax
749 andl $0xfff0ffff,%eax
750 orl $0x00000303,%eax
751 movl %eax,%dr7
752
753 popl %eax
754
755 ret
756
757 EXTERN(_MEMORY_READWRITE_BREAKPOINT1)
758 .code32
759
760 pushl %eax
761
762 movl 8(%esp),%eax
763
764 movl %eax,%dr0
765 movl %dr7,%eax
766 andl $0xfff0ffff,%eax
767 orl $0x00030303,%eax
768 movl %eax,%dr7
769
770 popl %eax
771
772 ret
773
774 EXTERN(_MEMORY_WRITE_BREAKPOINT1)
775 .code32
776
777 pushl %eax
778
779 movl 8(%esp),%eax
780
781 movl %eax,%dr0
782 movl %dr7,%eax
783 andl $0xfff0ffff,%eax
784 orl $0x00010303,%eax
785 movl %eax,%dr7
786
787 popl %eax
788
789 ret
790
791 EXTERN(_INSTRUCTION_BREAKPOINT2)
792 .code32
793
794 pushl %eax
795
796 movl 8(%esp),%eax
797
798 movl %eax,%dr1
799 movl %dr7,%eax
800 andl $0xff0fffff,%eax
801 orl $0x0000030c,%eax
802 movl %eax,%dr7
803
804 popl %eax
805
806 ret
807
808 EXTERN(_MEMORY_READWRITE_BREAKPOINT2)
809 .code32
810
811 pushl %eax
812
813 movl 8(%esp),%eax
814
815 movl %eax,%dr1
816 movl %dr7,%eax
817 andl $0xff0fffff,%eax
818 orl $0x0030030c,%eax
819 movl %eax,%dr7
820
821 popl %eax
822
823 ret
824
825 EXTERN(_MEMORY_WRITE_BREAKPOINT2)
826 .code32
827
828 pushl %eax
829
830 movl 8(%esp),%eax
831
832 movl %eax,%dr1
833 movl %dr7,%eax
834 andl $0xff0fffff,%eax
835 orl $0x0010030c,%eax
836 movl %eax,%dr7
837
838 popl %eax
839
840 ret
841
842 EXTERN(_INSTRUCTION_BREAKPOINT3)
843 .code32
844
845 pushl %eax
846
847 movl 8(%esp),%eax
848
849 movl %eax,%dr2
850 movl %dr7,%eax
851 andl $0xf0ffffff,%eax
852 orl $0x00000330,%eax
853 movl %eax,%dr7
854
855 popl %eax
856
857 ret
858
859 EXTERN(_MEMORY_READWRITE_BREAKPOINT3)
860 .code32
861
862 pushl %eax
863
864 movl 8(%esp),%eax
865
866 movl %eax,%dr2
867 movl %dr7,%eax
868 andl $0xf0ffffff,%eax
869 orl $0x03000330,%eax
870 movl %eax,%dr7
871
872 popl %eax
873
874 ret
875
876 EXTERN(_MEMORY_WRITE_BREAKPOINT3)
877 .code32
878
879 pushl %eax
880
881 movl 8(%esp),%eax
882
883 movl %eax,%dr2
884 movl %dr7,%eax
885 andl $0xf0ffffff,%eax
886 orl $0x01000330,%eax
887 movl %eax,%dr7
888
889 popl %eax
890
891 ret
892
893 EXTERN(_INSTRUCTION_BREAKPOINT4)
894 .code32
895
896 pushl %eax
897
898 movl 8(%esp),%eax
899
900 movl %eax,%dr3
901 movl %dr7,%eax
902 andl $0x0fffffff,%eax
903 orl $0x000003c0,%eax
904 movl %eax,%dr7
905
906 popl %eax
907
908 ret
909
910 EXTERN(_MEMORY_READWRITE_BREAKPOINT4)
911 .code32
912
913 pushl %eax
914
915 movl 8(%esp),%eax
916
917 movl %eax,%dr3
918 movl %dr7,%eax
919 andl $0x0fffffff,%eax
920 orl $0x300003c0,%eax
921 movl %eax,%dr7
922
923 popl %eax
924
925 ret
926
927 EXTERN(_MEMORY_WRITE_BREAKPOINT4)
928 .code32
929
930 pushl %eax
931
932 movl 8(%esp),%eax
933
934 movl %eax,%dr3
935 movl %dr7,%eax
936 andl $0x0fffffff,%eax
937 orl $0x100003c0,%eax
938 movl %eax,%dr7
939
940 popl %eax
941
942 ret