Auto-generate header of struct offsets/sizes

Code written in assembly needs to be told the offsets of struct members.
Currently these are hardcoded and static_assert-ed at compile time,
requiring manual updates every time struct declarations change.
This patch adds a mechanism for auto-generating a header with these
constants.

It uses a "hack" similar to other projects, e.g. Linux, where the
integer constant is used as an immediate in an inline assembly block.
The file is compiled and the constant extracted by a script which
generates the header file. For easy grep-ing, the constant is compiled
into a '.ascii' string, surrounded by magic strings, and extracted using
the 'strings' binutils tool.

To guarantee correctness, the same source file is compiled again as part
of the Hafnium binary but this time the declarations are converted to
static_asserts which check the values.

Fix: 120137356
Test: ./kokoru/ubuntu/build.sh
Change-Id: I551126519675e73cb01b4beb4ff9b1200b9b3de7
10 files changed
tree: f11f24220dc80f987b80e6db712b8dd238a97867
  1. .vscode/
  2. build/
  3. docs/
  4. driver/
  5. inc/
  6. kokoro/
  7. project/
  8. src/
  9. test/
  10. third_party/
  11. .clang-format
  12. .clang-tidy
  13. .gitignore
  14. .gitmodules
  15. .gn
  16. AUTHORS
  17. BUILD.gn
  18. CONTRIBUTING.md
  19. LICENSE
  20. Makefile
  21. README.md
README.md

Hafnium

Hafnium is a hypervisor, initially supporting aarch64 (64-bit ARMv8 CPUs).

Get in touch and keep up-to-date at hafnium-discuss@googlegroups.com.

Getting started

To jump in and build Hafnium, follow the getting started instructions.

If you want to contribute to the project, see details of how we accept contributions.

Documentation

More documentation is available on: