Пример #1
0
        public static Mem xmmword_ptr(GPVar @base, int displacement = 0)
        {
            Contract.Requires(@base != null);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return MemPtrBuild(@base, displacement, NAsmJit.Size.DQWORD);
        }
Пример #2
0
        public static Mem xmmword_ptr(GPVar @base, GPVar index, ScalingFactor scalingFactor, int displacement = 0)
        {
            Contract.Requires(@base != null);
            Contract.Requires(index != null);
            Contract.Requires(scalingFactor >= ScalingFactor.Times1 && scalingFactor <= ScalingFactor.Times8);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return MemPtrBuild(@base, index, scalingFactor, displacement, NAsmJit.Size.DQWORD);
        }
Пример #3
0
        public static Mem word_ptr(IntPtr target, GPVar index, ScalingFactor scalingFactor, int displacement = 0, SegmentPrefix segmentPrefix = SegmentPrefix.None)
        {
            Contract.Requires(index != null);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return MemPtrAbs(target, index, scalingFactor, displacement, segmentPrefix, NAsmJit.Size.WORD);
        }
Пример #4
0
        public Mem(GPVar @base, IntPtr displacement, int size = 0)
            : base(size: size)
        {
            if (@base == null)
                throw new ArgumentNullException("base");
            Contract.EndContractBlock();

            _type = MemoryType.Native;
            _segmentPrefix = SegmentPrefix.None;

            _sizePrefix = @base.Size != IntPtr.Size;

            _base = (RegIndex)@base.Id;
            _index = RegIndex.Invalid;
            _scalingFactor = ScalingFactor.Times1;

            _target = IntPtr.Zero;
            _displacement = displacement;
        }
Пример #5
0
        public static Mem ptr(GPVar @base, int displacement = 0)
        {
            Contract.Requires(@base != null);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return MemPtrBuild(@base, displacement, 0);
        }
Пример #6
0
        public static Mem sysint_ptr(GPVar @base, int displacement = 0)
        {
            Contract.Requires(@base != null);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return MemPtrBuild(@base, displacement, (NAsmJit.Size)IntPtr.Size);
        }
Пример #7
0
        public Mem(GPVar @base, GPVar index, ScalingFactor scalingFactor, IntPtr displacement, int size = 0)
            : base(size: size)
        {
            if (@base == null)
                throw new ArgumentNullException("base");
            if (index == null)
                throw new ArgumentNullException("index");
            if (scalingFactor < ScalingFactor.Times1 || scalingFactor > ScalingFactor.Times8)
                throw new ArgumentOutOfRangeException("scalingFactor");
            Contract.EndContractBlock();

            _type = MemoryType.Native;
            _segmentPrefix = SegmentPrefix.None;

            _sizePrefix = @base.Size != IntPtr.Size || index.Size != IntPtr.Size;

            _base = (RegIndex)@base.Id;
            _index = (RegIndex)index.Id;
            _scalingFactor = scalingFactor;

            _target = IntPtr.Zero;
            _displacement = displacement;
        }
Пример #8
0
 private static void GenerateNewException(Compiler c, GPVar dst, Imm code)
 {
     GPVar var = c.NewGP();
     c.Mov(var, code);
     CompilerFunctionCall call = c.Call(AllocateExceptionFunction, CallingConvention.Default, typeof(Func<int, IntPtr>));
     call.SetArgument(0, var);
     call.SetReturn(dst);
 }
Пример #9
0
        private static Mem MemPtrBuild(GPVar @base, int displacement, Size size)
        {
            Contract.Requires(@base != null);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return new Mem(@base, (IntPtr)displacement, (int)size);
        }
Пример #10
0
        public Mem(IntPtr target, GPVar index, ScalingFactor scalingFactor, IntPtr displacement, SegmentPrefix segmentPrefix, int size = 0)
            : base(size: size)
        {
            if (index == null)
                throw new ArgumentNullException("index");
            if (scalingFactor < ScalingFactor.Times1 || scalingFactor > ScalingFactor.Times8)
                throw new ArgumentOutOfRangeException("scalingFactor");
            Contract.EndContractBlock();

            _type = MemoryType.Absolute;
            _segmentPrefix = segmentPrefix;

            _sizePrefix = index.Size != IntPtr.Size;

            _base = RegIndex.Invalid;
            _index = (RegIndex)index.Id;
            _scalingFactor = scalingFactor;

            _target = target;
            _displacement = displacement;
        }
Пример #11
0
 private static void GenerateLoadExceptionMessage(Compiler c, GPVar dst, GPVar exceptionVariable)
 {
     c.Mov(dst, Mem.dword_ptr(exceptionVariable, ExceptionData_CodeOffset));
 }
Пример #12
0
 private static void GenerateLoadCurrentException(Compiler c, GPVar dst, GPVar threadDataVariable)
 {
     GenerateLoadThreadData(c, dst, threadDataVariable);
     c.Mov(dst, Mem.sysint_ptr(dst, ThreadData_ExceptionDataOffset));
 }
Пример #13
0
 private static void GenerateLoadThreadData(Compiler c, GPVar dst, GPVar threadDataVariable)
 {
     c.Mov(dst, threadDataVariable);
 }
Пример #14
0
        private static Mem MemPtrAbs(IntPtr target, GPVar index, ScalingFactor scalingFactor, int displacement, SegmentPrefix segmentPrefix, Size size)
        {
            Contract.Requires(index != null);
            Contract.Requires(scalingFactor >= ScalingFactor.Times1 && scalingFactor <= ScalingFactor.Times8);

            return new Mem(target, index, scalingFactor, (IntPtr)displacement, segmentPrefix, (int)size);
        }
Пример #15
0
        public Mem(Label label, GPVar index, ScalingFactor scalingFactor, IntPtr displacement, int size = 0)
            : this(label, displacement, size)
        {
            if (index == null)
                throw new ArgumentNullException("index");
            if (scalingFactor < ScalingFactor.Times1 || scalingFactor > ScalingFactor.Times8)
                throw new ArgumentOutOfRangeException("scalingFactor");
            Contract.EndContractBlock();

            _index = (RegIndex)index.Id;
            _scalingFactor = scalingFactor;
        }
Пример #16
0
        private static Mem MemPtrBuild(Label label, GPVar index, ScalingFactor scalingFactor, int displacement, Size size)
        {
            Contract.Requires(label != null);
            Contract.Requires(index != null);
            Contract.Requires(scalingFactor >= ScalingFactor.Times1 && scalingFactor <= ScalingFactor.Times8);
            Contract.Ensures(Contract.Result<Mem>() != null);

            return new Mem(label, index, scalingFactor, (IntPtr)displacement, (int)size);
        }
Пример #17
0
 private static void GenerateWriteLine(Compiler c, GPVar value)
 {
     CompilerFunctionCall call = c.Call(WriteIntegerFunction, CallingConvention.Default, typeof(Action<int>));
     call.SetArgument(0, value);
 }