base-hw: Cpu_lazy_state and alignment constraints
Adrian-Ken Rueegsegger
ken at ...309...
Mon Mar 9 15:01:08 CET 2015
Hello,
While implementing lazy FPU loading/storing for the x86 base-hw port I
came across an issue with regards to data structure alignment. The
implementation is similar to the one of base-hw cortex A9 and uses the
Cpu_lazy_state class to store the FPU state, see [1].
To use the fx[save|rstor] instructions, the storage area must be 16-byte
aligned which I set as alignment of the Cpu_lazy_state class [2].
Checking the alignment of the data structure during runtime showed
however, that the constraint is not correctly adhered to.
I suspect that the Kernel::Cpu_job class, which contains the lazy state
[3], is allocated without consideration for the required alignment.
I have worked around the issue by manually ensuring the correct
alignment [4] but I consider it a hack would like to get rid of it.
Since I am not quite sure how Cpu_job is allocated and what its life
cycle looks like, I would be glad if someone could give me some pointers
to verify my suspicion and give a suggestion on how one would go about
ensuring the proper alignment of all instances of Cpu_lazy_state.
Regards,
Adrian
[1] -
https://github.com/codelabs-ch/genode/blob/9a2a85c807a695a91088b6ab6e0d0de422c85dc1/repos/base-hw/src/core/include/spec/x86/cpu.h#L43
[2] -
https://github.com/codelabs-ch/genode/blob/9a2a85c807a695a91088b6ab6e0d0de422c85dc1/repos/base-hw/src/core/include/spec/x86/cpu.h#L75
[3] -
https://github.com/codelabs-ch/genode/blob/hw_x86-fpu/repos/base-hw/src/core/include/kernel/cpu.h#L132
[4] -
https://github.com/codelabs-ch/genode/commit/996ffa6407effaa45488ddf3e41986c4fd2947ed
More information about the users
mailing list