• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisãocaa8d70005e4e12392683c799b30790fc4c62166 (tree)
Hora2015-12-15 20:01:03
AutorNick Clifton <nickc@redh...>
CommiterNick Clifton

Mensagem de Log

Add support for the MRS instruction to the AArch64 simulator.

* aarch64/simulator.c (system_get): New function. Provides read
access to the dczid system register.
(do_mrs): New function - implements the MRS instruction.
(dexSystem): Call do_mrs for the MRS instruction. Halt on
unimplemented system instructions.

Mudança Sumário

Diff

--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,11 @@
1+2015-12-14 Nick Clifton <nickc@redhat.com>
2+
3+ * aarch64/simulator.c (system_get): New function. Provides read
4+ access to the dczid system register.
5+ (do_mrs): New function - implements the MRS instruction.
6+ (dexSystem): Call do_mrs for the MRS instruction. Halt on
7+ unimplemented system instructions.
8+
19 2015-11-24 Nick Clifton <nickc@redhat.com>
210
311 * configure.tgt: Add aarch64 entry.
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -12783,6 +12783,44 @@ dexExcpnGen (sim_cpu *cpu)
1278312783 HALT_UNALLOC;
1278412784 }
1278512785
12786+/* Stub for accessing system registers.
12787+ We implement support for the DCZID register since this is used
12788+ by the C library's memset function. */
12789+
12790+static uint64_t
12791+system_get (sim_cpu *cpu, unsigned op0, unsigned op1, unsigned crn,
12792+ unsigned crm, unsigned op2)
12793+{
12794+ if (crn == 0 && op1 == 3 && crm == 0 && op2 == 7)
12795+ /* DCZID_EL0 - the Data Cache Zero ID register.
12796+ We do not support DC ZVA at the moment, so
12797+ we return a value with the disable bit set. */
12798+ return ((uint64_t) 1) << 4;
12799+
12800+ HALT_NYI;
12801+}
12802+
12803+static void
12804+do_mrs (sim_cpu *cpu)
12805+{
12806+ /* instr[31:20] = 1101 01010 0011
12807+ instr[19] = op0
12808+ instr[18,16] = op1
12809+ instr[15,12] = CRn
12810+ instr[11,8] = CRm
12811+ instr[7,5] = op2
12812+ instr[4,0] = Rt */
12813+ unsigned sys_op0 = uimm (aarch64_get_instr (cpu), 19, 19) + 2;
12814+ unsigned sys_op1 = uimm (aarch64_get_instr (cpu), 18, 16);
12815+ unsigned sys_crn = uimm (aarch64_get_instr (cpu), 15, 12);
12816+ unsigned sys_crm = uimm (aarch64_get_instr (cpu), 11, 8);
12817+ unsigned sys_op2 = uimm (aarch64_get_instr (cpu), 7, 5);
12818+ unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
12819+
12820+ aarch64_set_reg_u64 (cpu, rt, NO_SP,
12821+ system_get (cpu, sys_op0, sys_op1, sys_crn, sys_crm, sys_op2));
12822+}
12823+
1278612824 static void
1278712825 dexSystem (sim_cpu *cpu)
1278812826 {
@@ -12842,9 +12880,7 @@ dexSystem (sim_cpu *cpu)
1284212880
1284312881 switch (op2)
1284412882 {
12845- case 2:
12846- HALT_NYI;
12847-
12883+ case 2: HALT_NYI;
1284812884 case 4: dsb (cpu); return;
1284912885 case 5: dmb (cpu); return;
1285012886 case 6: isb (cpu); return;
@@ -12855,25 +12891,25 @@ dexSystem (sim_cpu *cpu)
1285512891
1285612892 case 0x3B0:
1285712893 /* MRS Wt, sys-reg. */
12858- /* FIXME: Ignore for now. */
12894+ do_mrs (cpu);
1285912895 return;
1286012896
1286112897 case 0x3B4:
1286212898 case 0x3BD:
1286312899 /* MRS Xt, sys-reg. */
12864- /* FIXME: Ignore for now. */
12900+ do_mrs (cpu);
1286512901 return;
1286612902
1286712903 case 0x0B7:
1286812904 /* DC <type>, x<n>. */
12869- /* FIXME: Ignore for now. */
12905+ HALT_NYI;
1287012906 return;
1287112907
1287212908 default:
12873- if (uimm (aarch64_get_instr (cpu), 21, 20) == 0x1)
12874- /* MSR <sys-reg>, <Xreg>. */
12875- return;
12909+ /* if (uimm (aarch64_get_instr (cpu), 21, 20) == 0x1)
12910+ MRS Xt, sys-reg. */
1287612911 HALT_NYI;
12912+ return;
1287712913 }
1287812914 }
1287912915