蓬莱的编译和运行¶
- 目前是在unmarched板子上集成了蓬莱的Penglai-TVM 相关的应用。
下面从编译和运行两方面说明其使用。
蓬莱编译¶
蓬莱运行¶
- 将编译出来的peng-lai-all-unmatched.wic.xz,复制到SD卡中。
(/dev/sdb 更改为SD卡实际设备文件)。
xzcat peng-lai-all-unmatched.wic.xz | sudo dd of=/dev/sdb bs=512K iflag=fullblock oflag=direct conv=fsync
通过SD卡启动unmarched板子。
进入系统后,首先装载Penglai-TVM的驱动
cd /lib/modules/5.13.19 insmod penglai.ko
1、运行hello world 程序
root@unmatched:/lib/modules/5.13.19# cd /home/root root@unmatched:~# ./host hello-world [ 120.094199]hello world! host: PLenclave run is finish host: after exit the thread
2、运行停止和结束enclave端程序
root@unmatched:~# ./test-stop loop host0: stop enclave host0: resume enclave host0: destroy enclave host: PLenclave run is finish host: after exit the thread
3、运行enclave和host端的IPC通信程序(板子上没法生成report,所以值均为0)
root@unmatched:~# ./test-caller caller server server1 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, [ 173.805954] caller begin to run... [ 173.808627] shm content 11111 and size 0000000000004000 [ 173.813845] relay page content 22222 and size 0000000000004000 [ 173.819664] get the enclave report [ 173.972389] 0x00000000 [ 173.973996] 0x00000000 [ 173.976383] 0x00000000 [ 173.978683] 0x00000000 [ 173.981050] 0x00000000 [ 173.983371] 0x00000000 [ 173.985737] 0x00000000 [ 173.988080] 0x00000000 [ 173.990407] 0x00000000 [ 173.992769] 0x00000000 [ 173.995096] 0x00000000 [ 173.997461] 0x00000000 [ 173.999805] 0x00000000 [ 174.002132] 0x00000000 [ 174.004496] 0x00000000 [ 174.006823] 0x00000000 [ 174.009187] get the server1 enclave report [ 174.013269] 0x00000000 [ 174.015613] 0x00000000 [ 174.017941] 0x00000000 [ 174.020303] 0x00000000 [ 174.022631] 0x00000000 [ 174.024995] 0x00000000 [ 174.027322] 0x00000000 [ 174.029685] 0x00000000 [ 174.032030] 0x00000000 [ 174.034357] 0x00000000 [ 174.036720] 0x00000000 [ 174.039047] 0x00000000 [ 174.041411] 0x00000000 [ 174.043755] 0x00000000 [ 174.046082] 0x00000000 [ 174.048446] 0x00000000 [ 174.200237] server1: begin to run [ 174.202903] get the server enclave report [ 174.356254] 0x00000000 [ 174.357860] 0x00000000 [ 174.360242] 0x00000000 [ 174.362547] 0x00000000 [ 174.364910] 0x00000000 [ 174.367235] 0x00000000 [ 174.369596] 0x00000000 [ 174.371942] 0x00000000 [ 174.374271] 0x00000000 [ 174.376632] 0x00000000 [ 174.378961] 0x00000000 [ 174.381322] 0x00000000 [ 174.383667] 0x00000000 [ 174.385996] 0x00000000 [ 174.388357] 0x00000000 [ 174.390686] 0x00000000 [ 174.393054] server1: server_handle:0x0000000000000000 [ 174.398109] server: begin to run [ 174.401398] server: read req_vaddr:0x0000000019962000 [ 174.555938] server: read resp_vaddr:0x0000000019962000 [ 174.560366] server: exit with ret:0x0000000000000002 [ 174.565337] server1: read req_vaddr:0x0000000019961000 [ 174.570492] server1: read resp_vaddr:0x0000000019962000 [ 174.575634] server1: exit with retval:0x0000000000000003 [ 174.581052] caller: read req_vaddr after calling server:0x0000000000002000 [ 174.587858] caller: read resp_vaddr after calling server:0x0000000000002000 [ 174.594742] caller: get server1 retval:0x0000000000000003
4、运行mem 程序
root@unmatched:~# ./host mem [ 301.019408] begin test malloc [ 301.509377] end test malloc [ 301.511422] begin test mmap [ 302.443701] end test mmap:2621440 [ 302.446259] begin test sbrk [ 302.449073] ret of sbrk(0):0x0000001000001000 [ 302.629396] ret of sbrk(-4096):0x0000001000000000 [ 302.782949] ret of sbrk(4*4096):0x0000001000007000 [ 302.936842] ret of sbrk(1*4096):0x0000001000008000 [ 303.293351] ret of sbrk(-10*4096):0x0000001000000000 [ 303.297583] end test sbrk host: PLenclave run is finish host: after exit the thread