So the cps instruction will work in aarch32 and backward instruction set compatibility is preserved.

I did not realize the exception level model was fully implemented in aarch32, which means the exception handling and the setting up of the vector table changes considerably, as it does in aarch64.

Bob

Get Outlook for Android


From: Tomasz Gajewski <tomga@wp.pl>
Sent: Monday, January 7, 2019 11:50:18 AM
To: Bob Stewart
Cc: Genode users mailing list
Subject: Re: Genode on RPI
 
Bob Stewart <robjsstewart@gmail.com> writes:

> Hi Tomasz,
>
> Are you saying that the instruction cps #31 to set SVC state in crt0.s
> failed after u-boot left you in the aarch32 execution state?

As I understand it things are different on Raspberry Pi since some
version of firmware for RPI2 and later (those with hypervisor
capabilities). Firmware provider decided that firmare should start
system in Hyp mode. In my case the system is U-boot. U-boot is happy to
work in Hyp mode and after downloading Genode image (currently I have
tftp server set up for ease of testing) it checks the architecture of
image to be Aarch32. In this case it switches to Aarch32 mode but
leaving Hyp mode so crt0.s is run in Hyp mode in Aarch32 mode.

Hyp mode (according to [1]) is associated with PL2 privilege level and
cps #31 is trying to change processor mode to Secure Monitor Mode which
is associated with privilege level PL1. And changing exception levels is
allowed only by ERET.

> If so that would mean armv7 code does not run on an armv8
> platform. Crt0.s should run without any changes.

No. Difference armv7 vs. armv8 has nothing to do with root of the
problem. Only different privilege level when it is started is important
and that is why crt0.s required a change.

Tomasz Gajewski

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/ch03s02.html