mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-09-06 09:51:27 +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:
|
* Arguments passed in:
|
||||||
*
|
*
|
||||||
* r0 argv
|
* r0 function pntr
|
||||||
* r1 argc
|
* r1 argv
|
||||||
* r2 function pntr
|
* r2 argc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
invokeNative:
|
invokeNative:
|
||||||
stmfd sp!, {r4, r5, r6, r7, lr}
|
stmfd sp!, {r4, r5, r6, r7, lr}
|
||||||
mov r4, r0 /* get argv */
|
mov ip, r0 /* get function ptr */
|
||||||
mov r5, r1 /* get argc */
|
mov r4, r1 /* get argv */
|
||||||
mov ip, r2 /* get function ptr */
|
mov r5, r2 /* get argc */
|
||||||
|
|
||||||
cmp r5, #2 /* is argc < 2 ? */
|
cmp r5, #2 /* is argc < 2 ? */
|
||||||
blt return
|
blt return
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "wasm_runtime.h"
|
#include "wasm_runtime.h"
|
||||||
|
|
||||||
void invokeNative(uint32 argv[], uint32 argc, void (*native_code)())
|
void invokeNative(void (*native_code)(), uint32 argv[], uint32 argc)
|
||||||
{
|
{
|
||||||
WASMThread *self;
|
WASMThread *self;
|
||||||
switch(argc) {
|
switch(argc) {
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On function entry parameters:
|
* On function entry parameters:
|
||||||
* $4 = args
|
* $4 = func_ptr
|
||||||
* $5 = arg_num
|
* $5 = args
|
||||||
* $6 = func_ptr
|
* $6 = arg_num
|
||||||
*/
|
*/
|
||||||
|
|
||||||
invokeNative:
|
invokeNative:
|
||||||
|
@ -43,22 +43,22 @@ invokeNative:
|
||||||
move $fp, $sp
|
move $fp, $sp
|
||||||
|
|
||||||
/* allocate enough stack space */
|
/* allocate enough stack space */
|
||||||
sll $11, $5, 2
|
sll $11, $6, 2 /* $11 == arg_num * 4 */
|
||||||
subu $sp, $11
|
subu $sp, $11
|
||||||
|
|
||||||
/* make 8-byte aligned */
|
/* make 8-byte aligned */
|
||||||
and $sp, ~7
|
and $sp, ~7
|
||||||
|
|
||||||
move $9, $sp
|
move $9, $sp
|
||||||
move $25, $6 /* $25 = func_ptr */
|
move $25, $4 /* $25 = func_ptr */
|
||||||
|
|
||||||
push_args:
|
push_args:
|
||||||
beq $5, 0, done /* arg_num == 0 ? */
|
beq $6, 0, done /* arg_num == 0 ? */
|
||||||
lw $8, 0($4)
|
lw $8, 0($5) /* $8 = *args */
|
||||||
sw $8, 0($9)
|
sw $8, 0($9) /* store $8 to stack */
|
||||||
addu $4, 4
|
addu $5, 4 /* args++ */
|
||||||
addu $9, 4
|
addu $9, 4 /* sp++ */
|
||||||
subu $5, 1 /* arg_index-- */
|
subu $6, 1 /* arg_num-- */
|
||||||
j push_args
|
j push_args
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
|
@ -52,7 +52,7 @@ Linux
|
||||||
--------------------------------
|
--------------------------------
|
||||||
- Build</br>
|
- Build</br>
|
||||||
`./build.sh`</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>
|
- Run native Linux application</br>
|
||||||
`./lvgl_native_ui_app`</br>
|
`./lvgl_native_ui_app`</br>
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ Linux
|
||||||
`./wasm_runtime_wgl -s`</br>
|
`./wasm_runtime_wgl -s`</br>
|
||||||
Then install wasm APP use host tool.</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.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
|
Zephyr
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user