this part is unnecessarily complex, and will miss problems that might occur (weird ones but )...
+ dst = d; + src = s; + ok = 1; + for (i = 0; i < page_size; i++) { + if (*src != 0xFF) + if ( *dst != *src ) + { + ok = 0; + break; + } + dst++; + src++; + } + + if (!ok && tried++ < 0x10) { + start_index = i; + goto retry; + } + if (!ok) { + fprintf( stderr, " page %d failed!\n", (d-bios)/page_size ); + }
how about this?
+ dst = d; + src = s; + ok = 1; + for (i = 0; i < page_size; i++) { + + if ( *dst != *src ) + { + ok = 0; + break; + } + dst++; + src++; + } + + if (!ok && tried++ < 0x10) { + start_index = i; + goto retry; + } + if (!ok) { + fprintf( stderr, " page %d failed!\n", (d-bios)/page_size ); + }