WebAssembly Micro Runtime first version
This commit is contained in:
34
core/iwasm/runtime/platform/include/wasm_assert.h
Normal file
34
core/iwasm/runtime/platform/include/wasm_assert.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_ASSERT_H
|
||||
#define _WASM_ASSERT_H
|
||||
|
||||
#include "bh_assert.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define wasm_assert bh_assert
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _WASM_ASSERT_H */
|
||||
|
||||
23
core/iwasm/runtime/platform/include/wasm_config.h
Normal file
23
core/iwasm/runtime/platform/include/wasm_config.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_CONFIG_H
|
||||
#define _WASM_CONFIG_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#endif /* end of _WASM_CONFIG_H */
|
||||
|
||||
34
core/iwasm/runtime/platform/include/wasm_memory.h
Normal file
34
core/iwasm/runtime/platform/include/wasm_memory.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_MEMORY_H
|
||||
#define _WASM_MEMORY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "bh_memory.h"
|
||||
|
||||
#define wasm_malloc bh_malloc
|
||||
#define wasm_free bh_free
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _WASM_MEMORY_H */
|
||||
|
||||
24
core/iwasm/runtime/platform/include/wasm_platform_log.h
Normal file
24
core/iwasm/runtime/platform/include/wasm_platform_log.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_PLATFORM_LOG
|
||||
#define _WASM_PLATFORM_LOG
|
||||
|
||||
#define wasm_printf printf
|
||||
|
||||
#define wasm_vprintf vprintf
|
||||
|
||||
#endif /* _WASM_PLATFORM_LOG */
|
||||
63
core/iwasm/runtime/platform/include/wasm_thread.h
Normal file
63
core/iwasm/runtime/platform/include/wasm_thread.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file wasm_thread.h
|
||||
* @brief This file contains Beihai platform abstract layer interface for
|
||||
* thread relative function.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_THREAD_H
|
||||
#define _WASM_THREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "bh_thread.h"
|
||||
|
||||
|
||||
#define ws_thread_sys_init vm_thread_sys_init
|
||||
|
||||
#define ws_thread_sys_destroy vm_thread_sys_destroy
|
||||
|
||||
#define ws_self_thread vm_self_thread
|
||||
|
||||
#define ws_tls_put(ptr) vm_tls_put(0, ptr)
|
||||
|
||||
#define ws_tls_get() vm_tls_get(0)
|
||||
|
||||
static inline int
|
||||
ws_mutex_init(korp_mutex *mutex, bool is_recursive)
|
||||
{
|
||||
if (is_recursive)
|
||||
return vm_recursive_mutex_init(mutex);
|
||||
else
|
||||
return vm_mutex_init(mutex);
|
||||
}
|
||||
|
||||
#define ws_mutex_destroy vm_mutex_destroy
|
||||
|
||||
#define ws_mutex_lock vm_mutex_lock
|
||||
|
||||
#define ws_mutex_unlock vm_mutex_unlock
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _WASM_THREAD_H */
|
||||
|
||||
38
core/iwasm/runtime/platform/include/wasm_types.h
Normal file
38
core/iwasm/runtime/platform/include/wasm_types.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_TYPES_H
|
||||
#define _WASM_TYPES_H
|
||||
|
||||
#include "wasm_config.h"
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef char int8;
|
||||
typedef unsigned short uint16;
|
||||
typedef short int16;
|
||||
typedef unsigned int uint32;
|
||||
typedef int int32;
|
||||
|
||||
#include "wasm_platform.h"
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#endif /* end of _WASM_TYPES_H */
|
||||
|
||||
Reference in New Issue
Block a user