Skip to content

Commit

Permalink
(tinybit) fix a bug that erroneously hooked/unhooked non-fb drives.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenall committed Nov 19, 2014
1 parent f020968 commit f58722c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog_GRUB4DOS.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2014-11-19 (tinybit) fix a bug that erroneously hooked/unhooked non-fb drives.
2014-11-10 supported initrdfs.
2014-11-03 (tinybit) mask off non-booting floppy drives in order to gain more stability.
2014-11-02 (tinybit) fix offset nestification problem for virtual drives built on another in-situ virtual drive.
Expand Down
12 changes: 6 additions & 6 deletions stage2/fsys_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static int fb_init (void)

fb_drive_virtual = is_virtual(fb_drive);

if (fb_drive_virtual)
if (fb_drive_virtual && fb_drive == (unsigned char)(fb_status >> 8))
quick_hook (0);

ret = rawread (fb_drive, 0, 0, 512, (unsigned long long)(unsigned int)&m, 0xedde0d90);
Expand Down Expand Up @@ -259,7 +259,7 @@ static int fb_init (void)

init_end:

if (fb_drive_virtual)
if (fb_drive_virtual && fb_drive == (unsigned char)(fb_status >> 8))
quick_hook (fb_drive_virtual);

return ret;
Expand Down Expand Up @@ -325,14 +325,14 @@ fb_read (unsigned long long buf, unsigned long long len, unsigned long write)
{
sector = cur_file->data_start + (filepos >> 9) - fb_ofs;

if (fb_drive_virtual)
if (fb_drive_virtual && fb_drive == (unsigned char)(fb_status >> 8))
quick_hook (0);

disk_read_func = disk_read_hook;
ret = rawread (fb_drive, sector, filepos & 0x1ff, len, buf, write);
disk_read_func = NULL;

if (fb_drive_virtual)
if (fb_drive_virtual && fb_drive == (unsigned char)(fb_status >> 8))
quick_hook (fb_drive_virtual);

if (ret)
Expand All @@ -351,7 +351,7 @@ fb_read (unsigned long long buf, unsigned long long len, unsigned long write)
ofs = (unsigned long) filepos % 510;
saved_len = len;

if (fb_drive_virtual)
if (fb_drive_virtual && fb_drive == (unsigned char)(fb_status >> 8))
quick_hook (0);

while (len)
Expand All @@ -373,7 +373,7 @@ fb_read (unsigned long long buf, unsigned long long len, unsigned long write)
len -= n;
}

if (fb_drive_virtual)
if (fb_drive_virtual && fb_drive == (unsigned char)(fb_status >> 8))
quick_hook (fb_drive_virtual);

if (! ret)
Expand Down

0 comments on commit f58722c

Please sign in to comment.