On 14/4/25 18:38, Cornelia Huck wrote:
From: Eric Auger <eric.au...@redhat.com>

Introduce a script that automates the generation of system register
properties definitions from a given linux source tree
arch/arm64/tools/sysreg.

Invocation of
./update-aarch64-sysreg-code.sh $PATH_TO_LINUX_SOURCE_TREE
in scripts directory additionally generates
target/arm/cpu-sysreg-properties.c containing definitions for
feature ID registers.

update-aarch64-sysreg-code.sh additionally calls
gen-cpu-sysreg-properties.awk which is inherited from kernel
arch/arm64/tools/gen-sysreg.awk. All credits to Mark Rutland
the original author of this script.

[CH: split off from original patch adding both sysreg definitions
  and properties]
Signed-off-by: Eric Auger <eric.au...@redhat.com>
Signed-off-by: Cornelia Huck <coh...@redhat.com>
---
  scripts/gen-cpu-sysreg-properties.awk | 325 ++++++++++++++++++++++++++
  scripts/update-aarch64-sysreg-code.sh |   5 +-
  2 files changed, 329 insertions(+), 1 deletion(-)
  create mode 100755 scripts/gen-cpu-sysreg-properties.awk

diff --git a/scripts/gen-cpu-sysreg-properties.awk 
b/scripts/gen-cpu-sysreg-properties.awk
new file mode 100755
index 000000000000..76c37938b168
--- /dev/null
+++ b/scripts/gen-cpu-sysreg-properties.awk
@@ -0,0 +1,325 @@
+#!/bin/awk -f
+# SPDX-License-Identifier: GPL-2.0
+# gen-cpu-sysreg-properties.awk: arm64 sysreg header generator
+#
+# Usage: awk -f gen-cpu-sysreg-properties.awk 
$LINUX_PATH/arch/arm64/tools/sysreg


+BEGIN {

        print "/* AUTOMATICALLY GENERATED, DO NOT MODIFY */\n"

Should we keep copyright?

+       print "#include \"cpu-custom.h\""
+       print ""
+       print "ARM64SysReg arm64_id_regs[NUM_ID_IDX];"
+       print ""
+       print "void initialize_cpu_sysreg_properties(void)"
+       print "{"
+        print "    memset(arm64_id_regs, 0, sizeof(ARM64SysReg) * NUM_ID_IDX);"
+        print ""
+
+       __current_block_depth = 0
+       __current_block[__current_block_depth] = "Root"
+}

Reply via email to