SetVCommonHandler usage...

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
tjd
Posts: 23
Joined: Thu May 27, 2004 1:54 am
Location: Austin, TX
Contact:

SetVCommonHandler usage...

Post by tjd »

Does anyone have any idea why you can use SetVCommonHandler for things like breakpoints, but it doesn't seem to work for exceptions like bad addresses, FPE etc.? I looked at the code in ps2gdb and it's pretty similar to mine. If I execute a breakpoint, my handler gets called. If I reference a bad address, the thread just dies...

thanks in advance
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

A lot of addresses are TLB-protected. Those aren't routed through V_COMMON. Use the other SetWhateverHandler() (can't think of the name ATM) routine for those.
tjd
Posts: 23
Joined: Thu May 27, 2004 1:54 am
Location: Austin, TX
Contact:

Post by tjd »

Hmm, not sure what you meant by TLB-protected. My recollection is that every exception on a Mips processor is routed through a single vector located at 0x80000080. I'm assuming that the low-low-low level code in the PS2 gets control and simply looks up to see if the "user" has set up a handler. If so, it gets called. Ok, so breakpoints work, but invalid fetches don't-- so this would seem to indicate that the low-low-low level code is making a distinction. And this has me stumped (until I get tired and dissassemble the beast).

Anyway, per your suggestion I tried using both SetVTLBRefillHandler and SetVInterruptHandler. My reward was a dull stare from the PS2...
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

If you don't have access to the EE Core User Manual, then you may want to search Toshiba's semidconductor site for docs on the TX79 or TX7901 (descendants of the EE). The Toshiba manuals are almost 1:1 with the official EE manuals when it comes to describing core CPU features such as exceptions and the MMU.

Anyway, the EE doesn't just use 0x80, it uses a few other vectors. What I meant by "TLB-protected" was that if you access an address that the EE's kernel has disallowed access to, you'll get a TLB exception which won't go through the V_COMMON exception vector. Off the top of my head this includes the address range 0x0 to 0x50000. In that case you would hook that vector using SetVTLBRefillHandler().

If you get ahold of that manual you should find all you need to get it working.
Post Reply