[SeaBIOS] non-emulated AHCI hardware

Scott Duplichan scott at notabs.org
Tue Apr 26 00:31:36 CEST 2011


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. Debugging them is
a challenge for me because I am new to seabios development and its
method for writing code that works correctly in both 16-bit and
32-bit mode. Anyway, the first method I tried was to allocate a 
temporary I/O buffer that has the proper alignment. While that
creates overhead, it would only be invoked in the rare case of
unaligned request. But then there is the possibility that the
allocation function will not be able to satisfy the request.
Another possibility is splitting the request. The caller's buffer
could handle the bigger part, and a stack buffer could be used for
the remaining part. Yet another possibility is to backup the byte
that gets overwritten by the current patch method and restore it
afterwards. While that is an unreliable method for paged code, it
might work here. The only danger I can think of is if the caller's
buffer is at the end of a physical DRAM range.

Thanks,
Scott




More information about the SeaBIOS mailing list