base-hw: Cpu_lazy_state and alignment constraints

Adrian-Ken Rueegsegger ken at ...309...
Mon Mar 9 15:01:08 CET 2015


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.


[1] -
[2] -
[3] -
[4] -

More information about the users mailing list