2017-07-10 17:42:10 +02:00
|
|
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
|
|
|
// This file is part of Parity.
|
|
|
|
|
|
|
|
// Parity is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// Parity 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 General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
//! Wasm env module bindings
|
|
|
|
|
|
|
|
use parity_wasm::elements::ValueType::*;
|
|
|
|
use parity_wasm::interpreter::UserFunctionDescriptor;
|
|
|
|
use parity_wasm::interpreter::UserFunctionDescriptor::*;
|
|
|
|
|
|
|
|
pub const SIGNATURES: &'static [UserFunctionDescriptor] = &[
|
|
|
|
Static(
|
|
|
|
"_storage_read",
|
|
|
|
&[I32; 2],
|
|
|
|
Some(I32),
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_storage_write",
|
|
|
|
&[I32; 2],
|
|
|
|
Some(I32),
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_malloc",
|
|
|
|
&[I32],
|
|
|
|
Some(I32),
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_free",
|
|
|
|
&[I32],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"gas",
|
|
|
|
&[I32],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_debug",
|
|
|
|
&[I32; 2],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_suicide",
|
|
|
|
&[I32],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_create",
|
|
|
|
&[I32; 4],
|
|
|
|
Some(I32),
|
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"_ccall",
|
|
|
|
&[I32; 6],
|
|
|
|
Some(I32),
|
2017-07-10 17:42:10 +02:00
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"_dcall",
|
|
|
|
&[I32; 5],
|
|
|
|
Some(I32),
|
2017-07-10 17:42:10 +02:00
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"_scall",
|
|
|
|
&[I32; 5],
|
|
|
|
Some(I32),
|
2017-07-10 17:42:10 +02:00
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"abort",
|
2017-07-10 17:42:10 +02:00
|
|
|
&[I32],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"_abort",
|
|
|
|
&[],
|
2017-07-10 17:42:10 +02:00
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_rust_begin_unwind",
|
|
|
|
&[I32; 4],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"_emscripten_memcpy_big",
|
|
|
|
&[I32; 3],
|
2017-07-10 17:42:10 +02:00
|
|
|
Some(I32),
|
|
|
|
),
|
|
|
|
Static(
|
2017-07-24 16:45:15 +02:00
|
|
|
"___syscall6",
|
|
|
|
&[I32; 2],
|
2017-07-10 17:42:10 +02:00
|
|
|
Some(I32),
|
2017-07-27 14:36:55 +02:00
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"___syscall140",
|
|
|
|
&[I32; 2],
|
|
|
|
Some(I32)
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"___syscall146",
|
|
|
|
&[I32; 2],
|
|
|
|
Some(I32)
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"___syscall54",
|
|
|
|
&[I32; 2],
|
|
|
|
Some(I32)
|
|
|
|
),
|
|
|
|
Static(
|
|
|
|
"_llvm_trap",
|
|
|
|
&[I32; 0],
|
|
|
|
None
|
|
|
|
),
|
2017-07-10 17:42:10 +02:00
|
|
|
];
|