CPU Bi-Endian support of RK3399
#1
Hello!

According to ARM the Endian support of the ARMv8 CPUs may vary depending on architecture/model/manufacturer. Therefore I would like to learn whether the RK3399 does support big-endian mode of operation before I decide to order that board. I have written a small test code (32bit ARM!):

Code:
#include <stdio.h>

int main(int argc, char**argv)
{
   (void)argc; (void)argv;

   int tmp = 0;

   printf("Trying to switch endianess\n");

   asm volatile("setend be; str %0, %1; setend le"::"r"(0xdeadbeef),"m"(tmp));

   printf("Value in tmp is %08x, written was %08x\n", tmp, 0xdeadbeef);

   return 0;
}

The code does nothing extraordinary, it just switches the CPU mode to BE, stores variable in memory and switches back to LE, which is most likely the default mode on RK3399. I would like someone to compile this code in 32bit mode and test. There, three things can happen:
1. The "setend" instruction is obsolete and CPU is told to throw an exception on that instruction. In that case sigsegv is thrown and program ends without any output on the console.
2. The "setend" instruction is executed but the CPU does not support BE mode. In that case "Value in tmp is deadbeef, written was deadbeef" will show on the console
3. The "setend" instruction is executed and the CPU supports BE mode. In that case "Value in tmp is efbeadde, written was deadbeef" will show on the console.

Thanks for the help.
  Reply
#2
(02-15-2019, 07:12 AM)mschulz Wrote: Hello!

According to ARM the Endian support of the ARMv8 CPUs may vary depending on architecture/model/manufacturer. Therefore I would like to learn whether the RK3399 does support big-endian mode of operation before I decide to order that board. I have written a small test code (32bit ARM!):
(...)
The code does nothing extraordinary, it just switches the CPU mode to BE, stores variable in memory and switches back to LE, which is most likely the default mode on RK3399. I would like someone to compile this code in 32bit mode and test. There, three things can happen:
1. The "setend" instruction is obsolete and CPU is told to throw an exception on that instruction. In that case sigsegv is thrown and program ends without any output on the console.
2. The "setend" instruction is executed but the CPU does not support BE mode. In that case "Value in tmp is deadbeef, written was deadbeef" will show on the console
3. The "setend" instruction is executed and the CPU supports BE mode. In that case "Value in tmp is efbeadde, written was deadbeef" will show on the console.

Thanks for the help.

Hi,
Supporting mixed-endianness in armv8 is optional..
AFAIK armv8 is littleEndian by default
But if the implementer choose , it can support BigEndian too.

ARMv6 'setend' intruction,is deprecated in armv8-a( Only Supported in armv6 and armv7 )..
Therefore you would receive an error by the assembler in compilation process, regarding to 'setend', running in aarch64..

Maybe, if you are in aarch32 mode you can do that, with SCTLR_EL1 bit[ 8 ]
If you can ,
It should be possible big endian/Litle endian on data access, and default litle endian in fetching program code..
  Reply
#3
can you give specifics as to how you would compile the code in 32bit mode? do you mean running an arm 32bit kernel vs aarch64?
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  RockPro64 Official Kernel Support ASIC 8 2,187 07-12-2019, 08:33 AM
Last Post: Luke
  slarm64 (unofficial slackware) ROCKPro64 RK3399 (aarch64) mara 23 3,252 07-02-2019, 09:32 PM
Last Post: pineadmin
  RockPro64 alpha software support bavay 6 416 06-13-2019, 09:24 AM
Last Post: bavay
Big Grin RETRO GAMING: UPDATED RECALBOX FOR THE RK3399 ROCKPRO64 Mrfixit2001 24 2,333 06-10-2019, 02:54 AM
Last Post: pineadmin
  Looking for support ghiromax 0 172 02-11-2019, 06:43 AM
Last Post: ghiromax
  WiFi support on RockPro64 tagyro 4 787 12-11-2018, 02:43 PM
Last Post: fosf0r
  RockPro64 and 802.1q support [Solved] divek 2 310 11-04-2018, 11:15 AM
Last Post: divek
  Disable sdio (no wifi/bt) to fix pcie/nvme support RockPro64Newbie 0 265 09-22-2018, 04:07 PM
Last Post: RockPro64Newbie
Exclamation WiFi/BT module - Any images with support? duckkcud 1 375 09-01-2018, 02:28 AM
Last Post: evilbunny
  WINE Support Firesped 1 361 07-31-2018, 08:54 AM
Last Post: elatllat

Forum Jump:


Users browsing this thread: 1 Guest(s)