[OpenBIOS] [PATCH] forthstrap: avoid unaligned accesses

Aurelien Jarno aurelien at aurel32.net
Sun Dec 8 11:53:48 CET 2013


Trying to compile OpenBIOS for SPARC32 on a SPARC machine, I get a
SIGBUS within forthstrap, more precisely accessing reloc_table in
load_dictionary. This table is not aligned because the dictionnary
head as a size which is not a multiple of 4.

This is due to the file QEMU,tcx.bin which is being encoded, and which
has a size which is not a multiple of 4. Fix that by adding some padding
after the encoded data.
---
 kernel/bootstrap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bootstrap.c b/kernel/bootstrap.c
index 546ffee..7f4458e 100644
--- a/kernel/bootstrap.c
+++ b/kernel/bootstrap.c
@@ -1008,6 +1008,7 @@ encode_file( const char *name )
 	PUSH( pointer2cell(dict + dicthead) );
 	PUSH( size );
 	dicthead += size;
+	paddict(sizeof(cell));
 }
 
 
-- 
1.8.4.2




More information about the OpenBIOS mailing list