Import a basic instruction set for Ethereum
This commit is contained in:
parent
60360d1418
commit
b911c946f2
|
@ -38,9 +38,7 @@ static AsmArchRegister const _eth_registers[] =
|
|||
|
||||
static AsmArchInstruction const _eth_instructions[] =
|
||||
{
|
||||
#if 0
|
||||
# include "eth.ins"
|
||||
#endif
|
||||
#include "eth.ins"
|
||||
#include "common.ins"
|
||||
#include "null.ins"
|
||||
};
|
||||
|
|
154
src/arch/eth.ins
Normal file
154
src/arch/eth.ins
Normal file
|
@ -0,0 +1,154 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
/* helpers */
|
||||
/* opcodes */
|
||||
#define OP1F (8 << AOD_SIZE)
|
||||
|
||||
|
||||
/* instructions */
|
||||
{ "stop", 0x00, OP1F, AO_0() },
|
||||
{ "add", 0x01, OP1F, AO_0() },
|
||||
{ "mul", 0x02, OP1F, AO_0() },
|
||||
{ "sub", 0x03, OP1F, AO_0() },
|
||||
{ "div", 0x04, OP1F, AO_0() },
|
||||
{ "sdiv", 0x05, OP1F, AO_0() },
|
||||
{ "mod", 0x06, OP1F, AO_0() },
|
||||
{ "smod", 0x07, OP1F, AO_0() },
|
||||
{ "addmod", 0x08, OP1F, AO_0() },
|
||||
{ "submod", 0x09, OP1F, AO_0() },
|
||||
{ "exp", 0x0a, OP1F, AO_0() },
|
||||
{ "signextend", 0x0b, OP1F, AO_0() },
|
||||
{ "lt", 0x10, OP1F, AO_0() },
|
||||
{ "gt", 0x11, OP1F, AO_0() },
|
||||
{ "slt", 0x12, OP1F, AO_0() },
|
||||
{ "sgt", 0x13, OP1F, AO_0() },
|
||||
{ "eq", 0x14, OP1F, AO_0() },
|
||||
{ "iszero", 0x15, OP1F, AO_0() },
|
||||
{ "and", 0x16, OP1F, AO_0() },
|
||||
{ "or", 0x17, OP1F, AO_0() },
|
||||
{ "xor", 0x18, OP1F, AO_0() },
|
||||
{ "not", 0x19, OP1F, AO_0() },
|
||||
{ "byte", 0x1a, OP1F, AO_0() },
|
||||
{ "address", 0x30, OP1F, AO_0() },
|
||||
{ "origin", 0x32, OP1F, AO_0() },
|
||||
{ "caller", 0x33, OP1F, AO_0() },
|
||||
{ "callvalue", 0x34, OP1F, AO_0() },
|
||||
{ "calldataload",0x35,OP1F, AO_0() },
|
||||
{ "calldatasize",0x36,OP1F, AO_0() },
|
||||
{ "calldatacopy",0x37,OP1F, AO_0() },
|
||||
{ "callsize", 0x38, OP1F, AO_0() },
|
||||
{ "callcopy", 0x39, OP1F, AO_0() },
|
||||
{ "gasprice", 0x3a, OP1F, AO_0() },
|
||||
{ "extcodesize",0x3b, OP1F, AO_0() },
|
||||
{ "extcodecopy",0x3c, OP1F, AO_0() },
|
||||
{ "blockhash", 0x40, OP1F, AO_0() },
|
||||
{ "coinbase", 0x41, OP1F, AO_0() },
|
||||
{ "timestamp", 0x42, OP1F, AO_0() },
|
||||
{ "number", 0x43, OP1F, AO_0() },
|
||||
{ "difficulty", 0x44, OP1F, AO_0() },
|
||||
{ "gaslimit", 0x45, OP1F, AO_0() },
|
||||
{ "pop", 0x50, OP1F, AO_0() },
|
||||
{ "mload", 0x51, OP1F, AO_0() },
|
||||
{ "mstore", 0x52, OP1F, AO_0() },
|
||||
{ "mstore8", 0x53, OP1F, AO_0() },
|
||||
{ "sload", 0x54, OP1F, AO_0() },
|
||||
{ "sstore", 0x55, OP1F, AO_0() },
|
||||
{ "jump", 0x56, OP1F, AO_0() },
|
||||
{ "jumpi", 0x57, OP1F, AO_0() },
|
||||
{ "pc", 0x58, OP1F, AO_0() },
|
||||
{ "msize", 0x59, OP1F, AO_0() },
|
||||
{ "gas", 0x5a, OP1F, AO_0() },
|
||||
{ "jumpdest", 0x5b, OP1F, AO_0() },
|
||||
{ "push1", 0x60, OP1F, AO_0() },
|
||||
{ "push2", 0x61, OP1F, AO_0() },
|
||||
{ "push3", 0x62, OP1F, AO_0() },
|
||||
{ "push4", 0x63, OP1F, AO_0() },
|
||||
{ "push5", 0x64, OP1F, AO_0() },
|
||||
{ "push6", 0x65, OP1F, AO_0() },
|
||||
{ "push7", 0x66, OP1F, AO_0() },
|
||||
{ "push8", 0x67, OP1F, AO_0() },
|
||||
{ "push9", 0x68, OP1F, AO_0() },
|
||||
{ "push10", 0x69, OP1F, AO_0() },
|
||||
{ "push11", 0x6a, OP1F, AO_0() },
|
||||
{ "push12", 0x6b, OP1F, AO_0() },
|
||||
{ "push13", 0x6c, OP1F, AO_0() },
|
||||
{ "push14", 0x6d, OP1F, AO_0() },
|
||||
{ "push15", 0x6e, OP1F, AO_0() },
|
||||
{ "push16", 0x6f, OP1F, AO_0() },
|
||||
{ "push17", 0x70, OP1F, AO_0() },
|
||||
{ "push18", 0x71, OP1F, AO_0() },
|
||||
{ "push19", 0x72, OP1F, AO_0() },
|
||||
{ "push20", 0x73, OP1F, AO_0() },
|
||||
{ "push21", 0x74, OP1F, AO_0() },
|
||||
{ "push22", 0x75, OP1F, AO_0() },
|
||||
{ "push23", 0x76, OP1F, AO_0() },
|
||||
{ "push24", 0x77, OP1F, AO_0() },
|
||||
{ "push25", 0x78, OP1F, AO_0() },
|
||||
{ "push26", 0x79, OP1F, AO_0() },
|
||||
{ "push27", 0x7a, OP1F, AO_0() },
|
||||
{ "push28", 0x7b, OP1F, AO_0() },
|
||||
{ "push29", 0x7c, OP1F, AO_0() },
|
||||
{ "push30", 0x7d, OP1F, AO_0() },
|
||||
{ "push31", 0x7e, OP1F, AO_0() },
|
||||
{ "push32", 0x7f, OP1F, AO_0() },
|
||||
{ "dup1", 0x80, OP1F, AO_0() },
|
||||
{ "dup2", 0x81, OP1F, AO_0() },
|
||||
{ "dup3", 0x82, OP1F, AO_0() },
|
||||
{ "dup4", 0x83, OP1F, AO_0() },
|
||||
{ "dup5", 0x84, OP1F, AO_0() },
|
||||
{ "dup6", 0x85, OP1F, AO_0() },
|
||||
{ "dup7", 0x86, OP1F, AO_0() },
|
||||
{ "dup8", 0x87, OP1F, AO_0() },
|
||||
{ "dup9", 0x88, OP1F, AO_0() },
|
||||
{ "dup10", 0x89, OP1F, AO_0() },
|
||||
{ "dup11", 0x8a, OP1F, AO_0() },
|
||||
{ "dup12", 0x8b, OP1F, AO_0() },
|
||||
{ "dup13", 0x8c, OP1F, AO_0() },
|
||||
{ "dup14", 0x8d, OP1F, AO_0() },
|
||||
{ "dup15", 0x8e, OP1F, AO_0() },
|
||||
{ "dup16", 0x8f, OP1F, AO_0() },
|
||||
{ "swap1", 0x90, OP1F, AO_0() },
|
||||
{ "swap2", 0x91, OP1F, AO_0() },
|
||||
{ "swap3", 0x92, OP1F, AO_0() },
|
||||
{ "swap4", 0x93, OP1F, AO_0() },
|
||||
{ "swap5", 0x94, OP1F, AO_0() },
|
||||
{ "swap6", 0x95, OP1F, AO_0() },
|
||||
{ "swap7", 0x96, OP1F, AO_0() },
|
||||
{ "swap8", 0x97, OP1F, AO_0() },
|
||||
{ "swap9", 0x98, OP1F, AO_0() },
|
||||
{ "swap10", 0x99, OP1F, AO_0() },
|
||||
{ "swap11", 0x9a, OP1F, AO_0() },
|
||||
{ "swap12", 0x9b, OP1F, AO_0() },
|
||||
{ "swap13", 0x9c, OP1F, AO_0() },
|
||||
{ "swap14", 0x9d, OP1F, AO_0() },
|
||||
{ "swap15", 0x9e, OP1F, AO_0() },
|
||||
{ "swap16", 0x9f, OP1F, AO_0() },
|
||||
{ "log0", 0xa0, OP1F, AO_0() },
|
||||
{ "log1", 0xa1, OP1F, AO_0() },
|
||||
{ "log2", 0xa2, OP1F, AO_0() },
|
||||
{ "log3", 0xa3, OP1F, AO_0() },
|
||||
{ "log4", 0xa4, OP1F, AO_0() },
|
||||
{ "push", 0xb0, OP1F, AO_0() },
|
||||
{ "dup", 0xb1, OP1F, AO_0() },
|
||||
{ "swap", 0xb2, OP1F, AO_0() },
|
||||
{ "create", 0xf0, OP1F, AO_0() },
|
||||
{ "call", 0xf1, OP1F, AO_0() },
|
||||
{ "callcode", 0xf2, OP1F, AO_0() },
|
||||
{ "return", 0xf3, OP1F, AO_0() },
|
||||
{ "delegatecall",0xf4,OP1F, AO_0() },
|
||||
{ "selfdestruct",0xff,OP1F, AO_0() },
|
|
@ -50,7 +50,7 @@ type=plugin
|
|||
sources=eth.c
|
||||
|
||||
[eth.c]
|
||||
depends=common.ins,null.ins
|
||||
depends=common.ins,eth.ins,null.ins
|
||||
|
||||
[i386]
|
||||
type=plugin
|
||||
|
|
Loading…
Reference in New Issue
Block a user