示例#1
0
        public static void Mrs(ArmEmitterContext context)
        {
            OpCodeSystem op = (OpCodeSystem)context.CurrOp;

            Delegate dlg;

            switch (GetPackedId(op))
            {
            case 0b11_011_0000_0000_001: dlg = new _U64(NativeInterface.GetCtrEl0);    break;

            case 0b11_011_0000_0000_111: dlg = new _U64(NativeInterface.GetDczidEl0);  break;

            case 0b11_011_0100_0010_000: EmitGetNzcv(context);                         return;

            case 0b11_011_0100_0100_000: dlg = new _U64(NativeInterface.GetFpcr);      break;

            case 0b11_011_0100_0100_001: dlg = new _U64(NativeInterface.GetFpsr);      break;

            case 0b11_011_1101_0000_010: dlg = new _U64(NativeInterface.GetTpidrEl0);  break;

            case 0b11_011_1101_0000_011: dlg = new _U64(NativeInterface.GetTpidr);     break;

            case 0b11_011_1110_0000_000: dlg = new _U64(NativeInterface.GetCntfrqEl0); break;

            case 0b11_011_1110_0000_001: dlg = new _U64(NativeInterface.GetCntpctEl0); break;

            default: throw new NotImplementedException($"Unknown MRS 0x{op.RawOpCode:X8} at 0x{op.Address:X16}.");
            }

            SetIntOrZR(context, op.Rt, context.Call(dlg));
        }
示例#2
0
        public static void Mrrc(ArmEmitterContext context)
        {
            OpCode32System op = (OpCode32System)context.CurrOp;

            if (op.Coproc != 15)
            {
                throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}.");
            }

            var opc = op.MrrcOp;

            Delegate dlg;

            switch (op.CRm)
            {
            case 14:     // Timer.
                switch (opc)
                {
                case 0:
                    dlg = new _U64(NativeInterface.GetCntpctEl0); break;

                default:
                    throw new NotImplementedException($"Unknown MRRC Opc1 0x{opc:X16} at 0x{op.Address:X16}.");
                }
                break;

            default:
                throw new NotImplementedException($"Unknown MRRC 0x{op.RawOpCode:X8} at 0x{op.Address:X16}.");
            }

            Operand result = context.Call(dlg);

            SetIntA32(context, op.Rt, context.ConvertI64ToI32(result));
            SetIntA32(context, op.CRn, context.ConvertI64ToI32(context.ShiftRightUI(result, Const(32))));
        }