From 35f910f08b58e978bc9251872635075d6f422e48 Mon Sep 17 00:00:00 2001 From: Randy Pawell Date: Thu, 4 Dec 2014 00:32:24 +0000 Subject: MdeModulePkg: Source fixes and cleanup for ARMGCC compiles - Fix EFI_IPv4_ADDRESS usages to use a macro to copy the structure instead of direct assignment, to avoid runtime alignment errors. - Fix a EFI_INPUT_KEY usage in TerminalDxe to use CopyMem() to copy the structure instead of direct assignment, to avoid runtime alignment error. - Delete excess local variables that are initialized but otherwise unused. - CompilerIntrinsicsLib library now imported for AARCH64, as well as ARM. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Randy Pawell Reviewed-by: Olivier Martin Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16471 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c | 3 +-- MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 3 ++- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 7 ++++--- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c | 9 +++++---- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c | 9 +++++---- MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c | 11 ++++++----- 6 files changed, 23 insertions(+), 19 deletions(-) (limited to 'MdeModulePkg/Universal') diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c index 507f862de7..d789fbbc75 100644 --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c @@ -9,6 +9,7 @@ CapsuleDataCoalesce() will do basic validation before coalesce capsule data into memory. +(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -960,7 +961,6 @@ CapsuleDataCoalesce ( UINT8 *DestPtr; UINTN DestLength; UINT8 *RelocPtr; - UINT64 *AddDataPtr; UINTN CapsuleTimes; UINT64 SizeLeft; UINT64 CapsuleImageSize; @@ -986,7 +986,6 @@ CapsuleDataCoalesce ( CapsuleTimes = 0; CapsuleImageSize = 0; PrivateDataPtr = NULL; - AddDataPtr = NULL; CapsuleHeader = NULL; CapsuleBeginFlag = TRUE; CapsuleSize = 0; diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index 1f29b61646..4a008c9ada 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -1,6 +1,7 @@ /** @file Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol. +(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -847,7 +848,7 @@ EfiKeyFiFoRemoveOneKey ( return FALSE; } - *Output = TerminalDevice->EfiKeyFiFo->Data[Head]; + CopyMem (Output, &TerminalDevice->EfiKeyFiFo->Data[Head], sizeof (EFI_INPUT_KEY)); TerminalDevice->EfiKeyFiFo->Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1)); diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c index 03b7f28171..7ed2e5250f 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c @@ -1,6 +1,7 @@ /** @file Interface routine for Mtftp4. +(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -305,13 +306,13 @@ Mtftp4ConfigUnicastPort ( UdpConfig.ReceiveTimeout = 0; UdpConfig.TransmitTimeout = 0; UdpConfig.UseDefaultAddress = Config->UseDefaultSetting; - UdpConfig.StationAddress = Config->StationIp; - UdpConfig.SubnetMask = Config->SubnetMask; + IP4_COPY_ADDRESS (&UdpConfig.StationAddress, &Config->StationIp); + IP4_COPY_ADDRESS (&UdpConfig.SubnetMask, &Config->SubnetMask); UdpConfig.StationPort = 0; UdpConfig.RemotePort = 0; Ip = HTONL (Instance->ServerIp); - CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS)); + IP4_COPY_ADDRESS (&UdpConfig.RemoteAddress, &Ip); Status = UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfig); diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c index 21547ee3af..e983d79791 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c @@ -1,6 +1,7 @@ /** @file Routines to process Rrq (download). +(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -413,13 +414,13 @@ Mtftp4RrqConfigMcastPort ( UdpConfig.ReceiveTimeout = 0; UdpConfig.TransmitTimeout = 0; UdpConfig.UseDefaultAddress = Config->UseDefaultSetting; - UdpConfig.StationAddress = Config->StationIp; - UdpConfig.SubnetMask = Config->SubnetMask; + IP4_COPY_ADDRESS (&UdpConfig.StationAddress, &Config->StationIp); + IP4_COPY_ADDRESS (&UdpConfig.SubnetMask, &Config->SubnetMask); UdpConfig.StationPort = Instance->McastPort; UdpConfig.RemotePort = 0; Ip = HTONL (Instance->ServerIp); - CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS)); + IP4_COPY_ADDRESS (&UdpConfig.RemoteAddress, &Ip); Status = McastIo->Protocol.Udp4->Configure (McastIo->Protocol.Udp4, &UdpConfig); @@ -451,7 +452,7 @@ Mtftp4RrqConfigMcastPort ( // join the multicast group // Ip = HTONL (Instance->McastIp); - CopyMem (&Group, &Ip, sizeof (EFI_IPv4_ADDRESS)); + IP4_COPY_ADDRESS (&Group, &Ip); return McastIo->Protocol.Udp4->Groups (McastIo->Protocol.Udp4, TRUE, &Group); } diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c index b6d89be2b1..5b327af721 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c @@ -1,6 +1,7 @@ /** @file Tcp request dispatcher implementation. +(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -101,11 +102,11 @@ Tcp4GetMode ( AccessPoint->UseDefaultAddress = Tcb->UseDefaultAddr; - CopyMem (&AccessPoint->StationAddress, &Tcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS)); - AccessPoint->SubnetMask = Tcb->SubnetMask; + IP4_COPY_ADDRESS (&AccessPoint->StationAddress, &Tcb->LocalEnd.Ip); + IP4_COPY_ADDRESS (&AccessPoint->SubnetMask, &Tcb->SubnetMask); AccessPoint->StationPort = NTOHS (Tcb->LocalEnd.Port); - CopyMem (&AccessPoint->RemoteAddress, &Tcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS)); + IP4_COPY_ADDRESS (&AccessPoint->RemoteAddress, &Tcb->RemoteEnd.Ip); AccessPoint->RemotePort = NTOHS (Tcb->RemoteEnd.Port); AccessPoint->ActiveFlag = (BOOLEAN) (Tcb->State != TCP_LISTEN); @@ -458,7 +459,7 @@ Tcp4ConfigurePcb ( CopyMem (&Tcb->LocalEnd.Ip, &CfgData->AccessPoint.StationAddress, sizeof (IP4_ADDR)); Tcb->LocalEnd.Port = HTONS (CfgData->AccessPoint.StationPort); - Tcb->SubnetMask = CfgData->AccessPoint.SubnetMask; + IP4_COPY_ADDRESS (&Tcb->SubnetMask, &CfgData->AccessPoint.SubnetMask); if (CfgData->AccessPoint.ActiveFlag) { CopyMem (&Tcb->RemoteEnd.Ip, &CfgData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR)); diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c index d33402078f..5ea22acb14 100644 --- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c +++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c @@ -1,5 +1,6 @@ /** @file +(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -227,8 +228,8 @@ Udp4Configure ( // Save the configuration data. // CopyMem (&Instance->ConfigData, UdpConfigData, sizeof (Instance->ConfigData)); - Instance->ConfigData.StationAddress = Ip4ConfigData.StationAddress; - Instance->ConfigData.SubnetMask = Ip4ConfigData.SubnetMask; + IP4_COPY_ADDRESS (&Instance->ConfigData.StationAddress, &Ip4ConfigData.StationAddress); + IP4_COPY_ADDRESS (&Instance->ConfigData.SubnetMask, &Ip4ConfigData.SubnetMask); // // Try to allocate the required port resource. @@ -588,7 +589,7 @@ Udp4Transmit ( Udp4Header->Checksum = 0; UdpSessionData = TxData->UdpSessionData; - Override.Ip4OverrideData.SourceAddress = ConfigData->StationAddress; + IP4_COPY_ADDRESS (&Override.Ip4OverrideData.SourceAddress, &ConfigData->StationAddress); if (UdpSessionData != NULL) { // @@ -596,7 +597,7 @@ Udp4Transmit ( // UdpSessionData. // if (!EFI_IP4_EQUAL (&UdpSessionData->SourceAddress, &mZeroIp4Addr)) { - CopyMem (&Override.Ip4OverrideData.SourceAddress, &UdpSessionData->SourceAddress, sizeof (EFI_IPv4_ADDRESS)); + IP4_COPY_ADDRESS (&Override.Ip4OverrideData.SourceAddress, &UdpSessionData->SourceAddress); } if (UdpSessionData->SourcePort != 0) { @@ -643,7 +644,7 @@ Udp4Transmit ( // Fill the IpIo Override data. // if (TxData->GatewayAddress != NULL) { - CopyMem (&Override.Ip4OverrideData.GatewayAddress, TxData->GatewayAddress, sizeof (EFI_IPv4_ADDRESS)); + IP4_COPY_ADDRESS (&Override.Ip4OverrideData.GatewayAddress, TxData->GatewayAddress); } else { ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS)); } -- cgit v1.2.3