extremely weird error
Posted: Thu May 26, 2011 2:13 pm
OK, first, let me show you some code...
initrd_init() function:
media_read():
media->mread is actually ramdisk_read():
As you can see, all these functions keep on printing the media pointer, and in all cases, that pointer is 0x003002E0. The last printhex(), done by media_read() presents the correct pointer, but as soon as this function returns, the pointer printed by initrd_init() is 0, and that causes page faults! Does anyone see why this value is suddenly updated when media_read() returns?
initrd_init() function:
Code: Select all
(void)part;
initrd_head_t header;
media_acquire(media);
media_begin(media);
media_read(media, 0, 1, &header);
printhex(media); printk("\n");
while(1);
media_end(media);
media_release(media);
Code: Select all
void media_read(media_t *media, u32int sector, u32int count, char * buffer)
{
printhex(media); printk("\n");
media->mread(media, sector, count, buffer);
printhex(media); printk("\n");
};
Code: Select all
void ramdisk_read(media_t * media, u32int sector, u32int count, char * buffer)
{
if ((sector+count)*512 > media->size) count = (media->size-sector);
char * intbuf = (char *) (media->id + 512 * sector);
memcpy(buffer, intbuf, count*512);
printhex(media); printk("\n");
};