mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 06:55:07 +00:00
Re-implement invokeNative function of arm/mips/general version (#125)
Re-implement them due to the function prototype was changed. Fix typo of sample/gui/README.
This commit is contained in:
parent
42dc2d65a1
commit
2fca3aa3f5
|
@ -21,16 +21,16 @@
|
|||
/*
|
||||
* Arguments passed in:
|
||||
*
|
||||
* r0 argv
|
||||
* r1 argc
|
||||
* r2 function pntr
|
||||
* r0 function pntr
|
||||
* r1 argv
|
||||
* r2 argc
|
||||
*/
|
||||
|
||||
invokeNative:
|
||||
stmfd sp!, {r4, r5, r6, r7, lr}
|
||||
mov r4, r0 /* get argv */
|
||||
mov r5, r1 /* get argc */
|
||||
mov ip, r2 /* get function ptr */
|
||||
mov ip, r0 /* get function ptr */
|
||||
mov r4, r1 /* get argv */
|
||||
mov r5, r2 /* get argc */
|
||||
|
||||
cmp r5, #2 /* is argc < 2 ? */
|
||||
blt return
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "wasm_runtime.h"
|
||||
|
||||
void invokeNative(uint32 argv[], uint32 argc, void (*native_code)())
|
||||
void invokeNative(void (*native_code)(), uint32 argv[], uint32 argc)
|
||||
{
|
||||
WASMThread *self;
|
||||
switch(argc) {
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
/**
|
||||
* On function entry parameters:
|
||||
* $4 = args
|
||||
* $5 = arg_num
|
||||
* $6 = func_ptr
|
||||
* $4 = func_ptr
|
||||
* $5 = args
|
||||
* $6 = arg_num
|
||||
*/
|
||||
|
||||
invokeNative:
|
||||
|
@ -43,22 +43,22 @@ invokeNative:
|
|||
move $fp, $sp
|
||||
|
||||
/* allocate enough stack space */
|
||||
sll $11, $5, 2
|
||||
sll $11, $6, 2 /* $11 == arg_num * 4 */
|
||||
subu $sp, $11
|
||||
|
||||
/* make 8-byte aligned */
|
||||
and $sp, ~7
|
||||
and $sp, ~7
|
||||
|
||||
move $9, $sp
|
||||
move $25, $6 /* $25 = func_ptr */
|
||||
move $25, $4 /* $25 = func_ptr */
|
||||
|
||||
push_args:
|
||||
beq $5, 0, done /* arg_num == 0 ? */
|
||||
lw $8, 0($4)
|
||||
sw $8, 0($9)
|
||||
addu $4, 4
|
||||
addu $9, 4
|
||||
subu $5, 1 /* arg_index-- */
|
||||
beq $6, 0, done /* arg_num == 0 ? */
|
||||
lw $8, 0($5) /* $8 = *args */
|
||||
sw $8, 0($9) /* store $8 to stack */
|
||||
addu $5, 4 /* args++ */
|
||||
addu $9, 4 /* sp++ */
|
||||
subu $6, 1 /* arg_num-- */
|
||||
j push_args
|
||||
|
||||
done:
|
||||
|
|
|
@ -52,7 +52,7 @@ Linux
|
|||
--------------------------------
|
||||
- Build</br>
|
||||
`./build.sh`</br>
|
||||
All binaries are in "out", which contains "host_tool", "lvgl_native_ui_app", "ui_app.wasm", "ui_app_lvgl_compatible" and "wasm_runtime_wgl".
|
||||
All binaries are in "out", which contains "host_tool", "lvgl_native_ui_app", "ui_app.wasm", "ui_app_lvgl_compatible.wasm" and "wasm_runtime_wgl".
|
||||
- Run native Linux application</br>
|
||||
`./lvgl_native_ui_app`</br>
|
||||
|
||||
|
@ -61,7 +61,7 @@ Linux
|
|||
`./wasm_runtime_wgl -s`</br>
|
||||
Then install wasm APP use host tool.</br>
|
||||
`./host_tool -i ui_app -f ui_app.wasm`</br>
|
||||
`./host_tool -i ui_app -f ui_app_compatible.wasm`</br>
|
||||
`./host_tool -i ui_app -f ui_app_lvgl_compatible.wasm`</br>
|
||||
|
||||
Zephyr
|
||||
--------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user