嵌入式虚拟机 CarpVM

GPLv3
C/C++
Linux
2014-08-05
红薯

CarpVM 是一个用 C 语言编写的小型虚拟机。可以嵌入在应用程序中使用。

包含的指令集有:

  • HALT (code): Halts and attempts to clean up stack, data memory, and label memory before exiting with given exit code.

  • NOP (): Does nothing. Seriously.

  • LOAD (reg, val): Loads given integer value into given register.

  • MOV (dst, src): Copies contents of src register into dst register.

  • ADD (): Pops the top two integers from the stack and pushes their sum.

  • SUB (): Pops the top two integers from the stack and pushes the difference (lower minus upper).

  • MUL (): Pops the top two integers from the stack and pushes their product.

  • MOD (rega, regb): Computes rega % regb and stores in ERX.

  • NOT (reg): Computes bitwise NOT of reg and stores in reg.

  • XOR (): Pops the top two integers from the stack and XORs them.

  • OR (): Pops the top two integers from the stack and ORs them.

  • AND (): Pops the top two integers from the stack and ANDs them.

  • INCR (reg): Increments value in given register.

  • DECR (reg): Decrements value in given register.

  • INC (): Increments the value at the top of the stack.

  • DEC (): Decrements the value at the top of the stack.

  • PUSHR (reg): Pushes value in given register.

  • PUSH (val): Pushes given value.

  • POP (val): Pops an integer from the stack and dumps it into GBG.

  • CMP (): Pops the top two integers from the stack and checks if equal. 0 means equal. Result will be pushed onto the stack.

  • MOV (rega, regb): Move value in rega to regb.

  • JZ (addr): Jumps to given absolute address if top of the stack is 0.

  • RJZ (diff): Adds differential to current EIP (relative jump) if top of the stack is 0.

  • JNZ (addr): Jumps to given absolute address if top of the stack is not 0.

  • RJNZ (diff): Adds differential to current EIP (relative jump) if top of the stack is not 0.

  • JMP (addr): Jumps to given absolute address.

  • RJMP (diff): Adds differential to current EIP (relative jump).

  • DBS (key, val): Sets data memory at key (string pointer) to given value.

  • DBG (key, reg): Gets value from data memory at key (string pointer) and dumps it into given register.

  • CALL (key, nargs): Save state and set EIP to value in data memory at key.

  • RET (val): Push return value and load state.

  • PREG (reg): Prints contents of given register.

  • PTOP (): Peeks top of stack and prints top value.

加载中

评论(0)

暂无评论

暂无资讯

暂无问答

C++开源库

关于 C++ 框架、库和资源的一些汇总列表

2014/10/10 13:38
379
3
站在巨人的肩膀上,C++开源库大全

程序员要站在巨人的肩膀上,C++拥有丰富的开源库,这里包括:标准库、Web应用框架、人工智能、数据库、图片处理、机器学习、日志、代码分析等。 标准库 C++ Standard Library:是一系列类和函...

2014/11/14 09:34
337
0
推荐!国外程序员整理的 C++ 资源大全

本文由 伯乐在线 - JingerJoe 翻译自 fffaraz。未经许可,禁止转载! 欢迎加入:翻译小组,通过 翻译频道 贡献一份力量。 关于 C++ 框架、库和资源的一些汇总列表,由 fffaraz 发起和维护。 ...

2014/10/28 08:57
836
2
国外程序员整理的 C++ 资源大全

摘要:C++是在C语言的基础上开发的一种集面向对象编程、泛型编程和过程化编程于一体的编程语言。应用较为广泛,是一种静态数据类型检查的,支持多重编程的通用程序设计语言。 关于 C++ 框架、...

07/26 11:32
20
0
[C++] 分享国外程序员的 C++开发资源大全

、Web应用框架、人工智能、数据库、图片处理、机器学习、日志、代码分析等。 标准库 C++ Standard Library:是一系列类和函数的集合,使用核心语言编写,也是C++ISO自身标准的一部分。 Stan...

07/24 16:25
20
0
C++开源库大全

C++开源库大全 程序员要站在巨人的肩膀上,C++拥有丰富的开源库,这里包括:标准库、Web应用框架、人工智能、数据库、图片处理、机器学习、日志、代码分析等。 标准库 C++ Standard Library...

2016/10/15 19:25
258
0
C++ 资源大全

C++ 资源大全 http://www.uml.org.cn/c++/201411145.asp http://ezlippi.com/blog/2014/12/c-open-project.html 《C++ 并发编程指南》 关于 C++ 框架、库和资源的一些汇总列表,由 fffaraz发...

2016/12/05 13:37
203
0

没有更多内容

加载失败,请刷新页面

返回顶部
顶部