Kevin O'Connor wrote:
]> Peter Stuge wrote: ]> ]> ]Still it's not nice to write outside the callers buffer. Another OS ]> ]might call same function and SeaBIOS would end up corrupting some ]> ]variable. Ungood. I guess memmove() is the only choice? ]> ]> ]//Peter ]> ]> I had a couple of ideas for a more sound solution. ] ]This came up for DMA on IDE too. What I did there was just fallback ]to PIO if the buffer was not aligned. ] ]Out of curiosity, can you see what happens if you return ]DISK_RET_EBOUNDARY in the unaligned case?
DOS tries the same request 10 times then ignores the error and continues.
]It's not currently possible to dynamically allocate memory during ]runtime. However, it is possible to allocate a buffer at init and ]keep it around for later. How big of a buffer would you need?
I think a single aligned 512 byte buffer would do. The code could read a sector at a time and memcpy from the seabios aligned buffer into the caller's unaligned buffer.
]Thanks, ]-Kevin