Ejemplo n.º 1
0
        protected Word GetAnyPointerArg(Word word, AddressMapper mapper)
        {
            switch (word.Type)
            {
            case WordType.Value:
                return(new Word(WordType.AbsoluteAddr, mapper.Remap(word.Value)));

            case WordType.AbsoluteAddr:
            case WordType.RelativeAddr:
                return(word);

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 2
0
        protected Word GetAbsoluteArg(Word word, AddressMapper mapper)
        {
            if (word.Type != WordType.AbsoluteAddr)
            {
                if (word.Type == WordType.Value)
                {
                    return(new Word(WordType.AbsoluteAddr, mapper.Remap(word.Value)));
                }
                else
                {
                    throw new InvalidDataException(string.Format("hook {0} requested an absolute address argument, but got {1}", this, word));
                }
            }

            return(word);
        }
Ejemplo n.º 3
0
    public uint Remap(uint input)
    {
        if (Base != null)
        {
            input = Base.Remap(input);
        }

        foreach (var mapping in _mappings)
        {
            if (input >= mapping.start && input <= mapping.end)
            {
                return((uint)(input + mapping.delta));
            }
        }

        return(input);
    }
Ejemplo n.º 4
0
 public void LinkStatic(uint baseAddress, Dictionary <string, uint> externalSymbols)
 {
     _baseAddress = new Word(WordType.AbsoluteAddr, Mapper.Remap(baseAddress));
     DoLink(externalSymbols);
 }