Page MenuHomeFreeBSD

arm64: Set the endian without a memory access
Needs ReviewPublic

Authored by andrew on Tue, Jun 24, 2:27 PM.
Tags
None
Referenced Files
F124192860: D51012.id.diff
Wed, Jul 23, 1:24 PM
Unknown Object (File)
Mon, Jul 21, 2:58 PM
Unknown Object (File)
Mon, Jul 14, 9:06 AM
Unknown Object (File)
Sat, Jul 12, 6:14 PM
Unknown Object (File)
Tue, Jul 8, 4:27 AM
Unknown Object (File)
Sun, Jul 6, 6:38 PM
Unknown Object (File)
Sun, Jul 6, 6:00 PM
Unknown Object (File)
Sat, Jul 5, 1:05 PM
Subscribers

Details

Reviewers
manu
Group Reviewers
arm64
Summary

Early in the kernel we set the endian through the sctlr_el1 and
sctlr_el2 registers. To get the value to put into these registers we
load them from memory. As this will depend on the endian to get the
fields in the correct order then it will fail if the endian is not
what the kernel expects.

Add a macro to load a 64-bit value into a register without a memory
access and use this to set the register. As instructions are not
affected by the endian set in sctlr this is safe.

It is unlikely this will be hit as UEFI requires the processor to be
in little endian mode, however when booting using the Linux ABI the
kernel may start in big-endian, and secondary CPUs could be big-endian.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 65053
Build 61936: arc lint + arc unit

Event Timeline

sys/arm64/arm64/locore.S
381

Add a comment here that the system is in little endian mode and memory operations can be used from here on? Or extend the comment above with something like memory operations can be used after this operation?