mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
[HALX86] Minor fixes in HaliFindBusAddressTranslation()
- Remove ContextValue variable. This variable erroneously truncated *Context value (that can contain a pointer value) to 32 bits. - Gracefully fail instead of asserting.
This commit is contained in:
parent
4f41000714
commit
113656563a
1 changed files with 18 additions and 10 deletions
|
@ -1333,18 +1333,19 @@ HaliFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
|
|||
PHAL_BUS_HANDLER BusHandler;
|
||||
PBUS_HANDLER Handler;
|
||||
PLIST_ENTRY NextEntry;
|
||||
ULONG ContextValue;
|
||||
|
||||
/* Make sure we have a context */
|
||||
if (!Context) return FALSE;
|
||||
ASSERT((*Context) || (NextBus == TRUE));
|
||||
if (!Context)
|
||||
return FALSE;
|
||||
|
||||
/* Read the context */
|
||||
ContextValue = *Context;
|
||||
/* If we have data in the context, then this shouldn't be a new lookup */
|
||||
if ((*Context != 0) && (NextBus != FALSE))
|
||||
return FALSE;
|
||||
|
||||
/* Find the bus handler */
|
||||
Handler = HalpContextToBusHandler(ContextValue);
|
||||
if (!Handler) return FALSE;
|
||||
Handler = HalpContextToBusHandler(*Context);
|
||||
if (!Handler)
|
||||
return FALSE;
|
||||
|
||||
/* Check if this is an ongoing lookup */
|
||||
if (NextBus)
|
||||
|
@ -1354,7 +1355,8 @@ HaliFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
|
|||
NextEntry = &BusHandler->AllHandlers;
|
||||
|
||||
/* Get the next one if we were already with one */
|
||||
if (ContextValue) NextEntry = NextEntry->Flink;
|
||||
if (*Context)
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
/* Start scanning */
|
||||
while (TRUE)
|
||||
|
@ -1373,7 +1375,10 @@ HaliFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
|
|||
BusHandler->Handler.BusNumber,
|
||||
BusAddress,
|
||||
AddressSpace,
|
||||
TranslatedAddress)) break;
|
||||
TranslatedAddress))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Try the next one */
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
@ -1389,7 +1394,10 @@ HaliFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
|
|||
Handler->BusNumber,
|
||||
BusAddress,
|
||||
AddressSpace,
|
||||
TranslatedAddress)) return FALSE;
|
||||
TranslatedAddress))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Remember for next time */
|
||||
*Context = (ULONG_PTR)Handler;
|
||||
|
|
Loading…
Reference in a new issue