unexplained DSI exceptions

Post Reply
Eke
Posts: 64
Joined: Sat Mar 01, 2008 11:01 am

unexplained DSI exceptions

Post by Eke » Wed Nov 03, 2010 11:36 am

I have noticed weird DSI exceptions happening in my application, they do not seem related to the application code as they always happen in the lwp_heap_free application.

The exact stack flow is:

Code: Select all

lwp_heap_free->iosFree->c_irq_dispatcher->irq_exception_handler
As you can see, it seems that an IRQ callback is trying to free unallocated memory from an heap and cause the exception. Pressing the Reset button does nothing as the exception is caused during exception processing (well, I guess so).

I cannot explain myself what would cause this exception BUT I noticed they only happen if the console is not connected to the network (more exactly, the network settings are properly configured but Wifi is disconnected). I don't know if the issue is on HBC side (for example, network or Wifi device is not shutdown properly when it was not initially connected, and the device continue to send interrupts to the application) or a bug in libogc...

PS: I never try to use or even initialize the network in my own code
PS2: I tried to remove any connected USB drives but exception still happened. It really stops happening when I switched the Wifi ON and restarts HBC then the application.

Other test cases:

1) if I disconnect the Wifi router once the application is started, there is still no DSI exception occuring. However, rebooting to System Menu will hang and I have to switch the power off/on. Returning to HBC works normally but if I try to restart the application with the Wifi still being shutdown, DSI exception occurs again after a while when the application starts running.

2) if I wait for the HBC to connect to the network (Wifi ON) then disconnect the Wifi router and launch the application, everything is fine, no DSI exception in the application and returning to System Menu works as usual.

Any ideas ?

Eke
Posts: 64
Joined: Sat Mar 01, 2008 11:01 am

Re: unexplained DSI exceptions

Post by Eke » Thu Nov 04, 2010 1:36 am

Ok, I think I found a fix, not sure why though. First thing to note is that instability only occurred when loading the application through HBC with <no_ios_reload> flag , which lead me to think it had something to do with the initial startup state.

It's actually in the function __di_check_ahbprot(), called by DI_Init() in di.c (this is the first function I call in my app)

If I remove this:

Code: Select all

  res = __ES_Init();

	if (res < 0)
		return res;
everything is fine (DVD still working as long as <no_ios_reload> flag is used ) and no more DSI exception or freeze after loading the application via HBC, even when Wifi is disabled...

Btw, it seems like this call is unnecessary since ES was already initialized in libogc main
Also note that __ES_Init function calls __ES_InitFS everytime, which adds a new devoptab for FS each time you call it.
Maybe calling __ES_Close would also work, I didn't test it.

There still seem to be some instability though, mainly when plugging/unplugging USB drives or some hangs/exception on exit if I connect/disconnect Wifi after the application has been loaded.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests