mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 05:11:19 +00:00 
			
		
		
		
	 e517dbc7b2
			
		
	
	
		e517dbc7b2
		
			
		
	
	
	
	
		
			
			Add macro WASM_ENABLE_WORD_ALING_READ to enable reading 1/2/4 and n bytes data from vram buffer, which requires 4-byte addr alignment reading. Eliminate XIP AOT relocations related to the below ones: i32_div_u, f32_min, f32_max, f32_ceil, f32_floor, f32_trunc, f32_rint
		
			
				
	
	
		
			74 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * Copyright (C) 2019 Intel Corporation.  All rights reserved.
 | |
|  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 | |
|  */
 | |
| 
 | |
| #ifndef _BH_COMMON_H
 | |
| #define _BH_COMMON_H
 | |
| 
 | |
| #include "bh_platform.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| #define bh_memcpy_s(dest, dlen, src, slen)                            \
 | |
|     do {                                                              \
 | |
|         int _ret = slen == 0 ? 0 : b_memcpy_s(dest, dlen, src, slen); \
 | |
|         (void)_ret;                                                   \
 | |
|         bh_assert(_ret == 0);                                         \
 | |
|     } while (0)
 | |
| 
 | |
| #define bh_memcpy_wa(dest, dlen, src, slen)                            \
 | |
|     do {                                                               \
 | |
|         int _ret = slen == 0 ? 0 : b_memcpy_wa(dest, dlen, src, slen); \
 | |
|         (void)_ret;                                                    \
 | |
|         bh_assert(_ret == 0);                                          \
 | |
|     } while (0)
 | |
| 
 | |
| #define bh_memmove_s(dest, dlen, src, slen)                            \
 | |
|     do {                                                               \
 | |
|         int _ret = slen == 0 ? 0 : b_memmove_s(dest, dlen, src, slen); \
 | |
|         (void)_ret;                                                    \
 | |
|         bh_assert(_ret == 0);                                          \
 | |
|     } while (0)
 | |
| 
 | |
| #define bh_strcat_s(dest, dlen, src)            \
 | |
|     do {                                        \
 | |
|         int _ret = b_strcat_s(dest, dlen, src); \
 | |
|         (void)_ret;                             \
 | |
|         bh_assert(_ret == 0);                   \
 | |
|     } while (0)
 | |
| 
 | |
| #define bh_strcpy_s(dest, dlen, src)            \
 | |
|     do {                                        \
 | |
|         int _ret = b_strcpy_s(dest, dlen, src); \
 | |
|         (void)_ret;                             \
 | |
|         bh_assert(_ret == 0);                   \
 | |
|     } while (0)
 | |
| 
 | |
| int
 | |
| b_memcpy_s(void *s1, unsigned int s1max, const void *s2, unsigned int n);
 | |
| int
 | |
| b_memcpy_wa(void *s1, unsigned int s1max, const void *s2, unsigned int n);
 | |
| int
 | |
| b_memmove_s(void *s1, unsigned int s1max, const void *s2, unsigned int n);
 | |
| int
 | |
| b_strcat_s(char *s1, unsigned int s1max, const char *s2);
 | |
| int
 | |
| b_strcpy_s(char *s1, unsigned int s1max, const char *s2);
 | |
| 
 | |
| /* strdup with string allocated by BH_MALLOC */
 | |
| char *
 | |
| bh_strdup(const char *s);
 | |
| 
 | |
| /* strdup with string allocated by WA_MALLOC */
 | |
| char *
 | |
| wa_strdup(const char *s);
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif
 |