[PATCH] Fix some unaligned 32bit accesses in the AtomBios code.

Michael Cree mcree at orcon.net.nz
Sun Sep 26 01:52:54 PDT 2010


On the Alpha architecture unaligned 32bit accesses incur a software
trap to the kernel and pollute the kernel logs.  Fixed by use of the
ldl_u() interface.

Signed-off-by: Michael Cree <mcree at orcon.net.nz>
---
 src/AtomBios/CD_Operations.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/AtomBios/CD_Operations.c b/src/AtomBios/CD_Operations.c
index 9d399d5..f8b47e3 100644
--- a/src/AtomBios/CD_Operations.c
+++ b/src/AtomBios/CD_Operations.c
@@ -367,7 +367,7 @@ UINT32 GetParametersPS(PARSER_TEMP_DATA STACK_BASED *	pParserTempData)
     UINT32 data;
     pParserTempData->Index=*pParserTempData->pWorkingTableData->IP;
     pParserTempData->pWorkingTableData->IP+=sizeof(UINT8);
-    data = UINT32LE_TO_CPU(*(pParserTempData->pDeviceData->pParameterSpace+pParserTempData->Index));
+    data = UINT32LE_TO_CPU(ldl_u(pParserTempData->pDeviceData->pParameterSpace+pParserTempData->Index));
     return data;
 }
 
@@ -430,7 +430,7 @@ UINT32 GetParametersIndirect(PARSER_TEMP_DATA STACK_BASED *	pParserTempData)
 
     pParserTempData->Index=UINT16LE_TO_CPU(ldw_u((uint16_t *)pParserTempData->pWorkingTableData->IP));
     pParserTempData->pWorkingTableData->IP+=sizeof(UINT16);
-    ret = UINT32LE_TO_CPU(*(UINT32*)(RELATIVE_TO_BIOS_IMAGE(pParserTempData->Index)+pParserTempData->CurrentDataBlock));
+    ret = UINT32LE_TO_CPU(ldl_u((UINT32*)(RELATIVE_TO_BIOS_IMAGE(pParserTempData->Index)+pParserTempData->CurrentDataBlock)));
     return ret;
 }
 
@@ -453,7 +453,7 @@ UINT32 GetParametersDirect16(PARSER_TEMP_DATA STACK_BASED *	pParserTempData)
 UINT32 GetParametersDirect32(PARSER_TEMP_DATA STACK_BASED *	pParserTempData)
 {
     pParserTempData->CD_Mask.SrcAlignment=alignmentDword;
-    pParserTempData->Index=UINT32LE_TO_CPU(*(UINT32*)pParserTempData->pWorkingTableData->IP);
+    pParserTempData->Index=UINT32LE_TO_CPU(ldl_u((UINT32*)pParserTempData->pWorkingTableData->IP));
     pParserTempData->pWorkingTableData->IP+=sizeof(UINT32);
     return pParserTempData->Index;
 }
-- 
1.7.1



More information about the xorg-driver-ati mailing list