Create P-Code execution helper in apps/interpreters/prun; The P-Code binary format is functional except that there are still some modularity and kernel build issues that need to be addressed.

This commit is contained in:
Gregory Nutt
2014-05-09 08:52:11 -06:00
parent 898e59f112
commit ed2e4a15dc
9 changed files with 117 additions and 5 deletions
+22 -4
View File
@@ -47,6 +47,8 @@
#include <errno.h>
#include <debug.h>
#include <apps/interpreters/prun.h>
#include <nuttx/kmalloc.h>
#include <nuttx/poff.h>
#include <nuttx/fs/ramdisk.h>
@@ -78,6 +80,14 @@
# error CONFIG_SCHED_ONEXIT is required
#endif
#ifndef CONFIG_PCODE_VARSTACKSIZE
# define CONFIG_PCODE_VARSTACKSIZE 1024
#endif
#ifndef CONFIG_PCODE_STRSTACKSIZE
# define CONFIG_PCODE_STRSTACKSIZE 128
#endif
#ifdef CONFIG_PCODE_TEST_FS
# ifndef CONFIG_FS_ROMFS
# error You must select CONFIG_FS_ROMFS in your configuration file
@@ -255,19 +265,27 @@ static int pcode_proxy(int argc, char **argv)
if (ret < 0)
{
bdbg("ERROR: on_exit failed: %d\n", errno);
kfree(fullpath);
return EXIT_FAILURE;
}
/* Load the P-code file and execute it */
/* We don't need the fullpath now */
ret = prun(fullpath, CONFIG_PCODE_VARSTACKSIZE, CONFIG_PCODE_STRSTACKSIZE);
/* We no longer need the fullpath */
kfree(fullpath);
/* Execute the P-code file and execute it */
/* Check the result of the interpretation */
bdbg("ERROR: Not implemented\n");
return EXIT_FAILURE;
if (ret < 0)
{
bdbg("ERROR: Execution failed\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
#else
# error Missing logic for the case of CONFIG_NUTTX_KERNEL