OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Handling debug exception
PostPosted: Tue Jan 26, 2021 8:14 am 
Offline
Member
Member
User avatar

Joined: Wed Jan 13, 2021 8:49 am
Posts: 25
Hi!

How could I handle Exc1 (fired when EIP equals to DRn and debug feature is enabled in DR7)?
I mean the cs:eip in the stack is the one pointed by DRn. So if I'd like to continue the execution, I should disable DRn. But I don't want to. Any ideas?

Thanks,


Top
 Profile  
 
 Post subject: Re: Handling debug exception
PostPosted: Tue Jan 26, 2021 8:57 am 
Offline
Member
Member

Joined: Sun Nov 23, 2008 5:56 am
Posts: 42
Location: Russia, Saint-Petersburg
Take a look at this flag in EFLAGS.

Quote:
RF Resume (bit 16) — Controls the processor’s response to instruction-breakpoint conditions. When set, this flag temporarily disables debug exceptions (#DB) from being generated for instruction breakpoints (although other exception conditions can cause an exception to be generated). When clear, instruction breakpoints will generate debug exceptions.

The primary function of the RF flag is to allow the restarting of an instruction following a debug exception that was caused by an instruction breakpoint condition. Here, debug software must set this flag in the EFLAGS image on the stack just prior to returning to the interrupted program with IRETD (to prevent the instruction breakpoint from causing another debug exception). The processor then automatically clears this flag after the instruction returned to has been successfully executed, enabling instruction breakpoint faults again.

See also: Section 17.3.1.1, “Instruction-Breakpoint Exception Condition.”


Top
 Profile  
 
 Post subject: Re: Handling debug exception
PostPosted: Wed Jan 27, 2021 9:19 am 
Offline
Member
Member
User avatar

Joined: Wed Jan 13, 2021 8:49 am
Posts: 25
quirck wrote:
Take a look at this flag in EFLAGS.

Quote:
RF Resume (bit 16) — Controls the ...

See also: Section 17.3.1.1


A couple of ywars ago I've read about this, but totally forgot it. Thanks for the answer, it was a huge help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group