Browse Source

Adding AArch64 CurrentEL register

CurrentEL is used to determine the current "exception level" in the CPU.

It has four possible results:

0b00 - EL0 - Application
0b01 - EL1 - Rich OS
0b10 - EL2 - Hypervisor
0b11 - EL3 - Firmware

https://developer.arm.com/documentation/ddi0595/2020-12/AArch64-Registers/CurrentEL--Current-Exception-Level
https://developer.arm.com/documentation/102412/0100/Privilege-and-Exception-levels
Robert Roland 3 years ago
parent
commit
7cefe8a822

+ 2 - 0
compiler/aarch64/a64reg.dat

@@ -85,6 +85,8 @@ MPIDR_EL1,$05,$00,$04,mpidr_el1,0,0
 CNTFRQ_EL0,$03,$03,$0D,cntfrq_el0,0,0
 CNTFRQ_EL0,$03,$03,$0D,cntfrq_el0,0,0
 CNTPCT_EL0,$03,$03,$0E,cntpct_el0,0,0
 CNTPCT_EL0,$03,$03,$0E,cntpct_el0,0,0
 
 
+CurrentEL,$03,$00,$04,currentel,0,0
+
 ; vfp registers
 ; vfp registers
 ; generated by fpc/compiler/utils/gena64vfp.pp to avoid tedious typing
 ; generated by fpc/compiler/utils/gena64vfp.pp to avoid tedious typing
 B0,$04,$01,$00,b0,64,64
 B0,$04,$01,$00,b0,64,64

+ 1 - 0
compiler/aarch64/ra64con.inc

@@ -73,6 +73,7 @@ NR_TPIDR_EL0 = tregister($05000003);
 NR_MPIDR_EL1 = tregister($05000004);
 NR_MPIDR_EL1 = tregister($05000004);
 NR_CNTFRQ_EL0 = tregister($0303000D);
 NR_CNTFRQ_EL0 = tregister($0303000D);
 NR_CNTPCT_EL0 = tregister($0303000E);
 NR_CNTPCT_EL0 = tregister($0303000E);
+NR_CurrentEL = tregister($03000004);
 NR_B0 = tregister($04010000);
 NR_B0 = tregister($04010000);
 NR_H0 = tregister($04030000);
 NR_H0 = tregister($04030000);
 NR_S0 = tregister($04090000);
 NR_S0 = tregister($04090000);

+ 1 - 0
compiler/aarch64/ra64dwa.inc

@@ -73,6 +73,7 @@
 0,
 0,
 0,
 0,
 0,
 0,
+0,
 64,
 64,
 64,
 64,
 64,
 64,

+ 1 - 1
compiler/aarch64/ra64nor.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from a64reg.dat }
 { don't edit, this file is generated from a64reg.dat }
-650
+651

+ 1 - 0
compiler/aarch64/ra64num.inc

@@ -73,6 +73,7 @@ tregister($05000003),
 tregister($05000004),
 tregister($05000004),
 tregister($0303000D),
 tregister($0303000D),
 tregister($0303000E),
 tregister($0303000E),
+tregister($03000004),
 tregister($04010000),
 tregister($04010000),
 tregister($04030000),
 tregister($04030000),
 tregister($04090000),
 tregister($04090000),

+ 129 - 128
compiler/aarch64/ra64rni.inc

@@ -66,72 +66,41 @@
 62,
 62,
 64,
 64,
 66,
 66,
+74,
 72,
 72,
 73,
 73,
-79,
-97,
-115,
-133,
-151,
-169,
-187,
-205,
-223,
-241,
-259,
-277,
-295,
-313,
-331,
-349,
-367,
-385,
-403,
-421,
-439,
-457,
-475,
-493,
-511,
-529,
-547,
-565,
-583,
-601,
-619,
-637,
-74,
-92,
-110,
-128,
-146,
-164,
-182,
-200,
-218,
-236,
-254,
-272,
-290,
-308,
-326,
-344,
-362,
-380,
-398,
-416,
-434,
-452,
-470,
-488,
-506,
-524,
-542,
-560,
-578,
-596,
-614,
-632,
+80,
+98,
+116,
+134,
+152,
+170,
+188,
+206,
+224,
+242,
+260,
+278,
+296,
+314,
+332,
+350,
+368,
+386,
+404,
+422,
+440,
+458,
+476,
+494,
+512,
+530,
+548,
+566,
+584,
+602,
+620,
+638,
 75,
 75,
 93,
 93,
 111,
 111,
@@ -260,38 +229,38 @@
 600,
 600,
 618,
 618,
 636,
 636,
-84,
-102,
-120,
-138,
-156,
-174,
-192,
-210,
-228,
-246,
-264,
-282,
-300,
-318,
-336,
-354,
-372,
-390,
-408,
-426,
-444,
-462,
-480,
-498,
-516,
-534,
-552,
-570,
-588,
-606,
-624,
-642,
+79,
+97,
+115,
+133,
+151,
+169,
+187,
+205,
+223,
+241,
+259,
+277,
+295,
+313,
+331,
+349,
+367,
+385,
+403,
+421,
+439,
+457,
+475,
+493,
+511,
+529,
+547,
+565,
+583,
+601,
+619,
+637,
 85,
 85,
 103,
 103,
 121,
 121,
@@ -516,38 +485,38 @@
 613,
 613,
 631,
 631,
 649,
 649,
-80,
-98,
-116,
-134,
-152,
-170,
-188,
-206,
-224,
-242,
-260,
-278,
-296,
-314,
-332,
-350,
-368,
-386,
-404,
-422,
-440,
-458,
-476,
-494,
-512,
-530,
-548,
-566,
-584,
-602,
-620,
-638,
+92,
+110,
+128,
+146,
+164,
+182,
+200,
+218,
+236,
+254,
+272,
+290,
+308,
+326,
+344,
+362,
+380,
+398,
+416,
+434,
+452,
+470,
+488,
+506,
+524,
+542,
+560,
+578,
+596,
+614,
+632,
+650,
 81,
 81,
 99,
 99,
 117,
 117,
@@ -644,6 +613,38 @@
 605,
 605,
 623,
 623,
 641,
 641,
+84,
+102,
+120,
+138,
+156,
+174,
+192,
+210,
+228,
+246,
+264,
+282,
+300,
+318,
+336,
+354,
+372,
+390,
+408,
+426,
+444,
+462,
+480,
+498,
+516,
+534,
+552,
+570,
+588,
+606,
+624,
+642,
 67,
 67,
 68,
 68,
 69,
 69,

+ 327 - 326
compiler/aarch64/ra64sri.inc

@@ -1,73 +1,5 @@
 { don't edit, this file is generated from a64reg.dat }
 { don't edit, this file is generated from a64reg.dat }
 0,
 0,
-74,
-92,
-254,
-272,
-290,
-308,
-326,
-344,
-362,
-380,
-398,
-416,
-110,
-434,
-452,
-470,
-488,
-506,
-524,
-542,
-560,
-578,
-596,
-128,
-614,
-632,
-146,
-164,
-182,
-200,
-218,
-236,
-72,
-73,
-77,
-95,
-257,
-275,
-293,
-311,
-329,
-347,
-365,
-383,
-401,
-419,
-113,
-437,
-455,
-473,
-491,
-509,
-527,
-545,
-563,
-581,
-599,
-131,
-617,
-635,
-149,
-167,
-185,
-203,
-221,
-239,
-68,
-69,
 75,
 75,
 93,
 93,
 255,
 255,
@@ -100,8 +32,9 @@
 201,
 201,
 219,
 219,
 237,
 237,
-71,
-67,
+72,
+73,
+74,
 78,
 78,
 96,
 96,
 258,
 258,
@@ -134,6 +67,8 @@
 204,
 204,
 222,
 222,
 240,
 240,
+68,
+69,
 76,
 76,
 94,
 94,
 256,
 256,
@@ -166,424 +101,490 @@
 202,
 202,
 220,
 220,
 238,
 238,
+71,
+67,
+79,
+97,
+259,
+277,
+295,
+313,
+331,
+349,
+367,
+385,
+403,
+421,
+115,
+439,
+457,
+475,
+493,
+511,
+529,
+547,
+565,
+583,
+601,
+133,
+619,
+637,
+151,
+169,
+187,
+205,
+223,
+241,
+77,
+95,
+257,
+275,
+293,
+311,
+329,
+347,
+365,
+383,
+401,
+419,
+113,
+437,
+455,
+473,
+491,
+509,
+527,
+545,
+563,
+581,
+599,
+131,
+617,
+635,
+149,
+167,
+185,
+203,
+221,
+239,
 66,
 66,
 70,
 70,
-79,
-85,
-90,
-91,
-88,
+80,
 86,
 86,
+91,
+92,
 89,
 89,
-84,
 87,
 87,
-80,
-83,
+90,
+85,
+88,
 81,
 81,
+84,
 82,
 82,
-97,
-103,
-108,
-109,
-106,
+83,
+98,
 104,
 104,
+109,
+110,
 107,
 107,
-102,
 105,
 105,
-98,
-101,
+108,
+103,
+106,
 99,
 99,
+102,
 100,
 100,
-259,
-265,
-270,
-271,
-268,
+101,
+260,
 266,
 266,
+271,
+272,
 269,
 269,
-264,
 267,
 267,
-260,
-263,
+270,
+265,
+268,
 261,
 261,
+264,
 262,
 262,
-277,
-283,
-288,
-289,
-286,
+263,
+278,
 284,
 284,
+289,
+290,
 287,
 287,
-282,
 285,
 285,
-278,
-281,
+288,
+283,
+286,
 279,
 279,
+282,
 280,
 280,
-295,
-301,
-306,
-307,
-304,
+281,
+296,
 302,
 302,
+307,
+308,
 305,
 305,
-300,
 303,
 303,
-296,
-299,
+306,
+301,
+304,
 297,
 297,
+300,
 298,
 298,
-313,
-319,
-324,
-325,
-322,
+299,
+314,
 320,
 320,
+325,
+326,
 323,
 323,
-318,
 321,
 321,
-314,
-317,
+324,
+319,
+322,
 315,
 315,
+318,
 316,
 316,
-331,
-337,
-342,
-343,
-340,
+317,
+332,
 338,
 338,
+343,
+344,
 341,
 341,
-336,
 339,
 339,
-332,
-335,
+342,
+337,
+340,
 333,
 333,
+336,
 334,
 334,
-349,
-355,
-360,
-361,
-358,
+335,
+350,
 356,
 356,
+361,
+362,
 359,
 359,
-354,
 357,
 357,
-350,
-353,
+360,
+355,
+358,
 351,
 351,
+354,
 352,
 352,
-367,
-373,
-378,
-379,
-376,
+353,
+368,
 374,
 374,
+379,
+380,
 377,
 377,
-372,
 375,
 375,
-368,
-371,
+378,
+373,
+376,
 369,
 369,
+372,
 370,
 370,
-385,
-391,
-396,
-397,
-394,
+371,
+386,
 392,
 392,
+397,
+398,
 395,
 395,
-390,
 393,
 393,
-386,
-389,
+396,
+391,
+394,
 387,
 387,
+390,
 388,
 388,
-403,
-409,
-414,
-415,
-412,
+389,
+404,
 410,
 410,
+415,
+416,
 413,
 413,
-408,
 411,
 411,
-404,
-407,
+414,
+409,
+412,
 405,
 405,
+408,
 406,
 406,
-421,
-427,
-432,
-433,
-430,
+407,
+422,
 428,
 428,
+433,
+434,
 431,
 431,
-426,
 429,
 429,
-422,
-425,
+432,
+427,
+430,
 423,
 423,
+426,
 424,
 424,
-115,
-121,
-126,
-127,
-124,
+425,
+116,
 122,
 122,
+127,
+128,
 125,
 125,
-120,
 123,
 123,
-116,
-119,
+126,
+121,
+124,
 117,
 117,
+120,
 118,
 118,
-439,
-445,
-450,
-451,
-448,
+119,
+440,
 446,
 446,
+451,
+452,
 449,
 449,
-444,
 447,
 447,
-440,
-443,
+450,
+445,
+448,
 441,
 441,
+444,
 442,
 442,
-457,
-463,
-468,
-469,
-466,
+443,
+458,
 464,
 464,
+469,
+470,
 467,
 467,
-462,
 465,
 465,
-458,
-461,
+468,
+463,
+466,
 459,
 459,
+462,
 460,
 460,
-475,
-481,
-486,
-487,
-484,
+461,
+476,
 482,
 482,
+487,
+488,
 485,
 485,
-480,
 483,
 483,
-476,
-479,
+486,
+481,
+484,
 477,
 477,
+480,
 478,
 478,
-493,
-499,
-504,
-505,
-502,
+479,
+494,
 500,
 500,
+505,
+506,
 503,
 503,
-498,
 501,
 501,
-494,
-497,
+504,
+499,
+502,
 495,
 495,
+498,
 496,
 496,
-511,
-517,
-522,
-523,
-520,
+497,
+512,
 518,
 518,
+523,
+524,
 521,
 521,
-516,
 519,
 519,
-512,
-515,
+522,
+517,
+520,
 513,
 513,
+516,
 514,
 514,
-529,
-535,
-540,
-541,
-538,
+515,
+530,
 536,
 536,
+541,
+542,
 539,
 539,
-534,
 537,
 537,
-530,
-533,
+540,
+535,
+538,
 531,
 531,
+534,
 532,
 532,
-547,
-553,
-558,
-559,
-556,
+533,
+548,
 554,
 554,
+559,
+560,
 557,
 557,
-552,
 555,
 555,
-548,
-551,
+558,
+553,
+556,
 549,
 549,
+552,
 550,
 550,
-565,
-571,
-576,
-577,
-574,
+551,
+566,
 572,
 572,
+577,
+578,
 575,
 575,
-570,
 573,
 573,
-566,
-569,
+576,
+571,
+574,
 567,
 567,
+570,
 568,
 568,
-583,
-589,
-594,
-595,
-592,
+569,
+584,
 590,
 590,
+595,
+596,
 593,
 593,
-588,
 591,
 591,
-584,
-587,
+594,
+589,
+592,
 585,
 585,
+588,
 586,
 586,
-601,
-607,
-612,
-613,
-610,
+587,
+602,
 608,
 608,
+613,
+614,
 611,
 611,
-606,
 609,
 609,
-602,
-605,
+612,
+607,
+610,
 603,
 603,
+606,
 604,
 604,
-133,
-139,
-144,
-145,
-142,
+605,
+134,
 140,
 140,
+145,
+146,
 143,
 143,
-138,
 141,
 141,
-134,
-137,
+144,
+139,
+142,
 135,
 135,
+138,
 136,
 136,
-619,
-625,
-630,
-631,
-628,
+137,
+620,
 626,
 626,
+631,
+632,
 629,
 629,
-624,
 627,
 627,
-620,
-623,
+630,
+625,
+628,
 621,
 621,
+624,
 622,
 622,
-637,
-643,
-648,
-649,
-646,
+623,
+638,
 644,
 644,
+649,
+650,
 647,
 647,
-642,
 645,
 645,
-638,
-641,
+648,
+643,
+646,
 639,
 639,
+642,
 640,
 640,
-151,
-157,
-162,
-163,
-160,
+641,
+152,
 158,
 158,
+163,
+164,
 161,
 161,
-156,
 159,
 159,
-152,
-155,
+162,
+157,
+160,
 153,
 153,
+156,
 154,
 154,
-169,
-175,
-180,
-181,
-178,
+155,
+170,
 176,
 176,
+181,
+182,
 179,
 179,
-174,
 177,
 177,
-170,
-173,
+180,
+175,
+178,
 171,
 171,
+174,
 172,
 172,
-187,
-193,
-198,
-199,
-196,
+173,
+188,
 194,
 194,
+199,
+200,
 197,
 197,
-192,
 195,
 195,
-188,
-191,
+198,
+193,
+196,
 189,
 189,
+192,
 190,
 190,
-205,
-211,
-216,
-217,
-214,
+191,
+206,
 212,
 212,
+217,
+218,
 215,
 215,
-210,
 213,
 213,
-206,
-209,
+216,
+211,
+214,
 207,
 207,
+210,
 208,
 208,
-223,
-229,
-234,
-235,
-232,
+209,
+224,
 230,
 230,
+235,
+236,
 233,
 233,
-228,
 231,
 231,
-224,
-227,
+234,
+229,
+232,
 225,
 225,
+228,
 226,
 226,
-241,
-247,
-252,
-253,
-250,
+227,
+242,
 248,
 248,
+253,
+254,
 251,
 251,
-246,
 249,
 249,
-242,
-245,
+252,
+247,
+250,
 243,
 243,
+246,
 244,
 244,
+245,
 1,
 1,
 3,
 3,
 21,
 21,

+ 1 - 0
compiler/aarch64/ra64sta.inc

@@ -73,6 +73,7 @@
 0,
 0,
 0,
 0,
 0,
 0,
+0,
 64,
 64,
 64,
 64,
 64,
 64,

+ 1 - 0
compiler/aarch64/ra64std.inc

@@ -73,6 +73,7 @@
 'mpidr_el1',
 'mpidr_el1',
 'cntfrq_el0',
 'cntfrq_el0',
 'cntpct_el0',
 'cntpct_el0',
+'currentel',
 'b0',
 'b0',
 'h0',
 'h0',
 's0',
 's0',

+ 1 - 0
compiler/aarch64/ra64sup.inc

@@ -73,6 +73,7 @@ RS_TPIDR_EL0 = $03;
 RS_MPIDR_EL1 = $04;
 RS_MPIDR_EL1 = $04;
 RS_CNTFRQ_EL0 = $0D;
 RS_CNTFRQ_EL0 = $0D;
 RS_CNTPCT_EL0 = $0E;
 RS_CNTPCT_EL0 = $0E;
+RS_CurrentEL = $04;
 RS_B0 = $00;
 RS_B0 = $00;
 RS_H0 = $00;
 RS_H0 = $00;
 RS_S0 = $00;
 RS_S0 = $00;