=============================================================================== From: Elad Nachman Refer: 0 Subject: Writing your own Debugger 1: 80xxx Status: Public ------------------------------------------------------------------------------- Hello I-Gene! On the Wednesday April 20 1994 20:38, I-Gene Leong Headbanged on my metal fuses and wrote to Aaron Martin: IL> Now.. I need some info. IL> WHAT DO THE DEBUG REGISTERS DO??? IL> and IL> Could you maybe outline the bit fields of the debug registers? Here you go: Comment | dr0,dr1,dr2,dr3 32bit regs represnt breakpoints 0-3, linear address dr4,dr5 reserved, dr6 is statues reg : bits 0-3 are per each breakpoint - which one was triggered. Bit DR7 is the debug control register: LEN3 R/W3 LEN2 R/W2 LEN1 R/W1 LEN0 R/W0 GE LE G3 L3 G2 L2 G1 L1 G0 L0 31-30-29-28-27-26-25-24-23-22-21-20-19-18-17-16-15-14-13-12-11-10-9- 8- 7- 6- 5- 4- 3- 2- 1- 0 bit # LENn field (2 bits): 00 : byte/breakpoint Legal at any address 01 : Word (2 bytes) / Breakpoint must be at even address 10 : Reserved 11 : Dword (4 bytes) / Breakpoint address must be on Dword Boundary R/Wn field (2 bits): 00 - Execution Breakpoint 01 - Memory write Breakpoint 10 - Reserved for future use 11 - Memory Read Or Write Breakpoint Gn - Globally Enable Breakpoint. Breakpoint is enable untill cleared. Ln - Local Breakpoint. Cleared after a Task Switch. GE/LE - exact match. if used the return address points exactly at the interrupting instruction (The CPU slows). If not set , the address might be a bit farther ahead. Recommended! | .386P code segment USE16 assume cs:code org 100h begin: jmp start data1 dd 03f0h data2 dd 0 data3 dd 0 data4 dd 0 data5 dd 0 data6 dd 0 data7 dd 0 data8 dw 303h data8_ dw 3h data_nul dd 8 dup(0) start: xor ax,ax mov ds,ax cli mov bx,cs mov word ptr ds:[0004],offset handler mov word ptr ds:[0006],bx sti ;mov eax,03f0h ;mov dr0,eax ;mov eax,00000000000000110000001100000011b ;mov dr7,eax mov ax,cs mov es,ax mov di,offset data1 mov ax,0de09h int 67h mov al,byte ptr ds:[03f0h] mov ax,4c00h int 21h handler proc far push es push di mov ax,cs mov es,ax mov di,offset data_nul mov ax,0de09h int 67h mov ax,0007h int 10h pop di pop es iret endp code ends end begin Fare thee well, Elad --- * Origin: None is Listed! (2:403/169.4)