├── chapter_2 └── benos │ ├── sbi │ ├── sbi_payload │ ├── sbi_linker.ld │ ├── sbi_payload.S │ ├── sbi_base.ld │ └── sbi_linker_payload.ld │ ├── src │ ├── kernel.c │ └── linker.ld │ └── include │ └── uart.h ├── chapter_9 ├── lab9-3 │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── clint.h │ │ ├── string.h │ │ └── uart.h │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ └── sbi_base.ld │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ └── src │ │ └── memset.S ├── lab9-1 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── clint.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_timer.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S └── lab9-2 │ └── benos │ ├── include │ ├── memset.h │ ├── asm │ │ ├── types.h │ │ ├── timer.h │ │ └── clint.h │ ├── string.h │ └── uart.h │ ├── sbi │ ├── sbi_linker.ld │ ├── sbi_payload.S │ └── sbi_timer.h │ ├── scripts │ └── kallsyms │ │ └── kallsyms │ └── src │ └── memset.S ├── images ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── risc-v.jpg ├── risc-v.png ├── season_1.png ├── season_2.png ├── RISC-V-course.png ├── dianpu-qr-code.png └── RISC-V-course-qrcode.png ├── 勘误 └── pic │ ├── 18.23.png │ └── 18.31.png ├── chapter_10 ├── lab10-1 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ └── sbi_base.ld │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab10-3 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ └── sbi_base.ld │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab10-4 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ └── sbi_base.ld │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab10-5 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ └── sbi_base.ld │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab10-6 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab10-2-fixed │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_timer.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S └── lab10-2-issue │ └── benos │ ├── include │ ├── memset.h │ ├── asm │ │ ├── types.h │ │ ├── timer.h │ │ └── memory.h │ ├── string.h │ └── uart.h │ ├── sbi │ ├── sbi_linker.ld │ ├── sbi_payload.S │ └── sbi_timer.h │ ├── scripts │ └── kallsyms │ │ └── kallsyms │ └── src │ └── memset.S ├── chapter_5 ├── lab5_4 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ ├── memset.S │ │ └── linker.ld └── lab5_5 │ └── benos │ ├── include │ ├── memset.h │ ├── type.h │ └── uart.h │ ├── sbi │ ├── sbi_linker.ld │ ├── sbi_payload.S │ └── sbi_base.ld │ └── src │ ├── memset.S │ └── linker.ld ├── chapter_6 ├── lab6-1 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab6-2 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab6-3 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab6-4 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab6-5 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── .tmp_vmbenos1 │ │ ├── .tmp_vmbenos2 │ │ ├── src │ │ └── memset.S │ │ └── sbi │ │ └── sbi_boot.S ├── lab6-6 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── .tmp_vmbenos1 │ │ ├── .tmp_vmbenos2 │ │ ├── src │ │ └── memset.S │ │ └── sbi │ │ └── sbi_boot.S └── example6-15 │ ├── test │ └── test.c ├── chapter_7 ├── lab7-1 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab7-2 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab7-3 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab7-4 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab7-5 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab7-6 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S └── example7-9 │ └── Makefile ├── chapter_8 ├── case-8-1 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_trap.h │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── case-8-2 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ └── src │ │ └── memset.S ├── lab8-1 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_trap.h │ │ └── src │ │ └── memset.S ├── lab8-2 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── .tmp_vmbenos1 │ │ ├── .tmp_vmbenos2 │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S └── lab8-3 │ └── benos │ ├── include │ ├── memset.h │ ├── asm │ │ └── types.h │ ├── string.h │ └── uart.h │ ├── sbi │ ├── sbi_linker.ld │ └── sbi_payload.S │ ├── scripts │ └── kallsyms │ │ └── kallsyms │ └── src │ └── memset.S ├── chapter_4 ├── example_4_4 │ └── benos │ │ ├── include │ │ ├── memset.h │ │ ├── type.h │ │ ├── printk.h │ │ ├── string.h │ │ └── uart.h │ │ ├── .tmp_vmbenos1 │ │ ├── .tmp_vmbenos2 │ │ └── src │ │ └── memset.S ├── example_4_2 │ ├── .tmp_vmbenos1 │ ├── .tmp_vmbenos2 │ ├── include │ │ └── uart.h │ ├── src │ │ ├── kernel.c │ │ └── linker.ld │ └── sbi │ │ └── sbi_boot.S ├── example_4_3 │ ├── .tmp_vmbenos1 │ ├── .tmp_vmbenos2 │ ├── include │ │ └── uart.h │ ├── src │ │ ├── kernel.c │ │ └── linker.ld │ └── sbi │ │ └── sbi_boot.S └── example_4_1 │ └── example_4_1.c ├── chapter_3 ├── lab3_6 │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_base.ld │ │ └── sbi_linker_payload.ld │ ├── include │ │ └── uart.h │ └── src │ │ └── linker.ld ├── lab3_1 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ ├── include │ │ └── uart.h │ │ └── src │ │ └── linker.ld ├── lab3_2 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ ├── include │ │ └── uart.h │ │ └── src │ │ └── linker.ld ├── lab3_3 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ ├── include │ │ └── uart.h │ │ └── src │ │ └── linker.ld ├── lab3_4 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ ├── include │ │ ├── memset.h │ │ └── uart.h │ │ └── src │ │ ├── memset.S │ │ └── linker.ld ├── lab3_5 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ ├── include │ │ └── uart.h │ │ └── src │ │ └── linker.ld ├── lab3_7 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ └── sbi_base.ld │ │ ├── include │ │ ├── memset.h │ │ └── uart.h │ │ └── src │ │ ├── memset.S │ │ └── linker.ld └── lab3_8 │ └── benos │ ├── sbi │ ├── sbi_linker.ld │ ├── sbi_payload.S │ └── sbi_base.ld │ ├── include │ ├── memset.h │ └── uart.h │ └── src │ ├── memset.S │ └── linker.ld ├── chapter_17 ├── lab17-1 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ └── memory.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab17-2 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ ├── memory.h │ │ │ └── current.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab17-3 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ ├── memory.h │ │ │ └── current.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── lab17-4 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ ├── usr │ │ ├── user_syscall.c │ │ └── syscall.h │ │ └── src │ │ └── memset.S └── lab17-5 │ └── benos │ ├── sbi │ ├── sbi_linker.ld │ ├── sbi_payload.S │ ├── sbi_timer.h │ ├── sbi_lib.h │ └── sbi_base.ld │ ├── include │ ├── asm │ │ ├── types.h │ │ ├── timer.h │ │ ├── memory.h │ │ ├── current.h │ │ └── syscall.h │ ├── irq.h │ ├── memset.h │ ├── string.h │ └── uart.h │ ├── scripts │ └── kallsyms │ │ └── kallsyms │ └── src │ └── memset.S ├── chapter_18 ├── example_18_2_hello │ └── hello ├── example_18_4_gdb_c │ ├── asm.S │ ├── spike.lds │ └── do_main.c └── example_18_3_gdb_asm │ └── spike.lds ├── chapter_20 ├── case-20-1 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── case-20-2 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── virt │ │ ├── vs_mm.h │ │ └── vs_mmu.h │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── timer.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── case-20-3 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── virt │ │ ├── vs_mm.h │ │ └── vs_mmu.h │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ ├── timer.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── case-20-4 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── virt │ │ ├── vs_mm.h │ │ └── vs_mmu.h │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── vmm.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ ├── timer.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ └── src │ │ └── memset.S ├── case-20-5 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── virt │ │ └── vs_mm.h │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── vmm.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ ├── timer.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ ├── gos │ │ ├── kernel.c │ │ └── linker.ld │ │ └── src │ │ └── memset.S ├── lab20-1 │ ├── benos │ │ ├── sbi │ │ │ ├── sbi_linker.ld │ │ │ ├── sbi_payload.S- │ │ │ ├── sbi_timer.h │ │ │ └── sbi_lib.h │ │ ├── include │ │ │ ├── asm │ │ │ │ ├── types.h │ │ │ │ ├── timer.h │ │ │ │ ├── memory.h │ │ │ │ ├── current.h │ │ │ │ └── syscall.h │ │ │ ├── irq.h │ │ │ ├── memset.h │ │ │ ├── string.h │ │ │ └── uart.h │ │ ├── scripts │ │ │ └── kallsyms │ │ │ │ └── kallsyms │ │ └── src │ │ │ └── memset.S │ └── Readme.txt ├── lab20-2 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── virt │ │ └── vs_mm.h │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── vmm.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ ├── timer.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ ├── gos │ │ ├── kernel.c │ │ └── linker.ld │ │ └── src │ │ └── memset.S ├── lab20-4 │ └── benos │ │ ├── sbi │ │ ├── sbi_linker.ld │ │ ├── sbi_payload.S │ │ ├── sbi_timer.h │ │ ├── sbi_lib.h │ │ └── sbi_base.ld │ │ ├── virt │ │ └── vs_mm.h │ │ ├── include │ │ ├── asm │ │ │ ├── types.h │ │ │ ├── vmm.h │ │ │ ├── memory.h │ │ │ ├── current.h │ │ │ ├── timer.h │ │ │ └── syscall.h │ │ ├── irq.h │ │ ├── memset.h │ │ ├── string.h │ │ └── uart.h │ │ ├── scripts │ │ └── kallsyms │ │ │ └── kallsyms │ │ ├── gos │ │ ├── kernel.c │ │ └── linker.ld │ │ └── src │ │ └── memset.S └── lab20-5 │ └── benos │ ├── sbi │ ├── sbi_linker.ld │ ├── sbi_payload.S │ ├── sbi_timer.h │ ├── sbi_lib.h │ └── sbi_base.ld │ ├── virt │ └── vs_mm.h │ ├── include │ ├── asm │ │ ├── types.h │ │ ├── vmm.h │ │ ├── memory.h │ │ ├── current.h │ │ ├── timer.h │ │ └── syscall.h │ ├── irq.h │ ├── memset.h │ ├── string.h │ └── uart.h │ ├── scripts │ └── kallsyms │ │ └── kallsyms │ ├── gos │ ├── gos.h │ └── linker.ld │ └── src │ └── memset.S ├── chapter_12 └── lab12-1 │ └── Makefile ├── chapter_16 ├── lab16-2-c.litmus └── lab16-2-c-fix.litmus ├── chapter_14 └── example_14_6_simple_lock_amo │ └── lock.S └── chapter_15 └── litmus ├── lab15-1-c.litmus └── example_15_23_c_test.litmus /chapter_2/benos/sbi/sbi_payload: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax" 3 | .incbin "benos.bin" 4 | 5 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/1.jpg -------------------------------------------------------------------------------- /images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/2.jpg -------------------------------------------------------------------------------- /images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/3.jpg -------------------------------------------------------------------------------- /勘误/pic/18.23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/勘误/pic/18.23.png -------------------------------------------------------------------------------- /勘误/pic/18.31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/勘误/pic/18.31.png -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /images/risc-v.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/risc-v.jpg -------------------------------------------------------------------------------- /images/risc-v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/risc-v.png -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #include "type.h" 2 | 3 | void *memset(void *s, int c, size_t count); 4 | -------------------------------------------------------------------------------- /images/season_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/season_1.png -------------------------------------------------------------------------------- /images/season_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/season_2.png -------------------------------------------------------------------------------- /chapter_6/example6-15/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_6/example6-15/test -------------------------------------------------------------------------------- /images/RISC-V-course.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/RISC-V-course.png -------------------------------------------------------------------------------- /images/dianpu-qr-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/dianpu-qr-code.png -------------------------------------------------------------------------------- /chapter_2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_6/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /images/RISC-V-course-qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/images/RISC-V-course-qrcode.png -------------------------------------------------------------------------------- /chapter_3/lab3_1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_18/example_18_2_hello/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_18/example_18_2_hello/hello -------------------------------------------------------------------------------- /chapter_2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_6/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_4/example_4_2/.tmp_vmbenos1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_4/example_4_2/.tmp_vmbenos1 -------------------------------------------------------------------------------- /chapter_4/example_4_2/.tmp_vmbenos2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_4/example_4_2/.tmp_vmbenos2 -------------------------------------------------------------------------------- /chapter_4/example_4_3/.tmp_vmbenos1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_4/example_4_3/.tmp_vmbenos1 -------------------------------------------------------------------------------- /chapter_4/example_4_3/.tmp_vmbenos2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_4/example_4_3/.tmp_vmbenos2 -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/.tmp_vmbenos1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_6/lab6-5/benos/.tmp_vmbenos1 -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/.tmp_vmbenos2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_6/lab6-5/benos/.tmp_vmbenos2 -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/.tmp_vmbenos1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_6/lab6-6/benos/.tmp_vmbenos1 -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/.tmp_vmbenos2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_6/lab6-6/benos/.tmp_vmbenos2 -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/.tmp_vmbenos1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_8/lab8-2/benos/.tmp_vmbenos1 -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/.tmp_vmbenos2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_8/lab8-2/benos/.tmp_vmbenos2 -------------------------------------------------------------------------------- /chapter_9/lab9-3/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/sbi/sbi_linker.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_ARCH(riscv) 3 | ENTRY(_start) 4 | 5 | SECTIONS 6 | { 7 | INCLUDE "sbi/sbi_base.ld" 8 | } 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_18/example_18_4_gdb_c/asm.S: -------------------------------------------------------------------------------- 1 | .global asm_test 2 | asm_test: 3 | vsetvli t1, a1, e8 4 | 5 | vle8.v v0, (a0) 6 | vadd.vv v2, v0, v0 7 | 8 | ret 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/virt/vs_mm.h: -------------------------------------------------------------------------------- 1 | #ifndef __BENOS_VIRT_MM_H_ 2 | #define __BENOS_VIRT_MM_H_ 3 | 4 | #define VS_MEM 0x30000000 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /chapter_3/lab3_1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_3/lab3_2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_3/lab3_3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_3/lab3_5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/sbi/sbi_payload.S-: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/.tmp_vmbenos1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_4/example_4_4/benos/.tmp_vmbenos1 -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/.tmp_vmbenos2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_4/example_4_4/benos/.tmp_vmbenos2 -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_6/example6-15/test.c: -------------------------------------------------------------------------------- 1 | 2 | int a = 5; 3 | 4 | int foo(void) 5 | { 6 | return a; 7 | } 8 | 9 | int main(void) 10 | { 11 | foo(); 12 | } 13 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_7/example7-9/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all: 3 | gcc in_test.c -o in_test -O2 4 | gcc in_test_fix.c -o in_test_fix -O2 5 | 6 | clean: 7 | rm in_test in_test_fix 8 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/sbi/sbi_payload.S: -------------------------------------------------------------------------------- 1 | 2 | .section .payload, "ax", %progbits 3 | .globl payload_bin 4 | payload_bin: 5 | .incbin "benos.bin" 6 | 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/include/type.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPE_H 2 | #define _BENOS_TYPE_H 3 | 4 | typedef unsigned int size_t; 5 | 6 | #endif /*BENOS_TYPE_H*/ 7 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_9/lab9-3/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_TYPES_H 2 | #define _BENOS_TYPES_H 3 | 4 | #define BITS_PER_LONG 64 5 | 6 | #endif /* CONFIG_64BIT */ 7 | -------------------------------------------------------------------------------- /chapter_18/example_18_3_gdb_asm/spike.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH( "riscv" ) 2 | 3 | SECTIONS 4 | { 5 | . = 0x10010000; 6 | .text : { *(.text) } 7 | .data : { *(.data) } 8 | } 9 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_8/lab8-2/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_8/lab8-3/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_9/lab9-1/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_9/lab9-2/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-1/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-3/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-4/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-5/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-6/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_17/lab17-1/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_17/lab17-2/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_17/lab17-3/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_17/lab17-4/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/usr/user_syscall.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "syscall.h" 3 | 4 | unsigned long malloc(void) 5 | { 6 | return syscall(__NR_malloc); 7 | } 8 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_17/lab17-5/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/lab20-1/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/lab20-2/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/lab20-4/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/lab20-5/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/case-20-1/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/case-20-2/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/case-20-3/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/case-20-4/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_20/case-20-5/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_9/lab9-3/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-2-fixed/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/scripts/kallsyms/kallsyms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/runninglinuxkernel/riscv_programming_practice/HEAD/chapter_10/lab10-2-issue/benos/scripts/kallsyms/kallsyms -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/irq.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define raw_local_irq_disable() arch_local_irq_disable() 4 | #define raw_local_irq_enable() arch_local_irq_enable() 5 | 6 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/memset.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_MEMSET_H 2 | #define _BENOS_MEMSET_H 3 | 4 | #include "type.h" 5 | 6 | void *memset(void *s, int c, size_t count); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | void handle_timer_irq(void); 5 | void timer_init(void); 6 | 7 | #endif /* _ASM_TIMER_H*/ 8 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_2/benos/src/kernel.c: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | 3 | void kernel_main(void) 4 | { 5 | uart_init(); 6 | uart_send_string("Welcome RISC-V!\r\n"); 7 | 8 | while (1) { 9 | ; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/gos/gos.h: -------------------------------------------------------------------------------- 1 | #ifndef _GOS_H_ 2 | #define _GOS_H_ 3 | 4 | void vs_trap_init(void); 5 | void vs_handle_timer_irq(void); 6 | void vs_timer_init(void); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void (*fn)(char c)); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void (*fn)(char c)); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/usr/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_USR_SYSCALL_H_ 2 | #define _BENOS_USR_SYSCALL_H_ 3 | 4 | extern unsigned long syscall(int nr, ...); 5 | 6 | unsigned long malloc(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void (*fn)(char c)); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/include/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTK_H 2 | #define _PRINTK_H 3 | 4 | void init_printk_done(void (*fn)(char c)); 5 | int printk(const char *fmt, ...); 6 | 7 | #endif /*_PRINTK_H*/ 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/sbi/sbi_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TIMER_H 2 | #define _SBI_TIMER_H 3 | 4 | void sbi_timer_process(void); 5 | void clint_timer_event_start(unsigned long next_event); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /chapter_18/example_18_4_gdb_c/spike.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH( "riscv" ) 2 | 3 | SECTIONS 4 | { 5 | . = 0x10010000; 6 | .text : { *(.text.startup) } 7 | .text : { *(.text) } 8 | .data : { *(.data) } 9 | } 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/virt/vs_mmu.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VS_MMU_H_ 2 | #define _BENOS_VS_MMU_H_ 3 | 4 | void set_vs_mapping_page(unsigned long gva, unsigned long gpa); 5 | void vs_paging_init(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/virt/vs_mmu.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VS_MMU_H_ 2 | #define _BENOS_VS_MMU_H_ 3 | 4 | void set_vs_mapping_page(unsigned long gva, unsigned long gpa); 5 | void vs_paging_init(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/asm/vmm.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VMM_H_ 2 | #define _BENOS_VMM_H_ 3 | 4 | unsigned long hlvwu(unsigned long addr); 5 | void hsvw(unsigned long addr, unsigned long value); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/virt/vs_mmu.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VS_MMU_H_ 2 | #define _BENOS_VS_MMU_H_ 3 | 4 | void set_vs_mapping_page(unsigned long gva, unsigned long gpa); 5 | void vs_paging_init(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/gos/kernel.c: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | 3 | void kernel_main(void) 4 | { 5 | uart_init(); 6 | uart_send_string("Welcome GuestOS!\r\n"); 7 | 8 | while (1) { 9 | ; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/asm/vmm.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VMM_H_ 2 | #define _BENOS_VMM_H_ 3 | 4 | unsigned long hlvwu(unsigned long addr); 5 | void hsvw(unsigned long addr, unsigned long value); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/gos/kernel.c: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | 3 | void kernel_main(void) 4 | { 5 | uart_init(); 6 | uart_send_string("Welcome GuestOS!\r\n"); 7 | 8 | while (1) { 9 | ; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/gos/kernel.c: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | 3 | void kernel_main(void) 4 | { 5 | uart_init(); 6 | uart_send_string("Welcome GuestOS!\r\n"); 7 | 8 | while (1) { 9 | ; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/src/memset.S: -------------------------------------------------------------------------------- 1 | .global __memset_16bytes_asm 2 | __memset_16bytes_asm: 3 | li t0, 0 4 | .loop: 5 | sd a1, (a0) 6 | sd a1, 8(a0) 7 | addi t0, t0, 16 8 | blt t0, a2, .loop 9 | 10 | ret 11 | -------------------------------------------------------------------------------- /chapter_12/lab12-1/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | gcc -pthread false_sharing_struct.c -o false_sharing_struct 3 | gcc -pthread false_sharing_array.c -o false_sharing_array 4 | 5 | clean: 6 | rm false_sharing_struct false_sharing_array 7 | -------------------------------------------------------------------------------- /chapter_18/example_18_4_gdb_c/do_main.c: -------------------------------------------------------------------------------- 1 | char bufa[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; 2 | 3 | extern void asm_test(char *buf, int n); 4 | 5 | void do_main(void) 6 | { 7 | asm_test(bufa, 16); 8 | } 9 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/sbi/sbi_trap.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TRAP_H 2 | #define _SBI_TRAP_H 3 | 4 | #define CAUSE_SUPERVISOR_ECALL 0x9 5 | 6 | void sbi_trap_init(void); 7 | void sbi_trap_handler(struct sbi_trap_regs *regs); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/sbi/sbi_trap.h: -------------------------------------------------------------------------------- 1 | #ifndef _SBI_TRAP_H 2 | #define _SBI_TRAP_H 3 | 4 | #define CAUSE_SUPERVISOR_ECALL 0x9 5 | 6 | void sbi_trap_init(void); 7 | void sbi_trap_handler(struct sbi_trap_regs *regs); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_6/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include "type.h" 5 | 6 | void *memcpy(void *dest, const void *src, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | #endif /* _STRING_H*/ 10 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/asm/vmm.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VMM_H_ 2 | #define _BENOS_VMM_H_ 3 | 4 | unsigned long hlvwu(unsigned long addr); 5 | unsigned long hlvxwu(unsigned long addr); 6 | void hsvw(unsigned long addr, unsigned long value); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/asm/vmm.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VMM_H_ 2 | #define _BENOS_VMM_H_ 3 | 4 | unsigned long hlvwu(unsigned long addr); 5 | unsigned long hlvxwu(unsigned long addr); 6 | void hsvw(unsigned long addr, unsigned long value); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/sbi/sbi_lib.h: -------------------------------------------------------------------------------- 1 | #ifndef __SBI_LIB_H__ 2 | #define __SBI_LIB_H__ 3 | 4 | unsigned long read_csr_num(int csr_num); 5 | void write_csr_num(int csr_num, unsigned long val); 6 | unsigned long log2roundup(unsigned long x); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_4/example_4_2/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_4/example_4_3/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/asm/vmm.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_VMM_H_ 2 | #define _BENOS_VMM_H_ 3 | 4 | unsigned long hlvwu(unsigned long addr); 5 | unsigned long hlvxwu(unsigned long addr); 6 | void hsvw(unsigned long addr, unsigned long value); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /chapter_3/lab3_1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_4/example_4_2/src/kernel.c: -------------------------------------------------------------------------------- 1 | int add_c(int a, int b) 2 | { 3 | return a + b; 4 | } 5 | 6 | int func1(void) 7 | { 8 | int a = 1; 9 | int b = 2; 10 | 11 | return add_c(a, b); 12 | } 13 | 14 | void kernel_main(void) 15 | { 16 | func1(); 17 | } 18 | -------------------------------------------------------------------------------- /chapter_4/example_4_3/src/kernel.c: -------------------------------------------------------------------------------- 1 | int add_c(int a, int b) 2 | { 3 | return a + b; 4 | } 5 | 6 | int func1(void) 7 | { 8 | int a = 1; 9 | int b = 2; 10 | 11 | return add_c(a, b); 12 | } 13 | 14 | void kernel_main(void) 15 | { 16 | func1(); 17 | } 18 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | 9 | #endif /*_MINI_UART_H */ 10 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | 10 | #endif /* _ASM_TIMER_H*/ 11 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | 通过修改ld链接脚本文件,让run_on_vm()函数链接到0x81000000,不过这样导致benos.bin文件过大。 3 | 在编译mysbi时候,让payload过大, 4 | 5 | mysbi.bin (addresses 0x0000000080000000 - 0x0000000080e04010) //mysbi超过了0x80200000. 6 | 7 | 所以这个实验需要把sbi_payload.S文件去掉,暂时不把benos.bin编译到mysbi中。 8 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/include/asm/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_MEMORY_H 2 | #define _ASM_MEMORY_H 3 | 4 | #include "mm.h" 5 | 6 | #define DDR_BASE 0x80000000UL 7 | #define TOTAL_MEMORY (16 * 0x100000UL) 8 | 9 | #define DDR_END (DDR_BASE + TOTAL_MEMORY) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /chapter_16/lab16-2-c.litmus: -------------------------------------------------------------------------------- 1 | C test 2 | "ab经典内存屏障故障" 3 | { } 4 | P0(int *a, int *b) 5 | { 6 | WRITE_ONCE(*a, 1); 7 | WRITE_ONCE(*b, 1); 8 | } 9 | 10 | P1(int *a, int *b) 11 | { 12 | int r0 = READ_ONCE(*b); 13 | int r1 = READ_ONCE(*a); 14 | } 15 | exists (1:r0=1 /\ 1:r1=0) 16 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_8/lab8-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_8/lab8-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_8/lab8-3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_4/example_4_4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | #endif /*_MINI_UART_H */ 11 | -------------------------------------------------------------------------------- /chapter_2/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | unsigned long get_cycles(void); 10 | 11 | #endif /* _ASM_TIMER_H*/ 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | unsigned long get_cycles(void); 10 | 11 | #endif /* _ASM_TIMER_H*/ 12 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | unsigned long get_cycles(void); 10 | 11 | #endif /* _ASM_TIMER_H*/ 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | unsigned long get_cycles(void); 10 | 11 | #endif /* _ASM_TIMER_H*/ 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | unsigned long get_cycles(void); 10 | 11 | #endif /* _ASM_TIMER_H*/ 12 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/asm/current.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_CURRENT_H 2 | #define _BENOS_CURRENT_H 3 | 4 | static struct task_struct *get_current(void) 5 | { 6 | register struct task_struct *tp __asm__("tp"); 7 | return tp; 8 | } 9 | 10 | #define current get_current() 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/asm/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_TIMER_H 2 | #define _ASM_TIMER_H 3 | 4 | #define CLINT_TIMEBASE_FREQ 10000000 5 | #define HZ 100 6 | 7 | void handle_timer_irq(void); 8 | void timer_init(void); 9 | unsigned long get_cycles(void); 10 | 11 | #endif /* _ASM_TIMER_H*/ 12 | -------------------------------------------------------------------------------- /chapter_3/lab3_6/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_4/example_4_1/example_4_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h =8, i = 9, j = -1; 6 | 7 | printf("data: %d %d %d %d %d %d %d %d %d %d\n", 8 | a, b, c, d, e, f, g, h, i, j); 9 | 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /chapter_4/example_4_2/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_4/example_4_3/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/gos/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/gos/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/gos/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_1/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_2/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_3/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_5/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/src/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/gos/linker.ld: -------------------------------------------------------------------------------- 1 | SECTIONS 2 | { 3 | . = 0x80200000, 4 | 5 | .text.boot : { *(.text.boot) } 6 | .text : { *(.text) } 7 | .rodata : { *(.rodata) } 8 | .data : { *(.data) } 9 | . = ALIGN(0x8); 10 | bss_begin = .; 11 | .bss : { *(.bss*) } 12 | bss_end = .; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/include/asm/clint.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLINT_RISCV_H__ 2 | #define __CLINT_RISCV_H__ 3 | 4 | #define VIRT_CLINT_ADDR 0x2000000 5 | #define VIRT_CLINT_TIMER_CMP (VIRT_CLINT_ADDR + 0x4000) 6 | 7 | #define VIRT_CLINT_TIMER_VAL (VIRT_CLINT_ADDR + 0xbff8) 8 | 9 | #endif /* __CLINT_RISCV_H__ */ 10 | -------------------------------------------------------------------------------- /chapter_9/lab9-1/benos/include/asm/clint.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLINT_RISCV_H__ 2 | #define __CLINT_RISCV_H__ 3 | 4 | #define VIRT_CLINT_ADDR 0x2000000 5 | #define VIRT_CLINT_TIMER_CMP (VIRT_CLINT_ADDR + 0x4000) 6 | 7 | #define VIRT_CLINT_TIMER_VAL (VIRT_CLINT_ADDR + 0xbff8) 8 | 9 | #endif /* __CLINT_RISCV_H__ */ 10 | -------------------------------------------------------------------------------- /chapter_9/lab9-2/benos/include/asm/clint.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLINT_RISCV_H__ 2 | #define __CLINT_RISCV_H__ 3 | 4 | #define VIRT_CLINT_ADDR 0x2000000 5 | #define VIRT_CLINT_TIMER_CMP (VIRT_CLINT_ADDR + 0x4000) 6 | 7 | #define VIRT_CLINT_TIMER_VAL (VIRT_CLINT_ADDR + 0xbff8) 8 | 9 | #endif /* __CLINT_RISCV_H__ */ 10 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_14/example_14_6_simple_lock_amo/lock.S: -------------------------------------------------------------------------------- 1 | /* 2 | get_lock(lock) 3 | */ 4 | 5 | .global get_lock 6 | get_lock: 7 | li a2, 1 8 | retry: 9 | amomax.w a1, a2, (a0) 10 | bnez a1, retry 11 | 12 | ret 13 | 14 | /* 15 | free_lock(lock) 16 | */ 17 | .global free_lock 18 | free_lock: 19 | sw x0, (a0) 20 | -------------------------------------------------------------------------------- /chapter_16/lab16-2-c-fix.litmus: -------------------------------------------------------------------------------- 1 | C test 2 | "ab经典内存屏障故障" 3 | { } 4 | P0(int *a, int *b) 5 | { 6 | WRITE_ONCE(*a, 1); 7 | smp_wmb(); 8 | WRITE_ONCE(*b, 1); 9 | } 10 | 11 | P1(int *a, int *b) 12 | { 13 | int r0 = READ_ONCE(*b); 14 | smp_rmb(); 15 | int r1 = READ_ONCE(*a); 16 | } 17 | exists (1:r0=1 /\ 1:r1=0) 18 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-1/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_3/lab3_6/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_9/lab9-3/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-fixed/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_10/lab10-2-issue/benos/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _MINI_UART_H 2 | #define _MINI_UART_H 3 | 4 | void uart_init ( void ); 5 | char uart_recv ( void ); 6 | void uart_send ( char c ); 7 | void uart_send_string(char* str); 8 | void putchar(char c); 9 | 10 | void enable_uart_plic(); 11 | 12 | #endif /*_MINI_UART_H */ 13 | -------------------------------------------------------------------------------- /chapter_15/litmus/lab15-1-c.litmus: -------------------------------------------------------------------------------- 1 | C test 2 | "shared_data and flag test" 3 | { } 4 | P0(int *x, int *y) 5 | { 6 | WRITE_ONCE(*x, 1); 7 | smp_mb(); 8 | int r1 = READ_ONCE(*y); 9 | } 10 | P1(int *x, int *y) 11 | { 12 | WRITE_ONCE(*y, 1); 13 | smp_mb(); 14 | int r2 = READ_ONCE(*x); 15 | } 16 | exists (0:r1=0 /\ 1:r2=0) 17 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/include/asm/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENOS_ASM_SYSCALL_H 2 | #define _BENOS_ASM_SYSCALL_H 3 | 4 | #include 5 | 6 | typedef long (*syscall_fn_t)(struct pt_regs *); 7 | 8 | extern const syscall_fn_t syscall_table[]; 9 | 10 | void riscv_svc_handler(struct pt_regs *regs); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /chapter_10/lab10-1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_10/lab10-3/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_10/lab10-4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_10/lab10-5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_10/lab10-6/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_15/litmus/example_15_23_c_test.litmus: -------------------------------------------------------------------------------- 1 | C test 2 | "shared_data and flag test" 3 | { } 4 | P0(int *data, int *flag) 5 | { 6 | WRITE_ONCE(*data, 55); 7 | WRITE_ONCE(*flag, 1); 8 | } 9 | P1(int *data, int *flag) 10 | { 11 | int a= READ_ONCE(*flag); 12 | int b = READ_ONCE(*data); 13 | } 14 | exists (1:a=1 /\ 1:b!=55) 15 | -------------------------------------------------------------------------------- /chapter_17/lab17-1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_17/lab17-2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_17/lab17-3/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_17/lab17-4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_17/lab17-5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_2/benos/sbi/sbi_linker_payload.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(riscv) 2 | ENTRY(_start) 3 | 4 | SECTIONS 5 | { 6 | INCLUDE "sbi/sbi_base.ld" 7 | 8 | . = 0x80200000; 9 | 10 | .payload : 11 | { 12 | PROVIDE(_payload_start = .); 13 | *(.payload) 14 | . = ALIGN(8); 15 | PROVIDE(_payload_end = .); 16 | } 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /chapter_20/case-20-1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/case-20-2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/case-20-3/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/case-20-4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/case-20-5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/lab20-2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/lab20-4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_20/lab20-5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_3/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_6/sbi/sbi_linker_payload.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_ARCH(riscv) 2 | ENTRY(_start) 3 | 4 | SECTIONS 5 | { 6 | INCLUDE "sbi/sbi_base.ld" 7 | 8 | . = 0x80200000; 9 | 10 | .payload : 11 | { 12 | PROVIDE(_payload_start = .); 13 | *(.payload) 14 | . = ALIGN(8); 15 | PROVIDE(_payload_end = .); 16 | } 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /chapter_3/lab3_7/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_3/lab3_8/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_4/example_4_2/sbi/sbi_boot.S: -------------------------------------------------------------------------------- 1 | .section ".text.boot" 2 | 3 | .globl _start 4 | _start: 5 | /* 设置栈, 栈的大小为4KB */ 6 | la sp, stacks_start 7 | li t0, 4096 8 | add sp, sp, t0 9 | 10 | /* 跳转到C语言 */ 11 | tail sbi_main 12 | 13 | .section .data 14 | .align 12 15 | .global stacks_start 16 | stacks_start: 17 | .skip 4096 18 | -------------------------------------------------------------------------------- /chapter_4/example_4_3/sbi/sbi_boot.S: -------------------------------------------------------------------------------- 1 | .section ".text.boot" 2 | 3 | .globl _start 4 | _start: 5 | /* 设置栈, 栈的大小为4KB */ 6 | la sp, stacks_start 7 | li t0, 4096 8 | add sp, sp, t0 9 | 10 | /* 跳转到C语言 */ 11 | tail sbi_main 12 | 13 | .section .data 14 | .align 12 15 | .global stacks_start 16 | stacks_start: 17 | .skip 4096 18 | -------------------------------------------------------------------------------- /chapter_5/lab5_4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_5/lab5_5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_6/lab6-1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_6/lab6-2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_6/lab6-3/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_6/lab6-4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_6/lab6-5/benos/sbi/sbi_boot.S: -------------------------------------------------------------------------------- 1 | .section ".text.boot" 2 | 3 | .globl _start 4 | _start: 5 | /* 设置栈, 栈的大小为4KB */ 6 | la sp, stacks_start 7 | li t0, 4096 8 | add sp, sp, t0 9 | 10 | /* 跳转到C语言 */ 11 | tail sbi_main 12 | 13 | .section .data 14 | .align 12 15 | .global stacks_start 16 | stacks_start: 17 | .skip 4096 18 | -------------------------------------------------------------------------------- /chapter_6/lab6-6/benos/sbi/sbi_boot.S: -------------------------------------------------------------------------------- 1 | .section ".text.boot" 2 | 3 | .globl _start 4 | _start: 5 | /* 设置栈, 栈的大小为4KB */ 6 | la sp, stacks_start 7 | li t0, 4096 8 | add sp, sp, t0 9 | 10 | /* 跳转到C语言 */ 11 | tail sbi_main 12 | 13 | .section .data 14 | .align 12 15 | .global stacks_start 16 | stacks_start: 17 | .skip 4096 18 | -------------------------------------------------------------------------------- /chapter_7/lab7-1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_7/lab7-2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_7/lab7-3/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_7/lab7-4/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_7/lab7-5/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_7/lab7-6/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_8/case-8-1/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | -------------------------------------------------------------------------------- /chapter_8/case-8-2/benos/sbi/sbi_base.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * 设置sbi的加载入口地址为0x80000000 3 | */ 4 | 5 | . = 0x80000000, 6 | 7 | .text.boot : { *(.text.boot) } 8 | .text : { *(.text) } 9 | .rodata : { *(.rodata) } 10 | .data : { *(.data) } 11 | . = ALIGN(0x8); 12 | bss_begin = .; 13 | .bss : { *(.bss*) } 14 | bss_end = .; 15 | --------------------------------------------------------------------------------