Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting AL in extended_read_disk is senseless? #7

Open
TheFox opened this issue Aug 9, 2018 · 0 comments
Open

Setting AL in extended_read_disk is senseless? #7

TheFox opened this issue Aug 9, 2018 · 0 comments

Comments

@TheFox
Copy link

TheFox commented Aug 9, 2018

Look at this block in the bios:

mov	ah, 0
cpu	186
shl	ax, 9
extended_read_disk
shr	ax, 9
cpu	8086
mov	ah, 0x02	; Put read code back

cmp	al, 0
je	rd_error

The extended_read_disk instruction writes the error to AL. But right after the read we shift AX back 9 bits to right (shr ax, 9) which overrides AL. So what's even the point of cmp al, 0 and setting AL in extended_read_disk?

And even when you fix the bios, the read function in 8086tiny.c is still wrong. You use AX as length to read. But read() returns, for example 512, which is 0 inside AL because of the overflow. So even if we don't shift bits after the read AL indicates "error".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant