基于指令集 rv64i
实现了mtime,超级精简的uart和mmu sv39.
支持的参数:
-a 关闭所有调试打印
-e 关闭错误打印
-g 用更好的方式来显示打印
-d 开启所有调试打印(包括寄存器和csr列表)
juice_vm_release_for_Linux_and_win_0420de4b.zip
以下 2021-03-06 更新:
--------------------------------
无第三方库不到5000行C语言实现一个risc-v虚拟机,带mmu
基于指令集 rv64i
实现了mtime,超级精简的uart和mmu sv39.
支持的参数:
-a 关闭所有调试打印
-e 关闭错误打印
-g 用更好的方式来显示打印
-d 开启所有调试打印(包括寄存器和csr列表)
-i 开启指令解码调试信息
-m 开启mmu调试信息
1. 已经支持了c语言编程。
2. 已完成freertos移植。
3. 已完成mebedtls移植。
4. 已完成mmu sv39测试。
5. 已完成mtimer测试。
6. 已完成opensbi移植。
最近编辑记录 xiaohui (2021-01-11 17:28:18)
离线
附上之前的freertos移植流程,传送门:https://whycan.com/t_5766.html
离线
例子里的rv_config.h忘记上传了,里面的内容就是
#define RV_CPU_SIM_RAM_START_ADDR 0
#define RV_CPU_SIM_RAM_SIZE 10 * RAM_SIZE_MB
离线
测试例程所用的编译器下载链接,传送门:https://www.sifive.com/software#GCC
最近编辑记录 xiaohui (2021-01-11 18:03:22)
离线
来了来了 给大佬点赞来了
谢谢大佬围观
离线
更新,发布安卓版本的可执行文件:juice_vm_android_0420de4b.zip
这个发布包里没有包含测试例子,测试例子使用本帖一楼的测试即可。
最近编辑记录 xiaohui (2021-01-19 18:07:46)
离线
juice_vm_release_for_Win64_f041c8a2.zip
202210306更新:
1. 已经支持了c语言编程。
2. 已完成freertos移植。
3. 已完成mebedtls移植。
4. 已完成mmu sv39测试。
5. 已完成mtimer测试。
6. 已完成opensbi移植。
添加了-m参数用于开启mmu调试信息
1113e998 add sfence.vma instr
f118d476 add print instr support
1e3e7204 add AMOSWAP.D LR.D and SC.D instr support
686741ea add AMOSWAP.D LR.D and SC.D instr support
f2f699c0 add -i arg to enable instr print support
113f66da add misa csr support
19cf60d1 fix divu err
ad512e54 add divu remw and remu instr
9abc0566 fix mem overflow
0ceb663e fix divw instr and add REMW instr
10a2ea78 fix divw instr
9c93c4ce add amoswap.w , mul and divw instr
df10ad45 change the fireware start addr to 0x80000000
d31b4ac1 add amoadd.w inst
最近编辑记录 xiaohui (2021-03-06 18:54:19)
离线
运行freertos的截图:
离线
juice_vm_release_for_Linux_57ba985a.zip
20210424更新:
1. 已完成rt-thread移植。
2.新增-L参数用于指定打印日志方式。
3.新增-l参数用于在出现死循环的时候结束运行。
4.新增-r参数用于开启trap调试打印
5.更新了Alive logo。
6.新增-T参数用于执行过程输出反汇编调试打印。
7.新增m模块支持。
8.新增s-mode支持(u-mode支持中)。
最近编辑记录 xiaohui (2021-04-23 18:18:46)
离线
厉害(20210424更新?我穿越了?
哈哈,是的,欢迎来到未来。
离线
20210427更新:
提交了RT-Thread 的适配 到官方仓库:详情请点击https://github.com/RT-Thread/rt-thread/tree/master/bsp/juicevm
离线
global_vm_log_init output_mode_sel: 0 JUICE_VM_LOG_MAX_NUM:2900
gg ,ggg, gg ,a8a, ,gggg, ,ggggggg, ,ggg, ,g,ggg, ,ggg,_,ggg,
dP8dP Y8a 88 ,8 8, ,88 Y8b,dP Y8dP Y8a ,8dP Y8dP Y88P Y8b
dP YYb, `88 88 d8 8b d8 `Yd8' a YYb, `88 d8Yb, `88' `88' `88
,8 `8` 88 88 88 88d8' 8b d88 Y8P'` 88 88 ` 88 88 88
I8 Yb 88 88 88 8,8I Y88P`8baaaa 88 88 88 88 88
`8b, `8, 88 88 Y8 8I8' ,d8P I8 8I 88 88 88
` Y88888 88 88 `8, ,8d8 d8 `8, ,8' 88 88 88
Y8 88 888888 8,8 Y8, Y8, Y8, ,8P 88 88 88
,88,Y8b,____,d88`8b, ,d8b,`Yba,,_____`Yba,,_____, Yb,_,dP 88 88 Y8,
,ad88888 Y888888P Y8 Y88P Y8 ` Y8888888 ` Y8888888 Y8P 88 88 `Y8
,dP ' Yb
,8' I8
,8' I8
I8, ,8'
`Y8,___,d8'
Y888P
email: juicemail@163.com
version:f259ffe5 f259ffe5 Fri, 7 May 2021 16:31:18 +0800 xiaoxiaohuixxh feat(vm): pass ui ua si test but lrsc and scr test
firm_addr:build/platform/juice/juiceRv/firmware/fw_payload.bin
fd = 3
file_size = 6169144
interrupt_vertor_register_mag_init
rv_csr_register_init
csr_addr_misa 8000000000040101
csr_addr_mvendorid 0000000000000000
csr_addr_marchid 0000000000000000
csr_addr_mimpid 0000000000000000
csr_addr_mhartid 0000000000000000
rv_peripheral_device_init
[rv64_sim][dev][mmu]rv.c(6114):rv_peripheral_device_mmu_init,Sv39 mode support only
[rv64_sim][dev][mtime]rv.c(5773):rv_peripheral_device_mtime_init
[rv64_sim][dev][mtime]rv.c(5792):pdev_mtime_irq_info 0x55f859de9110 92c00003 92c00007
[rv64_sim][proc][err]rv.c[interrupt_vertor_register](1910){pc:0000000000000000}:interrupt_vertor_register err->irq info err irq_v 1 addr_min 4
[rv64_sim][dev][mtime]rv.c(5803):pdev_mtime_irq_info_on_umode (nil) 92c00003 92c00007
[rv64_sim][dev][uart0]rv.c(5580):rv_peripheral_device_uart0_init
[rv64_sim][dev][uart0]rv.c(5596):pdev_uart0_irq_info 0x55f859de90f0
rv sim start...loading
cpu run...
[juiceRv]set_rv_scr csr_addr 0000000000000180(csr_addr_satp) new_v 0000000000000000
get_MODE_xsatp(get_rv_csr(csr_addr_satp)) 0
OpenSBI v0.9
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : juice-JuiceRv
Platform Features : timer,mfdeleg
Platform HART Count : 1
Firmware Base : 0x80000000
Firmware Size : 80 KB
Runtime SBI Version : 0.3
Domain0 Name : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*
Domain0 Region00 : 0x0000000080000000-0x000000008001ffff ()
Domain0 Region01 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000080200000
Domain0 Next Arg1 : 0x0000000082200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 0
Boot HART Domain : root
Boot HART ISA : rv64ias
Boot HART Features : scounteren,mcounteren,time
Boot HART PMP Count : 64
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count : 29
Boot HART MHPM Count : 29
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
[juiceRv]set_rv_scr csr_addr 0000000000000105(csr_addr_stvec) new_v 0000000080200000
[juiceRv]set_rv_scr csr_addr 0000000000000180(csr_addr_satp) new_v 0000000000000000
get_MODE_xsatp(get_rv_csr(csr_addr_satp)) 0
H
D
C
B
M
S
R
R1[juiceRv]set_rv_scr csr_addr 0000000000000105(csr_addr_stvec) new_v ffffffff800003a4
23[juiceRv]set_rv_scr csr_addr 0000000000000180(csr_addr_satp) new_v 800000000008021c
get_MODE_xsatp(get_rv_csr(csr_addr_satp)) 8
[rv64_sim][dev][mmu][err]rv.c(6220):V:0 R:0 W:0
[rv64_sim][dev][mmu][err]rv.c(6221):如果pte.v = 0,或者pte.r = 0且pte.w = 1,则停止并引发与原始访问类型相对应的页面错误异常。
[rv64_sim][dev][mmu][err]rv.c(6305):rv_peripheral_device_mmu_translation pc:0000000080200394 va 0000000080200394 pa 0000000000000000
[rv64_sim][proc][err]rv.c[RISCVTrap](1404){pc:0000000080200394}:RV_exception_Instruction_page_fault va 0000000080200394
[rv64_sim][dev][mmu][err]rv.c(6317):this addr not found
5
[juiceRv]set_rv_scr csr_addr 0000000000000105(csr_addr_stvec) new_v ffffffff800003f0
6[juiceRv]set_rv_scr csr_addr 0000000000000180(csr_addr_satp) new_v 80000000000805a7
get_MODE_xsatp(get_rv_csr(csr_addr_satp)) 8
I
Parse_dtb
start_kernel
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] memblock_add enter
[ 0.000000] No DTB passed to the kernel
[ 0.000000] func start_kernel ( 647 )
[ 0.000000] func start_kernel ( 651 )
[ 0.000000] func start_kernel ( 653 )
[ 0.000000] func start_kernel ( 656 )
[ 0.000000] func start_kernel ( 659 )
[ 0.000000] func start_kernel ( 661 )
[ 0.000000] func start_kernel ( 668 )
[ 0.000000] func start_kernel ( 670 )
[ 0.000000] Linux version 5.0.0-g1e922e1de (xiaohui@DESKTOP-7HFR7VO) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #51 Mon Mar 29 01:40:29 CST 2021
[ 0.000000] func start_kernel ( 672 )
[ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[ 0.000000] printk: bootconsole [sbi0] enabled
[ 0.000000]
[ 0.000000] reg->base: 80200000 reg->size: e00000
[ 0.000000]
[ 0.000000] mem_size: 0000000000e00000
[ 0.000000]
[ 0.000000] memblock_end_of_DRAM end addr: ffffffff800e269c
[ 0.000000] initrd not found or empty - disabling initrd
[ 0.000000]
[ 0.000000] memblock_dump_all end addr: ffffffff800217bc
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000080ffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x0000000080ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000080ffffff]
[ 0.000000] On node 0 totalpages: 3584
[ 0.000000] memblock_alloc_try_nid_nopanic: 229376 bytes align=0x40 nid=0 from=0x0000000000000000 max_addr=0x0000000000000000 alloc_node_mem_map.constprop.34+0x70/0xc0
[ 0.000000] DMA32 zone: 49 pages used for memmap
[ 0.000000] DMA32 zone: 0 pages reserved
[ 0.000000] DMA32 zone: 3584 pages, LIFO batch:0
[ 0.000000] memblock_alloc_try_nid_nopanic: 8 bytes align=0x40 nid=0 from=0x0000000000000000 max_addr=0x0000000000000000 setup_usemap.isra.8+0x5c/0x78
[ 0.000000] memblock_alloc_try_nid: 2740 bytes align=0x8 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 early_init_dt_alloc_memory_arch+0x20/0x30
[ 0.000000] memblock_alloc_try_nid_nopanic: 67108864 bytes align=0x1000 nid=-1 from=0x0000000000000000 max_addr=0x00000000ffffffff swiotlb_init+0x64/0xd8
[ 0.000000] software IO TLB: Cannot allocate buffer
[ 0.000000] elf_hwcap is 0x1101
[ 0.000000] func start_kernel ( 696 )
[ 0.000000] func start_kernel ( 702 )
[ 0.000000] func start_kernel ( 704 )
[ 0.000000] func start_kernel ( 706 )
[ 0.000000] func start_kernel ( 708 )
[ 0.000000] memblock_alloc_try_nid: 67 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0x1fc/0xcc8
[ 0.000000] memblock_alloc_try_nid: 67 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0x228/0xcc8
[ 0.000000] memblock_alloc_try_nid: 67 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0x250/0xcc8
[ 0.000000] func start_kernel ( 710 )
[ 0.000000] func start_kernel ( 712 )
[ 0.000000] memblock_alloc_try_nid_nopanic: 4096 bytes align=0x1000 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_alloc_alloc_info+0x68/0xc4
[ 0.000000] memblock_alloc_try_nid_nopanic: 32768 bytes align=0x1000 nid=-1 from=0x0000000080200000 max_addr=0x0000000000000000 setup_per_cpu_areas+0x48/0xb8
[ 0.000000] memblock_alloc_try_nid: 8 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_setup_first_chunk+0x394/0x78c
[ 0.000000] memblock_alloc_try_nid: 8 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_setup_first_chunk+0x3b4/0x78c
[ 0.000000] memblock_alloc_try_nid: 4 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_setup_first_chunk+0x3d0/0x78c
[ 0.000000] memblock_alloc_try_nid: 8 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_setup_first_chunk+0x3ec/0x78c
rs1 >= 0 && rs2 >= 0rs1 >= 0 && rs2 >= 0rs1 >= 0 && rs2 >= 0[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] memblock_alloc_try_nid: 240 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_setup_first_chunk+0x69c/0x78c
[ 0.000000] memblock_alloc_try_nid: 105 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_alloc_first_chunk+0x98/0x314
[ 0.000000] memblock_alloc_try_nid: 1024 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_alloc_first_chunk+0xd8/0x314
[ 0.000000] memblock_alloc_try_nid: 1032 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_alloc_first_chunk+0x100/0x314
[ 0.000000] memblock_alloc_try_nid: 160 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 pcpu_alloc_first_chunk+0x124/0x314
rs1 <= 0 && rs2 >= 0rs1 >= 0 && rs2 >= 0[ 0.000000] memblock_free: [0x0000000080fc6000-0x0000000080fc6fff] pcpu_free_alloc_info+0x24/0x34
[ 0.000000] func start_kernel ( 714 )
[ 0.000000] func start_kernel ( 716 )
[ 0.000000] func start_kernel ( 718 )
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 3535
[ 0.000000] func start_kernel ( 721 )
[ 0.000000] func start_kernel ( 723 )
[ 0.000000] Kernel command line: console=hvc0 earlycon=sbi console=hvc0 earlycon=sbi memblock=debug
[ 0.000000] func start_kernel ( 726 )
[ 0.000000] func start_kernel ( 728 )
[ 0.000000] func start_kernel ( 733 )
[ 0.000000] func start_kernel ( 737 )
[ 0.000000] func start_kernel ( 740 )
[ 0.000000] func start_kernel ( 747 )
[ 0.000000] memblock_alloc_try_nid_nopanic: 16384 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 alloc_large_system_hash+0x2c4/0x4c0
[ 0.000000] Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.000000] memblock_alloc_try_nid_nopanic: 8192 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 alloc_large_system_hash+0x2c4/0x4c0
[ 0.000000] Inode-cache hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.000000] func start_kernel ( 749 )
[ 0.000000] Sorting __ex_table...
[ 0.000000] func start_kernel ( 751 )
[juiceRv]set_rv_scr csr_addr 0000000000000105(csr_addr_stvec) new_v ffffffff80020e54
[ 0.000000] func start_kernel ( 753 )
[ 0.000000] func mm_init ( 621 )
[ 0.000000] Memory: 10068K/14336K available (2794K kernel code, 181K rwdata, 620K rodata, 128K init, 240K bss, 4268K reserved, 0K cma-reserved)
[ 0.000000] func mm_init ( 623 )
[rv64_sim][dev][mmu][err]rv.c(6220):V:0 R:0 W:0
[rv64_sim][dev][mmu][err]rv.c(6221):如果pte.v = 0,或者pte.r = 0且pte.w = 1,则停止并引发与原始访问类型相对应的页面错误异常。
[rv64_sim][dev][mmu][err]rv.c(6305):rv_peripheral_device_mmu_translation pc:ffffffff800b3004 va 000000017fc861df pa 0000000080579c10
[rv64_sim][proc][err]rv.c[RISCVTrap](1456){pc:ffffffff800b3004}:RV_exception_Load_page_fault va 000000017fc861df
[rv64_sim][dev][mmu][err]rv.c(6317):this addr not found
[ 0.000000] Unable to handle kernel paging request at virtual address 000000017fc861df
[ 0.000000] Oops [#1]
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-g1e922e1de #51
[ 0.000000] sepc: ffffffff800b3004 ra : ffffffff800b3004 sp : ffffffff80379c20
[ 0.000000] gp : ffffffff803a3178 tp : ffffffff80382418 t0 : 0000000000008000
[ 0.000000] t1 : 0000000000000000 t2 : 0000000000000000 s0 : 000000017fc862ef
[ 0.000000] s1 : ffffffff80391468 a0 : 0000000000000000 a1 : ffffffff80de4008
[ 0.000000] a2 : 0000000000000001 a3 : 0000000000000000 a4 : 0000000000000000
[ 0.000000] a5 : ffffffffffffff01 a6 : 00000000000000ff a7 : 0000000000000000
[ 0.000000] s2 : 0000000000000000 s3 : 0000000000000000 s4 : ffffffff80391458
[ 0.000000] s5 : ffffffff8039fdf0 s6 : 000000007fc60188 s7 : 0000000000000001
[ 0.000000] s8 : 0000000000000001 s9 : 0000000000000000 s10: 0000000000000088
[ 0.000000] s11: 00000000003fffff t3 : ffffffff8039fe78 t4 : 0000000000000001
[ 0.000000] t5 : ffffffff8039fe78 t6 : c000000000000000
[ 0.000000] sstatus: 0000000000000000 sbadaddr: 000000017fc861df scause: 000000000000000d
[ 0.000000] random: get_random_bytes called from print_oops_end_marker+0x58/0x7c with crng_init=0
[ 0.000000] ---[ end trace c955a8d686188788 ]---
[ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
oops! stop!!!
------------------------global_vm_log_output global_vm_log_pos:0------------------------
最新进度,linux kernel还是没跑起来
离线
bellard的riscv&x86模拟器
https://bellard.org/tinyemu/
谢谢大佬分享,一直也有关注这个天才大佬的项目。
离线
20210508更新:
1,上传一个ubuntu20.04上可以正常运行的发布包,感谢@XBOOT大佬的反馈。
2,添加了div指令支持。
3,修复了divuw,divw,remu,remw,amomin.w,amoswap.w的指令错误。
juice_vm_for_Linux_b58244f3.zip
最近编辑记录 xiaohui (2021-05-08 16:01:15)
离线
20210524进展公布(发行包还在整理中):
1,修复了mtime在m-mode,s-mode和u-mode下的中断处理漏洞。
2,修复了ecall在s-mode下的漏洞。
3,修复了在s-mode和u-mode下进入异常模式,更新csr寄存器的漏洞。
4,移植了linux。
juice_vm成功运行kernel主线5.0.0。
juice_vm成功运行kernel主线5.0.0。
juice_vm成功运行kernel主线5.0.0。
离线
20210524进展公布,发布包发布juice_vm_release_for_Linux_c21682d3.zip:
1,修复了mtime在m-mode,s-mode和u-mode下的中断处理漏洞。
2,修复了ecall在s-mode下的漏洞。
3,修复了在s-mode和u-mode下进入异常模式,更新csr寄存器的漏洞。
4,移植了linux。
juice_vm成功运行kernel主线5.0.0。
juice_vm成功运行kernel主线5.0.0。
juice_vm成功运行kernel主线5.0.0。
离线
opensbi和kernel的代码已发布到github!!!
https://github.com/juiceRv/kernel_juicevm_port
kernel的配置文件在arch/riscv/configs/juicevm_defconfig,make ARCH=riscv juicevm_defconfig
需要修改下arch/riscv/configs/juicevm_defconfig里的CONFIG_INITRAMFS_SOURCE="/mnt/ssd_prj/risc-v_sim/sim/test/opensbi/opensbi-master/rootfs"
修改为opensbi里的路径
opensbi仓库
https://github.com/juiceRv/opensbi_juicevm_port
toolchains
https://github.com/juiceRv/gcc-gnu-toolchains-for-juicevm
最近编辑记录 xiaohui (2021-05-25 19:18:44)
离线
分享下软件的参数说明:
t: enable test mode
进入固件测试模式
当出现下面的状态会结束运行并且打印出通过还是失败的字样
x3_gp寄存器的值为1 和 x17_a7寄存器的值为93时,进入了ecall异常就会触发。x10_a0 寄存器的值为 0时打印pass字样,否则打印fail字样
-------------------------------------------------------------------------------
T: enable trap debug mode
使能异常调试模式,出现异常时会打印当前异常的调试信息
-------------------------------------------------------------------------------
d: enable debug mode
打开虚拟机内所有的调试选项,输出最详细的调试信息,包括指令译码,处理执行,当前寄存器列表,csr列表等
-------------------------------------------------------------------------------
c: print cst operation msg
打开虚拟机的csr寄存器读写调试信息。读写csr寄存器的时候都会打印对应的csr寄存器的值
-------------------------------------------------------------------------------
a: diable all debug msg
关闭所有调试选项,译码调试默认打开
-------------------------------------------------------------------------------
x: enable test mode for exception
打开异常测试模式,当出现异常时结束运行
-------------------------------------------------------------------------------
g: enable better readability printing
使用可读性更好的方式打印信息
-------------------------------------------------------------------------------
e: disable all error msg
关闭所有的错误信息打印
-------------------------------------------------------------------------------
i: enable all instr debug msg
打开所有指令调试信息打印
-------------------------------------------------------------------------------
m: enable mmu debug msg
打开mmu的遍历调试信息
-------------------------------------------------------------------------------
p: print mmu page 8 byte data
hexdump打印mmu页表里的8字节数据
-------------------------------------------------------------------------------
P: print mmu page 4K Byte data
hexdump打印mmu页表里的4K字节数据
-------------------------------------------------------------------------------
s: uart addr not use mmu translation
启用mmu翻译时,忽略uart的外设地址,在启用了mmu的时候也可以直接通过uart原始物理地址来操作uart外设
-------------------------------------------------------------------------------
S: switch mode debug info
打开切换mode时的调试信息,m-mode,s-mode和u-mode切换的时候都会打印调试信息
-------------------------------------------------------------------------------
M: disable mmu err msg
关闭mmu缺页异常,访问异常,加载异常的错误信息
-------------------------------------------------------------------------------
r: enable trap debug msg
打印更详细的进入中断的调试信息
-------------------------------------------------------------------------------
A: enable addr translation debug print
打印地址转换的调试打印
-------------------------------------------------------------------------------
L(n): output_mode_sel n = 0 -> stdout
1 -> log_buf UNIX SYS ONLY(buf_size:(2900))
2 -> none
选择虚拟机输出的方式,1,直接标准输出。2,使用一个buf先缓存,退出的时候再输出bug大小2900Byte。3,不输出。
-------------------------------------------------------------------------------
l: enable endless loop check (RV_ENDLESS_LOOP_CHECK_EXIT_CNT:(3))
启用死循环监测机制,当有连续3次出现同样的指令执行流程(包括寄存器和csr寄存器的值都没有改变),结束虚拟机的运行。可以搭配-L参数使用,方便调试固件。一般assert都是直接死循环。
-------------------------------------------------------------------------------
离线
更新私有软件源:
echo "deb http://xiaohui.mongoyun.com:3333/ trusty main" | sudo tee -a /etc/apt/sources.list
wget -O - http://xiaohui.mongoyun.com:3333/key/deb.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install juicevm
离线
退出时,恢复一下终端的状态吧,看不到光标了,还有参数选项解释可以详细点,现在不知道怎么传参
这个问题还有出现吗?我在发布前已经修复了这个问题的。
离线
离线
你们的github还能登录?貌似说已经被墙掉了。。
可以的呢
离线
20210716更新:
请移步到https://whycan.com/t_6881.html
离线
20210716更新:
esp32上运行juicevm。听说esp32和linux kernel更配哦
https://whycan.com/t_6899.html
离线
可以gdb调试吗?
TODO
离线
esp32运行linux的视频发布了:https://www.bilibili.com/video/av631861476
离线
ma6254 说:可以gdb调试吗?
TODO
GDB调试已支持。
20210725更新:
juice_vm_release_for_Linux_b0583e8f.zip
最近编辑记录 xiaohui (2021-07-25 22:35:58)
离线
开源juicevm的gdb stub组件:https://github.com/juiceRv/gdb_stub_for_juicevm
最近编辑记录 xiaohui (2021-07-26 12:17:26)
离线
讨论帖:
需要给juicevm添加一个显示器外设,想来坑网投个票:请在讨论里回复自己的想法,谢谢大家的支持
1.类似大多数soc里的做法,实现一个lcd控制器。
2.实现类似vga控制器的做法,控制当前笔的位置和颜色。
离线
离线
离线
大神,这个能在macOS下编译一个么,试了下NEMU但是无法编译出可以在用户态下运行的程序
juicevm 新增了macos的发行包了,后面上传上来。
这里的用户态是指risc-v里的user mode还是macos的用户程序?
如果是risc-v 的用户模式是支持的,用户程序的话不支持呢。
离线
20210902更新:
可能有小伙伴以为juicevm不更新了,打算做成TLS的,这次更新时间长是因为我把代码框架重构了,为后面的多核和多架构支持做好了准备。
这次更新除了框架重构外还添加了risc-v32 ima的支持(在rv32下暂不支持任何MMU,但是已经在TODO里啦,只要是RV32支持的将全都有),还即将支持用设备树来实现动态的寄存器地址和外设配置呢。下面我们下载下最新的支持体验下吧!!!
这次上传只打包了linux下的版本,window和macos的在路上了。
juice_vm_release_for_Linux_f73bcb1c.zip
离线
顺便给大家献上risc-v32下的测试代码:
rv32_test_c_env.zip
为了大家需要打字才可以运行,编译代码如下:
wget https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.1/xpack-riscv-none-embed-gcc-8.3.0-2.1-linux-x64.tar.gz
tar vxf xpack-riscv-none-embed-gcc-8.3.0-2.1-linux-x64.tar.gz
unzip rv32_test_c_env.zip
cd rv32_test_c_env
make CROSS_COMPILE=../xpack-riscv-none-embed-gcc-8.3.0-2.1/bin/riscv-none-embed-
./juicevm_rv32_for_Linux.out -a -g ./c_env_test.bin
运行效果:
global_vm_log_init juicevm_rv_output_mode_sel: 0 JUICE_VM_LOG_MAX_NUM:6000
_ _ __ ____ __
| |_ _(_) ___ __\ \ / | \/ |
_ | | | | | |/ __/ _ \ \ / /| |\/| |
| |_| | |_| | | (_| __/\ V / | | | |
\___/ \__,_|_|\___\___| \_/ |_| |_|
email: juicemail@163.com
version:f73bcb1c f73bcb1c Thu, 2 Sep 2021 19:39:22 +0800 xiaohui Merge branch 'master' of e.coding.net:xiaoxiaohuixxh/risc-v_vm/risc-v_sim
firm_addr:../../rv32_test/c_env/c_env_test.bin
fd = 3
file_size = 16928
[rv64_sim][dev][mem]main.c(280):RV_CPU_SIM_RAM_START_ADDR 7fbec83cce0b
[rv64_sim][dev][mem]main.c(284):RV_CPU_SIM_RAM_SIZE 8388608 Bytes 8.000000 MiB
interrupt_vertor_register_mag_init
rv_csr_register_init
csr_addr_misa 40140101
csr_addr_mvendorid 00000000
csr_addr_marchid 00000000
csr_addr_mimpid 00000000
csr_addr_mhartid 00000000
rv_peripheral_device_init
[rv64_sim][dev][mmu]rv_pdev.c(605):rv_peripheral_device_mmu_init,Sv39 mode support only
[rv64_sim][dev][mtime]rv_pdev.c(247):rv_peripheral_device_mtime_init
[rv64_sim][dev][mtime]rv_pdev.c(272):pdev_mtime_irq_info 0x7fffd20ac734 80800003 80800007
[rv64_sim][proc][err]rv.c[interrupt_vertor_register32](825){pc:0000000000000000}:interrupt_vertor_register err->irq info err irq_v 1 addr_min 4
[rv64_sim][dev][mtime]rv_pdev.c(283):pdev_mtime_irq_info_on_umode (nil) 80800003 80800007
[rv64_sim][dev][uart0]rv_pdev.c(32):rv_peripheral_device_uart0_init
[rv64_sim][dev][uart0]rv_pdev.c(48):pdev_uart0_irq_info 0x7fffd20ac724
[rv64_sim][dev][uart0]rv_pdev.c(49):pdev_uart0_write_addr 80800000
[rv64_sim][dev][uart0]rv_pdev.c(50):pdev_uart0_state_addr 80800002
[rv64_sim][dev][fb0]framebuffer.c(24):rv_peripheral_device_fb0_init
rv sim start...
loading...
RV_CPU_SIM_RAM_START_ADDR 80000000
rv_cpu->reg.pc 80000000
instr 80000000 100117
cpu run...
ab
hello world1
离线
期待大家一键三连。。。@晕哥啥时候开发一键三连功能呀???
离线
20210916更新:
https://github.com/juiceRv/JuiceVm/blob/master/juice_vm_release_for_Linux_and_mingw64_laster.zip
feat(allwinner-d1): add allwinner d1 support
离线
2021-10-24更新:
1.修复指令bug并通过risc-v官方指令集测试。
2.成功启动busybox。
3.在linux平台下支持模拟网卡。
juice_vm_release_f6bb27902.zip
linux运行固件:
fw_payload.zip
最近编辑记录 xiaohui (2021-10-25 12:04:02)
离线
uip_test:
uip_test.zip
/*
* Copyright (c) 2006-2021, JuiceVm Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021/04/22 Juice the first version
*/
#ifndef RV_MTVEC_MAP_INCLUDE
#define RV_MTVEC_MAP_INCLUDE
#include "rv_config.h"
#define JUICEVM_RELASE_VERSION 90
// #define mtvec_base_addr 0x5400 // 0x5400=21*1024 BYTE = 21KB
// #define mktime_irq_offet 0x2
#define RAM_SIZE_KB (1024)
#define RAM_SIZE_MB (1024*RAM_SIZE_KB)
#define RAM_SIZE_GB (1024*RAM_SIZE_MB)
#define RV_CPU_SIM_RAM_START_ADDR ((_cur_rv_uint)(0x80000000))
#define RV_CPU_SIM_RAM_SIZE ((_cur_rv_uint)(256 * RAM_SIZE_MB))
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define rv_sim_pdev_base_addr (0x1000)
#else
#define rv_sim_pdev_base_addr (RV_CPU_SIM_RAM_START_ADDR+RV_CPU_SIM_RAM_SIZE)
#endif
#define rv_sim_pdev_uart0_base_addr (rv_sim_pdev_base_addr)
#define pdev_uart0_write_addr (rv_sim_pdev_uart0_base_addr)
#define pdev_uart0_read_addr (rv_sim_pdev_uart0_base_addr+1)
#define pdev_uart0_free_state 0x00
#define pdev_uart0_readbusy_state 0x01
#define pdev_uart0_state_addr (rv_sim_pdev_uart0_base_addr+2)
#define rv_sim_pdev_mtime_base_addr (rv_sim_pdev_base_addr+3)
#define pdev_mtime_mtime_addr (rv_sim_pdev_mtime_base_addr)
#define pdev_mtime_mtimecmp_addr (rv_sim_pdev_mtime_base_addr+4)
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define rv_sim_pdev_clint_base_addr (pdev_mtime_mtimecmp_addr+4)
#define rv_sim_pdev_clint_msip_addr (rv_sim_pdev_clint_base_addr) // machine mode software intterupt pending
#define rv_sim_pdev_clint_mtimecmp_addr (rv_sim_pdev_clint_base_addr+0x4000)
#define rv_sim_pdev_clint_mtime_addr (rv_sim_pdev_clint_base_addr+0xBFF8)
#define rv_sim_pdev_clint_max_addr (rv_sim_pdev_clint_mtime_addr)
#define rv_sim_pdev_clint_next_addr (rv_sim_pdev_clint_max_addr+4)
#endif
#ifdef UNIX_COMPILER
#if !defined(ESPIDF)
#define peripheral_device_netcard0 1
#endif // !defined(ESPIDF)
#endif // UNIX_COMPILER
#if (peripheral_device_netcard0 == 1)
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define pdev_netcard0_base_addr (rv_sim_pdev_clint_next_addr)
#define pdev_netcard0_write_addr (pdev_netcard0_base_addr)
#define pdev_netcard0_write_end_addr (pdev_netcard0_base_addr+1500)
#define pdev_netcard0_write_cnt_H_addr (pdev_netcard0_write_end_addr+1)
#define pdev_netcard0_write_cnt_L_addr (pdev_netcard0_write_cnt_H_addr+2)
#define pdev_netcard0_write_start_addr (pdev_netcard0_write_cnt_L_addr+2)
#define pdev_netcard0_read_addr (pdev_netcard0_write_start_addr+1)
#define pdev_netcard0_read_end_addr (pdev_netcard0_read_addr+1500)
#define pdev_netcard0_readbuf_cnt_H_addr (pdev_netcard0_read_end_addr+1)
#define pdev_netcard0_readbuf_cnt_L_addr (pdev_netcard0_readbuf_cnt_H_addr+1)
#define pdev_netcard0_state_addr (pdev_netcard0_readbuf_cnt_L_addr+2)
#define pdev_netcard0_max_addr (pdev_netcard0_state_addr)
#define pdev_netcard0_next_addr (pdev_netcard0_state_addr+1)
#define pdev_netcard0_free_state 0x00
#define pdev_netcard0_readbusy_state 0x01
#else
#error("not support netcard yet");
#endif
#endif // (peripheral_device_netcard0 == 1)
#define uart0_irq_flag 1
#define uart0_irq_ecode 24
#define RV_exception_Instruction_address_misaligned_IFLAG 0
#define RV_exception_Instruction_address_misaligned_ECODE 0
#define RV_exception_Instruction_access_fault_IFLAG 0
#define RV_exception_Instruction_access_fault_ECODE 1
#define RV_exception_Illegal_Instruction_IFLAG 0
#define RV_exception_Illegal_Instruction_ECODE 2
#define RV_exception_Breakpoint_IFLAG 0
#define RV_exception_Breakpoint_ECODE 3
#define RV_exception_LoadAddress_Misaligned_IFLAG 0
#define RV_exception_LoadAddress_Misaligned_ECODE 4
#define RV_exception_Load_access_fault_IFLAG 0
#define RV_exception_Load_access_fault_ECODE 5
#define RV_exception_Store_or_AMO_Address_Misaligned_IFLAG 0
#define RV_exception_Store_or_AMO_Address_Misaligned_ECODE 6
#define RV_exception_Store_or_AMO_access_fault_IFLAG 0
#define RV_exception_Store_or_AMO_access_fault_ECODE 7
#define RV_exception_Environment_call_from_Umode_IFLAG 0
#define RV_exception_Environment_call_from_Umode_ECODE 8
#define RV_exception_Environment_call_from_Smode_IFLAG 0
#define RV_exception_Environment_call_from_Smode_ECODE 9
// https://zhuanlan.zhihu.com/p/164394603
#define RV_exception_Environment_Call_FromMachine_IFLAG 0
#define RV_exception_Environment_Call_FromMachine_ECODE 11
#define RV_exception_Environment_Call_FromUser_IFLAG 0
#define RV_exception_Environment_Call_FromUser_ECODE 8
#define RV_exception_Environment_Call_FromSupervisor_IFLAG 0
#define RV_exception_Environment_Call_FromSupervisor_ECODE 9
#define RV_exception_FloatingPoint_Disabled_IFLAG
#define RV_exception_FloatingPoint_Disabled_ECODE
#define RV_exception_Instruction_page_fault_IFLAG 0
#define RV_exception_Instruction_page_fault_ECODE 12
#define RV_exception_Load_page_fault_IFLAG 0
#define RV_exception_Load_page_fault_ECODE 13
#define RV_exception_Store_or_AMO_page_fault_IFLAG 0
#define RV_exception_Store_or_AMO_page_fault_ECODE 15
// Interrupt Exception Code Description
// 1 0 Reserved
// 1 1 Supervisor software interrupt not support
// 1 2 Reserved
// 1 3 Machine software interrupt not support
// 1 4 Reserved
// 1 5 Supervisor timer interrupt not support
// 1 6 Reserved
// 1 7 Machine timer interrupt support
// 1 8 Reserved
// 1 9 Supervisor external interrupt not support
// 1 10 Reserved
// 1 11 Machine external interrupt not support
// 1 12 Reserved
// 1 13 Reserved
// 1 14 Reserved
// 1 15 Reserved
// // 1 ≥16 Designated for platform use
// 0 0 Instruction address misaligned not support
// 0 1 Instruction access fault not support
// 0 2 Illegal instruction support
// 0 3 Breakpoint support
// 0 4 Load address misaligned support
// 0 5 Load access fault not support
// 0 6 Store/AMO address misaligned support
// 0 7 Store/AMO access fault not support
// 0 8 Environment call from U-mode not support
// 0 9 Environment call from S-mode not support
// 0 10 Reserved
// 0 11 Environment call from M-mode support
// 0 12 Instruction page fault not support
// 0 13 Load page fault not support
// 0 14 Reserved
// 0 15 Store/AMO page fault not support
// 0 16-23 Reserved
// // 0 24–31 Designated for custom use
// 0 32-47 Reserved
// // 0 48–63 Designated for custom use
// 0 ≥64 Reserved
// #define mtime_irq_flag 1
// #define mtime_irq_ecode 7
#define RV_Supervisor_software_interrupt_IFLAG 1
#define RV_Supervisor_software_interrupt_ECODE 1
#define RV_Machine_software_interrupt_IFLAG 1
#define RV_Machine_software_interrupt_ECODE 3
#define RV_User_timer_interrupt_IFLAG 1
#define RV_User_timer_interrupt_ECODE 4
#define RV_Supervisor_timer_interrupt_IFLAG 1
#define RV_Supervisor_timer_interrupt_ECODE 5
#define RV_Machine_timer_interrupt_IFLAG 1
#define RV_Machine_timer_interrupt_ECODE 7
#define RV_Supervisor_external_interrupt_IFLAG 1
#define RV_Supervisor_external_interrupt_ECODE 9
#define RV_Machine_external_interrupt_IFLAG 1
#define RV_Machine_external_interrupt_ECODE 10
#endif // RV_MTVEC_MAP_INCLUDE
最近编辑记录 xiaohui (2021-10-25 12:55:27)
离线
大佬,什么时候会开源啊。非常好奇想学习一下的说
他的外设和组件已经在逐步开源了呢。
gdb组件开源:
https://github.com/juiceRv/gdb_stub_for_juicevm
fb组件开源:
https://github.com/juiceRv/tinygl_sdl_test
暂时不开源虚拟机的cpu部分。
cpu部分以为耦合性比较强,正在拆分成多级流水线的实现方式,使用内置的调度器进行并行处理。所以暂时没有开源时间公布。
离线
2021-11-12更新:
1.在linux平台和window下支持模拟显示器。
juice_vm_release_9bf0c4eb2.zip
加速后的效果
/*
*
* Automatically generated file; DO NOT EDIT.
* JuiceVm Compile Menu
*
*/
#define CONFIG_HAVE_FB_SDL_SUPPORT 1
#define CONFIG_FB_SDL_HEIGHT 480
#define CONFIG_FB_SDL_WIDTH 600
/*
* Copyright (c) 2006-2021, JuiceVm Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021/04/22 Juice the first version
*/
#ifndef RV_MTVEC_MAP_INCLUDE
#define RV_MTVEC_MAP_INCLUDE
#include "rv_config.h"
#include <generated/autoconf.h>
#define JUICEVM_RELASE_VERSION 90
// #define mtvec_base_addr 0x5400 // 0x5400=21*1024 BYTE = 21KB
// #define mktime_irq_offet 0x2
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define rv_sim_pdev_base_addr (0x1000)
#else
#define rv_sim_pdev_base_addr (RV_CPU_SIM_RAM_START_ADDR+RV_CPU_SIM_RAM_SIZE)
#endif
#define rv_sim_pdev_uart0_base_addr (rv_sim_pdev_base_addr)
#define pdev_uart0_write_addr (rv_sim_pdev_uart0_base_addr)
#define pdev_uart0_read_addr (rv_sim_pdev_uart0_base_addr+1)
#define pdev_uart0_free_state 0x00
#define pdev_uart0_readbusy_state 0x01
#define pdev_uart0_state_addr (rv_sim_pdev_uart0_base_addr+2)
#define rv_sim_pdev_mtime_base_addr (rv_sim_pdev_base_addr+3)
#define pdev_mtime_mtime_addr (rv_sim_pdev_mtime_base_addr)
#define pdev_mtime_mtimecmp_addr (rv_sim_pdev_mtime_base_addr+4)
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define rv_sim_pdev_clint_base_addr (pdev_mtime_mtimecmp_addr+4)
#define rv_sim_pdev_clint_msip_addr (rv_sim_pdev_clint_base_addr) // machine mode software intterupt pending
#define rv_sim_pdev_clint_mtimecmp_addr (rv_sim_pdev_clint_base_addr+0x4000)
#define rv_sim_pdev_clint_mtime_addr (rv_sim_pdev_clint_base_addr+0xBFF8)
#define rv_sim_pdev_clint_max_addr (rv_sim_pdev_clint_mtime_addr)
#define rv_sim_pdev_clint_next_addr (rv_sim_pdev_clint_max_addr+4)
#endif
#ifdef UNIX_COMPILER
#if !defined(ESPIDF)
#define peripheral_device_netcard0 1
#endif // !defined(ESPIDF)
#endif // UNIX_COMPILER
// #if (peripheral_device_netcard0 == 1)
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define pdev_netcard0_base_addr (rv_sim_pdev_clint_next_addr)
#define pdev_netcard0_write_addr (pdev_netcard0_base_addr)
#define pdev_netcard0_write_end_addr (pdev_netcard0_base_addr+1500)
#define pdev_netcard0_write_cnt_H_addr (pdev_netcard0_write_end_addr+1)
#define pdev_netcard0_write_cnt_L_addr (pdev_netcard0_write_cnt_H_addr+2)
#define pdev_netcard0_write_start_addr (pdev_netcard0_write_cnt_L_addr+2)
#define pdev_netcard0_read_addr (pdev_netcard0_write_start_addr+1)
#define pdev_netcard0_read_end_addr (pdev_netcard0_read_addr+1500)
#define pdev_netcard0_readbuf_cnt_H_addr (pdev_netcard0_read_end_addr+1)
#define pdev_netcard0_readbuf_cnt_L_addr (pdev_netcard0_readbuf_cnt_H_addr+1)
#define pdev_netcard0_state_addr (pdev_netcard0_readbuf_cnt_L_addr+2)
#define pdev_netcard0_max_addr (pdev_netcard0_state_addr)
#define pdev_netcard0_next_addr (pdev_netcard0_state_addr+1)
#define pdev_netcard0_free_state 0x00
#define pdev_netcard0_readbusy_state 0x01
#else
#error("not support netcard yet");
#endif
// #endif // (peripheral_device_netcard0 == 1)
// #if (defined(CONFIG_HAVE_FB_SDL_SUPPORT))
#if (defined(JUICEVM_RELASE_VERSION) && (JUICEVM_RELASE_VERSION == 90))
#define pdev_fb0_base_addr (pdev_netcard0_next_addr)
#define pdev_fb0_write_x_H_addr (pdev_fb0_base_addr+1)
#define pdev_fb0_write_x_L_addr (pdev_fb0_base_addr+2)
#define pdev_fb0_write_y_H_addr (pdev_fb0_base_addr+3)
#define pdev_fb0_write_y_L_addr (pdev_fb0_base_addr+4)
#define pdev_fb0_write_r_addr (pdev_fb0_write_y_L_addr+1)
#define pdev_fb0_write_g_addr (pdev_fb0_write_y_L_addr+2)
#define pdev_fb0_write_b_addr (pdev_fb0_write_y_L_addr+3)
#define pdev_fb0_write_set_addr (pdev_fb0_write_y_L_addr+4)
#define pdev_fb0_write_render_addr (pdev_fb0_write_y_L_addr+5)
#define pdev_fb0_max_addr (pdev_fb0_write_render_addr)
#define pdev_fb0_next_addr (pdev_fb0_write_render_addr+1)
#else
#error("not support fb0 yet");
#endif
// #endif // (defined(CONFIG_HAVE_FB_SDL_SUPPORT))
#define uart0_irq_flag 1
#define uart0_irq_ecode 24
#define RV_exception_Instruction_address_misaligned_IFLAG 0
#define RV_exception_Instruction_address_misaligned_ECODE 0
#define RV_exception_Instruction_access_fault_IFLAG 0
#define RV_exception_Instruction_access_fault_ECODE 1
#define RV_exception_Illegal_Instruction_IFLAG 0
#define RV_exception_Illegal_Instruction_ECODE 2
#define RV_exception_Breakpoint_IFLAG 0
#define RV_exception_Breakpoint_ECODE 3
#define RV_exception_LoadAddress_Misaligned_IFLAG 0
#define RV_exception_LoadAddress_Misaligned_ECODE 4
#define RV_exception_Load_access_fault_IFLAG 0
#define RV_exception_Load_access_fault_ECODE 5
#define RV_exception_Store_or_AMO_Address_Misaligned_IFLAG 0
#define RV_exception_Store_or_AMO_Address_Misaligned_ECODE 6
#define RV_exception_Store_or_AMO_access_fault_IFLAG 0
#define RV_exception_Store_or_AMO_access_fault_ECODE 7
#define RV_exception_Environment_call_from_Umode_IFLAG 0
#define RV_exception_Environment_call_from_Umode_ECODE 8
#define RV_exception_Environment_call_from_Smode_IFLAG 0
#define RV_exception_Environment_call_from_Smode_ECODE 9
// https://zhuanlan.zhihu.com/p/164394603
#define RV_exception_Environment_Call_FromMachine_IFLAG 0
#define RV_exception_Environment_Call_FromMachine_ECODE 11
#define RV_exception_Environment_Call_FromUser_IFLAG 0
#define RV_exception_Environment_Call_FromUser_ECODE 8
#define RV_exception_Environment_Call_FromSupervisor_IFLAG 0
#define RV_exception_Environment_Call_FromSupervisor_ECODE 9
#define RV_exception_FloatingPoint_Disabled_IFLAG
#define RV_exception_FloatingPoint_Disabled_ECODE
#define RV_exception_Instruction_page_fault_IFLAG 0
#define RV_exception_Instruction_page_fault_ECODE 12
#define RV_exception_Load_page_fault_IFLAG 0
#define RV_exception_Load_page_fault_ECODE 13
#define RV_exception_Store_or_AMO_page_fault_IFLAG 0
#define RV_exception_Store_or_AMO_page_fault_ECODE 15
// Interrupt Exception Code Description
// 1 0 Reserved
// 1 1 Supervisor software interrupt not support
// 1 2 Reserved
// 1 3 Machine software interrupt not support
// 1 4 Reserved
// 1 5 Supervisor timer interrupt not support
// 1 6 Reserved
// 1 7 Machine timer interrupt support
// 1 8 Reserved
// 1 9 Supervisor external interrupt not support
// 1 10 Reserved
// 1 11 Machine external interrupt not support
// 1 12 Reserved
// 1 13 Reserved
// 1 14 Reserved
// 1 15 Reserved
// // 1 ≥16 Designated for platform use
// 0 0 Instruction address misaligned not support
// 0 1 Instruction access fault not support
// 0 2 Illegal instruction support
// 0 3 Breakpoint support
// 0 4 Load address misaligned support
// 0 5 Load access fault not support
// 0 6 Store/AMO address misaligned support
// 0 7 Store/AMO access fault not support
// 0 8 Environment call from U-mode not support
// 0 9 Environment call from S-mode not support
// 0 10 Reserved
// 0 11 Environment call from M-mode support
// 0 12 Instruction page fault not support
// 0 13 Load page fault not support
// 0 14 Reserved
// 0 15 Store/AMO page fault not support
// 0 16-23 Reserved
// // 0 24–31 Designated for custom use
// 0 32-47 Reserved
// // 0 48–63 Designated for custom use
// 0 ≥64 Reserved
// #define mtime_irq_flag 1
// #define mtime_irq_ecode 7
#define RV_Supervisor_software_interrupt_IFLAG 1
#define RV_Supervisor_software_interrupt_ECODE 1
#define RV_Machine_software_interrupt_IFLAG 1
#define RV_Machine_software_interrupt_ECODE 3
#define RV_User_timer_interrupt_IFLAG 1
#define RV_User_timer_interrupt_ECODE 4
#define RV_Supervisor_timer_interrupt_IFLAG 1
#define RV_Supervisor_timer_interrupt_ECODE 5
#define RV_Machine_timer_interrupt_IFLAG 1
#define RV_Machine_timer_interrupt_ECODE 7
#define RV_Supervisor_external_interrupt_IFLAG 1
#define RV_Supervisor_external_interrupt_ECODE 9
#define RV_Machine_external_interrupt_IFLAG 1
#define RV_Machine_external_interrupt_ECODE 10
#endif // RV_MTVEC_MAP_INCLUDE
最近编辑记录 xiaohui (2021-11-10 15:38:12)
离线
分享:不依赖时钟和os调度的uip例子
https://github.com/juiceRv/uip_test_for_juicevm
离线
希望这个模拟器能够加载 UART、SPI、Ethernet、usb等自定义外设,采用plugin模式,类似device tree。另外,建议提供demo,然后就能实用化了。
谢谢大佬的建议,会把这些建议加入到TODO list.
离线
juicevm的源代码真的没时间整理了。不嫌乱的话可以投票是否开源。
新项目,不过也是不怎么更新,但是开源: https://juicescript.com/
离线