#117645 - cj - Tue Feb 06, 2007 8:47 am
I'm developing a DLDI driver and need to output some debugging messages. I figure the best way to do so is to link in the driver instead of patching it. After digging around the source code of libfat, I was able to put this together:
However, when I print a directory-listing, is freezes after displaying about 4 entries (with or without debugging messages). In contrast, when I patch in the driver, it does not freeze. I've verified that it is not freezing in my driver -- during the directory listing, it reads one block, prints some files, then freezes somewhere in a call to dirnext().
First, am I setting up the driver correctly? If so, then any ideas what may be going on? The only thing I can figure is that my driver is corrupting memory and the bug is only manifesting when linked in directly.
Thanks for your time!
-CJ
Code: |
extern const devoptab_t dotab_fat;
char nm[] = "X9SD"; IO_INTERFACE fatIf; fatIf.ioType = *((uint32*)nm); fatIf.features = FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_SLOT_NDS; fatIf.fn_startup = &_X9SD_startup; fatIf.fn_isInserted = &_X9SD_isInserted; fatIf.fn_readSectors = &_X9SD_readSectors; fatIf.fn_writeSectors = &_X9SD_writeSectors; fatIf.fn_clearStatus = &_X9SD_clearStatus; fatIf.fn_shutdown = &_X9SD_shutdown; fatIf.fn_startup(); fatMountCustomInterface(&fatIf, 8); fatSetDefaultInterface(PI_CUSTOM); AddDevice(&dotab_fat); chdir ("fat:/"); |
However, when I print a directory-listing, is freezes after displaying about 4 entries (with or without debugging messages). In contrast, when I patch in the driver, it does not freeze. I've verified that it is not freezing in my driver -- during the directory listing, it reads one block, prints some files, then freezes somewhere in a call to dirnext().
First, am I setting up the driver correctly? If so, then any ideas what may be going on? The only thing I can figure is that my driver is corrupting memory and the bug is only manifesting when linked in directly.
Thanks for your time!
-CJ