Coder Social home page Coder Social logo

easyvm's People

Contributors

dalerkd avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

fcccode

easyvm's Issues

建议下一步是增加: 指针式内存读写指令和ebp指令,及地址范围安全检查.

  1. 如果希望支持自修改
    增加任意内存 和 寄存器 间的指令
    movp2r
    movr2p
    或者用现有指令进行兼容.
  2. ebp相关支持,为了更好地支持call
    对于ebp,ebp+4等指令进行处理,它依赖于自修改.
  • 将ebp列入可操控寄存器
  • 增加ebp+i读写
    能否用其他指令替代?而不用单独增加它?因为这样的指令还有很多eg:esp+i,,,,
  1. 安全:地址范围进行检查

    movp2r
    movr2p
    call
    ret
    incd
    decd
    进行限制.

新的设计建议: 完善指令设计:增加 模式和宽度

对于涉及 立即数 的命令,存在数据宽度的问题.
从内存读和写一个数据的时候会遇到这个问题.

eg:

char* a ="1234";

  • a = 1;
    mov eax, dword ptr [xxx]
    mov dword ptr [xxx],eax
    以及 eax也涉及这个操作.

指令宽度
124
[operator] [reg:dest,source][模式:dest,source] [寄存器宽度,数据宽度] data

宽度上

这样设计有一个问题没有解决:寄存器宽度.如何控制寄存器间宽度?
ah,al我们只支持al,和ax,eax,rax?
1,2,4,8位

模式上

intel支持 mov [eps+4],0x1234
我们不支持....

目标有三种:

立即数做目标地址[]
dest寄存器做目标地址[]
dest寄存器做目标

来源有两种

source寄存器做来源
立即数做来源

综合介绍

我认为这些组的顺序或许可以做更合理的调动.

  1. operator是操作符:一个字节
  2. reg组:一个字节
    reg组中用一个字节定义了两个寄存器,
    高位表达dest寄存器编号,低位表达source寄存器编号.
  3. 模式组:一个字节
    核心是要告知我们采取的模式,我们现在有6种模式,我们需要考虑拓展性.
    第一想法是dest,source的排序.或许会有更好的安排?
  4. 宽度组:一个字节
    高位表示寄存器宽度,低位表示数据的宽度.有1,2,4,8代表byte,word,dword,qword.

这样就能将所有的同种操作合并在一起了.
将以下指令合并成了一条eg:

mov eax,1
mov [eax],0x12345678
mov [eax],[ebx]
mov 0x12345678,eax

展望

除了以上的具体选择改善,其实可以做指令的合并来做改善,
如果将某些指令和另些指令合并压缩在一个数据的位置上.
但这样会导致这些指令难以让人手工编写.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.