Exemplo n.º 1
0
        public static void Vmsr(ArmEmitterContext context)
        {
            OpCode32SimdSpecial op = (OpCode32SimdSpecial)context.CurrOp;

            Delegate dlg;

            switch (op.Sreg)
            {
            case 0b0000:     // FPSID
                throw new NotImplementedException("Supervisor Only");

            case 0b0001:     // FPSCR
                dlg = new _Void_U32(NativeInterface.SetFpscr); break;

            case 0b0101:     // MVFR2
                throw new NotImplementedException("MVFR2");

            case 0b0110:     // MVFR1
                throw new NotImplementedException("MVFR1");

            case 0b0111:     // MVFR0
                throw new NotImplementedException("MVFR0");

            case 0b1000:     // FPEXC
                throw new NotImplementedException("Supervisor Only");

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

            context.Call(dlg, GetIntA32(context, op.Rt));
        }
Exemplo n.º 2
0
        private static void EmitSetFpscr(ArmEmitterContext context)
        {
            OpCode32SimdSpecial op = (OpCode32SimdSpecial)context.CurrOp;

            Operand t = GetIntA32(context, op.Rt);

            Operand v = context.ShiftRightUI(t, Const((int)FPState.VFlag));

            v = context.BitwiseAnd(v, Const(1));

            Operand c = context.ShiftRightUI(t, Const((int)FPState.CFlag));

            c = context.BitwiseAnd(c, Const(1));

            Operand z = context.ShiftRightUI(t, Const((int)FPState.ZFlag));

            z = context.BitwiseAnd(z, Const(1));

            Operand n = context.ShiftRightUI(t, Const((int)FPState.NFlag));

            n = context.BitwiseAnd(n, Const(1));

            SetFpFlag(context, FPState.VFlag, v);
            SetFpFlag(context, FPState.CFlag, c);
            SetFpFlag(context, FPState.ZFlag, z);
            SetFpFlag(context, FPState.NFlag, n);

            context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.SetFpscr)), t);
        }
Exemplo n.º 3
0
        public static void Vmsr(ArmEmitterContext context)
        {
            OpCode32SimdSpecial op = (OpCode32SimdSpecial)context.CurrOp;

            switch (op.Sreg)
            {
            case 0b0000:     // FPSID
                throw new NotImplementedException("Supervisor Only");

            case 0b0001:     // FPSCR
                EmitSetFpscr(context); return;

            case 0b0101:     // MVFR2
                throw new NotImplementedException("MVFR2");

            case 0b0110:     // MVFR1
                throw new NotImplementedException("MVFR1");

            case 0b0111:     // MVFR0
                throw new NotImplementedException("MVFR0");

            case 0b1000:     // FPEXC
                throw new NotImplementedException("Supervisor Only");

            default:
                throw new NotImplementedException($"Unknown VMSR 0x{op.RawOpCode:X8} at 0x{op.Address:X16}.");
            }
        }
Exemplo n.º 4
0
        private static void EmitGetFpscr(ArmEmitterContext context)
        {
            OpCode32SimdSpecial op = (OpCode32SimdSpecial)context.CurrOp;

            Operand vSh = context.ShiftLeft(GetFpFlag(FPState.VFlag), Const((int)FPState.VFlag));
            Operand cSh = context.ShiftLeft(GetFpFlag(FPState.CFlag), Const((int)FPState.CFlag));
            Operand zSh = context.ShiftLeft(GetFpFlag(FPState.ZFlag), Const((int)FPState.ZFlag));
            Operand nSh = context.ShiftLeft(GetFpFlag(FPState.NFlag), Const((int)FPState.NFlag));

            Operand nzcvSh = context.BitwiseOr(context.BitwiseOr(nSh, zSh), context.BitwiseOr(cSh, vSh));

            Operand fpscr = context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.GetFpscr)));

            SetIntA32(context, op.Rt, context.BitwiseOr(nzcvSh, fpscr));
        }
Exemplo n.º 5
0
        public static void Vmrs(ArmEmitterContext context)
        {
            OpCode32SimdSpecial op = (OpCode32SimdSpecial)context.CurrOp;

            if (op.Rt == RegisterAlias.Aarch32Pc && op.Sreg == 0b0001)
            {
                // Special behavior: copy NZCV flags into APSR.
                SetFlag(context, PState.VFlag, GetFpFlag(FPState.VFlag));
                SetFlag(context, PState.CFlag, GetFpFlag(FPState.CFlag));
                SetFlag(context, PState.ZFlag, GetFpFlag(FPState.ZFlag));
                SetFlag(context, PState.NFlag, GetFpFlag(FPState.NFlag));

                return;
            }

            MethodInfo info;

            switch (op.Sreg)
            {
            case 0b0000:     // FPSID
                throw new NotImplementedException("Supervisor Only");

            case 0b0001:     // FPSCR
                info = typeof(NativeInterface).GetMethod(nameof(NativeInterface.GetFpscr)); break;

            case 0b0101:     // MVFR2
                throw new NotImplementedException("MVFR2");

            case 0b0110:     // MVFR1
                throw new NotImplementedException("MVFR1");

            case 0b0111:     // MVFR0
                throw new NotImplementedException("MVFR0");

            case 0b1000:     // FPEXC
                throw new NotImplementedException("Supervisor Only");

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

            SetIntA32(context, op.Rt, context.Call(info));
        }