optim struct for code.
This commit is contained in:
@@ -38,3 +38,15 @@
|
||||
#define IS_MODULE(option) __is_defined(option##_MODULE)
|
||||
|
||||
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
|
||||
|
||||
/* Import a binary file */
|
||||
#define IMPORT_BIN(sect, file, sym) asm (\
|
||||
".section " #sect "\n" /* Change section */\
|
||||
".balign 4\n" /* Word alignment */\
|
||||
".global " #sym "\n" /* Export the object address */\
|
||||
#sym ":\n" /* Define the object label */\
|
||||
".incbin \"" file "\"\n" /* Import the file */\
|
||||
".global _sizeof_" #sym "\n" /* Export the object size */\
|
||||
".set _sizeof_" #sym ", . - " #sym "\n" /* Define the object size */\
|
||||
".balign 4\n" /* Word alignment */\
|
||||
".section \".text\"\n") /* Restore section */
|
||||
|
||||
@@ -23,6 +23,8 @@ target_link_libraries(uvmm.elf
|
||||
cjson
|
||||
${GCC_LIB_PATH}/libgcc.a
|
||||
)
|
||||
# configure_file(src/benos.bin ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/uvmm.elf.dir/src/benos.bin COPYONLY)
|
||||
# configure_file(src/vm_benos.json ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/uvmm.elf.dir/src/vm_benos.json COPYONLY)
|
||||
target_include_directories(
|
||||
uvmm.elf
|
||||
PUBLIC
|
||||
|
||||
BIN
mkrtos_user/server/uvmm/src/benos.bin
Executable file
BIN
mkrtos_user/server/uvmm/src/benos.bin
Executable file
Binary file not shown.
@@ -1,13 +1,17 @@
|
||||
|
||||
#include <printf.h>
|
||||
#include <unistd.h>
|
||||
#include <u_types.h>
|
||||
#include "guest_os.h"
|
||||
#include "u_task.h"
|
||||
#include <stdio.h>
|
||||
#include "uvmm_dev_man.h"
|
||||
extern umword_t os_bin;
|
||||
extern umword_t os_bin_end;
|
||||
#include <printf.h>
|
||||
#include <stdio.h>
|
||||
#include <u_types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <u_util.h>
|
||||
|
||||
extern const char benos_bin[], _sizeof_benos_bin[];
|
||||
extern const char benos_json[], _sizeof_benos_json[];
|
||||
|
||||
extern umword_t uvmm_dev_json;
|
||||
static guest_os_t gos;
|
||||
int main(int argc, char *args[])
|
||||
@@ -17,11 +21,10 @@ int main(int argc, char *args[])
|
||||
|
||||
uvmm_dev_simul_init();
|
||||
|
||||
mk_printf("guest os entry addr:[0x%lx 0x%lx]\n", &os_bin, &os_bin_end);
|
||||
guest_os_create(&gos, (char *)&uvmm_dev_json,
|
||||
0x20000000, &os_bin, &os_bin_end, 32 * 1024 * 1024);
|
||||
while (1)
|
||||
{
|
||||
mk_printf("guest os entry addr:[0x%lx 0x%lx]\n", benos_bin, benos_bin + (umword_t)_sizeof_benos_bin);
|
||||
guest_os_create(&gos, (char *)benos_json,
|
||||
0x20000000, (void*)benos_bin, (void*)(benos_bin + (umword_t)_sizeof_benos_bin), 32 * 1024 * 1024);
|
||||
while (1) {
|
||||
sleep(1);
|
||||
}
|
||||
// mk_printf("print test0.\n");
|
||||
@@ -42,3 +45,7 @@ int main(int argc, char *args[])
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
IMPORT_BIN(".rodata", "/home/mkrtos-real/mkrtos_user/server/uvmm/src/benos.bin", benos_bin);
|
||||
IMPORT_BIN(".rodata", "/home/mkrtos-real/mkrtos_user/server/uvmm/src/vm_benos.json", benos_json);
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
.global os_bin
|
||||
.global os_bin_end
|
||||
.global uvmm_dev_json
|
||||
.global uvmm_dev_json_end
|
||||
.align 12
|
||||
os_bin:
|
||||
.incbin "/Users/zhangzheng/mkrtos-real/benos/arch/arm64/boot/benos.bin"
|
||||
os_bin_end:
|
||||
.quad 0
|
||||
uvmm_dev_json:
|
||||
.incbin "/Users/zhangzheng/mkrtos-real/mkrtos_user/server/uvmm/src/vm_benos.json"
|
||||
uvmm_dev_json_end:
|
||||
.quad 0
|
||||
Reference in New Issue
Block a user