[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] x86/gen-cpuid: avoid violations of Misra rule 1.3
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 2 Aug 2023 11:43:25 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xmAn4ea9Ft5uLOmWRqAcascwlZgYJ3Ef4JqGmYRj/ls=; b=CrBsktgy4/bSypTGE8TCqftG1qwthlux49uOqR/ldqHKREWfpjVKkoy4cwKaAvhHx4i2RAU36FOA260gvT2GVQZK91XVkOdswfEpjjzPBIa0VZKf8QcRAUfCcOfgoMczAvhDqECmG5/dM+L5Oa9LZr1nIslQD20RtmsK1BitZj1AN1mmCaurcl53+q+TGUv7OY5AwqFv8tpv1wcxdzpiERXKsbcXMHNbdJPKwBwOXp6vOt6ez+QSV6GDUuMJdiSJIZTqu7j72c/BwUUUuW1OP+N32D4jbSKNkXAyG1zTZIE49IR+K48/KzZQIyBVOXXvY8hDNbySMjze6z4nWeU16A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kW/1+cr+StnCQmI79Z9amuALg8WIaLckvPDrgw5Sazr1eD/0QJzgkXX7Ccl11ZMS2SfZfkO/IYASKGB2w0cGQxX1L/S1fWhVr+eJY0S1l2yNpyFBxY4G4gvZk8a3tozdMMCADDw4b+QkZ3qSm2K/L7Wz4S77FkVwXOXC99WONXEkxIEmOooi1WPmZ/3IW6Uod7xa/nnP3WZ2DaCsKShY97a8qV2QtNZkJx/xfASBfDexh7zth3h4Hs4DiJUH8mvl0AnVBeMPw2OjHN5nM8UfNEuovUIaI/BKIlvHBhucG8uuL5hzp3vpzg6OnHra56LSL6ZU7a7LpEWzcaBQBA6RFg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
- Delivery-date: Wed, 02 Aug 2023 09:43:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Structures or unions without any named members aren't liked by Misra
(nor the C standard). Avoid emitting such for leaves without any known
bits.
At this occasion also add the script to the X86 section in ./MAINTAINERS.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -601,6 +601,7 @@ F: xen/arch/x86/
F: xen/include/public/arch-x86/
F: xen/include/xen/lib/x86
F: xen/lib/x86
+F: xen/tools/gen-cpuid.py
F: tools/firmware/hvmloader/
F: tools/firmware/rombios/
F: tools/firmware/vgabios/
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -367,6 +367,7 @@ def crunch_numbers(state):
for word in range(state.nr_entries):
names = []
+ empty = 1
for bit in range(32):
name = state.names.get(word * 32 + bit, "")
@@ -380,9 +381,15 @@ def crunch_numbers(state):
if name in ("APIC", "OSXSAVE", "OSPKE"):
name = ""
+ if name:
+ empty = 0
+
names.append(name.lower())
- state.bitfields.append("bool " + ":1, ".join(names) + ":1")
+ if empty:
+ state.bitfields.append("unsigned int empty_" + str(word) + ":32")
+ else:
+ state.bitfields.append("bool " + ":1, ".join(names) + ":1")
def write_results(state):
|