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 derefencing
the instance parameter pointer.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
---
openbios-devel/drivers/escc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c
index 892dc8c..9973fe1 100644
--- a/openbios-devel/drivers/escc.c
+++ b/openbios-devel/drivers/escc.c
@@ -131,7 +131,7 @@ void serial_cls(void)
/* ( addr len -- actual ) */
static void
-escc_read(phys_addr_t *address)
+escc_read(ucell *address)
{
char *addr;
int len;
@@ -152,7 +152,7 @@ escc_read(phys_addr_t *address)
/* ( 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 @@ escc_close(void)
}
static void
-escc_open(phys_addr_t *address)
+escc_open(ucell *address)
{
#ifdef CONFIG_DRIVER_ESCC_SUN
int len;
@@ -199,7 +199,7 @@ escc_open(phys_addr_t *address)
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 },
--
1.7.10.4