Closed djphoenix closed 7 years ago
I have previously tried larger sizes and it didn't work properly. The buffer is just there for historic reasons, but I can't imagine it's harming the performance much. As for saving space, yes if the buffer were removed you would want to tidy up that bit of code a bit, but saving space is not a concern - we have the entire devices memory to play with, there is nothing else running. The code would be nearer and clearer not having any kind of union or shared buffer at all, just have two separate structures.
So for direct in-memory read, it works for 4k size (so, not tried larger, but I think sector-read is safe). About buffer - yes, I think it is safe to get two buffers for rom/section headers (gcc should optimise them on stack anyway). Should I prepare a pull request, or you may implement it in your way?
PR would be nice please. I currently have no development system, so I'll have to take your word for it that's it's working fine so please test carefully.
I see that in stage2 you're use temporary buffer of size 0x100. The reason of this is unknown for me, but with this patch it is keeps to work for me (much faster):
Can you describe why you're use this buffer?
And, so, with
union
you can keep some space if one of header is less than 0x100 bytes: