From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.68.42; helo=eur02-he1-obe.outbound.protection.outlook.com; envelope-from=marvin.haeuser@outlook.com; receiver=edk2-devel@lists.01.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068042.outbound.protection.outlook.com [40.92.68.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 522EE223C176D for ; Tue, 27 Feb 2018 08:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MqBKIDtgkTfH1SeOND2YDD3AOGkyEofX197dssR94OA=; b=HE480d38FQyIa83+Mkj8RwQKTy6Z0j33MSRZysbCpMroCZZTbF2O3KyDC5h+v7DV3bnfDrWi/gzXtyKByI4X2LGHPHRCNWw+xU7gu18SYM3iNT43w+UlRkeX84YL0U5KcMHPAljVnWQNHOnFM+m2rWTGE0KMkLKk7pC189vQvX5bEUag5AnGOT7BdPyKDJyBBn4OE3dLxp35Z51YeRwipThPxGIUFT+5LYKNQ5eGZ3wGeO2EepTPntP+k6ooi8KSQw3FQzWf2RlxbuNJ1N2u++zTeWfEQgqzLIWW3rELGtgGQt4w2tB1uhIKhVgr0xzdam0kAsLiJCoEFhPwHZQZqQ== Received: from VE1EUR02FT055.eop-EUR02.prod.protection.outlook.com (10.152.12.53) by VE1EUR02HT218.eop-EUR02.prod.protection.outlook.com (10.152.13.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.485.12; Tue, 27 Feb 2018 16:47:57 +0000 Received: from AM4PR06MB1491.eurprd06.prod.outlook.com (10.152.12.60) by VE1EUR02FT055.mail.protection.outlook.com (10.152.13.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15 via Frontend Transport; Tue, 27 Feb 2018 16:47:57 +0000 Received: from AM4PR06MB1491.eurprd06.prod.outlook.com ([fe80::7d81:9d96:1051:d20d]) by AM4PR06MB1491.eurprd06.prod.outlook.com ([fe80::7d81:9d96:1051:d20d%14]) with mapi id 15.20.0527.021; Tue, 27 Feb 2018 16:47:57 +0000 From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "edk2-devel@lists.01.org" CC: "michael.d.kinney@intel.com" , "liming.gao@intel.com" Thread-Topic: [PATCH 2/2] MdePkg/UefiSpec.h: Ensure safe bitwise operations. Thread-Index: AQHTr+q3wgH4GjKFeUK8MP+tHSpaWg== Date: Tue, 27 Feb 2018 16:47:56 +0000 Message-ID: References: <20180227164740.4132-1-Marvin.Haeuser@outlook.com> In-Reply-To: <20180227164740.4132-1-Marvin.Haeuser@outlook.com> Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:34D54BB96132D4D0A99214541A71E9C80850FCCA9793A31CBE38A7B7BB0A10AC; UpperCasedChecksum:3ECFEF9253670FB0799DCAA5332485636F430959A3A1B8BE0DB4BCFDA2E2103B; SizeAsReceived:7238; Count:47 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [NtbGTJ/5nX78J/uJFH2K4jiMJNVl1A7h] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR02HT218; 6:JHivvCinVEWeei7JTLntOIzTi+Nbh8AUGMTlale1/c+pHv6O/ezUkU6WOfhKP8Q3u2lEwbqpM/aEI9i7NGiwnjXXU+dKvsmyuGlsarOdU4VquPyf2LfEhKmA7Pthp4TYvuWyHcvLMcL/okjTd7sBvbjfaj2PGhaDKpSXMgNsPfau7liBtS+8qV83NpEAdM4H5eres3S84tJd1P9TbbrMnnqQz2TLOwBlyQBTjlD5kp1ajZ1Am5Y/6alrcWmaz0lG5OWo7svxDI/qVuGzDtyge6U7ggJkFztmhtOY3xCvdUfh0QdcH7+KLAsAdArPKJNh/S92bCsgpv3RSKa+9RXWOF5sltb0pV6hjI+tDE4rQGk=; 5:8q1OogyhoZonP9IrwLoRQm2ZZbRyR2fHcZWbaUJU9C7i9v+Ud1+ReYiSj+1IUhS+uQ/W9WAIsTWeCVppQCwYLxT9ilFlv33xjLfi2G7Vhdo6yghhdbsMEMrRRhOY7dZlHho3iuE3y1QswW17T6EYN85QJFRpyeBtTwGPsCrP31M=; 24:TJDRLpAVR0SJ2DjhZl6K/23jhT/1JVvmu6NMA37RvQyN2RF9HeKvw/Blvn+pU8gQfV81CzCevf5ld1IXjHUW6lyOCKE3eMn8H7SkFZsdAj8=; 7:haL+7rIaJ7Nf6cMH64h8Vf4e0iFcBK2ZC/phF/ifwB5ykwHL7ZcDz0Gk3FrPZWXVB7TD59kg8D5SFvqMMwZcCyfFK9vPF2AQ1u8pTw1rDKSZzfr8LtOuc+ivhjC/5nLzKM7tAiwpqeDa83u7p91Gn1jd2etix+02Z3alMbYwcFx+LO0/vAaX1/zQEJzV1xeToC2VnceMt6WLw7cOMR2Y+fvvlQr4Zt4/P2AHsrNhnBXzpJ1IgyN+UW+VGMtUqyqT x-incomingheadercount: 47 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:VE1EUR02HT218; x-ms-traffictypediagnostic: VE1EUR02HT218: x-ms-office365-filtering-correlation-id: 9f965339-2f84-405f-2d70-08d57e01da1d x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR02HT218; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR02HT218; x-forefront-prvs: 05961EBAFC x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR02HT218; H:AM4PR06MB1491.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f965339-2f84-405f-2d70-08d57e01da1d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2018 16:47:56.9705 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT218 Subject: [PATCH 2/2] MdePkg/UefiSpec.h: Ensure safe bitwise operations. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2018 16:41:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable As per the C standard, bit-level operations on signed integers are either undefined or implementation-defined. Hence, use the BIT definitions from Base.h where applicable and mark the others as unsigned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marvin Haeuser --- MdePkg/Include/Uefi/UefiSpec.h | 96 ++++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.= h index ee016b48ded3..16abf3fce95f 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -52,46 +52,46 @@ typedef enum { // // Bit definitions for EFI_TIME.Daylight // -#define EFI_TIME_ADJUST_DAYLIGHT 0x01 -#define EFI_TIME_IN_DAYLIGHT 0x02 +#define EFI_TIME_ADJUST_DAYLIGHT BIT0 +#define EFI_TIME_IN_DAYLIGHT BIT1 =20 /// /// Value definition for EFI_TIME.TimeZone. /// -#define EFI_UNSPECIFIED_TIMEZONE 0x07FF +#define EFI_UNSPECIFIED_TIMEZONE 0x07FFU =20 // // Memory cacheability attributes // -#define EFI_MEMORY_UC 0x0000000000000001ULL -#define EFI_MEMORY_WC 0x0000000000000002ULL -#define EFI_MEMORY_WT 0x0000000000000004ULL -#define EFI_MEMORY_WB 0x0000000000000008ULL -#define EFI_MEMORY_UCE 0x0000000000000010ULL +#define EFI_MEMORY_UC BIT0 +#define EFI_MEMORY_WC BIT1 +#define EFI_MEMORY_WT BIT2 +#define EFI_MEMORY_WB BIT3 +#define EFI_MEMORY_UCE BIT4 // // Physical memory protection attributes // // Note: UEFI spec 2.5 and following: use EFI_MEMORY_RO as write-protected= physical memory // protection attribute. Also, EFI_MEMORY_WP means cacheability attribute. // -#define EFI_MEMORY_WP 0x0000000000001000ULL -#define EFI_MEMORY_RP 0x0000000000002000ULL -#define EFI_MEMORY_XP 0x0000000000004000ULL -#define EFI_MEMORY_RO 0x0000000000020000ULL +#define EFI_MEMORY_WP BIT12 +#define EFI_MEMORY_RP BIT13 +#define EFI_MEMORY_XP BIT14 +#define EFI_MEMORY_RO BIT17 // // Physical memory persistence attribute.=20 // The memory region supports byte-addressable non-volatility. // -#define EFI_MEMORY_NV 0x0000000000008000ULL +#define EFI_MEMORY_NV BIT15 // // The memory region provides higher reliability relative to other memory = in the system. // If all memory has the same reliability, then this bit is not used. // -#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000ULL +#define EFI_MEMORY_MORE_RELIABLE BIT16 // // Runtime memory attribute // -#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL +#define EFI_MEMORY_RUNTIME BIT63 =20 /// /// Memory descriptor version number. @@ -363,7 +363,7 @@ EFI_STATUS // // ConvertPointer DebugDisposition type. // -#define EFI_OPTIONAL_PTR 0x00000001 +#define EFI_OPTIONAL_PTR 0x00000001U =20 /** Determines the new virtual address that is to be used on subsequent memo= ry accesses. @@ -393,20 +393,20 @@ EFI_STATUS // EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or // EVT_NOTIFY_SIGNAL. // -#define EVT_TIMER 0x80000000 -#define EVT_RUNTIME 0x40000000 -#define EVT_NOTIFY_WAIT 0x00000100 -#define EVT_NOTIFY_SIGNAL 0x00000200 +#define EVT_TIMER 0x80000000U +#define EVT_RUNTIME 0x40000000U +#define EVT_NOTIFY_WAIT 0x00000100U +#define EVT_NOTIFY_SIGNAL 0x00000200U =20 -#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 -#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 +#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201U +#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202U =20 // // The event's NotifyContext pointer points to a runtime memory // address. // The event is deprecated in UEFI2.0 and later specifications. // -#define EVT_RUNTIME_CONTEXT 0x20000000 +#define EVT_RUNTIME_CONTEXT 0x20000000U =20 =20 /** @@ -1279,12 +1279,12 @@ EFI_STATUS OUT VOID **Interface ); =20 -#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 -#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 -#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 -#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 -#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 -#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 +#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL BIT0 +#define EFI_OPEN_PROTOCOL_GET_PROTOCOL BIT1 +#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL BIT2 +#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER BIT3 +#define EFI_OPEN_PROTOCOL_BY_DRIVER BIT4 +#define EFI_OPEN_PROTOCOL_EXCLUSIVE BIT5 =20 /** Queries a handle to determine if it supports a specified protocol. If th= e protocol is supported by the @@ -1656,9 +1656,9 @@ typedef struct { VOID* CapsulePtr[1]; } EFI_CAPSULE_TABLE; =20 -#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 -#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 -#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000 +#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET BIT16 +#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE BIT17 +#define CAPSULE_FLAGS_INITIATE_RESET BIT18 =20 /** Passes capsules to the firmware with both virtual and physical mapping. = Depending on the intended @@ -1764,12 +1764,12 @@ EFI_STATUS // // Firmware should stop at a firmware user interface on next boot // -#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x000000000000= 0001 -#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x000000000000= 0002 -#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x000000000000= 0004 -#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x000000000000= 0008 -#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x000000000000= 0010 -#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x000000000000= 0040 +#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI BIT0 +#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION BIT1 +#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED BIT2 +#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED BIT3 +#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED BIT4 +#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY BIT6 =20 // // EFI Runtime Services Table @@ -2093,18 +2093,18 @@ typedef struct _EFI_LOAD_OPTION { // // EFI Load Options Attributes // -#define LOAD_OPTION_ACTIVE 0x00000001 -#define LOAD_OPTION_FORCE_RECONNECT 0x00000002 -#define LOAD_OPTION_HIDDEN 0x00000008 -#define LOAD_OPTION_CATEGORY 0x00001F00 +#define LOAD_OPTION_ACTIVE BIT0 +#define LOAD_OPTION_FORCE_RECONNECT BIT1 +#define LOAD_OPTION_HIDDEN BIT3 +#define LOAD_OPTION_CATEGORY 0x00001F00U =20 -#define LOAD_OPTION_CATEGORY_BOOT 0x00000000 -#define LOAD_OPTION_CATEGORY_APP 0x00000100 +#define LOAD_OPTION_CATEGORY_BOOT 0x00000000U +#define LOAD_OPTION_CATEGORY_APP 0x00000100U =20 -#define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001 -#define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002 -#define EFI_BOOT_OPTION_SUPPORT_SYSPREP 0x00000010 -#define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300 +#define EFI_BOOT_OPTION_SUPPORT_KEY BIT0 +#define EFI_BOOT_OPTION_SUPPORT_APP BIT1 +#define EFI_BOOT_OPTION_SUPPORT_SYSPREP BIT4 +#define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300U =20 /// /// EFI Boot Key Data --=20 2.16.0.windows.2