error on read from disk in real mode
-
- Member
- Posts: 199
- Joined: Fri Jul 13, 2007 6:37 am
- Location: Stuttgart/Germany
- Contact:
error on read from disk in real mode
hi
i hope this question is not *too* stupid
i am trying to read a sector from disk into memory with Int 13/AH=02h (in real mode)
i want to load the sector at address 1FF00h
therefore i load
es with 1470h
and
bx with b800h
when i call the interrupt it doesnt work, the error code i get in ah is 09h: data boundary error (attempted DMA across 64K boundary or >80h sectors)
whats wrong with this?
whats this data boundary error all about?
i hope this question is not *too* stupid
i am trying to read a sector from disk into memory with Int 13/AH=02h (in real mode)
i want to load the sector at address 1FF00h
therefore i load
es with 1470h
and
bx with b800h
when i call the interrupt it doesnt work, the error code i get in ah is 09h: data boundary error (attempted DMA across 64K boundary or >80h sectors)
whats wrong with this?
whats this data boundary error all about?
Re: error on read from disk in real mode
well
fist:
what is the content of the registers just before you execute "int 0x13" (the reason why im asking is due to the fackt that some registers content is "unvalide")
to give an "answer":
the error means that you are trying to load more than 64KB, and that is not possible due to the DMA (dont care about the DMA, you will need to study a little on DMA to know what i mean).
KMT dk
fist:
what is the content of the registers just before you execute "int 0x13" (the reason why im asking is due to the fackt that some registers content is "unvalide")
to give an "answer":
the error means that you are trying to load more than 64KB, and that is not possible due to the DMA (dont care about the DMA, you will need to study a little on DMA to know what i mean).
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
-
- Member
- Posts: 199
- Joined: Fri Jul 13, 2007 6:37 am
- Location: Stuttgart/Germany
- Contact:
Re: error on read from disk in real mode
kmtdk wrote:well
fist:
what is the content of the registers just before you execute "int 0x13" (the reason why im asking is due to the fackt that some registers content is "unvalide")
Code: Select all
<bochs:2> registers
eax: 0x534d0201 1397555713
ecx: 0x00000205 517
edx: 0x534d0100 1397555456
ebx: 0x0000b800 47104
esp: 0x0000fffa 65530
ebp: 0x00000000 0
esi: 0x000e0001 917505
edi: 0x534d0201 1397555713
eip: 0x00000131
eflags 0x00000097
id vip vif ac vm rf nt IOPL=0 of df if tf SF zf AF PF CF
Re: error on read from disk in real mode
well
first i cant see anything wrong ( except segment registers are not listed)
however**
im sure that i had a simerlary problem, and the problem was sp.
it has someting to do with the "warp around"
but im not sure
KMT dk
first i cant see anything wrong ( except segment registers are not listed)
however**
im sure that i had a simerlary problem, and the problem was sp.
it has someting to do with the "warp around"
but im not sure
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: error on read from disk in real mode
If you're trying to load to linear address 1FF00h what you should do is set ES to 1FF0h and BX to 0. That way it's the same address but you can load the whole 64KB.
-
- Member
- Posts: 199
- Joined: Fri Jul 13, 2007 6:37 am
- Location: Stuttgart/Germany
- Contact:
Re: error on read from disk in real mode
well, i *AM* doing that
actually, what i am doing in my code is load several segments one by one at address 14700h
so i first load es with 1470 h and bx with 0
then i increment bx by 512 after each segment is loaded and then i load the next segment
after incrementing bx, i check whether it reaches 0, and if so, i increment es by 20h
then i got the error and this is what i did to find out where it occurs
because the ax register is overwritten *AFTER* the error occurs, i copied ax to di just before every call to the interrupt to load from disk
so when i got the error, i was able to view the relevant registers ax (now copied to di), bx, cx and dx
what i saw was that bx had value b800h
even though i am not able to do "info sreg" in my bochs (no idea why), i can assure you, that es is still 1470h, because i had placed a hlt instruction just before incrementing es, which did not kick in before the load error - so it's never executed!
so then i thought lets just try to load this one offending sector at the exact same memory address - and the error still occurred
then i tried to load the very same segment at address 1470h:0 and it worked => something is wrong with WHERE i load the sector
actually, what i am doing in my code is load several segments one by one at address 14700h
so i first load es with 1470 h and bx with 0
then i increment bx by 512 after each segment is loaded and then i load the next segment
after incrementing bx, i check whether it reaches 0, and if so, i increment es by 20h
then i got the error and this is what i did to find out where it occurs
because the ax register is overwritten *AFTER* the error occurs, i copied ax to di just before every call to the interrupt to load from disk
so when i got the error, i was able to view the relevant registers ax (now copied to di), bx, cx and dx
what i saw was that bx had value b800h
even though i am not able to do "info sreg" in my bochs (no idea why), i can assure you, that es is still 1470h, because i had placed a hlt instruction just before incrementing es, which did not kick in before the load error - so it's never executed!
so then i thought lets just try to load this one offending sector at the exact same memory address - and the error still occurred
then i tried to load the very same segment at address 1470h:0 and it worked => something is wrong with WHERE i load the sector
-
- Member
- Posts: 199
- Joined: Fri Jul 13, 2007 6:37 am
- Location: Stuttgart/Germany
- Contact:
Re: error on read from disk in real mode
believe it or not
but im still stuck
as soon as i try to load a disk sector at 1ff00h, i get an error
i have also tried with keeping bx always 0 and just incrementing es by 20h for each sector
same result
i can load my disk image at a different memory location very well
but thats obviously no solution to my problem
1ff00h: does that not ring any bell with any of you?
but im still stuck
as soon as i try to load a disk sector at 1ff00h, i get an error
i have also tried with keeping bx always 0 and just incrementing es by 20h for each sector
same result
i can load my disk image at a different memory location very well
but thats obviously no solution to my problem
1ff00h: does that not ring any bell with any of you?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: error on read from disk in real mode
More like, you mentioned the error yourself:
And apparently, the bios doesn't like you loading data there.
loading a sector at 0x1ff00 (which means, up to and including 0x200ff) which means it crosses the 64K boundary (1ffff-20000).(...) the error code i get in ah is 09h: data boundary error (attempted DMA across 64K boundary (...)
And apparently, the bios doesn't like you loading data there.
Re: error on read from disk in real mode
Some additions to Combuster's reply:
The BIOS is using Direct Memory Access to transfer data from disk to memory. DMA will only transfer data to one and the same DMA page at once. A DMA page is 64 kiB and always starts at an exact multiple of 64 kiB. Note: this is a physical addresses, not an offset relative to some segment address (as Troy Martin seems to think).
A transfer can not cross a DMA page boundary. So DMA may transfer at most 64 kiB if the memory buffers starts at an exact boundary, 64 kiB minus 1 byte if it starts at a boundary plus 1, 64 kiB minus 2 bytes if it starts at a boundary plus 2, etcetera.
(This doesn't mean that you may actually read 64 kiB at once from disk, because disk access is even more limited than DMA.)
So you may load at most 256 bytes to physical address 1FF00H otherwise you are crossing DMA page boundary 20000H. A sector is usually 512 bytes, so load to 1FE00H and you will be fine.
The BIOS is using Direct Memory Access to transfer data from disk to memory. DMA will only transfer data to one and the same DMA page at once. A DMA page is 64 kiB and always starts at an exact multiple of 64 kiB. Note: this is a physical addresses, not an offset relative to some segment address (as Troy Martin seems to think).
A transfer can not cross a DMA page boundary. So DMA may transfer at most 64 kiB if the memory buffers starts at an exact boundary, 64 kiB minus 1 byte if it starts at a boundary plus 1, 64 kiB minus 2 bytes if it starts at a boundary plus 2, etcetera.
(This doesn't mean that you may actually read 64 kiB at once from disk, because disk access is even more limited than DMA.)
So you may load at most 256 bytes to physical address 1FF00H otherwise you are crossing DMA page boundary 20000H. A sector is usually 512 bytes, so load to 1FE00H and you will be fine.
-
- Member
- Posts: 199
- Joined: Fri Jul 13, 2007 6:37 am
- Location: Stuttgart/Germany
- Contact:
Re: error on read from disk in real mode
Ok i understand
of course i did see the error message before, but i thought it wanted to tell me i was trying to load beyond my segment limit of 64k, which was nonsense, so i thought it was just another "erroneous" bochs error - alas, my experience with bochs is that its error messages are often not really to the point...
of course i did see the error message before, but i thought it wanted to tell me i was trying to load beyond my segment limit of 64k, which was nonsense, so i thought it was just another "erroneous" bochs error - alas, my experience with bochs is that its error messages are often not really to the point...