Open ccckmit opened 3 years ago
02-ContextSwitch
guest@localhost:~/sp/10-riscv/03-mini-riscv-os$ cd 02-ContextSwitch/
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/02-ContextSwitch$ ls
02-ContextSwitch--RISC-V的內文切換.md linux.md os.elf riscv.h sys.h
lib.c Makefile os.h run.md sys.s
lib.h os.c os.ld start.s
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/02-ContextSwitch$ make clean
rm -f *.elf
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/02-ContextSwitch$ make
riscv64-unknown-elf-gcc -nostdlib -fno-builtin -mcmodel=medany -march=rv32ima -mabi=ilp32 -T os.ld -o os.elf start.s sys.s lib.c os.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/02-ContextSwitch$ make qemu
Press Ctrl-A and then X to exit QEMU
qemu-system-riscv32 -nographic -smp 4 -machine virt -bios none -kernel os.elf
OS start
Task0: Context Switch Success !
QEMU: Terminated
03-MultiTasking
https://gitlab.com/ccc109/sp/-/tree/master/10-riscv/03-mini-riscv-os/03-MultiTasking
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/03-MultiTasking/os.c
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/03-MultiTasking/sys.s
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/03-MultiTasking/task.c
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/03-MultiTasking/user.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os$ cd 03-MultiTasking/
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/03-MultiTasking$ ls
03-MultiTasking--RISC-V的協同式多工.md linux.md os.elf riscv.h sys.h task.h
lib.c Makefile os.h run.md sys.s user.c
lib.h os.c os.ld start.s task.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/03-MultiTasking$ make clean
rm -f *.elf
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/03-MultiTasking$ make
riscv64-unknown-elf-gcc -nostdlib -fno-builtin -mcmodel=medany -march=rv32ima -mabi=ilp32 -T os.ld -o os.elf start.s sys.s lib.c task.c os.c user.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/03-MultiTasking$ make qemu
Press Ctrl-A and then X to exit QEMU
qemu-system-riscv32 -nographic -smp 4 -machine virt -bios none -kernel os.elf
OS start
OS: Activate next task
Task0: Created!
Task0: Now, return to kernel mode
OS: Back to OS
OS: Activate next task
Task1: Created!
Task1: Now, return to kernel mode
OS: Back to OS
OS: Activate next task
Task0: Running...
OS: Back to OS
OS: Activate next task
Task1: Running...
OS: Back to OS
OS: Activate next task
Task0: Running...
OS: Back to OS
OS: Activate next task
Task1: Running...
OS: Back to OS
OS: Activate next task
Task0: Running...
OS: Back to OS
OS: Activate next task
Task1: Running...
QEMU: Terminated
04-TimerInterrupt
https://gitlab.com/ccc109/sp/-/tree/master/10-riscv/03-mini-riscv-os/04-TimerInterrupt
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/04-TimerInterrupt/os.c
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/04-TimerInterrupt/timer.c
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/04-TimerInterrupt/sys.s
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/04-TimerInterrupt$ make clean
rm -f *.elf
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/04-TimerInterrupt$ make
riscv64-unknown-elf-gcc -nostdlib -fno-builtin -mcmodel=medany -march=rv32ima -mabi=ilp32 -T os.ld -o os.elf start.s sys.s lib.c timer.c os.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/04-TimerInterrupt$ make qemu
Press Ctrl-A and then X to exit QEMU
qemu-system-riscv32 -nographic -smp 4 -machine virt -bios none -kernel os.elf
OS start
timer_handler: 1
timer_handler: 2
timer_handler: 3
timer_handler: 4
timer_handler: 5
timer_handler: 6
timer_handler: 7
timer_handler: 8
timer_handler: 9
timer_handler: 10
timer_handler: 11
timer_handler: 12
timer_handler: 13
timer_handler: 14
QEMU: Terminated
https://gitlab.com/ccc109/sp/-/tree/master/10-riscv/03-mini-riscv-os/05-Preemptive
https://gitlab.com/ccc109/sp/-/blob/master/10-riscv/03-mini-riscv-os/05-Preemptive/user.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/05-Preemptive$ make clean
rm -f *.elf
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/05-Preemptive$ make
riscv64-unknown-elf-gcc -nostdlib -fno-builtin -mcmodel=medany -march=rv32ima -mabi=ilp32 -T os.ld -o os.elf start.s sys.s lib.c timer.c task.c os.c user.c trap.c
guest@localhost:~/sp/10-riscv/03-mini-riscv-os/05-Preemptive$ make qemu
Press Ctrl-A and then X to exit QEMU
qemu-system-riscv32 -nographic -smp 4 -machine virt -bios none -kernel os.elf
OS start
OS: Activate next task
Task0: Created!
Task0: Running...
timer interruption!
timer_handler: 1
OS: Back to OS
OS: Activate next task
Task1: Created!
Task1: Running...
timer interruption!
timer_handler: 2
OS: Back to OS
OS: Activate next task
Task0: Running...
timer interruption!
timer_handler: 3
OS: Back to OS
OS: Activate next task
Task1: Running...
timer interruption!
timer_handler: 4
OS: Back to OS
OS: Activate next task
Task0: Running...
timer interruption!
timer_handler: 5
OS: Back to OS
OS: Activate next task
Task1: Running...
timer interruption!
timer_handler: 6
OS: Back to OS
OS: Activate next task
Task0: Running...
timer interruption!
timer_handler: 7
OS: Back to OS
OS: Activate next task
Task1: Running...
QEMU: Terminated
休息到 3:50
RISC-V 書籍
請用 Google Meet 參加 Q&A 時間
110810508 曾智暐 到
請重新進來Google Meet 參加 Q&A 時間
請寫『姓名:到』!