1;; ----------------------------------------------------------------------- 2;; 3;; Copyright 2003-2008 H. Peter Anvin - All Rights Reserved 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, Inc., 53 Temple Place Ste 330, 8;; Boston MA 02111-1307, USA; either version 2 of the License, or 9;; (at your option) any later version; incorporated herein by reference. 10;; 11;; ----------------------------------------------------------------------- 12 13;; 14;; regdump.inc 15;; 16;; Dump as much as possible of the register state; for debugging 17;; 18 19disk_dumpregs: 20 mov ah,02h 21 call dumpregs 22 int 13h 23 ret 24 25dumpregs: 26 push gs 27 push fs 28 push es 29 push ds 30 push ss 31 push cs 32 pushad 33 pushfd 34 35 push cs 36 pop ds 37 38 mov bp,sp 39 mov di,regnames 40 41 mov cx,9 ; 9 32-bit registers 42.reg8: 43 mov si,[di] 44 inc di 45 inc di 46 call writestr 47 mov eax,[bp] 48 add bp,4 49 call writehex8 50 loop .reg8 51 52 mov cx,7 ; 6 16-bit registers 53.reg4: 54 mov si,[di] 55 inc di 56 inc di 57 call writestr 58 mov eax,[bp] 59 inc bp 60 inc bp 61 call writehex4 62 loop .reg4 63 64 call crlf 65 66 popfd 67 popad 68 add sp,4 ; Skip CS, SS 69 pop ds 70 pop es 71 pop fs 72 pop gs 73 ret 74 75regnames: 76 dw .eflags 77 dw .edi 78 dw .esi 79 dw .ebp 80 dw .esp 81 dw .ebx 82 dw .edx 83 dw .ecx 84 dw .eax 85 dw .cs 86 dw .ss 87 dw .ds 88 dw .es 89 dw .fs 90 dw .gs 91 dw .ip 92 93.eflags db 'EFL: ', 0 94.edi db 13,10,'EDI: ', 0 95.esi db ' ESI: ', 0 96.ebp db ' EBP: ', 0 97.esp db ' ESP: ', 0 98.ebx db 13,10,'EBX: ', 0 99.edx db ' EDX: ', 0 100.ecx db ' ECX: ', 0 101.eax db ' EAX: ', 0 102.cs db 13,10,'CS: ',0 103.ss db ' SS: ',0 104.ds db ' DS: ',0 105.es db ' ES: ',0 106.fs db ' FS: ',0 107.gs db ' GS: ',0 108.ip db ' IP: ',0 109