[OpenBIOS] [commit] r1128 - trunk/openbios-devel/drivers

repository service svn at openbios.org
Sun Apr 21 10:27:23 CEST 2013


Author: mcayland
Date: Sun Apr 21 10:27:23 2013
New Revision: 1128
URL: http://tracker.coreboot.org/trac/openbios/changeset/1128

Log:
SPARC: Fix escc instance structure alignment

When binding C functions to Forth words using NODE_METHODs for the SPARC ESCC
serial driver, the C instance parameter pointer was set to be a pointer to a
phys_addr_t.

This is incorrect in the case where sizeof(phys_addr_t) != sizeof(cell) such
as on SPARC32, as the address allocated from the Forth machine would be aligned
to sizeof(cell); hence an alignment exception could be generated on random
occasions on SPARC32 when the allocated address generated by Forth when opening
the device was aligned to just 4 bytes (and not also 8 bytes) when dereferencing
the instance parameter pointer.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/drivers/escc.c

Modified: trunk/openbios-devel/drivers/escc.c
==============================================================================
--- trunk/openbios-devel/drivers/escc.c	Sun Apr 21 10:27:21 2013	(r1127)
+++ trunk/openbios-devel/drivers/escc.c	Sun Apr 21 10:27:23 2013	(r1128)
@@ -131,7 +131,7 @@
 
 /* ( addr len -- actual ) */
 static void
-escc_read(phys_addr_t *address)
+escc_read(ucell *address)
 {
     char *addr;
     int len;
@@ -152,7 +152,7 @@
 
 /* ( addr len -- actual ) */
 static void
-escc_write(phys_addr_t *address)
+escc_write(ucell *address)
 {
     unsigned char *addr;
     int i, len;
@@ -172,7 +172,7 @@
 }
 
 static void
-escc_open(phys_addr_t *address)
+escc_open(ucell *address)
 {
 #ifdef CONFIG_DRIVER_ESCC_SUN
     int len;
@@ -199,7 +199,7 @@
     RET ( -1 );
 }
 
-DECLARE_UNNAMED_NODE(escc, INSTALL_OPEN, sizeof(phys_addr_t));
+DECLARE_UNNAMED_NODE(escc, INSTALL_OPEN, sizeof(ucell));
 
 NODE_METHODS(escc) = {
     { "open",               escc_open              },



More information about the OpenBIOS mailing list