From 8c661977b8541f403cd1405a5fa4ae6d73d43675 Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Tue, 19 Apr 2022 22:44:01 +0200 Subject: [PATCH] Use a virtual manifest starting tutorial 12 This is finally possible since the new feature resolver. For reference: https://github.com/rust-lang/rust-analyzer/issues/6197#issuecomment-827564835 --- 12_integrated_testing/Cargo.lock | 4 +- 12_integrated_testing/Cargo.toml | 63 +- 12_integrated_testing/Makefile | 18 +- 12_integrated_testing/README.md | 1352 +---------------- 12_integrated_testing/kernel/Cargo.toml | 58 + 12_integrated_testing/{ => kernel}/build.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu.rs | 0 .../src/_arch/aarch64/cpu/boot.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu/boot.s | 0 .../src/_arch/aarch64/exception.rs | 0 .../src/_arch/aarch64/exception.s | 0 .../_arch/aarch64/exception/asynchronous.rs | 0 .../src/_arch/aarch64/memory/mmu.rs | 0 .../aarch64/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/_arch/aarch64/time.rs | 0 12_integrated_testing/{ => kernel}/src/bsp.rs | 0 .../{ => kernel}/src/bsp/device_driver.rs | 0 .../{ => kernel}/src/bsp/device_driver/bcm.rs | 0 .../src/bsp/device_driver/bcm/bcm2xxx_gpio.rs | 0 .../device_driver/bcm/bcm2xxx_pl011_uart.rs | 0 .../src/bsp/device_driver/common.rs | 0 .../{ => kernel}/src/bsp/raspberrypi.rs | 0 .../src/bsp/raspberrypi/console.rs | 0 .../{ => kernel}/src/bsp/raspberrypi/cpu.rs | 0 .../src/bsp/raspberrypi/driver.rs | 0 .../src/bsp/raspberrypi/kernel.ld | 0 .../src/bsp/raspberrypi/memory.rs | 0 .../src/bsp/raspberrypi/memory/mmu.rs | 0 .../{ => kernel}/src/console.rs | 0 12_integrated_testing/{ => kernel}/src/cpu.rs | 0 .../{ => kernel}/src/cpu/boot.rs | 0 .../{ => kernel}/src/driver.rs | 0 .../{ => kernel}/src/exception.rs | 0 .../src/exception/asynchronous.rs | 0 12_integrated_testing/{ => kernel}/src/lib.rs | 0 .../{ => kernel}/src/main.rs | 0 .../{ => kernel}/src/memory.rs | 0 .../{ => kernel}/src/memory/mmu.rs | 0 .../src/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/panic_wait.rs | 0 .../{ => kernel}/src/print.rs | 0 .../{ => kernel}/src/synchronization.rs | 0 .../{ => kernel}/src/time.rs | 0 .../{ => kernel}/tests/00_console_sanity.rb | 0 .../{ => kernel}/tests/00_console_sanity.rs | 0 .../{ => kernel}/tests/01_timer_sanity.rs | 0 .../tests/02_exception_sync_page_fault.rs | 0 .../tests/03_exception_restore_sanity.rb | 0 .../tests/03_exception_restore_sanity.rs | 0 .../{ => kernel}/tests/boot_test_string.rb | 0 .../tests/panic_exit_success/mod.rs | 0 .../tests/panic_wait_forever/mod.rs | 0 .../{ => libraries}/test-macros/Cargo.toml | 0 .../{ => libraries}/test-macros/src/lib.rs | 0 .../{ => libraries}/test-types/Cargo.toml | 0 .../{ => libraries}/test-types/src/lib.rs | 0 .../Cargo.lock | 4 +- .../Cargo.toml | 63 +- 13_exceptions_part2_peripheral_IRQs/Makefile | 18 +- 13_exceptions_part2_peripheral_IRQs/README.md | 178 +-- .../kernel/Cargo.toml | 58 + .../{ => kernel}/build.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu.rs | 0 .../src/_arch/aarch64/cpu/boot.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu/boot.s | 0 .../{ => kernel}/src/_arch/aarch64/cpu/smp.rs | 0 .../src/_arch/aarch64/exception.rs | 0 .../src/_arch/aarch64/exception.s | 0 .../_arch/aarch64/exception/asynchronous.rs | 0 .../src/_arch/aarch64/memory/mmu.rs | 0 .../aarch64/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/_arch/aarch64/time.rs | 0 .../{ => kernel}/src/bsp.rs | 0 .../{ => kernel}/src/bsp/device_driver.rs | 0 .../{ => kernel}/src/bsp/device_driver/arm.rs | 0 .../src/bsp/device_driver/arm/gicv2.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicc.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicd.rs | 0 .../{ => kernel}/src/bsp/device_driver/bcm.rs | 0 .../src/bsp/device_driver/bcm/bcm2xxx_gpio.rs | 0 .../bcm/bcm2xxx_interrupt_controller.rs | 0 .../peripheral_ic.rs | 0 .../device_driver/bcm/bcm2xxx_pl011_uart.rs | 0 .../src/bsp/device_driver/common.rs | 0 .../{ => kernel}/src/bsp/raspberrypi.rs | 0 .../src/bsp/raspberrypi/console.rs | 0 .../{ => kernel}/src/bsp/raspberrypi/cpu.rs | 0 .../src/bsp/raspberrypi/driver.rs | 0 .../src/bsp/raspberrypi/exception.rs | 0 .../bsp/raspberrypi/exception/asynchronous.rs | 0 .../src/bsp/raspberrypi/kernel.ld | 0 .../src/bsp/raspberrypi/memory.rs | 0 .../src/bsp/raspberrypi/memory/mmu.rs | 0 .../{ => kernel}/src/console.rs | 0 .../{ => kernel}/src/cpu.rs | 0 .../{ => kernel}/src/cpu/boot.rs | 0 .../{ => kernel}/src/cpu/smp.rs | 0 .../{ => kernel}/src/driver.rs | 0 .../{ => kernel}/src/exception.rs | 0 .../src/exception/asynchronous.rs | 0 .../{ => kernel}/src/lib.rs | 0 .../{ => kernel}/src/main.rs | 0 .../{ => kernel}/src/memory.rs | 0 .../{ => kernel}/src/memory/mmu.rs | 0 .../src/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/panic_wait.rs | 0 .../{ => kernel}/src/print.rs | 0 .../{ => kernel}/src/state.rs | 0 .../{ => kernel}/src/synchronization.rs | 0 .../{ => kernel}/src/time.rs | 0 .../{ => kernel}/tests/00_console_sanity.rb | 0 .../{ => kernel}/tests/00_console_sanity.rs | 0 .../{ => kernel}/tests/01_timer_sanity.rs | 0 .../tests/02_exception_sync_page_fault.rs | 0 .../tests/03_exception_restore_sanity.rb | 0 .../tests/03_exception_restore_sanity.rs | 0 .../tests/04_exception_irq_sanity.rs | 0 .../{ => kernel}/tests/boot_test_string.rb | 0 .../tests/panic_exit_success/mod.rs | 0 .../tests/panic_wait_forever/mod.rs | 0 .../{ => libraries}/test-macros/Cargo.toml | 0 .../{ => libraries}/test-macros/src/lib.rs | 0 .../{ => libraries}/test-types/Cargo.toml | 0 .../{ => libraries}/test-types/src/lib.rs | 0 14_virtual_mem_part2_mmio_remap/Cargo.lock | 4 +- 14_virtual_mem_part2_mmio_remap/Cargo.toml | 63 +- 14_virtual_mem_part2_mmio_remap/Makefile | 18 +- 14_virtual_mem_part2_mmio_remap/README.md | 187 +-- .../kernel/Cargo.toml | 58 + .../{ => kernel}/build.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu.rs | 0 .../src/_arch/aarch64/cpu/boot.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu/boot.s | 0 .../{ => kernel}/src/_arch/aarch64/cpu/smp.rs | 0 .../src/_arch/aarch64/exception.rs | 0 .../src/_arch/aarch64/exception.s | 0 .../_arch/aarch64/exception/asynchronous.rs | 0 .../src/_arch/aarch64/memory/mmu.rs | 0 .../aarch64/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/_arch/aarch64/time.rs | 0 .../{ => kernel}/src/bsp.rs | 0 .../{ => kernel}/src/bsp/device_driver.rs | 0 .../{ => kernel}/src/bsp/device_driver/arm.rs | 0 .../src/bsp/device_driver/arm/gicv2.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicc.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicd.rs | 0 .../{ => kernel}/src/bsp/device_driver/bcm.rs | 0 .../src/bsp/device_driver/bcm/bcm2xxx_gpio.rs | 0 .../bcm/bcm2xxx_interrupt_controller.rs | 0 .../peripheral_ic.rs | 0 .../device_driver/bcm/bcm2xxx_pl011_uart.rs | 0 .../src/bsp/device_driver/common.rs | 0 .../{ => kernel}/src/bsp/raspberrypi.rs | 0 .../src/bsp/raspberrypi/console.rs | 0 .../{ => kernel}/src/bsp/raspberrypi/cpu.rs | 0 .../src/bsp/raspberrypi/driver.rs | 0 .../src/bsp/raspberrypi/exception.rs | 0 .../bsp/raspberrypi/exception/asynchronous.rs | 0 .../src/bsp/raspberrypi/kernel.ld | 0 .../src/bsp/raspberrypi/memory.rs | 0 .../src/bsp/raspberrypi/memory/mmu.rs | 0 .../{ => kernel}/src/common.rs | 0 .../{ => kernel}/src/console.rs | 0 .../{ => kernel}/src/cpu.rs | 0 .../{ => kernel}/src/cpu/boot.rs | 0 .../{ => kernel}/src/cpu/smp.rs | 0 .../{ => kernel}/src/driver.rs | 0 .../{ => kernel}/src/exception.rs | 0 .../src/exception/asynchronous.rs | 0 .../{ => kernel}/src/lib.rs | 0 .../{ => kernel}/src/main.rs | 0 .../{ => kernel}/src/memory.rs | 0 .../{ => kernel}/src/memory/mmu.rs | 0 .../{ => kernel}/src/memory/mmu/alloc.rs | 0 .../src/memory/mmu/mapping_record.rs | 0 .../src/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/memory/mmu/types.rs | 0 .../{ => kernel}/src/panic_wait.rs | 0 .../{ => kernel}/src/print.rs | 0 .../{ => kernel}/src/state.rs | 0 .../{ => kernel}/src/synchronization.rs | 0 .../{ => kernel}/src/time.rs | 0 .../{ => kernel}/tests/00_console_sanity.rb | 0 .../{ => kernel}/tests/00_console_sanity.rs | 0 .../{ => kernel}/tests/01_timer_sanity.rs | 0 .../tests/02_exception_sync_page_fault.rs | 0 .../tests/03_exception_restore_sanity.rb | 0 .../tests/03_exception_restore_sanity.rs | 0 .../tests/04_exception_irq_sanity.rs | 0 .../{ => kernel}/tests/boot_test_string.rb | 0 .../tests/panic_exit_success/mod.rs | 0 .../tests/panic_wait_forever/mod.rs | 0 .../{ => libraries}/test-macros/Cargo.toml | 0 .../{ => libraries}/test-macros/src/lib.rs | 0 .../{ => libraries}/test-types/Cargo.toml | 0 .../{ => libraries}/test-types/src/lib.rs | 0 .../Cargo.lock | 4 +- .../Cargo.toml | 63 +- .../Makefile | 20 +- .../README.md | 280 ++-- .../kernel/Cargo.toml | 58 + .../{ => kernel}/build.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu.rs | 0 .../src/_arch/aarch64/cpu/boot.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu/boot.s | 0 .../{ => kernel}/src/_arch/aarch64/cpu/smp.rs | 0 .../src/_arch/aarch64/exception.rs | 0 .../src/_arch/aarch64/exception.s | 0 .../_arch/aarch64/exception/asynchronous.rs | 0 .../src/_arch/aarch64/memory/mmu.rs | 0 .../aarch64/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/_arch/aarch64/time.rs | 0 .../{ => kernel}/src/bsp.rs | 0 .../{ => kernel}/src/bsp/device_driver.rs | 0 .../{ => kernel}/src/bsp/device_driver/arm.rs | 0 .../src/bsp/device_driver/arm/gicv2.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicc.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicd.rs | 0 .../{ => kernel}/src/bsp/device_driver/bcm.rs | 0 .../src/bsp/device_driver/bcm/bcm2xxx_gpio.rs | 0 .../bcm/bcm2xxx_interrupt_controller.rs | 0 .../peripheral_ic.rs | 0 .../device_driver/bcm/bcm2xxx_pl011_uart.rs | 0 .../src/bsp/device_driver/common.rs | 0 .../{ => kernel}/src/bsp/raspberrypi.rs | 0 .../src/bsp/raspberrypi/console.rs | 0 .../{ => kernel}/src/bsp/raspberrypi/cpu.rs | 0 .../src/bsp/raspberrypi/driver.rs | 0 .../src/bsp/raspberrypi/exception.rs | 0 .../bsp/raspberrypi/exception/asynchronous.rs | 0 .../src/bsp/raspberrypi/kernel.ld | 0 .../kernel_virt_addr_space_size.ld | 0 .../src/bsp/raspberrypi/memory.rs | 0 .../src/bsp/raspberrypi/memory/mmu.rs | 0 .../{ => kernel}/src/common.rs | 0 .../{ => kernel}/src/console.rs | 0 .../{ => kernel}/src/cpu.rs | 0 .../{ => kernel}/src/cpu/boot.rs | 0 .../{ => kernel}/src/cpu/smp.rs | 0 .../{ => kernel}/src/driver.rs | 0 .../{ => kernel}/src/exception.rs | 0 .../src/exception/asynchronous.rs | 0 .../{ => kernel}/src/lib.rs | 0 .../{ => kernel}/src/main.rs | 0 .../{ => kernel}/src/memory.rs | 0 .../{ => kernel}/src/memory/mmu.rs | 0 .../{ => kernel}/src/memory/mmu/alloc.rs | 0 .../src/memory/mmu/mapping_record.rs | 0 .../src/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/memory/mmu/types.rs | 0 .../{ => kernel}/src/panic_wait.rs | 0 .../{ => kernel}/src/print.rs | 0 .../{ => kernel}/src/state.rs | 0 .../{ => kernel}/src/synchronization.rs | 0 .../{ => kernel}/src/time.rs | 0 .../{ => kernel}/tests/00_console_sanity.rb | 0 .../{ => kernel}/tests/00_console_sanity.rs | 0 .../{ => kernel}/tests/01_timer_sanity.rs | 0 .../tests/02_exception_sync_page_fault.rs | 0 .../tests/03_exception_restore_sanity.rb | 0 .../tests/03_exception_restore_sanity.rs | 0 .../tests/04_exception_irq_sanity.rs | 0 .../{ => kernel}/tests/boot_test_string.rb | 0 .../tests/panic_exit_success/mod.rs | 0 .../tests/panic_wait_forever/mod.rs | 0 .../{ => libraries}/test-macros/Cargo.toml | 0 .../{ => libraries}/test-macros/src/lib.rs | 0 .../{ => libraries}/test-types/Cargo.toml | 0 .../{ => libraries}/test-types/src/lib.rs | 0 .../translation_table_tool/arch.rb | 0 .../{ => tools}/translation_table_tool/bsp.rb | 2 +- .../translation_table_tool/generic.rb | 0 .../translation_table_tool/kernel_elf.rb | 0 .../translation_table_tool/main.rb | 0 .../Cargo.lock | 4 +- .../Cargo.toml | 63 +- .../Makefile | 20 +- .../README.md | 102 +- .../kernel/Cargo.toml | 58 + .../{ => kernel}/build.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu.rs | 0 .../src/_arch/aarch64/cpu/boot.rs | 0 .../{ => kernel}/src/_arch/aarch64/cpu/boot.s | 0 .../{ => kernel}/src/_arch/aarch64/cpu/smp.rs | 0 .../src/_arch/aarch64/exception.rs | 0 .../src/_arch/aarch64/exception.s | 0 .../_arch/aarch64/exception/asynchronous.rs | 0 .../src/_arch/aarch64/memory/mmu.rs | 0 .../aarch64/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/_arch/aarch64/time.rs | 0 .../{ => kernel}/src/bsp.rs | 0 .../{ => kernel}/src/bsp/device_driver.rs | 0 .../{ => kernel}/src/bsp/device_driver/arm.rs | 0 .../src/bsp/device_driver/arm/gicv2.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicc.rs | 0 .../src/bsp/device_driver/arm/gicv2/gicd.rs | 0 .../{ => kernel}/src/bsp/device_driver/bcm.rs | 0 .../src/bsp/device_driver/bcm/bcm2xxx_gpio.rs | 0 .../bcm/bcm2xxx_interrupt_controller.rs | 0 .../peripheral_ic.rs | 0 .../device_driver/bcm/bcm2xxx_pl011_uart.rs | 0 .../src/bsp/device_driver/common.rs | 0 .../{ => kernel}/src/bsp/raspberrypi.rs | 0 .../src/bsp/raspberrypi/console.rs | 0 .../{ => kernel}/src/bsp/raspberrypi/cpu.rs | 0 .../src/bsp/raspberrypi/driver.rs | 0 .../src/bsp/raspberrypi/exception.rs | 0 .../bsp/raspberrypi/exception/asynchronous.rs | 0 .../src/bsp/raspberrypi/kernel.ld | 0 .../kernel_virt_addr_space_size.ld | 0 .../src/bsp/raspberrypi/memory.rs | 0 .../src/bsp/raspberrypi/memory/mmu.rs | 0 .../{ => kernel}/src/common.rs | 0 .../{ => kernel}/src/console.rs | 0 .../{ => kernel}/src/cpu.rs | 0 .../{ => kernel}/src/cpu/boot.rs | 0 .../{ => kernel}/src/cpu/smp.rs | 0 .../{ => kernel}/src/driver.rs | 0 .../{ => kernel}/src/exception.rs | 0 .../src/exception/asynchronous.rs | 0 .../{ => kernel}/src/lib.rs | 0 .../{ => kernel}/src/main.rs | 0 .../{ => kernel}/src/memory.rs | 0 .../{ => kernel}/src/memory/mmu.rs | 0 .../{ => kernel}/src/memory/mmu/alloc.rs | 0 .../src/memory/mmu/mapping_record.rs | 0 .../src/memory/mmu/translation_table.rs | 0 .../{ => kernel}/src/memory/mmu/types.rs | 0 .../{ => kernel}/src/panic_wait.rs | 0 .../{ => kernel}/src/print.rs | 0 .../{ => kernel}/src/state.rs | 0 .../{ => kernel}/src/synchronization.rs | 0 .../{ => kernel}/src/time.rs | 0 .../{ => kernel}/tests/00_console_sanity.rb | 0 .../{ => kernel}/tests/00_console_sanity.rs | 0 .../{ => kernel}/tests/01_timer_sanity.rs | 0 .../tests/02_exception_sync_page_fault.rs | 0 .../tests/03_exception_restore_sanity.rb | 0 .../tests/03_exception_restore_sanity.rs | 0 .../tests/04_exception_irq_sanity.rs | 0 .../{ => kernel}/tests/boot_test_string.rb | 0 .../tests/panic_exit_success/mod.rs | 0 .../tests/panic_wait_forever/mod.rs | 0 .../{ => libraries}/test-macros/Cargo.toml | 0 .../{ => libraries}/test-macros/src/lib.rs | 0 .../{ => libraries}/test-types/Cargo.toml | 0 .../{ => libraries}/test-types/src/lib.rs | 0 .../translation_table_tool/arch.rb | 0 .../{ => tools}/translation_table_tool/bsp.rb | 2 +- .../translation_table_tool/generic.rb | 0 .../translation_table_tool/kernel_elf.rb | 0 .../translation_table_tool/main.rb | 0 common/tests/dispatch.rb | 7 +- utils/devtool.rb | 10 +- utils/diff_tut_folders.bash | 3 +- 355 files changed, 833 insertions(+), 2009 deletions(-) create mode 100644 12_integrated_testing/kernel/Cargo.toml rename 12_integrated_testing/{ => kernel}/build.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/cpu.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/cpu/boot.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/cpu/boot.s (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/exception.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/exception.s (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/exception/asynchronous.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/memory/mmu.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/memory/mmu/translation_table.rs (100%) rename 12_integrated_testing/{ => kernel}/src/_arch/aarch64/time.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/device_driver.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/device_driver/bcm.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/device_driver/common.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi/console.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi/cpu.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi/driver.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi/kernel.ld (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi/memory.rs (100%) rename 12_integrated_testing/{ => kernel}/src/bsp/raspberrypi/memory/mmu.rs (100%) rename 12_integrated_testing/{ => kernel}/src/console.rs (100%) rename 12_integrated_testing/{ => kernel}/src/cpu.rs (100%) rename 12_integrated_testing/{ => kernel}/src/cpu/boot.rs (100%) rename 12_integrated_testing/{ => kernel}/src/driver.rs (100%) rename 12_integrated_testing/{ => kernel}/src/exception.rs (100%) rename 12_integrated_testing/{ => kernel}/src/exception/asynchronous.rs (100%) rename 12_integrated_testing/{ => kernel}/src/lib.rs (100%) rename 12_integrated_testing/{ => kernel}/src/main.rs (100%) rename 12_integrated_testing/{ => kernel}/src/memory.rs (100%) rename 12_integrated_testing/{ => kernel}/src/memory/mmu.rs (100%) rename 12_integrated_testing/{ => kernel}/src/memory/mmu/translation_table.rs (100%) rename 12_integrated_testing/{ => kernel}/src/panic_wait.rs (100%) rename 12_integrated_testing/{ => kernel}/src/print.rs (100%) rename 12_integrated_testing/{ => kernel}/src/synchronization.rs (100%) rename 12_integrated_testing/{ => kernel}/src/time.rs (100%) rename 12_integrated_testing/{ => kernel}/tests/00_console_sanity.rb (100%) rename 12_integrated_testing/{ => kernel}/tests/00_console_sanity.rs (100%) rename 12_integrated_testing/{ => kernel}/tests/01_timer_sanity.rs (100%) rename 12_integrated_testing/{ => kernel}/tests/02_exception_sync_page_fault.rs (100%) rename 12_integrated_testing/{ => kernel}/tests/03_exception_restore_sanity.rb (100%) rename 12_integrated_testing/{ => kernel}/tests/03_exception_restore_sanity.rs (100%) rename 12_integrated_testing/{ => kernel}/tests/boot_test_string.rb (100%) rename 12_integrated_testing/{ => kernel}/tests/panic_exit_success/mod.rs (100%) rename 12_integrated_testing/{ => kernel}/tests/panic_wait_forever/mod.rs (100%) rename 12_integrated_testing/{ => libraries}/test-macros/Cargo.toml (100%) rename 12_integrated_testing/{ => libraries}/test-macros/src/lib.rs (100%) rename 12_integrated_testing/{ => libraries}/test-types/Cargo.toml (100%) rename 12_integrated_testing/{ => libraries}/test-types/src/lib.rs (100%) create mode 100644 13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/build.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/cpu.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/cpu/boot.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/cpu/boot.s (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/cpu/smp.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/exception.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/exception.s (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/exception/asynchronous.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/memory/mmu.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/memory/mmu/translation_table.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/_arch/aarch64/time.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/arm.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/arm/gicv2.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicc.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicd.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/bcm.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/device_driver/common.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/console.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/cpu.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/driver.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/exception.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/exception/asynchronous.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/kernel.ld (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/memory.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/bsp/raspberrypi/memory/mmu.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/console.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/cpu.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/cpu/boot.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/cpu/smp.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/driver.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/exception.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/exception/asynchronous.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/lib.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/main.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/memory.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/memory/mmu.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/memory/mmu/translation_table.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/panic_wait.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/print.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/state.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/synchronization.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/src/time.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/00_console_sanity.rb (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/00_console_sanity.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/01_timer_sanity.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/02_exception_sync_page_fault.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/03_exception_restore_sanity.rb (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/03_exception_restore_sanity.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/04_exception_irq_sanity.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/boot_test_string.rb (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/panic_exit_success/mod.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => kernel}/tests/panic_wait_forever/mod.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => libraries}/test-macros/Cargo.toml (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => libraries}/test-macros/src/lib.rs (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => libraries}/test-types/Cargo.toml (100%) rename 13_exceptions_part2_peripheral_IRQs/{ => libraries}/test-types/src/lib.rs (100%) create mode 100644 14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/build.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/cpu.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/cpu/boot.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/cpu/boot.s (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/cpu/smp.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/exception.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/exception.s (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/exception/asynchronous.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/memory/mmu.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/memory/mmu/translation_table.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/_arch/aarch64/time.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/arm.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/arm/gicv2.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicc.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicd.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/bcm.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/device_driver/common.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/console.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/cpu.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/driver.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/exception.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/exception/asynchronous.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/kernel.ld (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/memory.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/bsp/raspberrypi/memory/mmu.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/common.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/console.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/cpu.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/cpu/boot.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/cpu/smp.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/driver.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/exception.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/exception/asynchronous.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/lib.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/main.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/memory.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/memory/mmu.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/memory/mmu/alloc.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/memory/mmu/mapping_record.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/memory/mmu/translation_table.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/memory/mmu/types.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/panic_wait.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/print.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/state.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/synchronization.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/src/time.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/00_console_sanity.rb (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/00_console_sanity.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/01_timer_sanity.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/02_exception_sync_page_fault.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/03_exception_restore_sanity.rb (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/03_exception_restore_sanity.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/04_exception_irq_sanity.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/boot_test_string.rb (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/panic_exit_success/mod.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => kernel}/tests/panic_wait_forever/mod.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => libraries}/test-macros/Cargo.toml (100%) rename 14_virtual_mem_part2_mmio_remap/{ => libraries}/test-macros/src/lib.rs (100%) rename 14_virtual_mem_part2_mmio_remap/{ => libraries}/test-types/Cargo.toml (100%) rename 14_virtual_mem_part2_mmio_remap/{ => libraries}/test-types/src/lib.rs (100%) create mode 100644 15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/build.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/cpu.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/cpu/boot.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/cpu/boot.s (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/cpu/smp.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/exception.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/exception.s (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/exception/asynchronous.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/memory/mmu.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/memory/mmu/translation_table.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/_arch/aarch64/time.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/arm.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/arm/gicv2.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicc.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicd.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/bcm.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/device_driver/common.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/console.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/cpu.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/driver.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/exception.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/exception/asynchronous.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/kernel.ld (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/memory.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/bsp/raspberrypi/memory/mmu.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/common.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/console.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/cpu.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/cpu/boot.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/cpu/smp.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/driver.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/exception.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/exception/asynchronous.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/lib.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/main.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/memory.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/memory/mmu.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/memory/mmu/alloc.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/memory/mmu/mapping_record.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/memory/mmu/translation_table.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/memory/mmu/types.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/panic_wait.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/print.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/state.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/synchronization.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/src/time.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/00_console_sanity.rb (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/00_console_sanity.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/01_timer_sanity.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/02_exception_sync_page_fault.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/03_exception_restore_sanity.rb (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/03_exception_restore_sanity.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/04_exception_irq_sanity.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/boot_test_string.rb (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/panic_exit_success/mod.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => kernel}/tests/panic_wait_forever/mod.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => libraries}/test-macros/Cargo.toml (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => libraries}/test-macros/src/lib.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => libraries}/test-types/Cargo.toml (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => libraries}/test-types/src/lib.rs (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => tools}/translation_table_tool/arch.rb (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => tools}/translation_table_tool/bsp.rb (94%) rename 15_virtual_mem_part3_precomputed_tables/{ => tools}/translation_table_tool/generic.rb (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => tools}/translation_table_tool/kernel_elf.rb (100%) rename 15_virtual_mem_part3_precomputed_tables/{ => tools}/translation_table_tool/main.rb (100%) create mode 100644 16_virtual_mem_part4_higher_half_kernel/kernel/Cargo.toml rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/build.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/cpu.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/cpu/boot.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/cpu/boot.s (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/cpu/smp.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/exception.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/exception.s (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/exception/asynchronous.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/memory/mmu.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/memory/mmu/translation_table.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/_arch/aarch64/time.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/arm.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/arm/gicv2.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicc.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/arm/gicv2/gicd.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/bcm.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/device_driver/common.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/console.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/cpu.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/driver.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/exception.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/exception/asynchronous.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/kernel.ld (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/memory.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/bsp/raspberrypi/memory/mmu.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/common.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/console.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/cpu.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/cpu/boot.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/cpu/smp.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/driver.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/exception.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/exception/asynchronous.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/lib.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/main.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/memory.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/memory/mmu.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/memory/mmu/alloc.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/memory/mmu/mapping_record.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/memory/mmu/translation_table.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/memory/mmu/types.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/panic_wait.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/print.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/state.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/synchronization.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/src/time.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/00_console_sanity.rb (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/00_console_sanity.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/01_timer_sanity.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/02_exception_sync_page_fault.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/03_exception_restore_sanity.rb (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/03_exception_restore_sanity.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/04_exception_irq_sanity.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/boot_test_string.rb (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/panic_exit_success/mod.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => kernel}/tests/panic_wait_forever/mod.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => libraries}/test-macros/Cargo.toml (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => libraries}/test-macros/src/lib.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => libraries}/test-types/Cargo.toml (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => libraries}/test-types/src/lib.rs (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => tools}/translation_table_tool/arch.rb (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => tools}/translation_table_tool/bsp.rb (94%) rename 16_virtual_mem_part4_higher_half_kernel/{ => tools}/translation_table_tool/generic.rb (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => tools}/translation_table_tool/kernel_elf.rb (100%) rename 16_virtual_mem_part4_higher_half_kernel/{ => tools}/translation_table_tool/main.rb (100%) diff --git a/12_integrated_testing/Cargo.lock b/12_integrated_testing/Cargo.lock index 5834e9f3..46e09629 100644 --- a/12_integrated_testing/Cargo.lock +++ b/12_integrated_testing/Cargo.lock @@ -39,9 +39,9 @@ checksum = "9ff023245bfcc73fb890e1f8d5383825b3131cc920020a5c487d6f113dfc428a" [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] diff --git a/12_integrated_testing/Cargo.toml b/12_integrated_testing/Cargo.toml index e768e678..6480a727 100644 --- a/12_integrated_testing/Cargo.toml +++ b/12_integrated_testing/Cargo.toml @@ -1,60 +1,9 @@ -[package] -name = "mingo" -version = "0.12.0" -authors = ["Andre Richter "] -edition = "2021" +[workspace] + +members = [ + "libraries/*", + "kernel" +] [profile.release] lto = true - -[features] -default = [] -bsp_rpi3 = ["tock-registers"] -bsp_rpi4 = ["tock-registers"] -test_build = ["qemu-exit"] - -##-------------------------------------------------------------------------------------------------- -## Dependencies -##-------------------------------------------------------------------------------------------------- - -[dependencies] -test-types = { path = "test-types" } - -# Optional dependencies -tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "3.x.x", optional = true } - -# Platform specific dependencies -[target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "7.x.x" } - -##-------------------------------------------------------------------------------------------------- -## Testing -##-------------------------------------------------------------------------------------------------- - -[dev-dependencies] -test-macros = { path = "test-macros" } - -# Unit tests are done in the library part of the kernel. -[lib] -name = "libkernel" -test = true - -# Disable unit tests for the kernel binary. -[[bin]] -name = "kernel" -path = "src/main.rs" -test = false - -# List of tests without harness. -[[test]] -name = "00_console_sanity" -harness = false - -[[test]] -name = "02_exception_sync_page_fault" -harness = false - -[[test]] -name = "03_exception_restore_sanity" -harness = false diff --git a/12_integrated_testing/Makefile b/12_integrated_testing/Makefile index 6adb1aca..427c9303 100644 --- a/12_integrated_testing/Makefile +++ b/12_integrated_testing/Makefile @@ -41,7 +41,7 @@ ifeq ($(BSP),rpi3) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi3.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi3.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat @@ -55,7 +55,7 @@ else ifeq ($(BSP),rpi4) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi4.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi4.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif @@ -67,9 +67,9 @@ export LD_SCRIPT_PATH ##-------------------------------------------------------------------------------------------------- ## Targets and Prerequisites ##-------------------------------------------------------------------------------------------------- +KERNEL_MANIFEST = kernel/Cargo.toml KERNEL_LINKER_SCRIPT = kernel.ld - -LAST_BUILD_CONFIG = target/$(BSP).build_config +LAST_BUILD_CONFIG = target/$(BSP).build_config KERNEL_ELF = target/$(TARGET)/release/kernel # This parses cargo's dep-info file. @@ -94,11 +94,11 @@ COMPILER_ARGS = --target=$(TARGET) \ $(FEATURES) \ --release -RUSTC_CMD = cargo rustc $(COMPILER_ARGS) +RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) CHECK_CMD = cargo check $(COMPILER_ARGS) -TEST_CMD = cargo test $(COMPILER_ARGS) +TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary @@ -203,6 +203,8 @@ chainboot: $(KERNEL_BIN) ##------------------------------------------------------------------------------ clippy: @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) --features test_build --tests \ + --manifest-path $(KERNEL_MANIFEST) ##------------------------------------------------------------------------------ ## Clean @@ -299,6 +301,10 @@ test_boot: $(KERNEL_BIN) define KERNEL_TEST_RUNNER #!/usr/bin/env bash + # The cargo test runner seems to change into the crate under test's directory. Therefore, ensure + # this script executes from the root. + cd $(shell pwd) + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/12_integrated_testing/README.md b/12_integrated_testing/README.md index 9c325e76..14dc3878 100644 --- a/12_integrated_testing/README.md +++ b/12_integrated_testing/README.md @@ -16,6 +16,7 @@ - [Introduction](#introduction) - [Challenges](#challenges) * [Acknowledgements](#acknowledgements) +- [Folder Restructuring](#folder-restructuring) - [Implementation](#implementation) * [Test Organization](#test-organization) * [Enabling `custom_test_frameworks` for Unit Tests](#enabling-custom_test_frameworks-for-unit-tests) @@ -82,6 +83,24 @@ additional insights. [testing]: https://os.phil-opp.com/testing +## Folder Restructuring + +For reasons explained later, in this tutorial, we need to add two support crates next to our main +kernel crate. To keep everything organized in separate directories, we are switching to what `cargo` +calls a [virtual manifest]. The kernel crate moves to `$ROOT/kernel`, and the support crates will go +into `$ROOT/libraries/`. The `Cargo.toml` in the `$ROOT` folder desribes this layout: + +```toml +[workspace] + +members = [ + "libraries/*", + "kernel" +] +``` + +[virtual manifest]: https://doc.rust-lang.org/cargo/reference/workspaces.html#virtual-manifest + ## Implementation We introduce two new `Makefile` targets: @@ -104,8 +123,8 @@ test: test_boot test_unit test_integration ### Test Organization -Until now, our kernel was a so-called `binary crate`. As [explained in the official Rust book], this -crate type disallows having `integration tests`. Quoting the book: +Until now, our kernel crate was a so-called `binary crate`. As [explained in the official Rust +book], this crate type disallows having `integration tests`. Quoting the book: [explained in the official Rust book]: https://doc.rust-lang.org/book/ch11-03-test-organization.html#integration-tests-for-binary-crates @@ -126,10 +145,10 @@ of the kernel code. The `main.rs` file is stripped down to the minimum. It only `use` statements. Since it is not possible to use `kernel` as the name for both the library and the binary part of the -crate, new entries in `Cargo.toml` are needed to differentiate the names. What's more, `cargo test` -would try to compile and run `unit tests` for both. In our case, it will be sufficient to have all -the unit test code in `lib.rs`, so test generation for `main.rs` can be disabled in `Cargo.toml` as -well through the `test` flag: +crate, new entries in `$ROOT/kernel/Cargo.toml` are needed to differentiate the names. What's more, +`cargo test` would try to compile and run `unit tests` for both. In our case, it will be sufficient +to have all the unit test code in `lib.rs`, so test generation for `main.rs` can be disabled in +`Cargo.toml` as well through the `test` flag: ```toml [lib] @@ -193,10 +212,10 @@ pub fn test_runner(tests: &[&test_types::UnitTest]) { The function signature shows that `test_runner` takes one argument: A slice of `test_types::UnitTest` references. This type definition lives in an external crate stored at -`$ROOT/test_types`. It is external because the type is also needed for a self-made [procedural -macro] that we'll use to write unit tests, and procedural macros _have_ to live in their own crate. -So to avoid a circular dependency between kernel and proc-macro, this split was needed. Anyways, -here is the type definition: +`$ROOT/libraries/test_types`. It is external because the type is also needed for a self-made +[procedural macro] that we'll use to write unit tests, and procedural macros _have_ to live in their +own crate. So to avoid a circular dependency between kernel and proc-macro, this split was needed. +Anyways, here is the type definition: [procedural macro]: https://doc.rust-lang.org/reference/procedural-macros.html @@ -396,6 +415,10 @@ The file `kernel_test_runner.sh` does not exist by default. We generate it on de define KERNEL_TEST_RUNNER #!/usr/bin/env bash + # The cargo test runner seems to change into the crate under test's directory. Therefore, ensure + # this script executes from the root. + cd $(shell pwd) + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') @@ -417,7 +440,7 @@ endef test_unit: $(call color_header, "Compiling unit test(s) - $(BSP)") $(call test_prepare) - RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(TEST_CMD) --lib + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(TEST_CMD) --lib ``` It first does the standard `objcopy` step to strip the `ELF` down to a raw binary. Just like in all @@ -426,7 +449,7 @@ provided to it by `cargo`, and finally compiles a `docker` command to execute th reference, here it is fully resolved for an `RPi3 BSP`: ```bash -docker run --rm -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing:/work/tutorial -w /work/tutorial -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing/../common:/work/common rustembedded/osdev-utils ruby ../common/tests/dispatch.rb qemu-system-aarch64 -M raspi3 -serial stdio -display none -semihosting -kernel $TEST_BINARY +docker run -t --rm -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing:/work/tutorial -w /work/tutorial -v /opt/rust-raspberrypi-OS-tutorials/12_integrated_testing/../common:/work/common rustembedded/osdev-utils:2021.12 ruby ../common/tests/dispatch.rb qemu-system-aarch64 -M raspi3 -serial stdio -display none -semihosting -kernel $TEST_BINARY ``` This command is quite similar to the one used in the `make test_boot` target that we have since @@ -441,17 +464,16 @@ executed successfully, which can be checked by inspecting `QEMU`'s exit code. So the provided qemu command it got from `ARGV`, and creates and runs an instance of `ExitCodeTest`: ```ruby -require_relative 'boot_test' -require_relative 'console_io_test' -require_relative 'exit_code_test' - qemu_cmd = ARGV.join(' ') binary = ARGV.last test_name = binary.gsub(%r{.*deps/}, '').split('-')[0] +# Check if virtual manifest (tutorial 12 or later) or not +path_prefix = File.exist?('kernel/Cargo.toml') ? 'kernel/' : '' + case test_name when 'kernel8.img' - load 'tests/boot_test_string.rb' # provides 'EXPECTED_PRINT' + load "#{path_prefix}tests/boot_test_string.rb" # provides 'EXPECTED_PRINT' BootTest.new(qemu_cmd, EXPECTED_PRINT).run # Doesn't return when 'libkernel' @@ -566,7 +588,7 @@ mod tests { ``` Note that since proc macros need to live in their own crates, we need to create a new one at -`$ROOT/test-macros` and save it there. +`$ROOT/libraries/test-macros` and save it there. Aaaaaand that's how you write unit tests. We're finished with that part for good now :raised_hands:. @@ -633,9 +655,9 @@ Note how the `test_runner` from `libkernel` is pulled in through For some tests, however, it is not needed to have the harness, because there is no need or possibility to partition the test into individual pieces. In this case, all the test code can live -in `kernel_init()`, and harness generation can be turned off through `Cargo.toml`. This tutorial -introduces two tests that don't need a harness. Here is how harness generation is turned off for -them: +in `kernel_init()`, and harness generation can be turned off through `$ROOT/kernel/Cargo.toml`. This +tutorial introduces two tests that don't need a harness. Here is how harness generation is turned +off for them: ```toml # List of tests without harness. @@ -740,7 +762,7 @@ Here is an excerpt from `00_console_sanity.rb` showing a subtest that does a han kernel over the console: ```ruby -require_relative '../../common/tests/console_io_test' +require 'console_io_test' # Verify sending and receiving works as expected. class TxRxHandshakeTest < SubtestBase @@ -890,1284 +912,12 @@ Compiling integration test(s) - rpi3 ``` ## Diff to previous -```diff - -diff -uNr 11_exceptions_part1_groundwork/.cargo/config.toml 12_integrated_testing/.cargo/config.toml ---- 11_exceptions_part1_groundwork/.cargo/config.toml -+++ 12_integrated_testing/.cargo/config.toml -@@ -0,0 +1,2 @@ -+[target.'cfg(target_os = "none")'] -+runner = "target/kernel_test_runner.sh" - -diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo.toml ---- 11_exceptions_part1_groundwork/Cargo.toml -+++ 12_integrated_testing/Cargo.toml -@@ -1,6 +1,6 @@ - [package] - name = "mingo" --version = "0.11.0" -+version = "0.12.0" - authors = ["Andre Richter "] - edition = "2021" - -@@ -11,20 +11,50 @@ - default = [] - bsp_rpi3 = ["tock-registers"] - bsp_rpi4 = ["tock-registers"] -- --[[bin]] --name = "kernel" --path = "src/main.rs" -+test_build = ["qemu-exit"] - - ##-------------------------------------------------------------------------------------------------- - ## Dependencies - ##-------------------------------------------------------------------------------------------------- - - [dependencies] -+test-types = { path = "test-types" } - - # Optional dependencies - tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -+qemu-exit = { version = "3.x.x", optional = true } - - # Platform specific dependencies - [target.'cfg(target_arch = "aarch64")'.dependencies] - cortex-a = { version = "7.x.x" } -+ -+##-------------------------------------------------------------------------------------------------- -+## Testing -+##-------------------------------------------------------------------------------------------------- -+ -+[dev-dependencies] -+test-macros = { path = "test-macros" } -+ -+# Unit tests are done in the library part of the kernel. -+[lib] -+name = "libkernel" -+test = true -+ -+# Disable unit tests for the kernel binary. -+[[bin]] -+name = "kernel" -+path = "src/main.rs" -+test = false -+ -+# List of tests without harness. -+[[test]] -+name = "00_console_sanity" -+harness = false -+ -+[[test]] -+name = "02_exception_sync_page_fault" -+harness = false -+ -+[[test]] -+name = "03_exception_restore_sanity" -+harness = false - -diff -uNr 11_exceptions_part1_groundwork/Makefile 12_integrated_testing/Makefile ---- 11_exceptions_part1_groundwork/Makefile -+++ 12_integrated_testing/Makefile -@@ -15,6 +15,13 @@ - # Default to a serial device name that is common in Linux. - DEV_SERIAL ?= /dev/ttyUSB0 - -+# Optional integration test name. -+ifdef TEST -+ TEST_ARG = --test $(TEST) -+else -+ TEST_ARG = --test '*' -+endif -+ - - - ##-------------------------------------------------------------------------------------------------- -@@ -28,6 +35,7 @@ - QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = raspi3 - QEMU_RELEASE_ARGS = -serial stdio -display none -+ QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting - OBJDUMP_BINARY = aarch64-none-elf-objdump - NM_BINARY = aarch64-none-elf-nm - READELF_BINARY = aarch64-none-elf-readelf -@@ -41,6 +49,7 @@ - QEMU_BINARY = qemu-system-aarch64 - QEMU_MACHINE_TYPE = - QEMU_RELEASE_ARGS = -serial stdio -display none -+ QEMU_TEST_ARGS = $(QEMU_RELEASE_ARGS) -semihosting - OBJDUMP_BINARY = aarch64-none-elf-objdump - NM_BINARY = aarch64-none-elf-nm - READELF_BINARY = aarch64-none-elf-readelf -@@ -89,6 +98,7 @@ - DOC_CMD = cargo doc $(COMPILER_ARGS) - CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) - CHECK_CMD = cargo check $(COMPILER_ARGS) -+TEST_CMD = cargo test $(COMPILER_ARGS) - OBJCOPY_CMD = rust-objcopy \ - --strip-all \ - -O binary -@@ -265,11 +275,13 @@ - ##-------------------------------------------------------------------------------------------------- - ## Testing targets - ##-------------------------------------------------------------------------------------------------- --.PHONY: test test_boot -+.PHONY: test test_boot test_unit test_integration -+ -+test_unit test_integration: FEATURES += --features test_build - - ifeq ($(QEMU_MACHINE_TYPE),) # QEMU is not supported for the board. - --test_boot test: -+test_boot test_unit test_integration test: - $(call color_header, "$(QEMU_MISSING_STRING)") - - else # QEMU is supported. -@@ -281,6 +293,43 @@ - $(call color_header, "Boot test - $(BSP)") - @$(DOCKER_TEST) $(EXEC_TEST_DISPATCH) $(EXEC_QEMU) $(QEMU_RELEASE_ARGS) -kernel $(KERNEL_BIN) - --test: test_boot -+##------------------------------------------------------------------------------ -+## Helpers for unit and integration test targets -+##------------------------------------------------------------------------------ -+define KERNEL_TEST_RUNNER -+ #!/usr/bin/env bash -+ -+ TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') -+ TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') -+ -+ $(OBJCOPY_CMD) $$TEST_ELF $$TEST_BINARY -+ $(DOCKER_TEST) $(EXEC_TEST_DISPATCH) $(EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY -+endef -+ -+export KERNEL_TEST_RUNNER -+ -+define test_prepare -+ @mkdir -p target -+ @echo "$$KERNEL_TEST_RUNNER" > target/kernel_test_runner.sh -+ @chmod +x target/kernel_test_runner.sh -+endef -+ -+##------------------------------------------------------------------------------ -+## Run unit test(s) -+##------------------------------------------------------------------------------ -+test_unit: -+ $(call color_header, "Compiling unit test(s) - $(BSP)") -+ $(call test_prepare) -+ @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(TEST_CMD) --lib -+ -+##------------------------------------------------------------------------------ -+## Run integration test(s) -+##------------------------------------------------------------------------------ -+test_integration: -+ $(call color_header, "Compiling integration test(s) - $(BSP)") -+ $(call test_prepare) -+ @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(TEST_CMD) $(TEST_ARG) -+ -+test: test_boot test_unit test_integration - - endif - -diff -uNr 11_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs 12_integrated_testing/src/_arch/aarch64/cpu.rs ---- 11_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs -+++ 12_integrated_testing/src/_arch/aarch64/cpu.rs -@@ -26,3 +26,24 @@ - asm::wfe() - } - } -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+#[cfg(feature = "test_build")] -+use qemu_exit::QEMUExit; -+ -+#[cfg(feature = "test_build")] -+const QEMU_EXIT_HANDLE: qemu_exit::AArch64 = qemu_exit::AArch64::new(); -+ -+/// Make the host QEMU binary execute `exit(1)`. -+#[cfg(feature = "test_build")] -+pub fn qemu_exit_failure() -> ! { -+ QEMU_EXIT_HANDLE.exit_failure() -+} -+ -+/// Make the host QEMU binary execute `exit(0)`. -+#[cfg(feature = "test_build")] -+pub fn qemu_exit_success() -> ! { -+ QEMU_EXIT_HANDLE.exit_success() -+} - -diff -uNr 11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs 12_integrated_testing/src/_arch/aarch64/exception.rs ---- 11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs -+++ 12_integrated_testing/src/_arch/aarch64/exception.rs -@@ -87,15 +87,14 @@ - - #[no_mangle] - unsafe extern "C" fn current_elx_synchronous(e: &mut ExceptionContext) { -- if e.fault_address_valid() { -- let far_el1 = FAR_EL1.get(); -- -- // This catches the demo case for this tutorial. If the fault address happens to be 8 GiB, -- // advance the exception link register for one instruction, so that execution can continue. -- if far_el1 == 8 * 1024 * 1024 * 1024 { -- e.elr_el1 += 4; -- -- return; -+ #[cfg(feature = "test_build")] -+ { -+ const TEST_SVC_ID: u64 = 0x1337; -+ -+ if let Some(ESR_EL1::EC::Value::SVC64) = e.esr_el1.exception_class() { -+ if e.esr_el1.iss() == TEST_SVC_ID { -+ return; -+ } - } - } - -@@ -192,6 +191,12 @@ - fn exception_class(&self) -> Option { - self.0.read_as_enum(ESR_EL1::EC) - } -+ -+ #[cfg(feature = "test_build")] -+ #[inline(always)] -+ fn iss(&self) -> u64 { -+ self.0.read(ESR_EL1::ISS) -+ } - } - - /// Human readable ESR_EL1. - -diff -uNr 11_exceptions_part1_groundwork/src/_arch/aarch64/memory/mmu/translation_table.rs 12_integrated_testing/src/_arch/aarch64/memory/mmu/translation_table.rs ---- 11_exceptions_part1_groundwork/src/_arch/aarch64/memory/mmu/translation_table.rs -+++ 12_integrated_testing/src/_arch/aarch64/memory/mmu/translation_table.rs -@@ -290,3 +290,31 @@ - self.lvl2.phys_start_addr_u64() - } - } -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+ -+#[cfg(test)] -+mod tests { -+ use super::*; -+ use test_macros::kernel_test; -+ -+ /// Check if the size of `struct TableDescriptor` is as expected. -+ #[kernel_test] -+ fn size_of_tabledescriptor_equals_64_bit() { -+ assert_eq!( -+ core::mem::size_of::(), -+ core::mem::size_of::() -+ ); -+ } -+ -+ /// Check if the size of `struct PageDescriptor` is as expected. -+ #[kernel_test] -+ fn size_of_pagedescriptor_equals_64_bit() { -+ assert_eq!( -+ core::mem::size_of::(), -+ core::mem::size_of::() -+ ); -+ } -+} - -diff -uNr 11_exceptions_part1_groundwork/src/_arch/aarch64/memory/mmu.rs 12_integrated_testing/src/_arch/aarch64/memory/mmu.rs ---- 11_exceptions_part1_groundwork/src/_arch/aarch64/memory/mmu.rs -+++ 12_integrated_testing/src/_arch/aarch64/memory/mmu.rs -@@ -163,3 +163,33 @@ - SCTLR_EL1.matches_all(SCTLR_EL1::M::Enable) - } - } -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+ -+#[cfg(test)] -+mod tests { -+ use super::*; -+ use core::{cell::UnsafeCell, ops::Range}; -+ use test_macros::kernel_test; -+ -+ /// Check if KERNEL_TABLES is in .bss. -+ #[kernel_test] -+ fn kernel_tables_in_bss() { -+ extern "Rust" { -+ static __bss_start: UnsafeCell; -+ static __bss_end_exclusive: UnsafeCell; -+ } -+ -+ let bss_range = unsafe { -+ Range { -+ start: __bss_start.get(), -+ end: __bss_end_exclusive.get(), -+ } -+ }; -+ let kernel_tables_addr = unsafe { &KERNEL_TABLES as *const _ as usize as *mut u64 }; -+ -+ assert!(bss_range.contains(&kernel_tables_addr)); -+ } -+} - -diff -uNr 11_exceptions_part1_groundwork/src/bsp/raspberrypi/console.rs 12_integrated_testing/src/bsp/raspberrypi/console.rs ---- 11_exceptions_part1_groundwork/src/bsp/raspberrypi/console.rs -+++ 12_integrated_testing/src/bsp/raspberrypi/console.rs -@@ -35,3 +35,14 @@ - pub fn console() -> &'static impl console::interface::All { - &super::PL011_UART - } -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+ -+/// Minimal code needed to bring up the console in QEMU (for testing only). This is often less steps -+/// than on real hardware due to QEMU's abstractions. -+/// -+/// For the RPi, nothing needs to be done. -+#[cfg(feature = "test_build")] -+pub fn qemu_bring_up_console() {} - -diff -uNr 11_exceptions_part1_groundwork/src/bsp/raspberrypi/memory/mmu.rs 12_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs ---- 11_exceptions_part1_groundwork/src/bsp/raspberrypi/memory/mmu.rs -+++ 12_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs -@@ -69,3 +69,46 @@ - pub fn virt_mem_layout() -> &'static KernelVirtualLayout { - &LAYOUT - } -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+ -+#[cfg(test)] -+mod tests { -+ use super::*; -+ use test_macros::kernel_test; -+ -+ /// Check alignment of the kernel's virtual memory layout sections. -+ #[kernel_test] -+ fn virt_mem_layout_sections_are_64KiB_aligned() { -+ const SIXTYFOUR_KIB: usize = 65536; -+ -+ for i in LAYOUT.inner().iter() { -+ let start: usize = *(i.virtual_range)().start(); -+ let end: usize = *(i.virtual_range)().end() + 1; -+ -+ assert_eq!(start modulo SIXTYFOUR_KIB, 0); -+ assert_eq!(end modulo SIXTYFOUR_KIB, 0); -+ assert!(end >= start); -+ } -+ } -+ -+ /// Ensure the kernel's virtual memory layout is free of overlaps. -+ #[kernel_test] -+ fn virt_mem_layout_has_no_overlaps() { -+ let layout = virt_mem_layout().inner(); -+ -+ for (i, first) in layout.iter().enumerate() { -+ for second in layout.iter().skip(i + 1) { -+ let first_range = first.virtual_range; -+ let second_range = second.virtual_range; -+ -+ assert!(!first_range().contains(second_range().start())); -+ assert!(!first_range().contains(second_range().end())); -+ assert!(!second_range().contains(first_range().start())); -+ assert!(!second_range().contains(first_range().end())); -+ } -+ } -+ } -+} - -diff -uNr 11_exceptions_part1_groundwork/src/cpu.rs 12_integrated_testing/src/cpu.rs ---- 11_exceptions_part1_groundwork/src/cpu.rs -+++ 12_integrated_testing/src/cpu.rs -@@ -14,3 +14,6 @@ - // Architectural Public Reexports - //-------------------------------------------------------------------------------------------------- - pub use arch_cpu::{nop, wait_forever}; -+ -+#[cfg(feature = "test_build")] -+pub use arch_cpu::{qemu_exit_failure, qemu_exit_success}; - -diff -uNr 11_exceptions_part1_groundwork/src/exception.rs 12_integrated_testing/src/exception.rs ---- 11_exceptions_part1_groundwork/src/exception.rs -+++ 12_integrated_testing/src/exception.rs -@@ -28,3 +28,21 @@ - Hypervisor, - Unknown, - } -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+ -+#[cfg(test)] -+mod tests { -+ use super::*; -+ use test_macros::kernel_test; -+ -+ /// Libkernel unit tests must execute in kernel mode. -+ #[kernel_test] -+ fn test_runner_executes_in_kernel_mode() { -+ let (level, _) = current_privilege_level(); -+ -+ assert!(level == PrivilegeLevel::Kernel) -+ } -+} - -diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/lib.rs ---- 11_exceptions_part1_groundwork/src/lib.rs -+++ 12_integrated_testing/src/lib.rs -@@ -0,0 +1,183 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2018-2022 Andre Richter -+ -+// Rust embedded logo for `make doc`. -+#![doc(html_logo_url = "https://git.io/JeGIp")] -+ -+//! The `kernel` library. -+//! -+//! Used to compose the final kernel binary. -+//! -+//! # Code organization and architecture -+//! -+//! The code is divided into different *modules*, each representing a typical **subsystem** of the -+//! `kernel`. Top-level module files of subsystems reside directly in the `src` folder. For example, -+//! `src/memory.rs` contains code that is concerned with all things memory management. -+//! -+//! ## Visibility of processor architecture code -+//! -+//! Some of the `kernel`'s subsystems depend on low-level code that is specific to the target -+//! processor architecture. For each supported processor architecture, there exists a subfolder in -+//! `src/_arch`, for example, `src/_arch/aarch64`. -+//! -+//! The architecture folders mirror the subsystem modules laid out in `src`. For example, -+//! architectural code that belongs to the `kernel`'s MMU subsystem (`src/memory/mmu.rs`) would go -+//! into `src/_arch/aarch64/memory/mmu.rs`. The latter file is loaded as a module in -+//! `src/memory/mmu.rs` using the `path attribute`. Usually, the chosen module name is the generic -+//! module's name prefixed with `arch_`. -+//! -+//! For example, this is the top of `src/memory/mmu.rs`: -+//! -+//! ``` -+//! #[cfg(target_arch = "aarch64")] -+//! #[path = "../_arch/aarch64/memory/mmu.rs"] -+//! mod arch_mmu; -+//! ``` -+//! -+//! Often times, items from the `arch_ module` will be publicly reexported by the parent module. -+//! This way, each architecture specific module can provide its implementation of an item, while the -+//! caller must not be concerned which architecture has been conditionally compiled. -+//! -+//! ## BSP code -+//! -+//! `BSP` stands for Board Support Package. `BSP` code is organized under `src/bsp.rs` and contains -+//! target board specific definitions and functions. These are things such as the board's memory map -+//! or instances of drivers for devices that are featured on the respective board. -+//! -+//! Just like processor architecture code, the `BSP` code's module structure tries to mirror the -+//! `kernel`'s subsystem modules, but there is no reexporting this time. That means whatever is -+//! provided must be called starting from the `bsp` namespace, e.g. `bsp::driver::driver_manager()`. -+//! -+//! ## Kernel interfaces -+//! -+//! Both `arch` and `bsp` contain code that is conditionally compiled depending on the actual target -+//! and board for which the kernel is compiled. For example, the `interrupt controller` hardware of -+//! the `Raspberry Pi 3` and the `Raspberry Pi 4` is different, but we want the rest of the `kernel` -+//! code to play nicely with any of the two without much hassle. -+//! -+//! In order to provide a clean abstraction between `arch`, `bsp` and `generic kernel code`, -+//! `interface` traits are provided *whenever possible* and *where it makes sense*. They are defined -+//! in the respective subsystem module and help to enforce the idiom of *program to an interface, -+//! not an implementation*. For example, there will be a common IRQ handling interface which the two -+//! different interrupt controller `drivers` of both Raspberrys will implement, and only export the -+//! interface to the rest of the `kernel`. -+//! -+//! ``` -+//! +-------------------+ -+//! | Interface (Trait) | -+//! | | -+//! +--+-------------+--+ -+//! ^ ^ -+//! | | -+//! | | -+//! +----------+--+ +--+----------+ -+//! | kernel code | | bsp code | -+//! | | | arch code | -+//! +-------------+ +-------------+ -+//! ``` -+//! -+//! # Summary -+//! -+//! For a logical `kernel` subsystem, corresponding code can be distributed over several physical -+//! locations. Here is an example for the **memory** subsystem: -+//! -+//! - `src/memory.rs` and `src/memory/**/*` -+//! - Common code that is agnostic of target processor architecture and `BSP` characteristics. -+//! - Example: A function to zero a chunk of memory. -+//! - Interfaces for the memory subsystem that are implemented by `arch` or `BSP` code. -+//! - Example: An `MMU` interface that defines `MMU` function prototypes. -+//! - `src/bsp/__board_name__/memory.rs` and `src/bsp/__board_name__/memory/**/*` -+//! - `BSP` specific code. -+//! - Example: The board's memory map (physical addresses of DRAM and MMIO devices). -+//! - `src/_arch/__arch_name__/memory.rs` and `src/_arch/__arch_name__/memory/**/*` -+//! - Processor architecture specific code. -+//! - Example: Implementation of the `MMU` interface for the `__arch_name__` processor -+//! architecture. -+//! -+//! From a namespace perspective, **memory** subsystem code lives in: -+//! -+//! - `crate::memory::*` -+//! - `crate::bsp::memory::*` -+//! -+//! # Boot flow -+//! -+//! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. -+//! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. -+//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. -+ -+#![allow(clippy::upper_case_acronyms)] -+#![allow(incomplete_features)] -+#![feature(core_intrinsics)] -+#![feature(format_args_nl)] -+#![feature(linkage)] -+#![feature(panic_info_message)] -+#![feature(trait_alias)] -+#![no_std] -+// Testing -+#![cfg_attr(test, no_main)] -+#![feature(custom_test_frameworks)] -+#![reexport_test_harness_main = "test_main"] -+#![test_runner(crate::test_runner)] -+ -+mod panic_wait; -+mod synchronization; -+ -+pub mod bsp; -+pub mod console; -+pub mod cpu; -+pub mod driver; -+pub mod exception; -+pub mod memory; -+pub mod print; -+pub mod time; -+ -+//-------------------------------------------------------------------------------------------------- -+// Public Code -+//-------------------------------------------------------------------------------------------------- -+ -+/// Version string. -+pub fn version() -> &'static str { -+ concat!( -+ env!("CARGO_PKG_NAME"), -+ " version ", -+ env!("CARGO_PKG_VERSION") -+ ) -+} -+ -+#[cfg(not(test))] -+extern "Rust" { -+ fn kernel_init() -> !; -+} -+ -+//-------------------------------------------------------------------------------------------------- -+// Testing -+//-------------------------------------------------------------------------------------------------- -+ -+/// The default runner for unit tests. -+pub fn test_runner(tests: &[&test_types::UnitTest]) { -+ // This line will be printed as the test header. -+ println!("Running {} tests", tests.len()); -+ -+ for (i, test) in tests.iter().enumerate() { -+ print!("{:>3}. {:.<58}", i + 1, test.name); -+ -+ // Run the actual test. -+ (test.test_func)(); -+ -+ // Failed tests call panic!(). Execution reaches here only if the test has passed. -+ println!("[ok]") -+ } -+} -+ -+/// The `kernel_init()` for unit tests. -+#[cfg(test)] -+#[no_mangle] -+unsafe fn kernel_init() -> ! { -+ exception::handling_init(); -+ bsp::console::qemu_bring_up_console(); -+ -+ test_main(); -+ -+ cpu::qemu_exit_success() -+} - -diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/main.rs ---- 11_exceptions_part1_groundwork/src/main.rs -+++ 12_integrated_testing/src/main.rs -@@ -6,123 +6,12 @@ - #![doc(html_logo_url = "https://git.io/JeGIp")] - - //! The `kernel` binary. --//! --//! # Code organization and architecture --//! --//! The code is divided into different *modules*, each representing a typical **subsystem** of the --//! `kernel`. Top-level module files of subsystems reside directly in the `src` folder. For example, --//! `src/memory.rs` contains code that is concerned with all things memory management. --//! --//! ## Visibility of processor architecture code --//! --//! Some of the `kernel`'s subsystems depend on low-level code that is specific to the target --//! processor architecture. For each supported processor architecture, there exists a subfolder in --//! `src/_arch`, for example, `src/_arch/aarch64`. --//! --//! The architecture folders mirror the subsystem modules laid out in `src`. For example, --//! architectural code that belongs to the `kernel`'s MMU subsystem (`src/memory/mmu.rs`) would go --//! into `src/_arch/aarch64/memory/mmu.rs`. The latter file is loaded as a module in --//! `src/memory/mmu.rs` using the `path attribute`. Usually, the chosen module name is the generic --//! module's name prefixed with `arch_`. --//! --//! For example, this is the top of `src/memory/mmu.rs`: --//! --//! ``` --//! #[cfg(target_arch = "aarch64")] --//! #[path = "../_arch/aarch64/memory/mmu.rs"] --//! mod arch_mmu; --//! ``` --//! --//! Often times, items from the `arch_ module` will be publicly reexported by the parent module. --//! This way, each architecture specific module can provide its implementation of an item, while the --//! caller must not be concerned which architecture has been conditionally compiled. --//! --//! ## BSP code --//! --//! `BSP` stands for Board Support Package. `BSP` code is organized under `src/bsp.rs` and contains --//! target board specific definitions and functions. These are things such as the board's memory map --//! or instances of drivers for devices that are featured on the respective board. --//! --//! Just like processor architecture code, the `BSP` code's module structure tries to mirror the --//! `kernel`'s subsystem modules, but there is no reexporting this time. That means whatever is --//! provided must be called starting from the `bsp` namespace, e.g. `bsp::driver::driver_manager()`. --//! --//! ## Kernel interfaces --//! --//! Both `arch` and `bsp` contain code that is conditionally compiled depending on the actual target --//! and board for which the kernel is compiled. For example, the `interrupt controller` hardware of --//! the `Raspberry Pi 3` and the `Raspberry Pi 4` is different, but we want the rest of the `kernel` --//! code to play nicely with any of the two without much hassle. --//! --//! In order to provide a clean abstraction between `arch`, `bsp` and `generic kernel code`, --//! `interface` traits are provided *whenever possible* and *where it makes sense*. They are defined --//! in the respective subsystem module and help to enforce the idiom of *program to an interface, --//! not an implementation*. For example, there will be a common IRQ handling interface which the two --//! different interrupt controller `drivers` of both Raspberrys will implement, and only export the --//! interface to the rest of the `kernel`. --//! --//! ``` --//! +-------------------+ --//! | Interface (Trait) | --//! | | --//! +--+-------------+--+ --//! ^ ^ --//! | | --//! | | --//! +----------+--+ +--+----------+ --//! | kernel code | | bsp code | --//! | | | arch code | --//! +-------------+ +-------------+ --//! ``` --//! --//! # Summary --//! --//! For a logical `kernel` subsystem, corresponding code can be distributed over several physical --//! locations. Here is an example for the **memory** subsystem: --//! --//! - `src/memory.rs` and `src/memory/**/*` --//! - Common code that is agnostic of target processor architecture and `BSP` characteristics. --//! - Example: A function to zero a chunk of memory. --//! - Interfaces for the memory subsystem that are implemented by `arch` or `BSP` code. --//! - Example: An `MMU` interface that defines `MMU` function prototypes. --//! - `src/bsp/__board_name__/memory.rs` and `src/bsp/__board_name__/memory/**/*` --//! - `BSP` specific code. --//! - Example: The board's memory map (physical addresses of DRAM and MMIO devices). --//! - `src/_arch/__arch_name__/memory.rs` and `src/_arch/__arch_name__/memory/**/*` --//! - Processor architecture specific code. --//! - Example: Implementation of the `MMU` interface for the `__arch_name__` processor --//! architecture. --//! --//! From a namespace perspective, **memory** subsystem code lives in: --//! --//! - `crate::memory::*` --//! - `crate::bsp::memory::*` --//! --//! # Boot flow --//! --//! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. --//! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. --//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. -- --#![allow(clippy::upper_case_acronyms)] --#![allow(incomplete_features)] --#![feature(core_intrinsics)] -+ - #![feature(format_args_nl)] --#![feature(panic_info_message)] --#![feature(trait_alias)] - #![no_main] - #![no_std] - --mod bsp; --mod console; --mod cpu; --mod driver; --mod exception; --mod memory; --mod panic_wait; --mod print; --mod synchronization; --mod time; -+use libkernel::{bsp, console, driver, exception, info, memory, time}; - - /// Early init code. - /// -@@ -133,6 +22,7 @@ - /// - MMU + Data caching must be activated at the earliest. Without it, any atomic operations, - /// e.g. the yet-to-be-introduced spinlocks in the device drivers (which currently employ - /// NullLocks instead of spinlocks), will fail to work (properly) on the RPi SoCs. -+#[no_mangle] - unsafe fn kernel_init() -> ! { - use driver::interface::DriverManager; - use memory::mmu::interface::MMU; -@@ -159,15 +49,9 @@ - fn kernel_main() -> ! { - use bsp::console::console; - use console::interface::All; -- use core::time::Duration; - use driver::interface::DriverManager; -- use time::interface::TimeManager; - -- info!( -- "{} version {}", -- env!("CARGO_PKG_NAME"), -- env!("CARGO_PKG_VERSION") -- ); -+ info!("{}", libkernel::version()); - info!("Booting on: {}", bsp::board_name()); - - info!("MMU online. Special regions:"); -@@ -193,31 +77,6 @@ - info!(" {}. {}", i + 1, driver.compatible()); - } - -- info!("Timer test, spinning for 1 second"); -- time::time_manager().spin_for(Duration::from_secs(1)); -- -- // Cause an exception by accessing a virtual address for which no translation was set up. This -- // code accesses the address 8 GiB, which is outside the mapped address space. -- // -- // For demo purposes, the exception handler will catch the faulting 8 GiB address and allow -- // execution to continue. -- info!(""); -- info!("Trying to read from address 8 GiB..."); -- let mut big_addr: u64 = 8 * 1024 * 1024 * 1024; -- unsafe { core::ptr::read_volatile(big_addr as *mut u64) }; -- -- info!("************************************************"); -- info!("Whoa! We recovered from a synchronous exception!"); -- info!("************************************************"); -- info!(""); -- info!("Let's try again"); -- -- // Now use address 9 GiB. The exception handler won't forgive us this time. -- info!("Trying to read from address 9 GiB..."); -- big_addr = 9 * 1024 * 1024 * 1024; -- unsafe { core::ptr::read_volatile(big_addr as *mut u64) }; -- -- // Will never reach here in this tutorial. - info!("Echoing input now"); - - // Discard any spurious received characters before going into echo mode. - -diff -uNr 11_exceptions_part1_groundwork/src/memory/mmu.rs 12_integrated_testing/src/memory/mmu.rs ---- 11_exceptions_part1_groundwork/src/memory/mmu.rs -+++ 12_integrated_testing/src/memory/mmu.rs -@@ -66,7 +66,6 @@ - - /// Architecture agnostic translation types. - #[allow(missing_docs)] --#[allow(dead_code)] - #[derive(Copy, Clone)] - pub enum Translation { - Identity, -@@ -261,4 +260,9 @@ - info!("{}", i); - } - } -+ -+ #[cfg(test)] -+ pub fn inner(&self) -> &[TranslationDescriptor; NUM_SPECIAL_RANGES] { -+ &self.inner -+ } - } - -diff -uNr 11_exceptions_part1_groundwork/src/panic_wait.rs 12_integrated_testing/src/panic_wait.rs ---- 11_exceptions_part1_groundwork/src/panic_wait.rs -+++ 12_integrated_testing/src/panic_wait.rs -@@ -17,6 +17,23 @@ - unsafe { bsp::console::panic_console_out().write_fmt(args).unwrap() }; - } - -+/// The point of exit for `libkernel`. -+/// -+/// It is linked weakly, so that the integration tests can overload its standard behavior. -+#[linkage = "weak"] -+#[no_mangle] -+fn _panic_exit() -> ! { -+ #[cfg(not(feature = "test_build"))] -+ { -+ cpu::wait_forever() -+ } -+ -+ #[cfg(feature = "test_build")] -+ { -+ cpu::qemu_exit_failure() -+ } -+} -+ - /// Prints with a newline - only use from the panic handler. - /// - /// Carbon copy from -@@ -53,7 +70,7 @@ - return; - } - -- cpu::wait_forever() -+ _panic_exit() - } - - #[panic_handler] -@@ -81,5 +98,5 @@ - info.message().unwrap_or(&format_args!("")), - ); - -- cpu::wait_forever() -+ _panic_exit() - } - -diff -uNr 11_exceptions_part1_groundwork/test-macros/Cargo.toml 12_integrated_testing/test-macros/Cargo.toml ---- 11_exceptions_part1_groundwork/test-macros/Cargo.toml -+++ 12_integrated_testing/test-macros/Cargo.toml -@@ -0,0 +1,14 @@ -+[package] -+name = "test-macros" -+version = "0.1.0" -+authors = ["Andre Richter "] -+edition = "2021" -+ -+[lib] -+proc-macro = true -+ -+[dependencies] -+proc-macro2 = "1.x" -+quote = "1.x" -+syn = { version = "1.x", features = ["full"] } -+test-types = { path = "../test-types" } - -diff -uNr 11_exceptions_part1_groundwork/test-macros/src/lib.rs 12_integrated_testing/test-macros/src/lib.rs ---- 11_exceptions_part1_groundwork/test-macros/src/lib.rs -+++ 12_integrated_testing/test-macros/src/lib.rs -@@ -0,0 +1,29 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2019-2022 Andre Richter -+ -+use proc_macro::TokenStream; -+use proc_macro2::Span; -+use quote::quote; -+use syn::{parse_macro_input, Ident, ItemFn}; -+ -+#[proc_macro_attribute] -+pub fn kernel_test(_attr: TokenStream, input: TokenStream) -> TokenStream { -+ let f = parse_macro_input!(input as ItemFn); -+ -+ let test_name = &format!("{}", f.sig.ident); -+ let test_ident = Ident::new( -+ &format!("{}_TEST_CONTAINER", f.sig.ident.to_string().to_uppercase()), -+ Span::call_site(), -+ ); -+ let test_code_block = f.block; -+ -+ quote!( -+ #[test_case] -+ const #test_ident: test_types::UnitTest = test_types::UnitTest { -+ name: #test_name, -+ test_func: || #test_code_block, -+ }; -+ ) -+ .into() -+} - -diff -uNr 11_exceptions_part1_groundwork/tests/00_console_sanity.rb 12_integrated_testing/tests/00_console_sanity.rb ---- 11_exceptions_part1_groundwork/tests/00_console_sanity.rb -+++ 12_integrated_testing/tests/00_console_sanity.rb -@@ -0,0 +1,48 @@ -+# frozen_string_literal: true -+ -+# SPDX-License-Identifier: MIT OR Apache-2.0 -+# -+# Copyright (c) 2019-2022 Andre Richter -+ -+require 'console_io_test' -+ -+# Verify sending and receiving works as expected. -+class TxRxHandshakeTest < SubtestBase -+ def name -+ 'Transmit and Receive handshake' -+ end -+ -+ def run(qemu_out, qemu_in) -+ qemu_in.write_nonblock('ABC') -+ expect_or_raise(qemu_out, 'OK1234') -+ end -+end -+ -+# Check for correct TX statistics implementation. Depends on test 1 being run first. -+class TxStatisticsTest < SubtestBase -+ def name -+ 'Transmit statistics' -+ end -+ -+ def run(qemu_out, _qemu_in) -+ expect_or_raise(qemu_out, '6') -+ end -+end -+ -+# Check for correct RX statistics implementation. Depends on test 1 being run first. -+class RxStatisticsTest < SubtestBase -+ def name -+ 'Receive statistics' -+ end -+ -+ def run(qemu_out, _qemu_in) -+ expect_or_raise(qemu_out, '3') -+ end -+end -+ -+##-------------------------------------------------------------------------------------------------- -+## Test registration -+##-------------------------------------------------------------------------------------------------- -+def subtest_collection -+ [TxRxHandshakeTest.new, TxStatisticsTest.new, RxStatisticsTest.new] -+end - -diff -uNr 11_exceptions_part1_groundwork/tests/00_console_sanity.rs 12_integrated_testing/tests/00_console_sanity.rs ---- 11_exceptions_part1_groundwork/tests/00_console_sanity.rs -+++ 12_integrated_testing/tests/00_console_sanity.rs -@@ -0,0 +1,38 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2019-2022 Andre Richter -+ -+//! Console sanity tests - RX, TX and statistics. -+ -+#![feature(format_args_nl)] -+#![no_main] -+#![no_std] -+ -+/// Console tests should time out on the I/O harness in case of panic. -+mod panic_wait_forever; -+ -+use libkernel::{bsp, console, cpu, exception, print}; -+ -+#[no_mangle] -+unsafe fn kernel_init() -> ! { -+ use bsp::console::console; -+ use console::interface::*; -+ -+ exception::handling_init(); -+ bsp::console::qemu_bring_up_console(); -+ -+ // Handshake -+ assert_eq!(console().read_char(), 'A'); -+ assert_eq!(console().read_char(), 'B'); -+ assert_eq!(console().read_char(), 'C'); -+ print!("OK1234"); -+ -+ // 6 -+ print!("{}", console().chars_written()); -+ -+ // 3 -+ print!("{}", console().chars_read()); -+ -+ // The QEMU process running this test will be closed by the I/O test harness. -+ cpu::wait_forever(); -+} - -diff -uNr 11_exceptions_part1_groundwork/tests/01_timer_sanity.rs 12_integrated_testing/tests/01_timer_sanity.rs ---- 11_exceptions_part1_groundwork/tests/01_timer_sanity.rs -+++ 12_integrated_testing/tests/01_timer_sanity.rs -@@ -0,0 +1,49 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2019-2022 Andre Richter -+ -+//! Timer sanity tests. -+ -+#![feature(custom_test_frameworks)] -+#![no_main] -+#![no_std] -+#![reexport_test_harness_main = "test_main"] -+#![test_runner(libkernel::test_runner)] -+ -+use core::time::Duration; -+use libkernel::{bsp, cpu, exception, time, time::interface::TimeManager}; -+use test_macros::kernel_test; -+ -+#[no_mangle] -+unsafe fn kernel_init() -> ! { -+ exception::handling_init(); -+ bsp::console::qemu_bring_up_console(); -+ -+ // Depending on CPU arch, some timer bring-up code could go here. Not needed for the RPi. -+ -+ test_main(); -+ -+ cpu::qemu_exit_success() -+} -+ -+/// Simple check that the timer is running. -+#[kernel_test] -+fn timer_is_counting() { -+ assert!(time::time_manager().uptime().as_nanos() > 0) -+} -+ -+/// Timer resolution must be sufficient. -+#[kernel_test] -+fn timer_resolution_is_sufficient() { -+ assert!(time::time_manager().resolution().as_nanos() < 100) -+} -+ -+/// Sanity check spin_for() implementation. -+#[kernel_test] -+fn spin_accuracy_check_1_second() { -+ let t1 = time::time_manager().uptime(); -+ time::time_manager().spin_for(Duration::from_secs(1)); -+ let t2 = time::time_manager().uptime(); -+ -+ assert_eq!((t2 - t1).as_secs(), 1) -+} - -diff -uNr 11_exceptions_part1_groundwork/tests/02_exception_sync_page_fault.rs 12_integrated_testing/tests/02_exception_sync_page_fault.rs ---- 11_exceptions_part1_groundwork/tests/02_exception_sync_page_fault.rs -+++ 12_integrated_testing/tests/02_exception_sync_page_fault.rs -@@ -0,0 +1,43 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2019-2022 Andre Richter -+ -+//! Page faults must result in synchronous exceptions. -+ -+#![feature(format_args_nl)] -+#![no_main] -+#![no_std] -+ -+/// Overwrites libkernel's `panic_wait::_panic_exit()` so that it returns a "success" code. -+/// -+/// In this test, reaching the panic is a success, because it is called from the synchronous -+/// exception handler, which is what this test wants to achieve. -+/// -+/// It also means that this integration test can not use any other code that calls panic!() directly -+/// or indirectly. -+mod panic_exit_success; -+ -+use libkernel::{bsp, cpu, exception, info, memory, println}; -+ -+#[no_mangle] -+unsafe fn kernel_init() -> ! { -+ use memory::mmu::interface::MMU; -+ -+ exception::handling_init(); -+ bsp::console::qemu_bring_up_console(); -+ -+ // This line will be printed as the test header. -+ println!("Testing synchronous exception handling by causing a page fault"); -+ -+ if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() { -+ info!("MMU: {}", string); -+ cpu::qemu_exit_failure() -+ } -+ -+ info!("Writing beyond mapped area to address 9 GiB..."); -+ let big_addr: u64 = 9 * 1024 * 1024 * 1024; -+ core::ptr::read_volatile(big_addr as *mut u64); -+ -+ // If execution reaches here, the memory access above did not cause a page fault exception. -+ cpu::qemu_exit_failure() -+} - -diff -uNr 11_exceptions_part1_groundwork/tests/03_exception_restore_sanity.rb 12_integrated_testing/tests/03_exception_restore_sanity.rb ---- 11_exceptions_part1_groundwork/tests/03_exception_restore_sanity.rb -+++ 12_integrated_testing/tests/03_exception_restore_sanity.rb -@@ -0,0 +1,25 @@ -+# frozen_string_literal: true -+ -+# SPDX-License-Identifier: MIT OR Apache-2.0 -+# -+# Copyright (c) 2022 Andre Richter -+ -+require 'console_io_test' -+ -+# Verify that exception restore works. -+class ExceptionRestoreTest < SubtestBase -+ def name -+ 'Exception restore' -+ end -+ -+ def run(qemu_out, _qemu_in) -+ expect_or_raise(qemu_out, 'Back from system call!') -+ end -+end -+ -+##-------------------------------------------------------------------------------------------------- -+## Test registration -+##-------------------------------------------------------------------------------------------------- -+def subtest_collection -+ [ExceptionRestoreTest.new] -+end - -diff -uNr 11_exceptions_part1_groundwork/tests/03_exception_restore_sanity.rs 12_integrated_testing/tests/03_exception_restore_sanity.rs ---- 11_exceptions_part1_groundwork/tests/03_exception_restore_sanity.rs -+++ 12_integrated_testing/tests/03_exception_restore_sanity.rs -@@ -0,0 +1,55 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2022 Andre Richter -+ -+//! A simple sanity test to see if exception restore code works. -+ -+#![feature(format_args_nl)] -+#![no_main] -+#![no_std] -+ -+/// Console tests should time out on the I/O harness in case of panic. -+mod panic_wait_forever; -+ -+use core::arch::asm; -+use libkernel::{bsp, cpu, exception, info, memory, println}; -+ -+#[inline(never)] -+fn nested_system_call() { -+ #[cfg(target_arch = "aarch64")] -+ unsafe { -+ asm!("svc #0x1337", options(nomem, nostack, preserves_flags)); -+ } -+ -+ #[cfg(not(target_arch = "aarch64"))] -+ { -+ info!("Not supported yet"); -+ cpu::wait_forever(); -+ } -+} -+ -+#[no_mangle] -+unsafe fn kernel_init() -> ! { -+ use memory::mmu::interface::MMU; -+ -+ exception::handling_init(); -+ bsp::console::qemu_bring_up_console(); -+ -+ // This line will be printed as the test header. -+ println!("Testing exception restore"); -+ -+ if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() { -+ info!("MMU: {}", string); -+ cpu::qemu_exit_failure() -+ } -+ -+ info!("Making a dummy system call"); -+ -+ // Calling this inside a function indirectly tests if the link register is restored properly. -+ nested_system_call(); -+ -+ info!("Back from system call!"); -+ -+ // The QEMU process running this test will be closed by the I/O test harness. -+ cpu::wait_forever(); -+} - -diff -uNr 11_exceptions_part1_groundwork/tests/boot_test_string.rb 12_integrated_testing/tests/boot_test_string.rb ---- 11_exceptions_part1_groundwork/tests/boot_test_string.rb -+++ 12_integrated_testing/tests/boot_test_string.rb -@@ -1,3 +1,3 @@ - # frozen_string_literal: true - --EXPECTED_PRINT = 'lr : 0x' -+EXPECTED_PRINT = 'Echoing input now' - -diff -uNr 11_exceptions_part1_groundwork/tests/panic_exit_success/mod.rs 12_integrated_testing/tests/panic_exit_success/mod.rs ---- 11_exceptions_part1_groundwork/tests/panic_exit_success/mod.rs -+++ 12_integrated_testing/tests/panic_exit_success/mod.rs -@@ -0,0 +1,9 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2019-2022 Andre Richter -+ -+/// Overwrites libkernel's `panic_wait::_panic_exit()` with the QEMU-exit version. -+#[no_mangle] -+fn _panic_exit() -> ! { -+ libkernel::cpu::qemu_exit_success() -+} - -diff -uNr 11_exceptions_part1_groundwork/tests/panic_wait_forever/mod.rs 12_integrated_testing/tests/panic_wait_forever/mod.rs ---- 11_exceptions_part1_groundwork/tests/panic_wait_forever/mod.rs -+++ 12_integrated_testing/tests/panic_wait_forever/mod.rs -@@ -0,0 +1,9 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2022 Andre Richter -+ -+/// Overwrites libkernel's `panic_wait::_panic_exit()` with wait_forever. -+#[no_mangle] -+fn _panic_exit() -> ! { -+ libkernel::cpu::wait_forever() -+} - -diff -uNr 11_exceptions_part1_groundwork/test-types/Cargo.toml 12_integrated_testing/test-types/Cargo.toml ---- 11_exceptions_part1_groundwork/test-types/Cargo.toml -+++ 12_integrated_testing/test-types/Cargo.toml -@@ -0,0 +1,5 @@ -+[package] -+name = "test-types" -+version = "0.1.0" -+authors = ["Andre Richter "] -+edition = "2021" - -diff -uNr 11_exceptions_part1_groundwork/test-types/src/lib.rs 12_integrated_testing/test-types/src/lib.rs ---- 11_exceptions_part1_groundwork/test-types/src/lib.rs -+++ 12_integrated_testing/test-types/src/lib.rs -@@ -0,0 +1,16 @@ -+// SPDX-License-Identifier: MIT OR Apache-2.0 -+// -+// Copyright (c) 2019-2022 Andre Richter -+ -+//! Types for the `custom_test_frameworks` implementation. -+ -+#![no_std] -+ -+/// Unit test container. -+pub struct UnitTest { -+ /// Name of the test. -+ pub name: &'static str, -+ -+ /// Function pointer to the test. -+ pub test_func: fn(), -+} +The diff in this tutorial is skipped, because due to the changes in top-level folder structure, it +becomes unreadable. This might be fixed in the future. For now, consider using a diff tool like +`meld` to diff between the previous and the `kernel` folder of this tutorial to see the lion's share +of changes: + +```console +meld 11_exceptions_part1_groundwork 12_integrated_testing/kernel ``` diff --git a/12_integrated_testing/kernel/Cargo.toml b/12_integrated_testing/kernel/Cargo.toml new file mode 100644 index 00000000..be478e85 --- /dev/null +++ b/12_integrated_testing/kernel/Cargo.toml @@ -0,0 +1,58 @@ +[package] +name = "mingo" +version = "0.12.0" +authors = ["Andre Richter "] +edition = "2021" + + +[features] +default = [] +bsp_rpi3 = ["tock-registers"] +bsp_rpi4 = ["tock-registers"] +test_build = ["qemu-exit"] + +##-------------------------------------------------------------------------------------------------- +## Dependencies +##-------------------------------------------------------------------------------------------------- + +[dependencies] +test-types = { path = "../libraries/test-types" } + +# Optional dependencies +tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } +qemu-exit = { version = "3.x.x", optional = true } + +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] +cortex-a = { version = "7.x.x" } + +##-------------------------------------------------------------------------------------------------- +## Testing +##-------------------------------------------------------------------------------------------------- + +[dev-dependencies] +test-macros = { path = "../libraries/test-macros" } + +# Unit tests are done in the library part of the kernel. +[lib] +name = "libkernel" +test = true + +# Disable unit tests for the kernel binary. +[[bin]] +name = "kernel" +path = "src/main.rs" +test = false + +# List of tests without harness. +[[test]] +name = "00_console_sanity" +harness = false + +[[test]] +name = "02_exception_sync_page_fault" +harness = false + +[[test]] +name = "03_exception_restore_sanity" +harness = false diff --git a/12_integrated_testing/build.rs b/12_integrated_testing/kernel/build.rs similarity index 100% rename from 12_integrated_testing/build.rs rename to 12_integrated_testing/kernel/build.rs diff --git a/12_integrated_testing/src/_arch/aarch64/cpu.rs b/12_integrated_testing/kernel/src/_arch/aarch64/cpu.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/cpu.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/cpu.rs diff --git a/12_integrated_testing/src/_arch/aarch64/cpu/boot.rs b/12_integrated_testing/kernel/src/_arch/aarch64/cpu/boot.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/cpu/boot.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/cpu/boot.rs diff --git a/12_integrated_testing/src/_arch/aarch64/cpu/boot.s b/12_integrated_testing/kernel/src/_arch/aarch64/cpu/boot.s similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/cpu/boot.s rename to 12_integrated_testing/kernel/src/_arch/aarch64/cpu/boot.s diff --git a/12_integrated_testing/src/_arch/aarch64/exception.rs b/12_integrated_testing/kernel/src/_arch/aarch64/exception.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/exception.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/exception.rs diff --git a/12_integrated_testing/src/_arch/aarch64/exception.s b/12_integrated_testing/kernel/src/_arch/aarch64/exception.s similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/exception.s rename to 12_integrated_testing/kernel/src/_arch/aarch64/exception.s diff --git a/12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs b/12_integrated_testing/kernel/src/_arch/aarch64/exception/asynchronous.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/exception/asynchronous.rs diff --git a/12_integrated_testing/src/_arch/aarch64/memory/mmu.rs b/12_integrated_testing/kernel/src/_arch/aarch64/memory/mmu.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/memory/mmu.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/memory/mmu.rs diff --git a/12_integrated_testing/src/_arch/aarch64/memory/mmu/translation_table.rs b/12_integrated_testing/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/memory/mmu/translation_table.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs diff --git a/12_integrated_testing/src/_arch/aarch64/time.rs b/12_integrated_testing/kernel/src/_arch/aarch64/time.rs similarity index 100% rename from 12_integrated_testing/src/_arch/aarch64/time.rs rename to 12_integrated_testing/kernel/src/_arch/aarch64/time.rs diff --git a/12_integrated_testing/src/bsp.rs b/12_integrated_testing/kernel/src/bsp.rs similarity index 100% rename from 12_integrated_testing/src/bsp.rs rename to 12_integrated_testing/kernel/src/bsp.rs diff --git a/12_integrated_testing/src/bsp/device_driver.rs b/12_integrated_testing/kernel/src/bsp/device_driver.rs similarity index 100% rename from 12_integrated_testing/src/bsp/device_driver.rs rename to 12_integrated_testing/kernel/src/bsp/device_driver.rs diff --git a/12_integrated_testing/src/bsp/device_driver/bcm.rs b/12_integrated_testing/kernel/src/bsp/device_driver/bcm.rs similarity index 100% rename from 12_integrated_testing/src/bsp/device_driver/bcm.rs rename to 12_integrated_testing/kernel/src/bsp/device_driver/bcm.rs diff --git a/12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs b/12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs similarity index 100% rename from 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs rename to 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff --git a/12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs similarity index 100% rename from 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs rename to 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff --git a/12_integrated_testing/src/bsp/device_driver/common.rs b/12_integrated_testing/kernel/src/bsp/device_driver/common.rs similarity index 100% rename from 12_integrated_testing/src/bsp/device_driver/common.rs rename to 12_integrated_testing/kernel/src/bsp/device_driver/common.rs diff --git a/12_integrated_testing/src/bsp/raspberrypi.rs b/12_integrated_testing/kernel/src/bsp/raspberrypi.rs similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi.rs rename to 12_integrated_testing/kernel/src/bsp/raspberrypi.rs diff --git a/12_integrated_testing/src/bsp/raspberrypi/console.rs b/12_integrated_testing/kernel/src/bsp/raspberrypi/console.rs similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi/console.rs rename to 12_integrated_testing/kernel/src/bsp/raspberrypi/console.rs diff --git a/12_integrated_testing/src/bsp/raspberrypi/cpu.rs b/12_integrated_testing/kernel/src/bsp/raspberrypi/cpu.rs similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi/cpu.rs rename to 12_integrated_testing/kernel/src/bsp/raspberrypi/cpu.rs diff --git a/12_integrated_testing/src/bsp/raspberrypi/driver.rs b/12_integrated_testing/kernel/src/bsp/raspberrypi/driver.rs similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi/driver.rs rename to 12_integrated_testing/kernel/src/bsp/raspberrypi/driver.rs diff --git a/12_integrated_testing/src/bsp/raspberrypi/kernel.ld b/12_integrated_testing/kernel/src/bsp/raspberrypi/kernel.ld similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi/kernel.ld rename to 12_integrated_testing/kernel/src/bsp/raspberrypi/kernel.ld diff --git a/12_integrated_testing/src/bsp/raspberrypi/memory.rs b/12_integrated_testing/kernel/src/bsp/raspberrypi/memory.rs similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi/memory.rs rename to 12_integrated_testing/kernel/src/bsp/raspberrypi/memory.rs diff --git a/12_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs b/12_integrated_testing/kernel/src/bsp/raspberrypi/memory/mmu.rs similarity index 100% rename from 12_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs rename to 12_integrated_testing/kernel/src/bsp/raspberrypi/memory/mmu.rs diff --git a/12_integrated_testing/src/console.rs b/12_integrated_testing/kernel/src/console.rs similarity index 100% rename from 12_integrated_testing/src/console.rs rename to 12_integrated_testing/kernel/src/console.rs diff --git a/12_integrated_testing/src/cpu.rs b/12_integrated_testing/kernel/src/cpu.rs similarity index 100% rename from 12_integrated_testing/src/cpu.rs rename to 12_integrated_testing/kernel/src/cpu.rs diff --git a/12_integrated_testing/src/cpu/boot.rs b/12_integrated_testing/kernel/src/cpu/boot.rs similarity index 100% rename from 12_integrated_testing/src/cpu/boot.rs rename to 12_integrated_testing/kernel/src/cpu/boot.rs diff --git a/12_integrated_testing/src/driver.rs b/12_integrated_testing/kernel/src/driver.rs similarity index 100% rename from 12_integrated_testing/src/driver.rs rename to 12_integrated_testing/kernel/src/driver.rs diff --git a/12_integrated_testing/src/exception.rs b/12_integrated_testing/kernel/src/exception.rs similarity index 100% rename from 12_integrated_testing/src/exception.rs rename to 12_integrated_testing/kernel/src/exception.rs diff --git a/12_integrated_testing/src/exception/asynchronous.rs b/12_integrated_testing/kernel/src/exception/asynchronous.rs similarity index 100% rename from 12_integrated_testing/src/exception/asynchronous.rs rename to 12_integrated_testing/kernel/src/exception/asynchronous.rs diff --git a/12_integrated_testing/src/lib.rs b/12_integrated_testing/kernel/src/lib.rs similarity index 100% rename from 12_integrated_testing/src/lib.rs rename to 12_integrated_testing/kernel/src/lib.rs diff --git a/12_integrated_testing/src/main.rs b/12_integrated_testing/kernel/src/main.rs similarity index 100% rename from 12_integrated_testing/src/main.rs rename to 12_integrated_testing/kernel/src/main.rs diff --git a/12_integrated_testing/src/memory.rs b/12_integrated_testing/kernel/src/memory.rs similarity index 100% rename from 12_integrated_testing/src/memory.rs rename to 12_integrated_testing/kernel/src/memory.rs diff --git a/12_integrated_testing/src/memory/mmu.rs b/12_integrated_testing/kernel/src/memory/mmu.rs similarity index 100% rename from 12_integrated_testing/src/memory/mmu.rs rename to 12_integrated_testing/kernel/src/memory/mmu.rs diff --git a/12_integrated_testing/src/memory/mmu/translation_table.rs b/12_integrated_testing/kernel/src/memory/mmu/translation_table.rs similarity index 100% rename from 12_integrated_testing/src/memory/mmu/translation_table.rs rename to 12_integrated_testing/kernel/src/memory/mmu/translation_table.rs diff --git a/12_integrated_testing/src/panic_wait.rs b/12_integrated_testing/kernel/src/panic_wait.rs similarity index 100% rename from 12_integrated_testing/src/panic_wait.rs rename to 12_integrated_testing/kernel/src/panic_wait.rs diff --git a/12_integrated_testing/src/print.rs b/12_integrated_testing/kernel/src/print.rs similarity index 100% rename from 12_integrated_testing/src/print.rs rename to 12_integrated_testing/kernel/src/print.rs diff --git a/12_integrated_testing/src/synchronization.rs b/12_integrated_testing/kernel/src/synchronization.rs similarity index 100% rename from 12_integrated_testing/src/synchronization.rs rename to 12_integrated_testing/kernel/src/synchronization.rs diff --git a/12_integrated_testing/src/time.rs b/12_integrated_testing/kernel/src/time.rs similarity index 100% rename from 12_integrated_testing/src/time.rs rename to 12_integrated_testing/kernel/src/time.rs diff --git a/12_integrated_testing/tests/00_console_sanity.rb b/12_integrated_testing/kernel/tests/00_console_sanity.rb similarity index 100% rename from 12_integrated_testing/tests/00_console_sanity.rb rename to 12_integrated_testing/kernel/tests/00_console_sanity.rb diff --git a/12_integrated_testing/tests/00_console_sanity.rs b/12_integrated_testing/kernel/tests/00_console_sanity.rs similarity index 100% rename from 12_integrated_testing/tests/00_console_sanity.rs rename to 12_integrated_testing/kernel/tests/00_console_sanity.rs diff --git a/12_integrated_testing/tests/01_timer_sanity.rs b/12_integrated_testing/kernel/tests/01_timer_sanity.rs similarity index 100% rename from 12_integrated_testing/tests/01_timer_sanity.rs rename to 12_integrated_testing/kernel/tests/01_timer_sanity.rs diff --git a/12_integrated_testing/tests/02_exception_sync_page_fault.rs b/12_integrated_testing/kernel/tests/02_exception_sync_page_fault.rs similarity index 100% rename from 12_integrated_testing/tests/02_exception_sync_page_fault.rs rename to 12_integrated_testing/kernel/tests/02_exception_sync_page_fault.rs diff --git a/12_integrated_testing/tests/03_exception_restore_sanity.rb b/12_integrated_testing/kernel/tests/03_exception_restore_sanity.rb similarity index 100% rename from 12_integrated_testing/tests/03_exception_restore_sanity.rb rename to 12_integrated_testing/kernel/tests/03_exception_restore_sanity.rb diff --git a/12_integrated_testing/tests/03_exception_restore_sanity.rs b/12_integrated_testing/kernel/tests/03_exception_restore_sanity.rs similarity index 100% rename from 12_integrated_testing/tests/03_exception_restore_sanity.rs rename to 12_integrated_testing/kernel/tests/03_exception_restore_sanity.rs diff --git a/12_integrated_testing/tests/boot_test_string.rb b/12_integrated_testing/kernel/tests/boot_test_string.rb similarity index 100% rename from 12_integrated_testing/tests/boot_test_string.rb rename to 12_integrated_testing/kernel/tests/boot_test_string.rb diff --git a/12_integrated_testing/tests/panic_exit_success/mod.rs b/12_integrated_testing/kernel/tests/panic_exit_success/mod.rs similarity index 100% rename from 12_integrated_testing/tests/panic_exit_success/mod.rs rename to 12_integrated_testing/kernel/tests/panic_exit_success/mod.rs diff --git a/12_integrated_testing/tests/panic_wait_forever/mod.rs b/12_integrated_testing/kernel/tests/panic_wait_forever/mod.rs similarity index 100% rename from 12_integrated_testing/tests/panic_wait_forever/mod.rs rename to 12_integrated_testing/kernel/tests/panic_wait_forever/mod.rs diff --git a/12_integrated_testing/test-macros/Cargo.toml b/12_integrated_testing/libraries/test-macros/Cargo.toml similarity index 100% rename from 12_integrated_testing/test-macros/Cargo.toml rename to 12_integrated_testing/libraries/test-macros/Cargo.toml diff --git a/12_integrated_testing/test-macros/src/lib.rs b/12_integrated_testing/libraries/test-macros/src/lib.rs similarity index 100% rename from 12_integrated_testing/test-macros/src/lib.rs rename to 12_integrated_testing/libraries/test-macros/src/lib.rs diff --git a/12_integrated_testing/test-types/Cargo.toml b/12_integrated_testing/libraries/test-types/Cargo.toml similarity index 100% rename from 12_integrated_testing/test-types/Cargo.toml rename to 12_integrated_testing/libraries/test-types/Cargo.toml diff --git a/12_integrated_testing/test-types/src/lib.rs b/12_integrated_testing/libraries/test-types/src/lib.rs similarity index 100% rename from 12_integrated_testing/test-types/src/lib.rs rename to 12_integrated_testing/libraries/test-types/src/lib.rs diff --git a/13_exceptions_part2_peripheral_IRQs/Cargo.lock b/13_exceptions_part2_peripheral_IRQs/Cargo.lock index 8fde49ef..51d3ab82 100644 --- a/13_exceptions_part2_peripheral_IRQs/Cargo.lock +++ b/13_exceptions_part2_peripheral_IRQs/Cargo.lock @@ -39,9 +39,9 @@ checksum = "9ff023245bfcc73fb890e1f8d5383825b3131cc920020a5c487d6f113dfc428a" [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] diff --git a/13_exceptions_part2_peripheral_IRQs/Cargo.toml b/13_exceptions_part2_peripheral_IRQs/Cargo.toml index 7ef55831..6480a727 100644 --- a/13_exceptions_part2_peripheral_IRQs/Cargo.toml +++ b/13_exceptions_part2_peripheral_IRQs/Cargo.toml @@ -1,60 +1,9 @@ -[package] -name = "mingo" -version = "0.13.0" -authors = ["Andre Richter "] -edition = "2021" +[workspace] + +members = [ + "libraries/*", + "kernel" +] [profile.release] lto = true - -[features] -default = [] -bsp_rpi3 = ["tock-registers"] -bsp_rpi4 = ["tock-registers"] -test_build = ["qemu-exit"] - -##-------------------------------------------------------------------------------------------------- -## Dependencies -##-------------------------------------------------------------------------------------------------- - -[dependencies] -test-types = { path = "test-types" } - -# Optional dependencies -tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "3.x.x", optional = true } - -# Platform specific dependencies -[target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "7.x.x" } - -##-------------------------------------------------------------------------------------------------- -## Testing -##-------------------------------------------------------------------------------------------------- - -[dev-dependencies] -test-macros = { path = "test-macros" } - -# Unit tests are done in the library part of the kernel. -[lib] -name = "libkernel" -test = true - -# Disable unit tests for the kernel binary. -[[bin]] -name = "kernel" -path = "src/main.rs" -test = false - -# List of tests without harness. -[[test]] -name = "00_console_sanity" -harness = false - -[[test]] -name = "02_exception_sync_page_fault" -harness = false - -[[test]] -name = "03_exception_restore_sanity" -harness = false diff --git a/13_exceptions_part2_peripheral_IRQs/Makefile b/13_exceptions_part2_peripheral_IRQs/Makefile index 6adb1aca..427c9303 100644 --- a/13_exceptions_part2_peripheral_IRQs/Makefile +++ b/13_exceptions_part2_peripheral_IRQs/Makefile @@ -41,7 +41,7 @@ ifeq ($(BSP),rpi3) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi3.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi3.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat @@ -55,7 +55,7 @@ else ifeq ($(BSP),rpi4) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi4.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi4.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif @@ -67,9 +67,9 @@ export LD_SCRIPT_PATH ##-------------------------------------------------------------------------------------------------- ## Targets and Prerequisites ##-------------------------------------------------------------------------------------------------- +KERNEL_MANIFEST = kernel/Cargo.toml KERNEL_LINKER_SCRIPT = kernel.ld - -LAST_BUILD_CONFIG = target/$(BSP).build_config +LAST_BUILD_CONFIG = target/$(BSP).build_config KERNEL_ELF = target/$(TARGET)/release/kernel # This parses cargo's dep-info file. @@ -94,11 +94,11 @@ COMPILER_ARGS = --target=$(TARGET) \ $(FEATURES) \ --release -RUSTC_CMD = cargo rustc $(COMPILER_ARGS) +RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) CHECK_CMD = cargo check $(COMPILER_ARGS) -TEST_CMD = cargo test $(COMPILER_ARGS) +TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary @@ -203,6 +203,8 @@ chainboot: $(KERNEL_BIN) ##------------------------------------------------------------------------------ clippy: @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) --features test_build --tests \ + --manifest-path $(KERNEL_MANIFEST) ##------------------------------------------------------------------------------ ## Clean @@ -299,6 +301,10 @@ test_boot: $(KERNEL_BIN) define KERNEL_TEST_RUNNER #!/usr/bin/env bash + # The cargo test runner seems to change into the crate under test's directory. Therefore, ensure + # this script executes from the root. + cd $(shell pwd) + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/13_exceptions_part2_peripheral_IRQs/README.md b/13_exceptions_part2_peripheral_IRQs/README.md index eefe4b7e..35e0307f 100644 --- a/13_exceptions_part2_peripheral_IRQs/README.md +++ b/13_exceptions_part2_peripheral_IRQs/README.md @@ -489,7 +489,7 @@ sequences might be needed. Since nothing complex is happening in the implementation, it is not covered in detail here. Please refer to [the source of the **peripheral** controller] to check it out. -[the source of the **peripheral** controller]: src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs +[the source of the **peripheral** controller]: kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs ##### The IRQ Handler Table @@ -639,7 +639,7 @@ As with the implementation of the BCM interrupt controller driver, we won't cove parts in exhaustive detail. For that, please refer to [this folder] folder which contains all the sources. -[this folder]: src/bsp/device_driver/arm +[this folder]: kernel/src/bsp/device_driver/arm ## Test it @@ -746,9 +746,9 @@ Minipush 1.0 ## Diff to previous ```diff -diff -uNr 12_integrated_testing/Cargo.toml 13_exceptions_part2_peripheral_IRQs/Cargo.toml ---- 12_integrated_testing/Cargo.toml -+++ 13_exceptions_part2_peripheral_IRQs/Cargo.toml +diff -uNr 12_integrated_testing/kernel/Cargo.toml 13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml +--- 12_integrated_testing/kernel/Cargo.toml ++++ 13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mingo" @@ -758,9 +758,9 @@ diff -uNr 12_integrated_testing/Cargo.toml 13_exceptions_part2_peripheral_IRQs/C edition = "2021" -diff -uNr 12_integrated_testing/src/_arch/aarch64/cpu/smp.rs 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/smp.rs ---- 12_integrated_testing/src/_arch/aarch64/cpu/smp.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/smp.rs +diff -uNr 12_integrated_testing/kernel/src/_arch/aarch64/cpu/smp.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/smp.rs +--- 12_integrated_testing/kernel/src/_arch/aarch64/cpu/smp.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/smp.rs @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -793,9 +793,9 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/cpu/smp.rs 13_exceptions_part2 + T::from((MPIDR_EL1.get() & CORE_MASK) as u8) +} -diff -uNr 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs ---- 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs +diff -uNr 12_integrated_testing/kernel/src/_arch/aarch64/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception/asynchronous.rs +--- 12_integrated_testing/kernel/src/_arch/aarch64/exception/asynchronous.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception/asynchronous.rs @@ -11,13 +11,18 @@ //! //! crate::exception::asynchronous::arch_asynchronous @@ -889,9 +889,9 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 13_e #[rustfmt::skip] pub fn print_state() { -diff -uNr 12_integrated_testing/src/_arch/aarch64/exception.rs 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs ---- 12_integrated_testing/src/_arch/aarch64/exception.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs +diff -uNr 12_integrated_testing/kernel/src/_arch/aarch64/exception.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs +--- 12_integrated_testing/kernel/src/_arch/aarch64/exception.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs @@ -11,6 +11,7 @@ //! //! crate::exception::arch_exception @@ -915,9 +915,9 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception.rs 13_exceptions_par #[no_mangle] -diff -uNr 12_integrated_testing/src/bsp/device_driver/arm/gicv2/gicc.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs ---- 12_integrated_testing/src/bsp/device_driver/arm/gicv2/gicc.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -1061,9 +1061,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/arm/gicv2/gicc.rs 13_excep + } +} -diff -uNr 12_integrated_testing/src/bsp/device_driver/arm/gicv2/gicd.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicd.rs ---- 12_integrated_testing/src/bsp/device_driver/arm/gicv2/gicd.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicd.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -1265,9 +1265,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/arm/gicv2/gicd.rs 13_excep + } +} -diff -uNr 12_integrated_testing/src/bsp/device_driver/arm/gicv2.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs ---- 12_integrated_testing/src/bsp/device_driver/arm/gicv2.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/arm/gicv2.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/arm/gicv2.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2.rs @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -1489,9 +1489,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/arm/gicv2.rs 13_exceptions + } +} -diff -uNr 12_integrated_testing/src/bsp/device_driver/arm.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm.rs ---- 12_integrated_testing/src/bsp/device_driver/arm.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/arm.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/arm.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm.rs @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -1503,9 +1503,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/arm.rs 13_exceptions_part2 + +pub use gicv2::*; -diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs ---- 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs @@ -6,7 +6,7 @@ use crate::{ @@ -1534,9 +1534,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 13_exc } -diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs ---- 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -1706,9 +1706,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_interrupt_cont + } +} -diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs ---- 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -1842,9 +1842,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_interrupt_cont + } +} -diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs ---- 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -10,8 +10,8 @@ //! - @@ -2010,9 +2010,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs + } +} -diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm.rs ---- 12_integrated_testing/src/bsp/device_driver/bcm.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver/bcm.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver/bcm.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm.rs @@ -5,7 +5,11 @@ //! BCM driver top level. @@ -2026,9 +2026,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver/bcm.rs 13_exceptions_part2 +pub use bcm2xxx_interrupt_controller::*; pub use bcm2xxx_pl011_uart::*; -diff -uNr 12_integrated_testing/src/bsp/device_driver.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver.rs ---- 12_integrated_testing/src/bsp/device_driver.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/device_driver.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver.rs +--- 12_integrated_testing/kernel/src/bsp/device_driver.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver.rs @@ -4,9 +4,13 @@ //! Device driver. @@ -2044,9 +2044,9 @@ diff -uNr 12_integrated_testing/src/bsp/device_driver.rs 13_exceptions_part2_per #[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] pub use bcm::*; -diff -uNr 12_integrated_testing/src/bsp/raspberrypi/driver.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs ---- 12_integrated_testing/src/bsp/raspberrypi/driver.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/raspberrypi/driver.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/driver.rs +--- 12_integrated_testing/kernel/src/bsp/raspberrypi/driver.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/driver.rs @@ -12,7 +12,7 @@ /// Device Driver Manager type. @@ -2070,9 +2070,9 @@ diff -uNr 12_integrated_testing/src/bsp/raspberrypi/driver.rs 13_exceptions_part //-------------------------------------------------------------------------------------------------- -diff -uNr 12_integrated_testing/src/bsp/raspberrypi/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception/asynchronous.rs ---- 12_integrated_testing/src/bsp/raspberrypi/exception/asynchronous.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception/asynchronous.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/raspberrypi/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception/asynchronous.rs +--- 12_integrated_testing/kernel/src/bsp/raspberrypi/exception/asynchronous.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception/asynchronous.rs @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2111,9 +2111,9 @@ diff -uNr 12_integrated_testing/src/bsp/raspberrypi/exception/asynchronous.rs 13 + &super::super::INTERRUPT_CONTROLLER +} -diff -uNr 12_integrated_testing/src/bsp/raspberrypi/exception.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception.rs ---- 12_integrated_testing/src/bsp/raspberrypi/exception.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/raspberrypi/exception.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception.rs +--- 12_integrated_testing/kernel/src/bsp/raspberrypi/exception.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception.rs @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2123,9 +2123,9 @@ diff -uNr 12_integrated_testing/src/bsp/raspberrypi/exception.rs 13_exceptions_p + +pub mod asynchronous; -diff -uNr 12_integrated_testing/src/bsp/raspberrypi/memory.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs ---- 12_integrated_testing/src/bsp/raspberrypi/memory.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/raspberrypi/memory.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory.rs +--- 12_integrated_testing/kernel/src/bsp/raspberrypi/memory.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory.rs @@ -73,10 +73,12 @@ pub mod mmio { use super::*; @@ -2153,9 +2153,9 @@ diff -uNr 12_integrated_testing/src/bsp/raspberrypi/memory.rs 13_exceptions_part } } -diff -uNr 12_integrated_testing/src/bsp/raspberrypi.rs 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs ---- 12_integrated_testing/src/bsp/raspberrypi.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs +diff -uNr 12_integrated_testing/kernel/src/bsp/raspberrypi.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi.rs +--- 12_integrated_testing/kernel/src/bsp/raspberrypi.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi.rs @@ -7,6 +7,7 @@ pub mod console; pub mod cpu; @@ -2193,9 +2193,9 @@ diff -uNr 12_integrated_testing/src/bsp/raspberrypi.rs 13_exceptions_part2_perip //-------------------------------------------------------------------------------------------------- // Public Code -diff -uNr 12_integrated_testing/src/cpu/smp.rs 13_exceptions_part2_peripheral_IRQs/src/cpu/smp.rs ---- 12_integrated_testing/src/cpu/smp.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/cpu/smp.rs +diff -uNr 12_integrated_testing/kernel/src/cpu/smp.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu/smp.rs +--- 12_integrated_testing/kernel/src/cpu/smp.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu/smp.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2212,9 +2212,9 @@ diff -uNr 12_integrated_testing/src/cpu/smp.rs 13_exceptions_part2_peripheral_IR +//-------------------------------------------------------------------------------------------------- +pub use arch_smp::core_id; -diff -uNr 12_integrated_testing/src/cpu.rs 13_exceptions_part2_peripheral_IRQs/src/cpu.rs ---- 12_integrated_testing/src/cpu.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/cpu.rs +diff -uNr 12_integrated_testing/kernel/src/cpu.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu.rs +--- 12_integrated_testing/kernel/src/cpu.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu.rs @@ -10,6 +10,8 @@ mod boot; @@ -2225,9 +2225,9 @@ diff -uNr 12_integrated_testing/src/cpu.rs 13_exceptions_part2_peripheral_IRQs/s // Architectural Public Reexports //-------------------------------------------------------------------------------------------------- -diff -uNr 12_integrated_testing/src/driver.rs 13_exceptions_part2_peripheral_IRQs/src/driver.rs ---- 12_integrated_testing/src/driver.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/driver.rs +diff -uNr 12_integrated_testing/kernel/src/driver.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs +--- 12_integrated_testing/kernel/src/driver.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs @@ -23,6 +23,14 @@ unsafe fn init(&self) -> Result<(), &'static str> { Ok(()) @@ -2244,9 +2244,9 @@ diff -uNr 12_integrated_testing/src/driver.rs 13_exceptions_part2_peripheral_IRQ /// Device driver management functions. -diff -uNr 12_integrated_testing/src/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs ---- 12_integrated_testing/src/exception/asynchronous.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs +diff -uNr 12_integrated_testing/kernel/src/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/exception/asynchronous.rs +--- 12_integrated_testing/kernel/src/exception/asynchronous.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/exception/asynchronous.rs @@ -8,7 +8,145 @@ #[path = "../_arch/aarch64/exception/asynchronous.rs"] mod arch_asynchronous; @@ -2395,9 +2395,9 @@ diff -uNr 12_integrated_testing/src/exception/asynchronous.rs 13_exceptions_part + ret +} -diff -uNr 12_integrated_testing/src/lib.rs 13_exceptions_part2_peripheral_IRQs/src/lib.rs ---- 12_integrated_testing/src/lib.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/lib.rs +diff -uNr 12_integrated_testing/kernel/src/lib.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs +--- 12_integrated_testing/kernel/src/lib.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs @@ -108,6 +108,7 @@ #![allow(clippy::upper_case_acronyms)] @@ -2415,9 +2415,9 @@ diff -uNr 12_integrated_testing/src/lib.rs 13_exceptions_part2_peripheral_IRQs/s //-------------------------------------------------------------------------------------------------- -diff -uNr 12_integrated_testing/src/main.rs 13_exceptions_part2_peripheral_IRQs/src/main.rs ---- 12_integrated_testing/src/main.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/main.rs +diff -uNr 12_integrated_testing/kernel/src/main.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs +--- 12_integrated_testing/kernel/src/main.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs @@ -11,7 +11,7 @@ #![no_main] #![no_std] @@ -2484,9 +2484,9 @@ diff -uNr 12_integrated_testing/src/main.rs 13_exceptions_part2_peripheral_IRQs/ + cpu::wait_forever(); } -diff -uNr 12_integrated_testing/src/panic_wait.rs 13_exceptions_part2_peripheral_IRQs/src/panic_wait.rs ---- 12_integrated_testing/src/panic_wait.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/panic_wait.rs +diff -uNr 12_integrated_testing/kernel/src/panic_wait.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/panic_wait.rs +--- 12_integrated_testing/kernel/src/panic_wait.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/panic_wait.rs @@ -4,7 +4,7 @@ //! A panic handler that infinitely waits. @@ -2506,9 +2506,9 @@ diff -uNr 12_integrated_testing/src/panic_wait.rs 13_exceptions_part2_peripheral panic_prevent_reenter(); -diff -uNr 12_integrated_testing/src/state.rs 13_exceptions_part2_peripheral_IRQs/src/state.rs ---- 12_integrated_testing/src/state.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/state.rs +diff -uNr 12_integrated_testing/kernel/src/state.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/state.rs +--- 12_integrated_testing/kernel/src/state.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/state.rs @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2603,9 +2603,9 @@ diff -uNr 12_integrated_testing/src/state.rs 13_exceptions_part2_peripheral_IRQs + } +} -diff -uNr 12_integrated_testing/src/synchronization.rs 13_exceptions_part2_peripheral_IRQs/src/synchronization.rs ---- 12_integrated_testing/src/synchronization.rs -+++ 13_exceptions_part2_peripheral_IRQs/src/synchronization.rs +diff -uNr 12_integrated_testing/kernel/src/synchronization.rs 13_exceptions_part2_peripheral_IRQs/kernel/src/synchronization.rs +--- 12_integrated_testing/kernel/src/synchronization.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/src/synchronization.rs @@ -28,6 +28,21 @@ /// Locks the mutex and grants the closure temporary mutable access to the wrapped data. fn lock(&self, f: impl FnOnce(&mut Self::Data) -> R) -> R; @@ -2738,9 +2738,9 @@ diff -uNr 12_integrated_testing/src/synchronization.rs 13_exceptions_part2_perip + } } -diff -uNr 12_integrated_testing/tests/04_exception_irq_sanity.rs 13_exceptions_part2_peripheral_IRQs/tests/04_exception_irq_sanity.rs ---- 12_integrated_testing/tests/04_exception_irq_sanity.rs -+++ 13_exceptions_part2_peripheral_IRQs/tests/04_exception_irq_sanity.rs +diff -uNr 12_integrated_testing/kernel/tests/04_exception_irq_sanity.rs 13_exceptions_part2_peripheral_IRQs/kernel/tests/04_exception_irq_sanity.rs +--- 12_integrated_testing/kernel/tests/04_exception_irq_sanity.rs ++++ 13_exceptions_part2_peripheral_IRQs/kernel/tests/04_exception_irq_sanity.rs @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// diff --git a/13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml b/13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml new file mode 100644 index 00000000..1d99ad38 --- /dev/null +++ b/13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml @@ -0,0 +1,58 @@ +[package] +name = "mingo" +version = "0.13.0" +authors = ["Andre Richter "] +edition = "2021" + + +[features] +default = [] +bsp_rpi3 = ["tock-registers"] +bsp_rpi4 = ["tock-registers"] +test_build = ["qemu-exit"] + +##-------------------------------------------------------------------------------------------------- +## Dependencies +##-------------------------------------------------------------------------------------------------- + +[dependencies] +test-types = { path = "../libraries/test-types" } + +# Optional dependencies +tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } +qemu-exit = { version = "3.x.x", optional = true } + +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] +cortex-a = { version = "7.x.x" } + +##-------------------------------------------------------------------------------------------------- +## Testing +##-------------------------------------------------------------------------------------------------- + +[dev-dependencies] +test-macros = { path = "../libraries/test-macros" } + +# Unit tests are done in the library part of the kernel. +[lib] +name = "libkernel" +test = true + +# Disable unit tests for the kernel binary. +[[bin]] +name = "kernel" +path = "src/main.rs" +test = false + +# List of tests without harness. +[[test]] +name = "00_console_sanity" +harness = false + +[[test]] +name = "02_exception_sync_page_fault" +harness = false + +[[test]] +name = "03_exception_restore_sanity" +harness = false diff --git a/13_exceptions_part2_peripheral_IRQs/build.rs b/13_exceptions_part2_peripheral_IRQs/kernel/build.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/build.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/build.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/boot.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/boot.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.s b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/boot.s similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.s rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/boot.s diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/smp.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/smp.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/smp.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/cpu/smp.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.s b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.s similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.s rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception.s diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception/asynchronous.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/exception/asynchronous.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu/translation_table.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu/translation_table.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/time.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/time.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicd.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicd.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/common.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/common.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/common.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/common.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/console.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/console.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/console.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/console.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/cpu.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/cpu.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/cpu.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/cpu.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/driver.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/driver.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception/asynchronous.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception/asynchronous.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/exception/asynchronous.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/exception/asynchronous.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/kernel.ld b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/kernel.ld similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/kernel.ld rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/kernel.ld diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory/mmu.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory/mmu.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory/mmu.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory/mmu.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/console.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/console.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/console.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/console.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/cpu.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/cpu.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/cpu.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/cpu/boot.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/cpu/boot.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/cpu/boot.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu/boot.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/cpu/smp.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/cpu/smp.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/cpu/smp.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/cpu/smp.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/driver.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/driver.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/exception.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/exception.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/exception.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/exception.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/exception/asynchronous.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/exception/asynchronous.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/lib.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/lib.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/main.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/main.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/memory.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/memory.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/memory.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/memory.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/memory/mmu/translation_table.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/translation_table.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/translation_table.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/translation_table.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/panic_wait.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/panic_wait.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/panic_wait.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/panic_wait.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/print.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/print.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/print.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/print.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/state.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/state.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/state.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/state.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/synchronization.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/synchronization.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/synchronization.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/synchronization.rs diff --git a/13_exceptions_part2_peripheral_IRQs/src/time.rs b/13_exceptions_part2_peripheral_IRQs/kernel/src/time.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/src/time.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/src/time.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/00_console_sanity.rb b/13_exceptions_part2_peripheral_IRQs/kernel/tests/00_console_sanity.rb similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/00_console_sanity.rb rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/00_console_sanity.rb diff --git a/13_exceptions_part2_peripheral_IRQs/tests/00_console_sanity.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/00_console_sanity.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/00_console_sanity.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/00_console_sanity.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/01_timer_sanity.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/01_timer_sanity.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/01_timer_sanity.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/01_timer_sanity.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/02_exception_sync_page_fault.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/02_exception_sync_page_fault.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/02_exception_sync_page_fault.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/02_exception_sync_page_fault.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/03_exception_restore_sanity.rb b/13_exceptions_part2_peripheral_IRQs/kernel/tests/03_exception_restore_sanity.rb similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/03_exception_restore_sanity.rb rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/03_exception_restore_sanity.rb diff --git a/13_exceptions_part2_peripheral_IRQs/tests/03_exception_restore_sanity.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/03_exception_restore_sanity.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/03_exception_restore_sanity.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/03_exception_restore_sanity.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/04_exception_irq_sanity.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/04_exception_irq_sanity.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/04_exception_irq_sanity.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/04_exception_irq_sanity.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/boot_test_string.rb b/13_exceptions_part2_peripheral_IRQs/kernel/tests/boot_test_string.rb similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/boot_test_string.rb rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/boot_test_string.rb diff --git a/13_exceptions_part2_peripheral_IRQs/tests/panic_exit_success/mod.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/panic_exit_success/mod.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/panic_exit_success/mod.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/panic_exit_success/mod.rs diff --git a/13_exceptions_part2_peripheral_IRQs/tests/panic_wait_forever/mod.rs b/13_exceptions_part2_peripheral_IRQs/kernel/tests/panic_wait_forever/mod.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/tests/panic_wait_forever/mod.rs rename to 13_exceptions_part2_peripheral_IRQs/kernel/tests/panic_wait_forever/mod.rs diff --git a/13_exceptions_part2_peripheral_IRQs/test-macros/Cargo.toml b/13_exceptions_part2_peripheral_IRQs/libraries/test-macros/Cargo.toml similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/test-macros/Cargo.toml rename to 13_exceptions_part2_peripheral_IRQs/libraries/test-macros/Cargo.toml diff --git a/13_exceptions_part2_peripheral_IRQs/test-macros/src/lib.rs b/13_exceptions_part2_peripheral_IRQs/libraries/test-macros/src/lib.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/test-macros/src/lib.rs rename to 13_exceptions_part2_peripheral_IRQs/libraries/test-macros/src/lib.rs diff --git a/13_exceptions_part2_peripheral_IRQs/test-types/Cargo.toml b/13_exceptions_part2_peripheral_IRQs/libraries/test-types/Cargo.toml similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/test-types/Cargo.toml rename to 13_exceptions_part2_peripheral_IRQs/libraries/test-types/Cargo.toml diff --git a/13_exceptions_part2_peripheral_IRQs/test-types/src/lib.rs b/13_exceptions_part2_peripheral_IRQs/libraries/test-types/src/lib.rs similarity index 100% rename from 13_exceptions_part2_peripheral_IRQs/test-types/src/lib.rs rename to 13_exceptions_part2_peripheral_IRQs/libraries/test-types/src/lib.rs diff --git a/14_virtual_mem_part2_mmio_remap/Cargo.lock b/14_virtual_mem_part2_mmio_remap/Cargo.lock index 6526767a..337a9ed8 100644 --- a/14_virtual_mem_part2_mmio_remap/Cargo.lock +++ b/14_virtual_mem_part2_mmio_remap/Cargo.lock @@ -39,9 +39,9 @@ checksum = "9ff023245bfcc73fb890e1f8d5383825b3131cc920020a5c487d6f113dfc428a" [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] diff --git a/14_virtual_mem_part2_mmio_remap/Cargo.toml b/14_virtual_mem_part2_mmio_remap/Cargo.toml index 3146ad05..6480a727 100644 --- a/14_virtual_mem_part2_mmio_remap/Cargo.toml +++ b/14_virtual_mem_part2_mmio_remap/Cargo.toml @@ -1,60 +1,9 @@ -[package] -name = "mingo" -version = "0.14.0" -authors = ["Andre Richter "] -edition = "2021" +[workspace] + +members = [ + "libraries/*", + "kernel" +] [profile.release] lto = true - -[features] -default = [] -bsp_rpi3 = ["tock-registers"] -bsp_rpi4 = ["tock-registers"] -test_build = ["qemu-exit"] - -##-------------------------------------------------------------------------------------------------- -## Dependencies -##-------------------------------------------------------------------------------------------------- - -[dependencies] -test-types = { path = "test-types" } - -# Optional dependencies -tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "3.x.x", optional = true } - -# Platform specific dependencies -[target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "7.x.x" } - -##-------------------------------------------------------------------------------------------------- -## Testing -##-------------------------------------------------------------------------------------------------- - -[dev-dependencies] -test-macros = { path = "test-macros" } - -# Unit tests are done in the library part of the kernel. -[lib] -name = "libkernel" -test = true - -# Disable unit tests for the kernel binary. -[[bin]] -name = "kernel" -path = "src/main.rs" -test = false - -# List of tests without harness. -[[test]] -name = "00_console_sanity" -harness = false - -[[test]] -name = "02_exception_sync_page_fault" -harness = false - -[[test]] -name = "03_exception_restore_sanity" -harness = false diff --git a/14_virtual_mem_part2_mmio_remap/Makefile b/14_virtual_mem_part2_mmio_remap/Makefile index 6adb1aca..427c9303 100644 --- a/14_virtual_mem_part2_mmio_remap/Makefile +++ b/14_virtual_mem_part2_mmio_remap/Makefile @@ -41,7 +41,7 @@ ifeq ($(BSP),rpi3) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi3.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi3.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat @@ -55,7 +55,7 @@ else ifeq ($(BSP),rpi4) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi4.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi4.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif @@ -67,9 +67,9 @@ export LD_SCRIPT_PATH ##-------------------------------------------------------------------------------------------------- ## Targets and Prerequisites ##-------------------------------------------------------------------------------------------------- +KERNEL_MANIFEST = kernel/Cargo.toml KERNEL_LINKER_SCRIPT = kernel.ld - -LAST_BUILD_CONFIG = target/$(BSP).build_config +LAST_BUILD_CONFIG = target/$(BSP).build_config KERNEL_ELF = target/$(TARGET)/release/kernel # This parses cargo's dep-info file. @@ -94,11 +94,11 @@ COMPILER_ARGS = --target=$(TARGET) \ $(FEATURES) \ --release -RUSTC_CMD = cargo rustc $(COMPILER_ARGS) +RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) CHECK_CMD = cargo check $(COMPILER_ARGS) -TEST_CMD = cargo test $(COMPILER_ARGS) +TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary @@ -203,6 +203,8 @@ chainboot: $(KERNEL_BIN) ##------------------------------------------------------------------------------ clippy: @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) --features test_build --tests \ + --manifest-path $(KERNEL_MANIFEST) ##------------------------------------------------------------------------------ ## Clean @@ -299,6 +301,10 @@ test_boot: $(KERNEL_BIN) define KERNEL_TEST_RUNNER #!/usr/bin/env bash + # The cargo test runner seems to change into the crate under test's directory. Therefore, ensure + # this script executes from the root. + cd $(shell pwd) + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/14_virtual_mem_part2_mmio_remap/README.md b/14_virtual_mem_part2_mmio_remap/README.md index 0056174b..e19cedb7 100644 --- a/14_virtual_mem_part2_mmio_remap/README.md +++ b/14_virtual_mem_part2_mmio_remap/README.md @@ -298,8 +298,8 @@ pub unsafe fn kernel_map_mmio( This allocator is defined and implemented in the added file `src/memory/mmu/alloc.rs`. Like other parts of the mapping code, its implementation makes use of the newly introduced `PageAddress` -and `MemoryRegion` types (in [`src/memory/mmu/types.rs`](src/memory/mmu/types.rs)), but apart -from that is rather straight forward. Therefore, it won't be covered in details here. +and `MemoryRegion` types (in [`src/memory/mmu/types.rs`](kernel/src/memory/mmu/types.rs)), +but apart from that is rather straight forward. Therefore, it won't be covered in details here. The more interesting question is: How does the allocator get to learn which VAs it can use? @@ -341,13 +341,14 @@ the VA range. There's a couple of changes not covered in this tutorial text, but the reader should ideally skim through them: -- [`src/memory.rs`](src/memory.rs) and [`src/memory/mmu/types.rs`](src/memory/mmu/types.rs) - introduce a couple of supporting types, like`Address`, `PageAddress` and - `MemoryRegion`. It is worth reading their implementations. -- [`src/memory/mmu/mapping_record.rs`](src/memory/mmu/mapping_record.rs) provides the generic kernel - code's way of tracking previous memory mappings for use cases such as reusing existing mappings - (in case of drivers that have their MMIO ranges in the same `64 KiB` page) or printing mappings - statistics. +- [`src/memory.rs`](kernel/src/memory.rs) and + [`src/memory/mmu/types.rs`](kernel/src/memory/mmu/types.rs) introduce a couple of supporting + types, like`Address`, `PageAddress` and `MemoryRegion`. It is worth reading + their implementations. +- [`src/memory/mmu/mapping_record.rs`](kernel/src/memory/mmu/mapping_record.rs) provides the generic + kernel code's way of tracking previous memory mappings for use cases such as reusing existing + mappings (in case of drivers that have their MMIO ranges in the same `64 KiB` page) or printing + mappings statistics. ## Test it @@ -433,9 +434,9 @@ Minipush 1.0 ## Diff to previous ```diff -diff -uNr 13_exceptions_part2_peripheral_IRQs/Cargo.toml 14_virtual_mem_part2_mmio_remap/Cargo.toml ---- 13_exceptions_part2_peripheral_IRQs/Cargo.toml -+++ 14_virtual_mem_part2_mmio_remap/Cargo.toml +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml 14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml +--- 13_exceptions_part2_peripheral_IRQs/kernel/Cargo.toml ++++ 14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mingo" @@ -445,9 +446,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/Cargo.toml 14_virtual_mem_part2_mm edition = "2021" -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu/translation_table.rs 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translation_table.rs ---- 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu/translation_table.rs -+++ 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translation_table.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs @@ -14,10 +14,14 @@ //! crate::memory::mmu::translation_table::arch_translation_table @@ -705,9 +706,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu/trans use super::*; use test_macros::kernel_test; -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu.rs ---- 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs -+++ 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu.rs 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/_arch/aarch64/memory/mmu.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu.rs @@ -15,7 +15,7 @@ use crate::{ @@ -802,9 +803,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 14 - } -} -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicc.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicc.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs @@ -4,7 +4,9 @@ //! GICC Driver - GIC CPU interface. @@ -891,9 +892,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gi } } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicd.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicd.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicd.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicd.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs @@ -8,8 +8,9 @@ //! - SPI - Shared Peripheral Interrupt. @@ -967,9 +968,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gi _ => { let enable_reg_index_shared = enable_reg_index - 1; -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/arm/gicv2.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2.rs @@ -79,7 +79,8 @@ mod gicc; mod gicd; @@ -1043,9 +1044,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs self.gicd.boot_core_init(); } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs @@ -5,9 +5,10 @@ //! GPIO Driver. @@ -1131,9 +1132,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_ + } } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs @@ -7,7 +7,7 @@ use super::{InterruptController, PendingIRQs, PeripheralIRQ}; use crate::{ @@ -1218,9 +1219,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_ type IRQNumberType = PeripheralIRQ; -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs @@ -6,7 +6,7 @@ mod peripheral_ic; @@ -1259,9 +1260,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_ impl exception::asynchronous::interface::IRQManager for InterruptController { -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -10,10 +10,13 @@ //! - @@ -1368,9 +1369,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_ impl console::interface::Write for PL011Uart { -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/console.rs 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/console.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/console.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/console.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/console.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/console.rs @@ -5,7 +5,7 @@ //! BSP console facilities. @@ -1410,9 +1411,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/console.rs 14_ } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/driver.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/driver.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/driver.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/driver.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/driver.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/driver.rs @@ -46,7 +46,15 @@ &self.device_drivers[..] } @@ -1431,9 +1432,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/driver.rs 14_v super::GPIO.map_pl011_uart(); } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/kernel.ld 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/kernel.ld -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/kernel.ld 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel.ld +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/kernel.ld ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel.ld @@ -38,7 +38,7 @@ ***********************************************************************************************/ .boot_core_stack (NOLOAD) : @@ -1469,9 +1470,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/kernel.ld 14_v + ASSERT((. & PAGE_MASK) == 0, "MMIO remap reservation is not page aligned") } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory/mmu.rs 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory/mmu.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory/mmu.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory/mmu.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu.rs @@ -4,70 +4,163 @@ //! BSP Memory Management Unit. @@ -1761,9 +1762,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory/mmu.rs + } } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi/memory.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory.rs @@ -10,27 +10,59 @@ //! as the boot core's stack. //! @@ -2005,9 +2006,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs 14_v + PageAddress::from(map::END) } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi.rs ---- 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs -+++ 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi.rs 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/bsp/raspberrypi.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi.rs @@ -10,17 +10,20 @@ pub mod exception; pub mod memory; @@ -2054,9 +2055,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi.rs 14_virtual_ //-------------------------------------------------------------------------------------------------- -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/common.rs 14_virtual_mem_part2_mmio_remap/src/common.rs ---- 13_exceptions_part2_peripheral_IRQs/src/common.rs -+++ 14_virtual_mem_part2_mmio_remap/src/common.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/common.rs 14_virtual_mem_part2_mmio_remap/kernel/src/common.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/common.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/common.rs @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2088,9 +2089,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/common.rs 14_virtual_mem_part2 + (value + alignment - 1) & !(alignment - 1) +} -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/driver.rs 14_virtual_mem_part2_mmio_remap/src/driver.rs ---- 13_exceptions_part2_peripheral_IRQs/src/driver.rs -+++ 14_virtual_mem_part2_mmio_remap/src/driver.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs 14_virtual_mem_part2_mmio_remap/kernel/src/driver.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/driver.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/driver.rs @@ -31,6 +31,14 @@ fn register_and_enable_irq_handler(&'static self) -> Result<(), &'static str> { Ok(()) @@ -2132,9 +2133,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/driver.rs 14_virtual_mem_part2 } } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/lib.rs 14_virtual_mem_part2_mmio_remap/src/lib.rs ---- 13_exceptions_part2_peripheral_IRQs/src/lib.rs -+++ 14_virtual_mem_part2_mmio_remap/src/lib.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs 14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/lib.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs @@ -111,8 +111,10 @@ #![feature(asm_const)] #![feature(core_intrinsics)] @@ -2163,9 +2164,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/lib.rs 14_virtual_mem_part2_mm test_main(); -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/main.rs 14_virtual_mem_part2_mmio_remap/src/main.rs ---- 13_exceptions_part2_peripheral_IRQs/src/main.rs -+++ 14_virtual_mem_part2_mmio_remap/src/main.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/main.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs @@ -25,21 +25,41 @@ #[no_mangle] unsafe fn kernel_init() -> ! { @@ -2226,9 +2227,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/main.rs 14_virtual_mem_part2_m let (_, privilege_level) = exception::current_privilege_level(); info!("Current privilege level: {}", privilege_level); -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/alloc.rs 14_virtual_mem_part2_mmio_remap/src/memory/mmu/alloc.rs ---- 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/alloc.rs -+++ 14_virtual_mem_part2_mmio_remap/src/memory/mmu/alloc.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/alloc.rs 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/alloc.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/alloc.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/alloc.rs @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2301,9 +2302,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/alloc.rs 14_virtual + } +} -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/mapping_record.rs 14_virtual_mem_part2_mmio_remap/src/memory/mmu/mapping_record.rs ---- 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/mapping_record.rs -+++ 14_virtual_mem_part2_mmio_remap/src/memory/mmu/mapping_record.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/mapping_record.rs 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/mapping_record.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/mapping_record.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/mapping_record.rs @@ -0,0 +1,233 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -2539,9 +2540,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/mapping_record.rs 1 + KERNEL_MAPPING_RECORD.read(|mr| mr.print()); +} -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/translation_table.rs 14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs ---- 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/translation_table.rs -+++ 14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/translation_table.rs 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/translation_table.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/translation_table.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/translation_table.rs @@ -8,7 +8,91 @@ #[path = "../../_arch/aarch64/memory/mmu/translation_table.rs"] mod arch_translation_table; @@ -2636,9 +2637,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/translation_table.r + } +} -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/types.rs 14_virtual_mem_part2_mmio_remap/src/memory/mmu/types.rs ---- 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/types.rs -+++ 14_virtual_mem_part2_mmio_remap/src/memory/mmu/types.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/types.rs 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/types.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu/types.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/types.rs @@ -0,0 +1,373 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// @@ -3014,9 +3015,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu/types.rs 14_virtual + } +} -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs 14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs ---- 13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs -+++ 14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu.rs 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/memory/mmu.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu.rs @@ -3,29 +3,24 @@ // Copyright (c) 2020-2022 Andre Richter @@ -3424,9 +3425,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs 14_virtual_mem_p } } -diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2_mmio_remap/src/memory.rs ---- 13_exceptions_part2_peripheral_IRQs/src/memory.rs -+++ 14_virtual_mem_part2_mmio_remap/src/memory.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/src/memory.rs 14_virtual_mem_part2_mmio_remap/kernel/src/memory.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/src/memory.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/src/memory.rs @@ -5,3 +5,163 @@ //! Memory Management. @@ -3592,9 +3593,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2 + } +} -diff -uNr 13_exceptions_part2_peripheral_IRQs/tests/02_exception_sync_page_fault.rs 14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs ---- 13_exceptions_part2_peripheral_IRQs/tests/02_exception_sync_page_fault.rs -+++ 14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/tests/02_exception_sync_page_fault.rs 14_virtual_mem_part2_mmio_remap/kernel/tests/02_exception_sync_page_fault.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/tests/02_exception_sync_page_fault.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/tests/02_exception_sync_page_fault.rs @@ -21,18 +21,40 @@ #[no_mangle] @@ -3641,9 +3642,9 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/tests/02_exception_sync_page_fault info!("Writing beyond mapped area to address 9 GiB..."); let big_addr: u64 = 9 * 1024 * 1024 * 1024; -diff -uNr 13_exceptions_part2_peripheral_IRQs/tests/03_exception_restore_sanity.rs 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs ---- 13_exceptions_part2_peripheral_IRQs/tests/03_exception_restore_sanity.rs -+++ 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs +diff -uNr 13_exceptions_part2_peripheral_IRQs/kernel/tests/03_exception_restore_sanity.rs 14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rs +--- 13_exceptions_part2_peripheral_IRQs/kernel/tests/03_exception_restore_sanity.rs ++++ 14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rs @@ -30,18 +30,40 @@ #[no_mangle] diff --git a/14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml b/14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml new file mode 100644 index 00000000..deb0c8bc --- /dev/null +++ b/14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml @@ -0,0 +1,58 @@ +[package] +name = "mingo" +version = "0.14.0" +authors = ["Andre Richter "] +edition = "2021" + + +[features] +default = [] +bsp_rpi3 = ["tock-registers"] +bsp_rpi4 = ["tock-registers"] +test_build = ["qemu-exit"] + +##-------------------------------------------------------------------------------------------------- +## Dependencies +##-------------------------------------------------------------------------------------------------- + +[dependencies] +test-types = { path = "../libraries/test-types" } + +# Optional dependencies +tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } +qemu-exit = { version = "3.x.x", optional = true } + +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] +cortex-a = { version = "7.x.x" } + +##-------------------------------------------------------------------------------------------------- +## Testing +##-------------------------------------------------------------------------------------------------- + +[dev-dependencies] +test-macros = { path = "../libraries/test-macros" } + +# Unit tests are done in the library part of the kernel. +[lib] +name = "libkernel" +test = true + +# Disable unit tests for the kernel binary. +[[bin]] +name = "kernel" +path = "src/main.rs" +test = false + +# List of tests without harness. +[[test]] +name = "00_console_sanity" +harness = false + +[[test]] +name = "02_exception_sync_page_fault" +harness = false + +[[test]] +name = "03_exception_restore_sanity" +harness = false diff --git a/14_virtual_mem_part2_mmio_remap/build.rs b/14_virtual_mem_part2_mmio_remap/kernel/build.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/build.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/build.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.s b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.s similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.s rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.s diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/smp.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/smp.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/smp.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/smp.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.s b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.s similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.s rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception.s diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception/asynchronous.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/exception/asynchronous.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translation_table.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translation_table.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/time.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/time.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicc.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicc.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicd.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicd.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/common.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/common.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/common.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/device_driver/common.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/console.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/console.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/cpu.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/cpu.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/cpu.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/cpu.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/driver.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/driver.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/driver.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/driver.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/exception.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/exception.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/exception.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/exception.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/exception/asynchronous.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/exception/asynchronous.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/exception/asynchronous.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/exception/asynchronous.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel.ld similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel.ld diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/common.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/common.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/common.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/common.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/console.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/console.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/console.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/console.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/cpu.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/cpu.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/cpu.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/cpu.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/cpu/boot.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/cpu/boot.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/cpu/boot.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/cpu/boot.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/cpu/smp.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/cpu/smp.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/cpu/smp.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/cpu/smp.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/driver.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/driver.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/driver.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/driver.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/exception.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/exception.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/exception.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/exception.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/exception/asynchronous.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/exception/asynchronous.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/exception/asynchronous.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/exception/asynchronous.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/lib.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/lib.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/lib.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/main.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/main.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/main.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/memory.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/memory.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/memory.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/memory.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/memory/mmu/alloc.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/alloc.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/memory/mmu/alloc.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/alloc.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/memory/mmu/mapping_record.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/mapping_record.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/memory/mmu/mapping_record.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/mapping_record.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/translation_table.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/translation_table.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/memory/mmu/types.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/types.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/memory/mmu/types.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/types.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/panic_wait.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/panic_wait.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/panic_wait.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/panic_wait.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/print.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/print.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/print.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/print.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/state.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/state.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/state.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/state.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/synchronization.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/synchronization.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/synchronization.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/synchronization.rs diff --git a/14_virtual_mem_part2_mmio_remap/src/time.rs b/14_virtual_mem_part2_mmio_remap/kernel/src/time.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/src/time.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/src/time.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rb b/14_virtual_mem_part2_mmio_remap/kernel/tests/00_console_sanity.rb similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rb rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/00_console_sanity.rb diff --git a/14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/00_console_sanity.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/00_console_sanity.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/01_timer_sanity.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/01_timer_sanity.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/01_timer_sanity.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/01_timer_sanity.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/02_exception_sync_page_fault.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/02_exception_sync_page_fault.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rb b/14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rb similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rb rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rb diff --git a/14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/04_exception_irq_sanity.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/04_exception_irq_sanity.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/04_exception_irq_sanity.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/04_exception_irq_sanity.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/boot_test_string.rb b/14_virtual_mem_part2_mmio_remap/kernel/tests/boot_test_string.rb similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/boot_test_string.rb rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/boot_test_string.rb diff --git a/14_virtual_mem_part2_mmio_remap/tests/panic_exit_success/mod.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/panic_exit_success/mod.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/panic_exit_success/mod.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/panic_exit_success/mod.rs diff --git a/14_virtual_mem_part2_mmio_remap/tests/panic_wait_forever/mod.rs b/14_virtual_mem_part2_mmio_remap/kernel/tests/panic_wait_forever/mod.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/tests/panic_wait_forever/mod.rs rename to 14_virtual_mem_part2_mmio_remap/kernel/tests/panic_wait_forever/mod.rs diff --git a/14_virtual_mem_part2_mmio_remap/test-macros/Cargo.toml b/14_virtual_mem_part2_mmio_remap/libraries/test-macros/Cargo.toml similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/test-macros/Cargo.toml rename to 14_virtual_mem_part2_mmio_remap/libraries/test-macros/Cargo.toml diff --git a/14_virtual_mem_part2_mmio_remap/test-macros/src/lib.rs b/14_virtual_mem_part2_mmio_remap/libraries/test-macros/src/lib.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/test-macros/src/lib.rs rename to 14_virtual_mem_part2_mmio_remap/libraries/test-macros/src/lib.rs diff --git a/14_virtual_mem_part2_mmio_remap/test-types/Cargo.toml b/14_virtual_mem_part2_mmio_remap/libraries/test-types/Cargo.toml similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/test-types/Cargo.toml rename to 14_virtual_mem_part2_mmio_remap/libraries/test-types/Cargo.toml diff --git a/14_virtual_mem_part2_mmio_remap/test-types/src/lib.rs b/14_virtual_mem_part2_mmio_remap/libraries/test-types/src/lib.rs similarity index 100% rename from 14_virtual_mem_part2_mmio_remap/test-types/src/lib.rs rename to 14_virtual_mem_part2_mmio_remap/libraries/test-types/src/lib.rs diff --git a/15_virtual_mem_part3_precomputed_tables/Cargo.lock b/15_virtual_mem_part3_precomputed_tables/Cargo.lock index 9ce8fc76..1bac7e89 100644 --- a/15_virtual_mem_part3_precomputed_tables/Cargo.lock +++ b/15_virtual_mem_part3_precomputed_tables/Cargo.lock @@ -39,9 +39,9 @@ checksum = "9ff023245bfcc73fb890e1f8d5383825b3131cc920020a5c487d6f113dfc428a" [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] diff --git a/15_virtual_mem_part3_precomputed_tables/Cargo.toml b/15_virtual_mem_part3_precomputed_tables/Cargo.toml index 6a41bd03..6480a727 100644 --- a/15_virtual_mem_part3_precomputed_tables/Cargo.toml +++ b/15_virtual_mem_part3_precomputed_tables/Cargo.toml @@ -1,60 +1,9 @@ -[package] -name = "mingo" -version = "0.15.0" -authors = ["Andre Richter "] -edition = "2021" +[workspace] + +members = [ + "libraries/*", + "kernel" +] [profile.release] lto = true - -[features] -default = [] -bsp_rpi3 = ["tock-registers"] -bsp_rpi4 = ["tock-registers"] -test_build = ["qemu-exit"] - -##-------------------------------------------------------------------------------------------------- -## Dependencies -##-------------------------------------------------------------------------------------------------- - -[dependencies] -test-types = { path = "test-types" } - -# Optional dependencies -tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "3.x.x", optional = true } - -# Platform specific dependencies -[target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "7.x.x" } - -##-------------------------------------------------------------------------------------------------- -## Testing -##-------------------------------------------------------------------------------------------------- - -[dev-dependencies] -test-macros = { path = "test-macros" } - -# Unit tests are done in the library part of the kernel. -[lib] -name = "libkernel" -test = true - -# Disable unit tests for the kernel binary. -[[bin]] -name = "kernel" -path = "src/main.rs" -test = false - -# List of tests without harness. -[[test]] -name = "00_console_sanity" -harness = false - -[[test]] -name = "02_exception_sync_page_fault" -harness = false - -[[test]] -name = "03_exception_restore_sanity" -harness = false diff --git a/15_virtual_mem_part3_precomputed_tables/Makefile b/15_virtual_mem_part3_precomputed_tables/Makefile index a695185d..81de6005 100644 --- a/15_virtual_mem_part3_precomputed_tables/Makefile +++ b/15_virtual_mem_part3_precomputed_tables/Makefile @@ -41,7 +41,7 @@ ifeq ($(BSP),rpi3) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi3.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi3.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat @@ -55,7 +55,7 @@ else ifeq ($(BSP),rpi4) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi4.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi4.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif @@ -67,11 +67,11 @@ export LD_SCRIPT_PATH ##-------------------------------------------------------------------------------------------------- ## Targets and Prerequisites ##-------------------------------------------------------------------------------------------------- +KERNEL_MANIFEST = kernel/Cargo.toml KERNEL_LINKER_SCRIPT = kernel.ld +LAST_BUILD_CONFIG = target/$(BSP).build_config -TT_TOOL_PATH = translation_table_tool - -LAST_BUILD_CONFIG = target/$(BSP).build_config +TT_TOOL_PATH = tools/translation_table_tool KERNEL_ELF_RAW = target/$(TARGET)/release/kernel # This parses cargo's dep-info file. @@ -101,11 +101,11 @@ COMPILER_ARGS = --target=$(TARGET) \ $(FEATURES) \ --release -RUSTC_CMD = cargo rustc $(COMPILER_ARGS) +RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) CHECK_CMD = cargo check $(COMPILER_ARGS) -TEST_CMD = cargo test $(COMPILER_ARGS) +TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary @@ -219,6 +219,8 @@ chainboot: $(KERNEL_BIN) ##------------------------------------------------------------------------------ clippy: @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) --features test_build --tests \ + --manifest-path $(KERNEL_MANIFEST) ##------------------------------------------------------------------------------ ## Clean @@ -315,6 +317,10 @@ test_boot: $(KERNEL_BIN) define KERNEL_TEST_RUNNER #!/usr/bin/env bash + # The cargo test runner seems to change into the crate under test's directory. Therefore, ensure + # this script executes from the root. + cd $(shell pwd) + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/15_virtual_mem_part3_precomputed_tables/README.md b/15_virtual_mem_part3_precomputed_tables/README.md index b27571e3..c3554f19 100644 --- a/15_virtual_mem_part3_precomputed_tables/README.md +++ b/15_virtual_mem_part3_precomputed_tables/README.md @@ -540,15 +540,15 @@ already, the only missing piece that's left is the offline computation of the tr ### The Translation Table Tool -The tool for translation table computation is located in the folder `translation_table_tool` in the -root directory. For ease of use, it is written in `Ruby` 💎. The code is organized into `BSP` and -`arch` parts just like the kernel's `Rust` code, and also has a class for processing the kernel -`ELF` file: +The tool for translation table computation is located in the folder +`$ROOT/tools/translation_table_tool`. For ease of use, it is written in `Ruby` 💎. The code is +organized into `BSP` and `arch` parts just like the kernel's `Rust` code, and also has a class for +processing the kernel `ELF` file: ```console -$ tree translation_table_tool +$ tree tools/translation_table_tool -translation_table_tool +tools/translation_table_tool ├── arch.rb ├── bsp.rb ├── generic.rb @@ -568,7 +568,7 @@ In the `Makefile`, the tool is invoked after compiling and linking the kernel, a to the kernel's `ELF` file: ```Makefile -TT_TOOL_PATH = translation_table_tool +TT_TOOL_PATH = tools/translation_table_tool KERNEL_ELF_RAW = target/$(TARGET)/release/kernel # [...] @@ -796,9 +796,9 @@ Minipush 1.0 ## Diff to previous ```diff -diff -uNr 14_virtual_mem_part2_mmio_remap/Cargo.toml 15_virtual_mem_part3_precomputed_tables/Cargo.toml ---- 14_virtual_mem_part2_mmio_remap/Cargo.toml -+++ 15_virtual_mem_part3_precomputed_tables/Cargo.toml +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml 15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml +--- 14_virtual_mem_part2_mmio_remap/kernel/Cargo.toml ++++ 15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mingo" @@ -808,79 +808,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/Cargo.toml 15_virtual_mem_part3_precom edition = "2021" -diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precomputed_tables/Makefile ---- 14_virtual_mem_part2_mmio_remap/Makefile -+++ 15_virtual_mem_part3_precomputed_tables/Makefile -@@ -69,12 +69,19 @@ - ##-------------------------------------------------------------------------------------------------- - KERNEL_LINKER_SCRIPT = kernel.ld - -+TT_TOOL_PATH = translation_table_tool -+ - LAST_BUILD_CONFIG = target/$(BSP).build_config - --KERNEL_ELF = target/$(TARGET)/release/kernel -+KERNEL_ELF_RAW = target/$(TARGET)/release/kernel - # This parses cargo's dep-info file. - # https://doc.rust-lang.org/cargo/guide/build-cache.html#dep-info-files --KERNEL_ELF_DEPS = $(filter-out modulo: ,$(file < $(KERNEL_ELF_RAW).d)) $(LAST_BUILD_CONFIG) -+KERNEL_ELF_RAW_DEPS = $(filter-out modulo: ,$(file < $(KERNEL_ELF_RAW).d)) $(LAST_BUILD_CONFIG) -+ -+KERNEL_ELF_TTABLES = target/$(TARGET)/release/kernel+ttables -+KERNEL_ELF_TTABLES_DEPS = $(KERNEL_ELF_RAW) $(wildcard $(TT_TOOL_PATH)/*) -+ -+KERNEL_ELF = $(KERNEL_ELF_TTABLES) - - - -@@ -104,6 +111,7 @@ - -O binary - - EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) -+EXEC_TT_TOOL = ruby $(TT_TOOL_PATH)/main.rb - EXEC_TEST_DISPATCH = ruby ../common/tests/dispatch.rb - EXEC_MINIPUSH = ruby ../common/serial/minipush.rb - -@@ -154,16 +162,24 @@ - ##------------------------------------------------------------------------------ - ## Compile the kernel ELF - ##------------------------------------------------------------------------------ --$(KERNEL_ELF): $(KERNEL_ELF_DEPS) -+$(KERNEL_ELF_RAW): $(KERNEL_ELF_RAW_DEPS) - $(call color_header, "Compiling kernel ELF - $(BSP)") - @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(RUSTC_CMD) - - ##------------------------------------------------------------------------------ -+## Precompute the kernel translation tables and patch them into the kernel ELF -+##------------------------------------------------------------------------------ -+$(KERNEL_ELF_TTABLES): $(KERNEL_ELF_TTABLES_DEPS) -+ $(call color_header, "Precomputing kernel translation tables and patching kernel ELF") -+ @cp $(KERNEL_ELF_RAW) $(KERNEL_ELF_TTABLES) -+ @$(DOCKER_TOOLS) $(EXEC_TT_TOOL) $(BSP) $(KERNEL_ELF_TTABLES) -+ -+##------------------------------------------------------------------------------ - ## Generate the stripped kernel binary - ##------------------------------------------------------------------------------ --$(KERNEL_BIN): $(KERNEL_ELF) -+$(KERNEL_BIN): $(KERNEL_ELF_TTABLES) - $(call color_header, "Generating stripped binary") -- @$(OBJCOPY_CMD) $(KERNEL_ELF) $(KERNEL_BIN) -+ @$(OBJCOPY_CMD) $(KERNEL_ELF_TTABLES) $(KERNEL_BIN) - $(call color_progress_prefix, "Name") - @echo $(KERNEL_BIN) - $(call color_progress_prefix, "Size") -@@ -302,6 +318,7 @@ - TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') - TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') - -+ $(DOCKER_TOOLS) $(EXEC_TT_TOOL) $(BSP) $$TEST_ELF > /dev/null - $(OBJCOPY_CMD) $$TEST_ELF $$TEST_BINARY - $(DOCKER_TEST) $(EXEC_TEST_DISPATCH) $(EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY - endef - -diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs ---- 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot @@ -908,9 +838,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs 15_virtu asm::eret() } -diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.s 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s ---- 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.s -+++ 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.s 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.s +--- 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/cpu/boot.s ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.s @@ -56,11 +56,14 @@ // Prepare the jump to Rust code. @@ -930,9 +860,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.s 15_virtua // Infinitely wait for events (aka "park the core"). -diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translation_table.rs 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/translation_table.rs ---- 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translation_table.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/translation_table.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs @@ -125,7 +125,7 @@ } @@ -1135,9 +1065,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/memory/mmu/translati //-------------------------------------------------------------------------------------------------- -diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs ---- 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/console.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/console.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/console.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/console.rs @@ -22,6 +22,7 @@ /// # Safety /// @@ -1194,9 +1124,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/console.rs 15_virt + } +} -diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld ---- 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld -+++ 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel.ld 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel.ld +--- 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel.ld ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel.ld @@ -3,6 +3,8 @@ * Copyright (c) 2018-2022 Andre Richter */ @@ -1207,15 +1137,15 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel.ld 15_virtu PAGE_MASK = PAGE_SIZE - 1; -diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld ---- 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld -+++ 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld +--- 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld @@ -0,0 +1 @@ +__kernel_virt_addr_space_size = 1024 * 1024 * 1024 -diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs ---- 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory/mmu.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/bsp/raspberrypi/memory/mmu.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory/mmu.rs @@ -7,8 +7,8 @@ use crate::{ memory::{ @@ -1441,9 +1371,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v + ); } -diff -uNr 14_virtual_mem_part2_mmio_remap/src/main.rs 15_virtual_mem_part3_precomputed_tables/src/main.rs ---- 14_virtual_mem_part2_mmio_remap/src/main.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/main.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/main.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs @@ -15,31 +15,23 @@ /// Early init code. @@ -1493,9 +1423,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/main.rs 15_virtual_mem_part3_preco // Now bring up the remaining drivers. for i in bsp::driver::driver_manager() -diff -uNr 14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_table.rs ---- 14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_table.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/translation_table.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/translation_table.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu/translation_table.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/translation_table.rs @@ -23,6 +23,8 @@ /// Translation table interfaces. @@ -1583,9 +1513,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/memory/mmu/translation_table.rs 15 } } -diff -uNr 14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs 15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs ---- 14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs -+++ 15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu.rs 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/src/memory/mmu.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu.rs @@ -16,7 +16,8 @@ use crate::{ bsp, @@ -1752,9 +1682,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/memory/mmu.rs 15_virtual_mem_part3 - } -} -diff -uNr 14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rs 15_virtual_mem_part3_precomputed_tables/tests/00_console_sanity.rs ---- 14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rs -+++ 15_virtual_mem_part3_precomputed_tables/tests/00_console_sanity.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/tests/00_console_sanity.rs 15_virtual_mem_part3_precomputed_tables/kernel/tests/00_console_sanity.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/tests/00_console_sanity.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/tests/00_console_sanity.rs @@ -11,7 +11,7 @@ /// Console tests should time out on the I/O harness in case of panic. mod panic_wait_forever; @@ -1773,9 +1703,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/tests/00_console_sanity.rs 15_virtual_ // Handshake -diff -uNr 14_virtual_mem_part2_mmio_remap/tests/01_timer_sanity.rs 15_virtual_mem_part3_precomputed_tables/tests/01_timer_sanity.rs ---- 14_virtual_mem_part2_mmio_remap/tests/01_timer_sanity.rs -+++ 15_virtual_mem_part3_precomputed_tables/tests/01_timer_sanity.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/tests/01_timer_sanity.rs 15_virtual_mem_part3_precomputed_tables/kernel/tests/01_timer_sanity.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/tests/01_timer_sanity.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/tests/01_timer_sanity.rs @@ -11,12 +11,13 @@ #![test_runner(libkernel::test_runner)] @@ -1792,9 +1722,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/tests/01_timer_sanity.rs 15_virtual_me // Depending on CPU arch, some timer bring-up code could go here. Not needed for the RPi. -diff -uNr 14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs 15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_fault.rs ---- 14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs -+++ 15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_fault.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/tests/02_exception_sync_page_fault.rs 15_virtual_mem_part3_precomputed_tables/kernel/tests/02_exception_sync_page_fault.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/tests/02_exception_sync_page_fault.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/tests/02_exception_sync_page_fault.rs @@ -21,40 +21,12 @@ #[no_mangle] @@ -1839,9 +1769,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/tests/02_exception_sync_page_fault.rs info!("Writing beyond mapped area to address 9 GiB..."); let big_addr: u64 = 9 * 1024 * 1024 * 1024; -diff -uNr 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs 15_virtual_mem_part3_precomputed_tables/tests/03_exception_restore_sanity.rs ---- 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs -+++ 15_virtual_mem_part3_precomputed_tables/tests/03_exception_restore_sanity.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rs 15_virtual_mem_part3_precomputed_tables/kernel/tests/03_exception_restore_sanity.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/tests/03_exception_restore_sanity.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/tests/03_exception_restore_sanity.rs @@ -30,40 +30,12 @@ #[no_mangle] @@ -1886,9 +1816,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/tests/03_exception_restore_sanity.rs 1 info!("Making a dummy system call"); -diff -uNr 14_virtual_mem_part2_mmio_remap/tests/04_exception_irq_sanity.rs 15_virtual_mem_part3_precomputed_tables/tests/04_exception_irq_sanity.rs ---- 14_virtual_mem_part2_mmio_remap/tests/04_exception_irq_sanity.rs -+++ 15_virtual_mem_part3_precomputed_tables/tests/04_exception_irq_sanity.rs +diff -uNr 14_virtual_mem_part2_mmio_remap/kernel/tests/04_exception_irq_sanity.rs 15_virtual_mem_part3_precomputed_tables/kernel/tests/04_exception_irq_sanity.rs +--- 14_virtual_mem_part2_mmio_remap/kernel/tests/04_exception_irq_sanity.rs ++++ 15_virtual_mem_part3_precomputed_tables/kernel/tests/04_exception_irq_sanity.rs @@ -10,11 +10,12 @@ #![reexport_test_harness_main = "test_main"] #![test_runner(libkernel::test_runner)] @@ -1904,9 +1834,77 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/tests/04_exception_irq_sanity.rs 15_vi exception::handling_init(); -diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/arch.rb 15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb ---- 14_virtual_mem_part2_mmio_remap/translation_table_tool/arch.rb -+++ 15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb +diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precomputed_tables/Makefile +--- 14_virtual_mem_part2_mmio_remap/Makefile ++++ 15_virtual_mem_part3_precomputed_tables/Makefile +@@ -71,10 +71,17 @@ + KERNEL_LINKER_SCRIPT = kernel.ld + LAST_BUILD_CONFIG = target/$(BSP).build_config + +-KERNEL_ELF = target/$(TARGET)/release/kernel ++TT_TOOL_PATH = tools/translation_table_tool ++ ++KERNEL_ELF_RAW = target/$(TARGET)/release/kernel + # This parses cargo's dep-info file. + # https://doc.rust-lang.org/cargo/guide/build-cache.html#dep-info-files +-KERNEL_ELF_DEPS = $(filter-out modulo: ,$(file < $(KERNEL_ELF_RAW).d)) $(LAST_BUILD_CONFIG) ++KERNEL_ELF_RAW_DEPS = $(filter-out modulo: ,$(file < $(KERNEL_ELF_RAW).d)) $(LAST_BUILD_CONFIG) ++ ++KERNEL_ELF_TTABLES = target/$(TARGET)/release/kernel+ttables ++KERNEL_ELF_TTABLES_DEPS = $(KERNEL_ELF_RAW) $(wildcard $(TT_TOOL_PATH)/*) ++ ++KERNEL_ELF = $(KERNEL_ELF_TTABLES) + + + +@@ -104,6 +111,7 @@ + -O binary + + EXEC_QEMU = $(QEMU_BINARY) -M $(QEMU_MACHINE_TYPE) ++EXEC_TT_TOOL = ruby $(TT_TOOL_PATH)/main.rb + EXEC_TEST_DISPATCH = ruby ../common/tests/dispatch.rb + EXEC_MINIPUSH = ruby ../common/serial/minipush.rb + +@@ -154,16 +162,24 @@ + ##------------------------------------------------------------------------------ + ## Compile the kernel ELF + ##------------------------------------------------------------------------------ +-$(KERNEL_ELF): $(KERNEL_ELF_DEPS) ++$(KERNEL_ELF_RAW): $(KERNEL_ELF_RAW_DEPS) + $(call color_header, "Compiling kernel ELF - $(BSP)") + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(RUSTC_CMD) + + ##------------------------------------------------------------------------------ ++## Precompute the kernel translation tables and patch them into the kernel ELF ++##------------------------------------------------------------------------------ ++$(KERNEL_ELF_TTABLES): $(KERNEL_ELF_TTABLES_DEPS) ++ $(call color_header, "Precomputing kernel translation tables and patching kernel ELF") ++ @cp $(KERNEL_ELF_RAW) $(KERNEL_ELF_TTABLES) ++ @$(DOCKER_TOOLS) $(EXEC_TT_TOOL) $(BSP) $(KERNEL_ELF_TTABLES) ++ ++##------------------------------------------------------------------------------ + ## Generate the stripped kernel binary + ##------------------------------------------------------------------------------ +-$(KERNEL_BIN): $(KERNEL_ELF) ++$(KERNEL_BIN): $(KERNEL_ELF_TTABLES) + $(call color_header, "Generating stripped binary") +- @$(OBJCOPY_CMD) $(KERNEL_ELF) $(KERNEL_BIN) ++ @$(OBJCOPY_CMD) $(KERNEL_ELF_TTABLES) $(KERNEL_BIN) + $(call color_progress_prefix, "Name") + @echo $(KERNEL_BIN) + $(call color_progress_prefix, "Size") +@@ -308,6 +324,7 @@ + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') + TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') + ++ $(DOCKER_TOOLS) $(EXEC_TT_TOOL) $(BSP) $$TEST_ELF > /dev/null + $(OBJCOPY_CMD) $$TEST_ELF $$TEST_BINARY + $(DOCKER_TEST) $(EXEC_TEST_DISPATCH) $(EXEC_QEMU) $(QEMU_TEST_ARGS) -kernel $$TEST_BINARY + endef + +diff -uNr 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/arch.rb 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/arch.rb +--- 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/arch.rb ++++ 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/arch.rb @@ -0,0 +1,312 @@ +# frozen_string_literal: true + @@ -2221,9 +2219,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/arch.rb 15_virt +end +end -diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/bsp.rb 15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb ---- 14_virtual_mem_part2_mmio_remap/translation_table_tool/bsp.rb -+++ 15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb +diff -uNr 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/bsp.rb 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb +--- 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/bsp.rb ++++ 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + @@ -2235,7 +2233,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/bsp.rb 15_virtu +class RaspberryPi + attr_reader :kernel_granule, :kernel_virt_addr_space_size + -+ MEMORY_SRC = File.read('src/bsp/raspberrypi/memory.rs').split("\n") ++ MEMORY_SRC = File.read('kernel/src/bsp/raspberrypi/memory.rs').split("\n") + + def initialize + @kernel_granule = Granule64KiB @@ -2275,9 +2273,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/bsp.rb 15_virtu + end +end -diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/generic.rb 15_virtual_mem_part3_precomputed_tables/translation_table_tool/generic.rb ---- 14_virtual_mem_part2_mmio_remap/translation_table_tool/generic.rb -+++ 15_virtual_mem_part3_precomputed_tables/translation_table_tool/generic.rb +diff -uNr 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/generic.rb 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/generic.rb +--- 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/generic.rb ++++ 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/generic.rb @@ -0,0 +1,179 @@ +# frozen_string_literal: true + @@ -2459,9 +2457,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/generic.rb 15_v + BSP.phys_kernel_tables_base_addr_offset_in_file) +end -diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/kernel_elf.rb 15_virtual_mem_part3_precomputed_tables/translation_table_tool/kernel_elf.rb ---- 14_virtual_mem_part2_mmio_remap/translation_table_tool/kernel_elf.rb -+++ 15_virtual_mem_part3_precomputed_tables/translation_table_tool/kernel_elf.rb +diff -uNr 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/kernel_elf.rb 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/kernel_elf.rb +--- 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/kernel_elf.rb ++++ 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/kernel_elf.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + @@ -2560,9 +2558,9 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/kernel_elf.rb 1 + end +end -diff -uNr 14_virtual_mem_part2_mmio_remap/translation_table_tool/main.rb 15_virtual_mem_part3_precomputed_tables/translation_table_tool/main.rb ---- 14_virtual_mem_part2_mmio_remap/translation_table_tool/main.rb -+++ 15_virtual_mem_part3_precomputed_tables/translation_table_tool/main.rb +diff -uNr 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/main.rb 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/main.rb +--- 14_virtual_mem_part2_mmio_remap/tools/translation_table_tool/main.rb ++++ 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/main.rb @@ -0,0 +1,46 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true diff --git a/15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml b/15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml new file mode 100644 index 00000000..0d675c93 --- /dev/null +++ b/15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml @@ -0,0 +1,58 @@ +[package] +name = "mingo" +version = "0.15.0" +authors = ["Andre Richter "] +edition = "2021" + + +[features] +default = [] +bsp_rpi3 = ["tock-registers"] +bsp_rpi4 = ["tock-registers"] +test_build = ["qemu-exit"] + +##-------------------------------------------------------------------------------------------------- +## Dependencies +##-------------------------------------------------------------------------------------------------- + +[dependencies] +test-types = { path = "../libraries/test-types" } + +# Optional dependencies +tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } +qemu-exit = { version = "3.x.x", optional = true } + +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] +cortex-a = { version = "7.x.x" } + +##-------------------------------------------------------------------------------------------------- +## Testing +##-------------------------------------------------------------------------------------------------- + +[dev-dependencies] +test-macros = { path = "../libraries/test-macros" } + +# Unit tests are done in the library part of the kernel. +[lib] +name = "libkernel" +test = true + +# Disable unit tests for the kernel binary. +[[bin]] +name = "kernel" +path = "src/main.rs" +test = false + +# List of tests without harness. +[[test]] +name = "00_console_sanity" +harness = false + +[[test]] +name = "02_exception_sync_page_fault" +harness = false + +[[test]] +name = "03_exception_restore_sanity" +harness = false diff --git a/15_virtual_mem_part3_precomputed_tables/build.rs b/15_virtual_mem_part3_precomputed_tables/kernel/build.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/build.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/build.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.s similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.s diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/smp.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/smp.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/smp.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/smp.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.s b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.s similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.s rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception.s diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception/asynchronous.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception/asynchronous.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception/asynchronous.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/exception/asynchronous.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/translation_table.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/translation_table.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/time.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/time.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/time.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/time.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm/gicv2.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm/gicv2.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2/gicc.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2/gicc.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2/gicd.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2/gicd.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/common.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/common.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/common.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/device_driver/common.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/console.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/console.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/cpu.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/cpu.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/cpu.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/cpu.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/driver.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/driver.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/driver.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/driver.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/exception.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/exception.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/exception.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/exception.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/exception/asynchronous.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/exception/asynchronous.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/exception/asynchronous.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/exception/asynchronous.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel.ld similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel.ld diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory/mmu.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory/mmu.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/common.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/common.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/common.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/common.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/console.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/console.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/console.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/console.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/cpu.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/cpu.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/cpu.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/cpu.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/cpu/boot.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/cpu/boot.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/cpu/boot.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/cpu/boot.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/cpu/smp.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/cpu/smp.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/cpu/smp.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/cpu/smp.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/driver.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/driver.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/driver.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/driver.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/exception.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/exception.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/exception.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/exception.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/exception/asynchronous.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/exception/asynchronous.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/exception/asynchronous.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/exception/asynchronous.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/lib.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/lib.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/main.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/main.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/main.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/memory.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/memory.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/memory.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory/mmu/alloc.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/alloc.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/alloc.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/alloc.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory/mmu/mapping_record.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/mapping_record.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/mapping_record.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/mapping_record.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_table.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/translation_table.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_table.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/translation_table.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory/mmu/types.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/types.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/types.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/types.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/panic_wait.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/panic_wait.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/panic_wait.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/panic_wait.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/print.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/print.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/print.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/print.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/state.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/state.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/state.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/state.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/synchronization.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/synchronization.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/synchronization.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/synchronization.rs diff --git a/15_virtual_mem_part3_precomputed_tables/src/time.rs b/15_virtual_mem_part3_precomputed_tables/kernel/src/time.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/src/time.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/src/time.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/00_console_sanity.rb b/15_virtual_mem_part3_precomputed_tables/kernel/tests/00_console_sanity.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/00_console_sanity.rb rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/00_console_sanity.rb diff --git a/15_virtual_mem_part3_precomputed_tables/tests/00_console_sanity.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/00_console_sanity.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/00_console_sanity.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/00_console_sanity.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/01_timer_sanity.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/01_timer_sanity.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/01_timer_sanity.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/01_timer_sanity.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_fault.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/02_exception_sync_page_fault.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_fault.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/02_exception_sync_page_fault.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/03_exception_restore_sanity.rb b/15_virtual_mem_part3_precomputed_tables/kernel/tests/03_exception_restore_sanity.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/03_exception_restore_sanity.rb rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/03_exception_restore_sanity.rb diff --git a/15_virtual_mem_part3_precomputed_tables/tests/03_exception_restore_sanity.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/03_exception_restore_sanity.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/03_exception_restore_sanity.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/03_exception_restore_sanity.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/04_exception_irq_sanity.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/04_exception_irq_sanity.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/04_exception_irq_sanity.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/04_exception_irq_sanity.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/boot_test_string.rb b/15_virtual_mem_part3_precomputed_tables/kernel/tests/boot_test_string.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/boot_test_string.rb rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/boot_test_string.rb diff --git a/15_virtual_mem_part3_precomputed_tables/tests/panic_exit_success/mod.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/panic_exit_success/mod.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/panic_exit_success/mod.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/panic_exit_success/mod.rs diff --git a/15_virtual_mem_part3_precomputed_tables/tests/panic_wait_forever/mod.rs b/15_virtual_mem_part3_precomputed_tables/kernel/tests/panic_wait_forever/mod.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/tests/panic_wait_forever/mod.rs rename to 15_virtual_mem_part3_precomputed_tables/kernel/tests/panic_wait_forever/mod.rs diff --git a/15_virtual_mem_part3_precomputed_tables/test-macros/Cargo.toml b/15_virtual_mem_part3_precomputed_tables/libraries/test-macros/Cargo.toml similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/test-macros/Cargo.toml rename to 15_virtual_mem_part3_precomputed_tables/libraries/test-macros/Cargo.toml diff --git a/15_virtual_mem_part3_precomputed_tables/test-macros/src/lib.rs b/15_virtual_mem_part3_precomputed_tables/libraries/test-macros/src/lib.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/test-macros/src/lib.rs rename to 15_virtual_mem_part3_precomputed_tables/libraries/test-macros/src/lib.rs diff --git a/15_virtual_mem_part3_precomputed_tables/test-types/Cargo.toml b/15_virtual_mem_part3_precomputed_tables/libraries/test-types/Cargo.toml similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/test-types/Cargo.toml rename to 15_virtual_mem_part3_precomputed_tables/libraries/test-types/Cargo.toml diff --git a/15_virtual_mem_part3_precomputed_tables/test-types/src/lib.rs b/15_virtual_mem_part3_precomputed_tables/libraries/test-types/src/lib.rs similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/test-types/src/lib.rs rename to 15_virtual_mem_part3_precomputed_tables/libraries/test-types/src/lib.rs diff --git a/15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb b/15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/arch.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb rename to 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/arch.rb diff --git a/15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb b/15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb similarity index 94% rename from 15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb rename to 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb index 4aaedaf7..0b76b403 100644 --- a/15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb +++ b/15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb @@ -8,7 +8,7 @@ class RaspberryPi attr_reader :kernel_granule, :kernel_virt_addr_space_size - MEMORY_SRC = File.read('src/bsp/raspberrypi/memory.rs').split("\n") + MEMORY_SRC = File.read('kernel/src/bsp/raspberrypi/memory.rs').split("\n") def initialize @kernel_granule = Granule64KiB diff --git a/15_virtual_mem_part3_precomputed_tables/translation_table_tool/generic.rb b/15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/generic.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/translation_table_tool/generic.rb rename to 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/generic.rb diff --git a/15_virtual_mem_part3_precomputed_tables/translation_table_tool/kernel_elf.rb b/15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/kernel_elf.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/translation_table_tool/kernel_elf.rb rename to 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/kernel_elf.rb diff --git a/15_virtual_mem_part3_precomputed_tables/translation_table_tool/main.rb b/15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/main.rb similarity index 100% rename from 15_virtual_mem_part3_precomputed_tables/translation_table_tool/main.rb rename to 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/main.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/Cargo.lock b/16_virtual_mem_part4_higher_half_kernel/Cargo.lock index af4081af..7a24ae09 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Cargo.lock +++ b/16_virtual_mem_part4_higher_half_kernel/Cargo.lock @@ -39,9 +39,9 @@ checksum = "9ff023245bfcc73fb890e1f8d5383825b3131cc920020a5c487d6f113dfc428a" [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] diff --git a/16_virtual_mem_part4_higher_half_kernel/Cargo.toml b/16_virtual_mem_part4_higher_half_kernel/Cargo.toml index 4964df47..6480a727 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Cargo.toml +++ b/16_virtual_mem_part4_higher_half_kernel/Cargo.toml @@ -1,60 +1,9 @@ -[package] -name = "mingo" -version = "0.16.0" -authors = ["Andre Richter "] -edition = "2021" +[workspace] + +members = [ + "libraries/*", + "kernel" +] [profile.release] lto = true - -[features] -default = [] -bsp_rpi3 = ["tock-registers"] -bsp_rpi4 = ["tock-registers"] -test_build = ["qemu-exit"] - -##-------------------------------------------------------------------------------------------------- -## Dependencies -##-------------------------------------------------------------------------------------------------- - -[dependencies] -test-types = { path = "test-types" } - -# Optional dependencies -tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "3.x.x", optional = true } - -# Platform specific dependencies -[target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "7.x.x" } - -##-------------------------------------------------------------------------------------------------- -## Testing -##-------------------------------------------------------------------------------------------------- - -[dev-dependencies] -test-macros = { path = "test-macros" } - -# Unit tests are done in the library part of the kernel. -[lib] -name = "libkernel" -test = true - -# Disable unit tests for the kernel binary. -[[bin]] -name = "kernel" -path = "src/main.rs" -test = false - -# List of tests without harness. -[[test]] -name = "00_console_sanity" -harness = false - -[[test]] -name = "02_exception_sync_page_fault" -harness = false - -[[test]] -name = "03_exception_restore_sanity" -harness = false diff --git a/16_virtual_mem_part4_higher_half_kernel/Makefile b/16_virtual_mem_part4_higher_half_kernel/Makefile index a695185d..81de6005 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Makefile +++ b/16_virtual_mem_part4_higher_half_kernel/Makefile @@ -41,7 +41,7 @@ ifeq ($(BSP),rpi3) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi3.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi3.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a53 else ifeq ($(BSP),rpi4) TARGET = aarch64-unknown-none-softfloat @@ -55,7 +55,7 @@ else ifeq ($(BSP),rpi4) READELF_BINARY = aarch64-none-elf-readelf OPENOCD_ARG = -f /openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /openocd/rpi4.cfg JTAG_BOOT_IMAGE = ../X1_JTAG_boot/jtag_boot_rpi4.img - LD_SCRIPT_PATH = $(shell pwd)/src/bsp/raspberrypi + LD_SCRIPT_PATH = $(shell pwd)/kernel/src/bsp/raspberrypi RUSTC_MISC_ARGS = -C target-cpu=cortex-a72 endif @@ -67,11 +67,11 @@ export LD_SCRIPT_PATH ##-------------------------------------------------------------------------------------------------- ## Targets and Prerequisites ##-------------------------------------------------------------------------------------------------- +KERNEL_MANIFEST = kernel/Cargo.toml KERNEL_LINKER_SCRIPT = kernel.ld +LAST_BUILD_CONFIG = target/$(BSP).build_config -TT_TOOL_PATH = translation_table_tool - -LAST_BUILD_CONFIG = target/$(BSP).build_config +TT_TOOL_PATH = tools/translation_table_tool KERNEL_ELF_RAW = target/$(TARGET)/release/kernel # This parses cargo's dep-info file. @@ -101,11 +101,11 @@ COMPILER_ARGS = --target=$(TARGET) \ $(FEATURES) \ --release -RUSTC_CMD = cargo rustc $(COMPILER_ARGS) +RUSTC_CMD = cargo rustc $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) DOC_CMD = cargo doc $(COMPILER_ARGS) CLIPPY_CMD = cargo clippy $(COMPILER_ARGS) CHECK_CMD = cargo check $(COMPILER_ARGS) -TEST_CMD = cargo test $(COMPILER_ARGS) +TEST_CMD = cargo test $(COMPILER_ARGS) --manifest-path $(KERNEL_MANIFEST) OBJCOPY_CMD = rust-objcopy \ --strip-all \ -O binary @@ -219,6 +219,8 @@ chainboot: $(KERNEL_BIN) ##------------------------------------------------------------------------------ clippy: @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) + @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) --features test_build --tests \ + --manifest-path $(KERNEL_MANIFEST) ##------------------------------------------------------------------------------ ## Clean @@ -315,6 +317,10 @@ test_boot: $(KERNEL_BIN) define KERNEL_TEST_RUNNER #!/usr/bin/env bash + # The cargo test runner seems to change into the crate under test's directory. Therefore, ensure + # this script executes from the root. + cd $(shell pwd) + TEST_ELF=$$(echo $$1 | sed -e 's/.*target/target/g') TEST_BINARY=$$(echo $$1.img | sed -e 's/.*target/target/g') diff --git a/16_virtual_mem_part4_higher_half_kernel/README.md b/16_virtual_mem_part4_higher_half_kernel/README.md index 0c45e3ec..89f650a3 100644 --- a/16_virtual_mem_part4_higher_half_kernel/README.md +++ b/16_virtual_mem_part4_higher_half_kernel/README.md @@ -78,8 +78,8 @@ type KernelTranslationTable = ### Linking Changes -In the `link.ld` linker script, we define a new symbol `__kernel_virt_start_addr` now, which is the -start address of the kernel's virtual address space, calculated as `(u64::MAX - +In the `kernel.ld` linker script, we define a new symbol `__kernel_virt_start_addr` now, which is +the start address of the kernel's virtual address space, calculated as `(u64::MAX - __kernel_virt_addr_space_size) + 1`. Before the first section definition, we set the linker script's location counter to this address: @@ -325,9 +325,9 @@ Minipush 1.0 ## Diff to previous ```diff -diff -uNr 15_virtual_mem_part3_precomputed_tables/Cargo.toml 16_virtual_mem_part4_higher_half_kernel/Cargo.toml ---- 15_virtual_mem_part3_precomputed_tables/Cargo.toml -+++ 16_virtual_mem_part4_higher_half_kernel/Cargo.toml +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml 16_virtual_mem_part4_higher_half_kernel/kernel/Cargo.toml +--- 15_virtual_mem_part3_precomputed_tables/kernel/Cargo.toml ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mingo" @@ -337,9 +337,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/Cargo.toml 16_virtual_mem_part edition = "2021" -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs ---- 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.rs @@ -30,7 +30,10 @@ /// - The `bss` section is not initialized yet. The code must not use or reference it in any way. /// - The HW state of EL1 must be prepared in a sound way. @@ -390,9 +390,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs asm::eret() } -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.s ---- 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s -+++ 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.s +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.s 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.s +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/cpu/boot.s ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.s @@ -18,6 +18,18 @@ add \register, \register, #:lo12:\symbol .endm @@ -441,9 +441,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.s 1 // Infinitely wait for events (aka "park the core"). -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/translation_table.rs 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu/translation_table.rs ---- 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/translation_table.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu/translation_table.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs @@ -136,7 +136,7 @@ /// aligned, so the lvl3 is put first. #[repr(C)] @@ -515,9 +515,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu/t #[cfg(test)] mod tests { -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu.rs 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu.rs ---- 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/_arch/aarch64/memory/mmu.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu.rs @@ -66,6 +66,7 @@ impl MemoryManagementUnit { @@ -568,9 +568,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/memory/mmu.r self.configure_translation_control(); -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/console.rs ---- 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/console.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/console.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/console.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/console.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/console.rs @@ -4,7 +4,6 @@ //! BSP console facilities. @@ -638,9 +638,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/console.rs panic_uart -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/kernel.ld ---- 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld -+++ 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/kernel.ld +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel.ld 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/kernel.ld +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/kernel.ld ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/kernel.ld @@ -8,6 +8,13 @@ PAGE_SIZE = 64K; PAGE_MASK = PAGE_SIZE - 1; @@ -719,9 +719,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/kernel.ld + ASSERT((. & PAGE_MASK) == 0, "End of boot core stack is not page aligned") } -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs ---- 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory/mmu.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory/mmu.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory/mmu.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory/mmu.rs @@ -20,7 +20,7 @@ //-------------------------------------------------------------------------------------------------- @@ -760,9 +760,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu + ); } -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory.rs ---- 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/bsp/raspberrypi/memory.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory.rs @@ -37,13 +37,7 @@ //! The virtual memory layout is as follows: //! @@ -796,9 +796,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs pub mod mmu; -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/lib.rs 16_virtual_mem_part4_higher_half_kernel/src/lib.rs ---- 15_virtual_mem_part3_precomputed_tables/src/lib.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/lib.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/lib.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs @@ -150,11 +150,6 @@ ) } @@ -812,9 +812,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/lib.rs 16_virtual_mem_part // Testing //-------------------------------------------------------------------------------------------------- -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_table.rs 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/translation_table.rs ---- 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_table.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/translation_table.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/translation_table.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/translation_table.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/translation_table.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/translation_table.rs @@ -99,9 +99,9 @@ assert!(tables.init().is_ok()); @@ -838,9 +838,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/translation_tab ); -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/types.rs 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/types.rs ---- 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/types.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/types.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/types.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/types.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu/types.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/types.rs @@ -67,6 +67,11 @@ // PageAddress //------------------------------------------------------------------------------ @@ -854,9 +854,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/memory/mmu/types.rs 16_vir pub fn into_inner(self) -> Address { self.inner -diff -uNr 15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu.rs ---- 15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs -+++ 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu.rs 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/src/memory/mmu.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu.rs @@ -66,6 +66,11 @@ pub trait AssociatedTranslationTable { /// A translation table whose address range is: @@ -870,9 +870,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/memory/mmu.rs 16_virtual_m type TableStartFromBottom; } -diff -uNr 15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_fault.rs 16_virtual_mem_part4_higher_half_kernel/tests/02_exception_sync_page_fault.rs ---- 15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_fault.rs -+++ 16_virtual_mem_part4_higher_half_kernel/tests/02_exception_sync_page_fault.rs +diff -uNr 15_virtual_mem_part3_precomputed_tables/kernel/tests/02_exception_sync_page_fault.rs 16_virtual_mem_part4_higher_half_kernel/kernel/tests/02_exception_sync_page_fault.rs +--- 15_virtual_mem_part3_precomputed_tables/kernel/tests/02_exception_sync_page_fault.rs ++++ 16_virtual_mem_part4_higher_half_kernel/kernel/tests/02_exception_sync_page_fault.rs @@ -28,8 +28,8 @@ // This line will be printed as the test header. println!("Testing synchronous exception handling by causing a page fault"); @@ -885,9 +885,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/tests/02_exception_sync_page_f // If execution reaches here, the memory access above did not cause a page fault exception. -diff -uNr 15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/arch.rb ---- 15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb -+++ 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/arch.rb +diff -uNr 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/arch.rb 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/arch.rb +--- 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/arch.rb ++++ 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/arch.rb @@ -255,6 +255,8 @@ end @@ -898,9 +898,9 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/translation_table_tool/arch.rb lvl3_index = (addr & Granule512MiB::MASK) >> Granule64KiB::SHIFT -diff -uNr 15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/bsp.rb ---- 15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb -+++ 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/bsp.rb +diff -uNr 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/bsp.rb +--- 15_virtual_mem_part3_precomputed_tables/tools/translation_table_tool/bsp.rb ++++ 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/bsp.rb @@ -6,7 +6,7 @@ # Raspberry Pi 3 + 4 @@ -908,7 +908,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/translation_table_tool/bsp.rb - attr_reader :kernel_granule, :kernel_virt_addr_space_size + attr_reader :kernel_granule, :kernel_virt_addr_space_size, :kernel_virt_start_addr - MEMORY_SRC = File.read('src/bsp/raspberrypi/memory.rs').split("\n") + MEMORY_SRC = File.read('kernel/src/bsp/raspberrypi/memory.rs').split("\n") @@ -14,6 +14,7 @@ @kernel_granule = Granule64KiB diff --git a/16_virtual_mem_part4_higher_half_kernel/kernel/Cargo.toml b/16_virtual_mem_part4_higher_half_kernel/kernel/Cargo.toml new file mode 100644 index 00000000..d58c2f09 --- /dev/null +++ b/16_virtual_mem_part4_higher_half_kernel/kernel/Cargo.toml @@ -0,0 +1,58 @@ +[package] +name = "mingo" +version = "0.16.0" +authors = ["Andre Richter "] +edition = "2021" + + +[features] +default = [] +bsp_rpi3 = ["tock-registers"] +bsp_rpi4 = ["tock-registers"] +test_build = ["qemu-exit"] + +##-------------------------------------------------------------------------------------------------- +## Dependencies +##-------------------------------------------------------------------------------------------------- + +[dependencies] +test-types = { path = "../libraries/test-types" } + +# Optional dependencies +tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } +qemu-exit = { version = "3.x.x", optional = true } + +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] +cortex-a = { version = "7.x.x" } + +##-------------------------------------------------------------------------------------------------- +## Testing +##-------------------------------------------------------------------------------------------------- + +[dev-dependencies] +test-macros = { path = "../libraries/test-macros" } + +# Unit tests are done in the library part of the kernel. +[lib] +name = "libkernel" +test = true + +# Disable unit tests for the kernel binary. +[[bin]] +name = "kernel" +path = "src/main.rs" +test = false + +# List of tests without harness. +[[test]] +name = "00_console_sanity" +harness = false + +[[test]] +name = "02_exception_sync_page_fault" +harness = false + +[[test]] +name = "03_exception_restore_sanity" +harness = false diff --git a/16_virtual_mem_part4_higher_half_kernel/build.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/build.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/build.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/build.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.s b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.s similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.s rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/boot.s diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/smp.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/smp.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/smp.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/cpu/smp.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.s b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.s similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.s rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception.s diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception/asynchronous.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception/asynchronous.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception/asynchronous.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/exception/asynchronous.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu/translation_table.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/memory/mmu/translation_table.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/memory/mmu/translation_table.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/time.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/time.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/time.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/_arch/aarch64/time.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm/gicv2.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm/gicv2.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2/gicc.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2/gicc.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm/gicv2/gicc.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2/gicd.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2/gicd.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/arm/gicv2/gicd.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_interrupt_controller/peripheral_ic.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/common.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/common.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/common.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/device_driver/common.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/console.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/console.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/console.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/console.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/cpu.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/cpu.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/cpu.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/cpu.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/driver.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/driver.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/driver.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/driver.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/exception.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/exception.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/exception.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/exception.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/exception/asynchronous.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/exception/asynchronous.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/exception/asynchronous.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/exception/asynchronous.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/kernel.ld b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/kernel.ld similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/kernel.ld rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/kernel.ld diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/kernel_virt_addr_space_size.ld diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory/mmu.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/bsp/raspberrypi/memory/mmu.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/common.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/common.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/common.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/common.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/console.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/console.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/console.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/console.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/cpu.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/cpu.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/cpu.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/cpu.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/cpu/boot.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/cpu/boot.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/cpu/boot.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/cpu/boot.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/cpu/smp.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/cpu/smp.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/cpu/smp.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/cpu/smp.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/driver.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/driver.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/driver.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/driver.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/exception.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/exception.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/exception.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/exception.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/exception/asynchronous.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/exception/asynchronous.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/exception/asynchronous.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/exception/asynchronous.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/lib.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/lib.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/lib.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/main.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/main.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/main.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/main.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/memory.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/memory.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory/mmu.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/alloc.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/alloc.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/alloc.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/alloc.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/mapping_record.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/mapping_record.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/mapping_record.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/mapping_record.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/translation_table.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/translation_table.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/translation_table.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/translation_table.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/types.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/types.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/memory/mmu/types.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/memory/mmu/types.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/panic_wait.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/panic_wait.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/panic_wait.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/panic_wait.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/print.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/print.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/print.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/print.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/state.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/state.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/state.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/state.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/synchronization.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/synchronization.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/synchronization.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/synchronization.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/src/time.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/src/time.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/src/time.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/src/time.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/00_console_sanity.rb b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/00_console_sanity.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/00_console_sanity.rb rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/00_console_sanity.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/00_console_sanity.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/00_console_sanity.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/00_console_sanity.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/00_console_sanity.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/01_timer_sanity.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/01_timer_sanity.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/01_timer_sanity.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/01_timer_sanity.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/02_exception_sync_page_fault.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/02_exception_sync_page_fault.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/02_exception_sync_page_fault.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/02_exception_sync_page_fault.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/03_exception_restore_sanity.rb b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/03_exception_restore_sanity.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/03_exception_restore_sanity.rb rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/03_exception_restore_sanity.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/03_exception_restore_sanity.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/03_exception_restore_sanity.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/03_exception_restore_sanity.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/03_exception_restore_sanity.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/04_exception_irq_sanity.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/04_exception_irq_sanity.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/04_exception_irq_sanity.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/04_exception_irq_sanity.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/boot_test_string.rb b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/boot_test_string.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/boot_test_string.rb rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/boot_test_string.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/panic_exit_success/mod.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/panic_exit_success/mod.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/panic_exit_success/mod.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/panic_exit_success/mod.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/tests/panic_wait_forever/mod.rs b/16_virtual_mem_part4_higher_half_kernel/kernel/tests/panic_wait_forever/mod.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/tests/panic_wait_forever/mod.rs rename to 16_virtual_mem_part4_higher_half_kernel/kernel/tests/panic_wait_forever/mod.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/test-macros/Cargo.toml b/16_virtual_mem_part4_higher_half_kernel/libraries/test-macros/Cargo.toml similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/test-macros/Cargo.toml rename to 16_virtual_mem_part4_higher_half_kernel/libraries/test-macros/Cargo.toml diff --git a/16_virtual_mem_part4_higher_half_kernel/test-macros/src/lib.rs b/16_virtual_mem_part4_higher_half_kernel/libraries/test-macros/src/lib.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/test-macros/src/lib.rs rename to 16_virtual_mem_part4_higher_half_kernel/libraries/test-macros/src/lib.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/test-types/Cargo.toml b/16_virtual_mem_part4_higher_half_kernel/libraries/test-types/Cargo.toml similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/test-types/Cargo.toml rename to 16_virtual_mem_part4_higher_half_kernel/libraries/test-types/Cargo.toml diff --git a/16_virtual_mem_part4_higher_half_kernel/test-types/src/lib.rs b/16_virtual_mem_part4_higher_half_kernel/libraries/test-types/src/lib.rs similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/test-types/src/lib.rs rename to 16_virtual_mem_part4_higher_half_kernel/libraries/test-types/src/lib.rs diff --git a/16_virtual_mem_part4_higher_half_kernel/translation_table_tool/arch.rb b/16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/arch.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/arch.rb rename to 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/arch.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/translation_table_tool/bsp.rb b/16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/bsp.rb similarity index 94% rename from 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/bsp.rb rename to 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/bsp.rb index ddf69a17..536a2f21 100644 --- a/16_virtual_mem_part4_higher_half_kernel/translation_table_tool/bsp.rb +++ b/16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/bsp.rb @@ -8,7 +8,7 @@ class RaspberryPi attr_reader :kernel_granule, :kernel_virt_addr_space_size, :kernel_virt_start_addr - MEMORY_SRC = File.read('src/bsp/raspberrypi/memory.rs').split("\n") + MEMORY_SRC = File.read('kernel/src/bsp/raspberrypi/memory.rs').split("\n") def initialize @kernel_granule = Granule64KiB diff --git a/16_virtual_mem_part4_higher_half_kernel/translation_table_tool/generic.rb b/16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/generic.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/generic.rb rename to 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/generic.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/translation_table_tool/kernel_elf.rb b/16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/kernel_elf.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/kernel_elf.rb rename to 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/kernel_elf.rb diff --git a/16_virtual_mem_part4_higher_half_kernel/translation_table_tool/main.rb b/16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/main.rb similarity index 100% rename from 16_virtual_mem_part4_higher_half_kernel/translation_table_tool/main.rb rename to 16_virtual_mem_part4_higher_half_kernel/tools/translation_table_tool/main.rb diff --git a/common/tests/dispatch.rb b/common/tests/dispatch.rb index 86aaea86..b6223418 100755 --- a/common/tests/dispatch.rb +++ b/common/tests/dispatch.rb @@ -16,16 +16,19 @@ qemu_cmd = ARGV.join(' ') binary = ARGV.last test_name = binary.gsub(%r{.*deps/}, '').split('-')[0] +# Check if virtual manifest (tutorial 12 or later) or not +path_prefix = File.exist?('kernel/Cargo.toml') ? 'kernel/' : '' + case test_name when 'kernel8.img' - load 'tests/boot_test_string.rb' # provides 'EXPECTED_PRINT' + load "#{path_prefix}tests/boot_test_string.rb" # provides 'EXPECTED_PRINT' BootTest.new(qemu_cmd, EXPECTED_PRINT).run # Doesn't return when 'libkernel' ExitCodeTest.new(qemu_cmd, 'Kernel library unit tests').run # Doesn't return else - console_test_file = "tests/#{test_name}.rb" + console_test_file = "#{path_prefix}tests/#{test_name}.rb" test_name.concat('.rs') test = if File.exist?(console_test_file) load console_test_file # provides 'subtest_collection' diff --git a/utils/devtool.rb b/utils/devtool.rb index a926cd2c..9473ff8d 100755 --- a/utils/devtool.rb +++ b/utils/devtool.rb @@ -301,7 +301,15 @@ class DevTool # Only diff adjacent tutorials. This checks the numbers of the tutorial folders. return unless original[0..1].to_i + 1 == update[0..1].to_i - puts 'Diffing '.light_blue + original.ljust(padding) + " -> #{update}" + # Skip for tutorial 11. Due to the change to virtual manifest, the diff is rather + # unreadable. + if original[0..1].to_i == 11 + puts 'Skipping '.light_yellow + + "#{original}: Too noisy due to change to virtual manifest" + return + end + + puts 'Diffing '.light_blue + original.ljust(padding) + " -> #{update}" system("bash utils/diff_tut_folders.bash #{original} #{update}") end diff --git a/utils/diff_tut_folders.bash b/utils/diff_tut_folders.bash index f4e6d107..d93ca57d 100755 --- a/utils/diff_tut_folders.bash +++ b/utils/diff_tut_folders.bash @@ -9,7 +9,6 @@ DIFF=$( -x README.md \ -x README.CN.md \ -x README.ES.md \ - -x kernel \ -x kernel8.img \ -x Cargo.lock \ -x target \ @@ -17,7 +16,7 @@ DIFF=$( | sed -r "s/[12][90][127][0-9]-[0-9][0-9]-[0-9][0-9] .*//g" \ | sed -r "s/[[:space:]]*$//g" \ | sed -r "s/%/modulo/g" \ - | sed -r "s/diff -uNr -x README.md -x README.CN.md -x README.ES.md -x kernel -x kernel8.img -x Cargo.lock -x target/\ndiff -uNr/g" + | sed -r "s/diff -uNr -x README.md -x README.CN.md -x README.ES.md -x kernel8.img -x Cargo.lock -x target/\ndiff -uNr/g" ) HEADER="## Diff to previous"