Hi Adrian,
nice! Thanks for sending the patch. I have two nits:
- the patch seems to use CRLF line endings. I know we don't mention this
anywhere, but I am not sure what would happen if somebody missed this and tried
to apply it on a Linux box :-/
- never *EVER* declare a register structure as packed. You were lucky here
because all the members are just 8 bits wide, but if there were 16-bit or
32-bit fields, chaos would ensue.
Why? A packed structure means not just that the fields are packed together
without padding for natural alignment. It also means that the address of the
structure itself in memory need not be aligned to the size of its largest
element. So, GCC will generate code to read/write any field byte-by-byte
instead. Of course this works only for memory, not for registers!
Cheers
-Jiri
Adrian wrote:
I'm applying to HelenOS at GSoC 2012. My proposition is to write AMD
Lance AM7990 (and clones) Ethernet controller driver. I've actually done
a small patch for ticket #262, it replaces ns8250.c "magic numbers" with
structured register definitions. This patch was successfully tested
using slightly modified "tester serial1" command. Please let me know if
attached patch is correct.
Regards,
Adrian.
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel