From 0351e963a136b88d0715a5edd5012d6607e51f44 Mon Sep 17 00:00:00 2001 From: bzt Date: Mon, 18 Jan 2021 03:32:17 +0100 Subject: [PATCH] Initial Risc-V64 support --- images/Makefile | 10 +++++++- mykernel/mykernel.riscv64.elf | Bin 0 -> 4608 bytes mykernel/mykernel.riscv64.txt | 43 ++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100755 mykernel/mykernel.riscv64.elf create mode 100644 mykernel/mykernel.riscv64.txt diff --git a/images/Makefile b/images/Makefile index dd24e4c..75cf211 100644 --- a/images/Makefile +++ b/images/Makefile @@ -1,6 +1,7 @@ -# platform, either x86 or rpi +# platform, either x86, rpi or icicle PLATFORM=x86 #PLATFORM=rpi +#PLATFORM=icicle # the path to OVMF.fd (for testing with EFI) OVMF=/usr/share/qemu/bios-TianoCoreEFI.bin @@ -16,7 +17,11 @@ initdir: ifeq ($(PLATFORM),x86) cp ../mykernel/c/mykernel.x86_64.elf initrd/sys/core else +ifeq ($(PLATFORM),rpi) cp ../mykernel/c/mykernel.aarch64.elf initrd/sys/core +else + cp ../mykernel/c/mykernel.riscv64.elf initrd/sys/core +endif endif # create hybrid disk / cdrom image or ROM image @@ -68,6 +73,9 @@ linux: sdcard: qemu-system-aarch64 -M raspi3 -kernel ../dist/bootboot.img -drive file=disk-rpi.img,if=sd,format=raw -serial stdio +riscv: + qemu-system-riscv64 -M microchip-icicle-kit -kernel ../dist/bootboot.rv64 -drive file=disk-icicle.img,if=sd,format=raw -serial stdio + coreboot: ifeq ($(PLATFORM),x86) qemu-system-x86_64 -bios coreboot-x86.rom -drive file=disk-x86.img,format=raw -serial stdio diff --git a/mykernel/mykernel.riscv64.elf b/mykernel/mykernel.riscv64.elf new file mode 100755 index 0000000000000000000000000000000000000000..fb56b6222aa46558e790df7411a269cecb8d4a6f GIT binary patch literal 4608 zcmbtYZ)_Y#6`#Ge_flzbFX{&`#IlZD$QD7(DT(40TBT`J>IwlB5~v6Xakk@gE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 zE##fN8-nwGA6(^f;Pk$b*HWCC{=AQUAIb?t_V0hWsBpZ>s*f26m}o-gxfZm3|}mS$?0zMyt1`a3bPGO z(6r!s&;T-j9pK3UIGt|DYu-{DPAMWFUYe9zvJrs3J3d67VT4hp*5{={WXoX z!EpeBynr&`MFS9CfI&m%gRzf%Nbpjy?-evJ?`s|(79rS=kh{$mknzbQy^>7_{lWF2 z1EhW|nXF?;j(31W5Z_)XAKZKM1;UtU0IENzz};ho>x9waC7{bAbqDWLI!|q|)lp0k z?@qjd148#GLyR#hg2}FkF?jM5F3kmOoYloUSbX=L{+t;3ix(ae`rHwijSY?WXPJVp znbxuF@nb_rMw8zk#z!wc()c)ykA8Sa&Amqzzar&#V+f|Q2>Z!1B90K7sqpXmL-{T2 zorm)At92*gH*O65#&+7r&(s+E7w(txA@pJr&vxQJ9pJY_{sf*4oXrl6jhr1GIGbVV zKGruflEEJ~JUleQSl9Tu;Y@EIjF~Ypo{_W6KrX|&1_6qXu2BajedFV-i)X#7Hic14V4NKNe*^yFg1OM78LESP0Zq|&yA;dsce(y7Oi*7XMzdbjp>g8NLF&u#FbKl> zvaWH`$GnG0>dEm-AjG-!FYBKqeTkDc&{vp_!2)#YyaW=de>7n6*=~JY(=UrVkY~t$ tjkx$X63nrTN8Y?o08hqFP(FNz{@&6VX2N{8|NX#wn0}V@UwDlE{{YPQ4o3h0 literal 0 HcmV?d00001 diff --git a/mykernel/mykernel.riscv64.txt b/mykernel/mykernel.riscv64.txt new file mode 100644 index 0000000..01aee26 --- /dev/null +++ b/mykernel/mykernel.riscv64.txt @@ -0,0 +1,43 @@ +ELF Header: + Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 + Class: ELF64 + Data: 2's complement, little endian + Version: 1 (current) + OS/ABI: UNIX - System V + ABI Version: 0 + Type: EXEC (Executable file) + Machine: RISC-V + Version: 0x1 + Entry point address: 0xffffffffffe02000 + Start of program headers: 64 (bytes into file) + Start of section headers: 4032 (bytes into file) + Flags: 0x5, RVC, double-float ABI + Size of this header: 64 (bytes) + Size of program headers: 56 (bytes) + Number of program headers: 1 + Size of section headers: 64 (bytes) + Number of section headers: 9 + Section header string table index: 8 + +Program Headers: + Type Offset VirtAddr PhysAddr + FileSiz MemSiz Flags Align + LOAD 0x0000000000000078 0xffffffffffe02000 0xffffffffffe02000 + 0x0000000000000db8 0x0000000000000dc0 RWE 0x8 + + Section to Segment mapping: + Segment Sections... + 00 .text .got .got.plt .bss + +Symbol table '.symtab' contains 10 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: ffffffffffe02000 0 SECTION LOCAL DEFAULT 1 + 2: ffffffffffe02d88 0 SECTION LOCAL DEFAULT 2 + 3: ffffffffffe02da8 0 SECTION LOCAL DEFAULT 3 + 4: ffffffffffe02db8 0 SECTION LOCAL DEFAULT 4 + 5: 0000000000000000 0 SECTION LOCAL DEFAULT 5 + 6: ffffffffffe01000 0 NOTYPE GLOBAL DEFAULT 1 environment + 7: fffffffffc000000 0 NOTYPE GLOBAL DEFAULT ABS fb + 8: ffffffffffe00000 0 NOTYPE GLOBAL DEFAULT 1 bootboot + 9: fffffffff8000000 0 NOTYPE GLOBAL DEFAULT ABS mmio