Skip to content

Conversation

@wenyongh
Copy link

No description provided.

wenyongh added 24 commits May 17, 2019 06:26
Sync up with main repo
Sync up with main repo
Sync up with main repo
add support for AliOS Things (#34)
Implement memory profiler, optimize memory usage, modify code indent …
…iwasm build type to Release and 64 bit by default
Implement memory.grow and limit heap space base offset to 1G (#36)
Sync up with main repo
Add a new extension library: connection (#39)
Fix bug of reading magic number and version in big endian platform (#41)
Add support for VxWorks (#43)
Re-org platform APIs: move most platform APIs of iwasm to shared-lib …
Implement 2D graphic API (#87)
Sync up with main repo
Enhance wasm loader to fix some security issues (#91)
Sync up with main repo
Fix issue about illegal load of EXC_RETURN into PC on stm32 board (#98)
@cmickeyb
Copy link
Owner

merging this (passes all my tests). however, putting an sgx specific file into the libc runtime directory seems inconsistent with putting all platform specific code into one of the product directories. i'll let you figure out the clean way to make it work. just happy to have something i can use!!!!

@cmickeyb cmickeyb merged commit ad3c0f2 into cmickeyb:master Aug 19, 2019
@wenyongh
Copy link
Author

OK, it is a temporary method to enable the code. I am confused why you add macros OPS_INPUT_OUTPUT and OPS_UNSAFE_BUFFERS in file libc_wrappe.c, the memory buffer allocated in this file is also inside Enclave, it is allocated from the wasm app heap, which is inside Enclave. So the buffer should be safe.
I suggest to use the normal version of libc_wrapper.c, modify several places of printf to bh_printf, and comment the code using stdout/stdin/stderr, and have a try.

@cmickeyb
Copy link
Owner

cmickeyb commented Aug 20, 2019 via email

@wenyongh
Copy link
Author

For the printf like wrapper functions, including printf/sprintf/snprintf/puts/putchar, they actually don't use stdout/stderr, they call printf function. So could you remove OPS_INPUT_OUTPUT for them, and just modify calling printf to calling bh_printf?

The stdout and stderr are only used in function wasm_native_global_lookup(), you can add macro to comment them.

It is really difficult to check the string length for str* functions, if we check their characters one by one, the performance will be not so good. So if you want, you can add a macro to comment them.

Actually you didn't modify the implementation of these functions, so I suggest to use the same libc_wrapper.c file, and:
(1) modify printf to bh_printf
(2) add macro for some places, using #ifndef but not #ifdef, so by default the code is enabled. If you want to disable them, just add_definitions(macro) in your CMakeLists.txt.

What's your opinion?

cmickeyb pushed a commit that referenced this pull request Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants