Compare commits

..

430 Commits

Author SHA1 Message Date
iProgramInCpp
e63d804f6f limine: Fix two other small typos in PROTOCOL.md 2023-10-29 04:37:09 +01:00
mintsuki
cad3c72fce config: Fix bug where macro definitions were not skipped over properly when parsing 2023-10-29 04:27:04 +01:00
ミンツキ
7cd46f3d26
Merge pull request #314 from iProgramMC/fix-typo-in-protocol-1
limine: Fix a small typo error in PROTOCOL.md
2023-10-28 20:03:13 +02:00
iProgramInCpp
f4051f49db
limine: Fix a small typo error in PROTOCOL.md
This corrects an error which mistakenly says "the an Entry Point request (...)", in the section where the machine state at entry into the kernel is described.
2023-10-28 17:48:30 +03:00
mintsuki
a5051f92bf build: Changes to comply more with the GNU build system - adds ChangeLog 2023-10-28 05:16:45 +02:00
mintsuki
ec564407da docs: Update example Limine version in README to 5.20231024.0 2023-10-24 18:50:28 +02:00
mintsuki
a0127f9f40 pmm: Add MEMMAP_MAX macro and use it instead of hardcoding 256 2023-10-24 18:38:18 +02:00
mintsuki
e49865a467 lib/time: EFI: Return time of 0 if GetTime() unsupported 2023-10-24 18:38:18 +02:00
48cf
2bba72634f lib/gterm: Try to initialize all 32-bpp framebuffers 2023-10-24 18:38:18 +02:00
48cf
45b39285f1 pmm: Ignore allow_high_allocs on non x86-64 architectures 2023-10-24 18:38:18 +02:00
mintsuki
a795dc1972 build: Backport misc autoconf/pkgconf improvements 2023-10-24 01:21:24 +02:00
mintsuki
c1860c8d80 limine/ioapic: Change spec to avoid masking IOAPIC RTEs unless Fixed or Lowest Priority 2023-10-24 01:21:24 +02:00
mintsuki
49cfba851c build: Misc minor QOL configure.ac/GNUmakefile.in improvements 2023-10-24 01:21:24 +02:00
mintsuki
b348bb75e7 docs: Update example Limine version in README to 5.20231006.0 2023-10-06 12:25:44 -05:00
mintsuki
c1f5b21177 misc: Remove unnecessary ifdefs added in previous commits 2023-10-06 12:25:44 -05:00
mintsuki
b474b6bad0 misc: Only allocate memory and modules above 4GiB on 64-bit platforms 2023-10-06 12:25:44 -05:00
mintsuki
5323bce117 pmm: Allow allocations above 4GiB and use them in freadall() 2023-10-06 12:25:44 -05:00
mintsuki
1bcbf817ed docs: Update example Limine version in README to 5.20230928.2 2023-09-28 17:49:31 -05:00
mintsuki
f81b9d2dc3 build: Fix makefile target dependencies bug introduced in a0c2f95 2023-09-28 17:49:31 -05:00
mintsuki
d0a1285feb docs: Update example Limine version in README to 5.20230928.1 2023-09-28 16:26:32 -05:00
mintsuki
a0c2f95a1d build: Fix bug introduced in 7885f260 due to a misunderstanding of an objcopy flag 2023-09-28 16:03:13 -05:00
mintsuki
d421ebcb58 docs: Update example Limine version in README to 5.20230928.0 2023-09-28 06:56:28 -05:00
mintsuki
7117b85c86 build: Fix indentation issue in common/GNUmakefile 2023-09-28 06:56:28 -05:00
mintsuki
3a81c3e13d build: ldscripts: .reloc -> .dummy_reloc 2023-09-28 06:56:28 -05:00
mintsuki
a0997a598b build: Fix race conditions introduced in 22d45a54283d7f58f3ed7452278005baf6323f53 2023-09-28 06:56:28 -05:00
mintsuki
212dbd32c1 misc: Add .note.GNU-stack where it was still missing 2023-09-28 06:56:28 -05:00
mintsuki
a55f68b3bd smp: riscv64: Replace .insn directive with .4byte 2023-09-28 06:56:28 -05:00
mintsuki
a83dafe6f4 misc: Add section .note.GNU-stack to assembly files 2023-09-28 06:56:28 -05:00
mintsuki
afdc556301 time: Change signature of get_jdn() to use int types 2023-09-28 06:56:28 -05:00
mintsuki
bfc518cc07 docs: Update example Limine version in README to 5.20230924.0 2023-09-24 02:03:59 -05:00
mintsuki
81c39fc080 elf: Panic if there are PHDRs with different perms sharing same page 2023-09-24 01:56:50 -05:00
mintsuki
87a88bf565 smp: Remove dead 32-bit trampoline code 2023-09-23 17:37:38 -05:00
mintsuki
3fde8f0158 docs: PROTOCOL.md: Fix up layout of mappings table 2023-09-22 16:54:15 -05:00
mintsuki
50f4383f93 limine: Make explicit some implied padding in some structures 2023-09-22 16:40:07 -05:00
mintsuki
c7df84e237 test: riscv64: Fix issue with OVMF not working on latest QEMU 2023-09-22 16:39:59 -05:00
mintsuki
f1236373fe menu: Fix padding issue introduced in e1d25f8 2023-09-22 16:39:51 -05:00
mintsuki
a36de776a7 docs: Update example Limine version in README to 5.20230917.0 2023-09-16 17:14:13 -05:00
mintsuki
a0fb5a04d3 docs: PROTOCOL.md: Backport caching section from trunk 2023-09-16 16:31:16 -05:00
mintsuki
042a6e9554 misc: Backports from trunk 2023-09-16 15:12:14 -05:00
mintsuki
c5c43cb0fd misc: aarch64: Remove unused enter_in_current_el() function 2023-09-16 14:28:33 -05:00
mintsuki
5f7bcc0b1d riscv: Fix cherry-picking issue introduced in e3d65aa628edec447877d6e22debd225ac670fba 2023-09-16 11:35:43 -05:00
mintsuki
45958f7162 misc: Consistently call x86-64 such, instead of x86_64 2023-09-16 11:31:35 -05:00
mintsuki
e9b5511084 docs: PROTOCOL.md: Minor fixes 2023-09-16 11:31:19 -05:00
xvanc
f4bfe1289a riscv: skip rv{32,64} prefix when parsing extensions from isa strings 2023-09-16 11:28:15 -05:00
xvanc
cdac49ebfb acpi: remove duplicate definition in sys/lapic.c 2023-09-16 11:28:15 -05:00
xvanc
90b82dc43f riscv/vmm: use Svpbmt extension when available 2023-09-16 11:28:15 -05:00
xvanc
e3d65aa628 riscv: refactor smp init 2023-09-16 11:28:15 -05:00
xvanc
f33732a2e5 riscv: implement feature dectection 2023-09-16 11:21:17 -05:00
xvanc
09c430f286 lib/libc: add misc utilities 2023-09-16 11:21:17 -05:00
xvanc
2200161e7d acpi: move acpi structure defs to lib/acpi.h 2023-09-16 11:21:17 -05:00
mintsuki
f8bfe41e71 test: Use -dumpmachine to find architecture instead of expecting -target 2023-09-11 17:16:19 -05:00
mintsuki
0f7ee05635 misc/bios: Update and improve linker script and related files 2023-09-11 17:16:19 -05:00
mintsuki
b54c3fc9cc protos/chainload: Fix bug that could result in bogus oom errors. Fixes #302 2023-09-11 17:16:19 -05:00
mintsuki
756dd235ea decompressor: Mark .entry section with proper flags in entry.asm 2023-09-11 17:16:19 -05:00
mintsuki
09c87feaee decompressor: Add rodata PHDR and section to ld script 2023-09-11 17:16:19 -05:00
Kacper Słomiński
916aa370b2 protos: chainload: Allocate memory for the null terminator in cmdline 2023-09-11 17:16:19 -05:00
mintsuki
0ebf0245df misc: Misc EFI linker script improvements and drop .sbat 2023-09-11 17:16:19 -05:00
mintsuki
8f789fc0ae docs: Update example Limine version in README to 5.20230909.0 2023-09-09 16:08:08 -05:00
mintsuki
b5cffbb6e8 misc: Improve UEFI linker scripts 2023-09-09 15:57:38 -05:00
mintsuki
9ff62c2a62 docs: README.md: Fix minor grammar mistake 2023-09-09 10:08:44 -05:00
mintsuki
68f82c3d30 stage1/gdt: Mark accessed flag in descriptors 2023-09-09 10:08:44 -05:00
mintsuki
2642249edd docs: Remove references to shim as we don't directly support it 2023-09-09 10:08:44 -05:00
mintsuki
e6a67c80a6 x86/gdt: Mark accessed flag in descriptors 2023-09-09 10:08:44 -05:00
mintsuki
541dbd265c docs: Update example Limine version in README to 5.20230830.0 2023-08-29 22:34:47 -05:00
mintsuki
e207c03f69 build: Drop -mabi=sysv for x86 for clang 16 2023-08-29 22:34:27 -05:00
mintsuki
57e4ae6e25 config: Disable editor by default if config b2sum present. Fixes #296 2023-08-29 22:34:20 -05:00
mintsuki
a30cad3556 menu: Change menu arrow to use unicode big arrow 2023-08-29 22:34:15 -05:00
mintsuki
ac0d9465f5 gterm: Update font's big left and right arrows 2023-08-29 22:34:11 -05:00
mintsuki
f0b899b5bc docs: Update example Limine version in README to 5.20230819.0 2023-08-19 08:43:54 -05:00
mintsuki
4abedffb43 disk: BIOS: Skip drive if sector size is 0. Fixes #294 2023-08-19 08:20:45 -05:00
Kacper Słomiński
50dab6c2f1 smp: aarch64: Don't needlessly invalidate the data cache
Also get rid of the function to do clean + invalidate as not to be
tempted by it.
2023-08-18 13:38:14 -05:00
Kacper Słomiński
ba5d63b82a elf: aarch64: Don't needlessly invalidate the data cache
Cleaning the data cache to PoC without invalidating it is enough when
invalidating the instruction cache to PoU.
2023-08-18 13:37:55 -05:00
mintsuki
573d0095bf elf: elf64_load_section(): Return false early if sh_num == 0 2023-08-18 13:37:39 -05:00
mintsuki
27a32e416c disk: Add additional volume_index_i overflow guards 2023-08-18 13:37:16 -05:00
mintsuki
9a074530a9 exceptions: Change naming of exceptions in panic message 2023-08-18 13:36:58 -05:00
mintsuki
a248b557bb docs: Update example Limine version in README to 5.20230811.0 2023-08-11 10:31:14 -05:00
mintsuki
d66df6b38a limine: Do not return SMBIOS response if not present 2023-08-10 19:26:54 -05:00
mintsuki
1e9a42e7ce test: General makefile updates 2023-08-08 14:09:31 -05:00
mintsuki
b8fff872de test: Use Flanterm 2023-08-08 14:09:19 -05:00
mekb
820d4751d3 menu: Add option to hide help text 2023-08-08 14:09:11 -05:00
xvanc
82ea6d6a57 test/riscv: disable linker relaxation, specify ISA string and ABI
Although linker relaxation is disabled, the compiler still emits small
data sections which must be explicitly included in the linker script.
2023-08-04 07:22:12 -05:00
xvanc
030242d69a vmm/riscv: fix bug in vmm_max_paging_mode() 2023-08-03 20:12:51 -05:00
mintsuki
b64335f62a docs: Update example Limine version in README to 5.20230801.0 2023-08-01 05:32:12 -05:00
mintsuki
50b8ab2c26 rv64: Misc relaxation related fixes 2023-08-01 05:32:05 -05:00
mintsuki
2d0752f60c docs: Update example Limine version in README to 5.20230729.0 2023-07-29 12:00:19 -05:00
mintsuki
ff86be6be6 misc: Update test wallpaper and screenshot 2023-07-29 11:55:37 -05:00
mintsuki
2f1dac0600 gterm: Change resolutions at which autoscaling is triggered 2023-07-29 11:55:37 -05:00
mintsuki
0ecb2ab895 menu: Center menu vertically 2023-07-29 11:55:37 -05:00
mintsuki
474fc105a5 gop: Readd preset mode storage 2023-07-29 11:55:37 -05:00
mintsuki
418f8d7280 menu: Do not draw box around boot menu 2023-07-29 02:17:12 -05:00
mintsuki
722bde2cbc menu: Adjust centering by 2 characters to the left 2023-07-28 04:26:48 -05:00
mintsuki
5bdb1bbf55 menu: Fix a couple of boot menu alignment issues 2023-07-28 04:26:48 -05:00
mintsuki
8f167bc2e5 menu: Initialise max_len if null regardless of shift 2023-07-28 04:26:48 -05:00
mintsuki
d73cd37834 menu: Fix maybe uninitialised issue with cur_len var 2023-07-28 04:26:48 -05:00
mintsuki
478b6f3806 menu: Fix NULL deref bug with shift variable 2023-07-28 04:26:48 -05:00
mintsuki
4b452e69a4 console: Add slide command 2023-07-28 04:26:48 -05:00
mintsuki
98f30bfdd6 menu: Center boot menu 2023-07-28 04:26:48 -05:00
mintsuki
ba2597605b Revert "build: Make limine-uefi-cd.bin 16MiB in size (use FAT16)"
This reverts commit 2da0a08072545410c3ecab9be3e2bb5601a3c824.
2023-07-28 04:26:48 -05:00
mintsuki
9921af54d0 gterm: Autoscale font on higher resolutions 2023-07-28 04:26:48 -05:00
Kacper Słomiński
a2e502328d limine: Adjust higher half offsets for AArch64 2023-07-26 17:05:43 -05:00
Kacper Słomiński
dc68fcaff7 limine: Use a higher-half pointer for the stack on AArch64 2023-07-26 17:05:33 -05:00
mintsuki
f365a46617 misc: Minor updates to linker scripts 2023-07-26 17:05:20 -05:00
mintsuki
871a8053c2 build: Get rid of OBJCOPY2ELF_FLAGS since only IA-32/BIOS used it 2023-07-26 17:05:06 -05:00
mintsuki
49ecb6b577 build: Get rid of RISCV_CFLAGS variable as it is now unnecessary 2023-07-26 17:04:54 -05:00
mintsuki
997e2c756a ci: Remove openssh dependency no longer required for release 2023-07-26 17:04:46 -05:00
mintsuki
bc1896c5bb riscv64: Do not use global pointer register 2023-07-26 17:04:30 -05:00
mintsuki
e261a96fa4 docs/protocol: Fix typo and mandate ra and gp registers to be 0 for rv64 2023-07-26 17:04:21 -05:00
mintsuki
1f82dd89c7 host/limine: Fix typo 2023-07-26 17:03:52 -05:00
mintsuki
93942a3334 docs: Update example Limine version in README to 5.20230709.0 2023-07-09 03:55:27 +02:00
mintsuki
b72d033510 elf: elf64_load(): Remove accidentally left in debug code 2023-07-09 03:40:06 +02:00
mintsuki
11f50a6aaa part: Require keypresses between entry displays in list_volumes() 2023-07-09 03:37:55 +02:00
mintsuki
79e50a82af misc: Use assembly for memory functions on x86 2023-07-09 03:09:45 +02:00
mintsuki
17e26c8c95 elf: Fix potential uninitialised usage of bss_size 2023-07-09 03:09:45 +02:00
mintsuki
9333f1ca8b limine/elf: Optimise not to scan .bss for requests 2023-07-08 23:44:50 +02:00
mintsuki
99d671ecf8 build: Drop -Wno-deprecated-declarations flag 2023-06-20 16:24:27 +02:00
mintsuki
7882d89b4e limine: Drop 5-level paging request support 2023-06-20 16:10:08 +02:00
mintsuki
1ad6d6013e limine: Drop terminal request support 2023-06-20 15:58:52 +02:00
mintsuki
2ac43a320f asm: Add missing section directives 2023-06-20 13:24:49 +02:00
mintsuki
2d6a1e4535 console: Add firmware type command 2023-06-20 11:10:33 +02:00
mintsuki
d08ea721a5 limine.c: Add copyright and license information to version command 2023-06-20 10:19:01 +02:00
mintsuki
6e41938206 gensyms: Filter out non-function symbols 2023-06-20 08:54:53 +02:00
mintsuki
67fd1a8d9f docs: Update example Limine version in README to 4.20230615.0 2023-06-15 13:20:43 +02:00
mintsuki
66268f7d7f pmm: Use fixed value of 1024 for recl entries count 2023-06-15 13:06:52 +02:00
mintsuki
cb14f44eb3 pmm: Fix change-memmap-in-use bug 2023-06-15 12:54:36 +02:00
mintsuki
910a0d84a0 vmm: Fix page_sizes values and move declaration to top 2023-06-15 08:21:48 +02:00
mintsuki
2da0a08072 build: Make limine-uefi-cd.bin 16MiB in size (use FAT16) 2023-06-15 03:14:04 +02:00
mintsuki
670b635ae8 config: Add and document ARCH built-in macro 2023-06-15 02:23:48 +02:00
mintsuki
bc8188e275 misc: limine.sys -> limine-bios.sys 2023-06-15 02:02:32 +02:00
mintsuki
38ccb76c40 misc: limine-hdd.bin -> limine-bios-hdd.bin 2023-06-15 01:47:16 +02:00
mintsuki
7b1284808a build: Fix permissions of output files in makefile instead of release recipe 2023-06-15 01:33:17 +02:00
mintsuki
34a2e85c34 misc: Add missing EFI executables install commands to host Makefile 2023-06-15 01:12:56 +02:00
mintsuki
ece02695e8 misc: limine-cd.bin -> limine-bios-cd.bin 2023-06-15 01:07:44 +02:00
mintsuki
45fd1ac08f test: Misc updates to the linker script 2023-06-15 00:52:59 +02:00
mintsuki
264decd0ef misc: limine-cd-efi.bin -> limine-uefi-cd.bin 2023-06-14 03:14:41 +02:00
mintsuki
d0b9bbdca6 misc: limine-pxe.bin -> limine-bios-pxe.bin 2023-06-14 03:04:01 +02:00
mintsuki
1c5fde5dc9 misc: Add BOOTRISCV64.EFI to permissions fix list 2023-06-14 00:25:42 +02:00
mintsuki
a069e220c0 docs: BOOT{IA32,X64,AA64}.EFI -> BOOT*.EFI 2023-06-14 00:14:20 +02:00
mintsuki
b764792c97 docs: Mention creating the ESP tree in ISOHYBRID partition 2023-06-13 12:35:15 +02:00
mintsuki
a9e6e00994 docs: Add donations link 2023-06-12 17:46:39 +02:00
mintsuki
2b154138fe misc: Updates for new limine-efi 2023-06-12 05:57:47 +02:00
mintsuki
cde874fe80 misc: Updates for new flanterm 2023-06-10 19:23:50 +02:00
mintsuki
a627c732d5 docs: Update example Limine version in README to 4.20230606.0 2023-06-06 02:02:23 +02:00
mintsuki
b78309b45a misc: Remove tinf from tree, pull at bootstrap time 2023-06-06 01:16:58 +02:00
mintsuki
666c5dfcd1 riscv64: Update location of __global_pointer$ 2023-06-06 00:17:07 +02:00
mintsuki
13042bd25e build/riscv64: libgcc-riscv64 -> libgcc-riscv64-softfloat 2023-06-06 00:02:07 +02:00
mintsuki
f6946a7f0c test: Use retrage.github.io EDK2 nightly builds for all ports 2023-06-05 23:14:44 +02:00
mintsuki
74a6b8e125 protos/linux: Do not zero EFI memmap size on IA-32 EFI 2023-06-05 23:05:20 +02:00
mintsuki
705719a229 docs/readme: Adjust stb_image.h link to point to dev branch 2023-06-05 00:07:03 +02:00
mintsuki
e205d51ca4 docs: Add Limine pronounciation link to README.md 2023-06-04 23:39:14 +02:00
ミンツキ
fa7b2409e7
Merge pull request #276 from xvanc/trunk
limine: scale the maximum KASLR offset based on the address space size
2023-06-04 21:05:48 +02:00
xvanc
1f01ddfc6d
limine: scale the maximum KASLR offset based on the address space size 2023-06-04 13:50:26 -05:00
xvanc
9274ee656e
Initial riscv64 port (#274)
* initial riscv64 port

* enable Paging Mode feature for all architectures

* riscv: add missing protocol docs

* riscv: fix tests

* docs: clarify `LIMINE_PAGING_MODE_DEFAULT` macro

* build: fix whitespace in common/GNUmakefile

* riscv: default to Sv48 paging when supported

* vmm: make `VMM_MAX_LEVEL` 1-indexed

* limine: do not call `reported_addr()` before finaling paging mode

smp/riscv: do not overwrite the argument passed to APs

* limine/riscv: update default paging mode in limine.h

* test/riscv: pad OVMF.fd when downloading it
2023-06-04 01:36:06 +02:00
mintsuki
e91196d452 test: Fix copying mistake (typo) 2023-06-03 01:51:17 +02:00
ミンツキ
bee1d50c1a
Merge pull request #275 from blanham/netboot_fix_when_no_block_io
Fix netboot in configs where BLOCK_IO_PROTOCOL does not exist
2023-06-01 10:40:36 +02:00
Bryce Lanham
fe083d3701 Fix netboot in configs where BLOCK_IO does not exist
For example, netbooting qemu-system-aarch64 with no drive specified will
result in OVMF not loading the BLOCK_IO_PROTOCOL, causing a panic in
disk.s2.c.
2023-06-01 03:33:13 -05:00
mintsuki
dce1c31ad5 docs: Update example Limine version in README to 4.20230530.0 2023-05-30 22:44:12 +02:00
mintsuki
f26b651e5f disk/efi: Do not use DISK_IO protocol and fix buffer reuse bug 2023-05-30 21:36:09 +02:00
mintsuki
679fdd4351 misc: Use C instead of asm for mem*() family of functions 2023-05-30 12:23:31 +02:00
mintsuki
4190710dc6 docs: Update example Limine version in README to 4.20230529.0 2023-05-29 13:06:02 +02:00
mintsuki
9079f3007d ci: Fix permissions of certain files in binary branch 2023-05-29 12:51:21 +02:00
mintsuki
eac03c8c89 build/uefi: Remove now-useless -DGNU_EFI_USE_MS_ABI flag 2023-05-28 23:53:34 +02:00
mintsuki
0125dcd67a build/uefi: Pass -fshort-wchar to CC 2023-05-27 16:55:49 +02:00
mintsuki
844386487d docs: Update example Limine version in README 2023-05-14 09:28:24 +02:00
mintsuki
71b175b7b9 stb_image: Track dev branch 2023-05-14 06:08:55 +02:00
mintsuki
153412f53e host: Perform compile-time endian check if supported 2023-05-14 05:13:09 +02:00
mintsuki
7989064599 elf: Improve detection of relocatable ELFs 2023-05-13 00:05:50 +02:00
mintsuki
836d1c2038 docs: Update example Limine version in README 2023-05-03 22:51:13 +02:00
mintsuki
2c11fb337c stb_image: Update to commit with zlib EOF bug fixed 2023-05-03 19:53:27 +02:00
mintsuki
73462a5116 Revert "compress/gz: Add hack to allow macOS compressed GZs to load with stbi"
This reverts commit 1dd75a18aca6fe69e0b9df88d92ee99d1388eb48.
2023-05-03 19:53:27 +02:00
mintsuki
f618eb26af Revert "misc: Revert back to using tinf for all GZ decompression"
This reverts commit 3438b8d235be38850cee46d1950edcebf5ffcd41.
2023-05-03 19:53:27 +02:00
mintsuki
e9186e1859 Revert "uri: Backport pre-tinf-removal variable assignments"
This reverts commit 514522125b20ac9ce279fd5f02a5127d10974c8b.
2023-05-03 19:53:27 +02:00
mintsuki
35808c593e build: Remove some empty lines in dist make target 2023-05-03 15:54:14 +02:00
ミンツキ
717c60cd6a
Merge pull request #271 from blanham/multiboot1_fix_elf32_section_loading
multiboot1: also fix elf32 section loading
2023-05-03 03:54:46 +02:00
Bryce Lanham
e0c3e6bdce multiboot1: also fix elf32 section loading
As with the prior mb2 fix, use the correct size elf section header for
32 bit elf
2023-05-02 20:48:13 -05:00
ミンツキ
df34599feb
Merge pull request #270 from blanham/multiboot2_fix_elf32_section_loading
multiboot2: fix 32 bit elf section loading
2023-05-03 03:39:12 +02:00
Bryce Lanham
fdcb9a9243 multiboot2: fix 32 bit elf section loading
Existing code was using 64 bit elf section header unconditionally. This
commit fixes that :)
2023-05-02 20:15:43 -05:00
mintsuki
1a4888858b hgen: Add extra sed command for handling Solaris's od 2023-05-02 08:49:46 +02:00
mintsuki
8dd7973e23 pxe: Add and use constant PXE ACK packet size and fix BIOS PXE ACK struct 2023-04-28 04:59:08 +02:00
mintsuki
36846549e0 menu: Do not initialise textmode terminal if QUIET=yes. Addresses #269 2023-04-26 23:49:22 +02:00
mintsuki
172060e249 bootstrap: Add BOOTSTRAP_NO_SHALLOW_CLONES support 2023-04-25 02:42:34 +02:00
ミンツキ
d7da6d63b5
Merge pull request #267 from blanham/add_multiboot2_network_tag
Implement Multiboot2 network tag
2023-04-24 16:39:30 +02:00
Bryce Lanham
2362f1a785 Implement Multiboot2 network tag
Added caching of the dhcp response in the pxe code, and then adding the
tag containing it.
2023-04-24 06:44:56 -05:00
ミンツキ
2a26d90394
Merge pull request #265 from blanham/fix_pxe_proxy_boot
Fix PXE BIOS boot when using a proxy DHCP server
2023-04-22 10:37:23 +02:00
Bryce Lanham
64a0c6073b Fix PXE BIOS boot when using a proxy DHCP server 2023-04-22 01:22:36 -05:00
mintsuki
73b126e067 build: Sanitise autoconf substitutions with gmake variables 2023-04-21 18:57:08 +02:00
mintsuki
c41e3969a6 build: Pass proper warning flags to nasm 2023-04-18 12:41:01 +02:00
mintsuki
b991fb93f8 docs: Document TEXTMODE config for multiboot 1 and 2 2023-04-13 21:02:09 +02:00
mintsuki
e57050d9c7 multiboot1: Support TEXTMODE config as with Linux/mb2 protocols 2023-04-13 19:21:49 +02:00
mintsuki
93ae0e9afc textmode: Actually disable term hooking on non-managed initialisation 2023-04-13 18:49:26 +02:00
ミンツキ
3613997108
Merge pull request #263 from klange/mb2-textmode
multiboot2: Support TEXTMODE config as with linux
2023-04-12 16:24:14 +02:00
ミンツキ
eae24e64e5
Merge pull request #262 from klange/mb2-ignore-optional
multiboot2: ignore unsupported tags if they are marked optional
2023-04-12 13:18:34 +02:00
K. Lange
2da6225f9e multiboot2: ignore unsupported tags if they are marked optional 2023-04-12 19:53:24 +09:00
K. Lange
a3f84fc4a3 multiboot2: Support TEXTMODE config as with linux 2023-04-12 19:50:01 +09:00
mintsuki
240d9688b0 multiboot2: Fix lack of argument to panic format string 2023-04-12 09:56:28 +02:00
mintsuki
7ad444936e host: Condense various host utilities into a single executable 2023-04-11 22:04:05 +02:00
mintsuki
eba0183b6e build: Reorganise warning flags 2023-04-11 17:15:41 +02:00
mintsuki
ebd1953e51 build: Use uppercase PIE/PIC compilation flags 2023-04-11 15:57:02 +02:00
mintsuki
514522125b uri: Backport pre-tinf-removal variable assignments 2023-04-08 03:10:53 +02:00
mintsuki
3438b8d235 misc: Revert back to using tinf for all GZ decompression 2023-04-08 02:17:02 +02:00
mintsuki
e0f8d94de7 limine: Fix spurious deprecation warnings coming from limine.h 2023-03-30 08:26:14 +02:00
mintsuki
67d2631826 limine: Add note about deprecation of terminal to PROTOCOL.md 2023-03-30 04:13:45 +02:00
mintsuki
b66184cfbd limine: Clarify ambiguity with response revision and internal modules 2023-03-30 03:51:59 +02:00
mintsuki
012605adf9 limine: Fix issue with internal modules and kernels in root dir 2023-03-30 02:43:52 +02:00
mintsuki
d0df21abb9 limine: Mark terminal as deprecated 2023-03-30 02:12:24 +02:00
mintsuki
01eeeb6e1d term: Drop in_bootloader for new Flanterm 2023-03-30 01:23:55 +02:00
mintsuki
779571339e misc: Updates for Flanterm rebrand 2023-03-29 22:43:06 +02:00
mintsuki
936240a3c6 limine-deploy: Check ferror() before using perror() on fread/fwrite fails 2023-03-29 20:29:03 +02:00
mintsuki
a2dd3449a8 limine: Fix framebuffer pointer in terminal struct being invalid without a framebuffer request 2023-03-29 11:04:53 +02:00
mintsuki
42027470c7 limine: Fix bug where internal modules are parsed with revision < 1 2023-03-25 00:59:26 +01:00
mintsuki
45ff0e2e93 limine: Document internal modules 2023-03-24 18:44:25 +01:00
mintsuki
d0ee1e7d65 limine: Support relative-to-kernel paths for internal modules 2023-03-24 18:24:27 +01:00
mintsuki
698ca1a665 limine: Honour LIMINE_INTERNAL_MODULE_REQUIRED flag 2023-03-24 10:18:18 +01:00
mintsuki
830251e68e limine: Load internal modules before config modules 2023-03-24 09:07:40 +01:00
mintsuki
d4334699e3 limine: Implement internal modules concept 2023-03-24 01:02:31 +01:00
mintsuki
5a53f91e01 build: Split test portion of root makefile to own file 2023-03-23 16:03:58 +01:00
mintsuki
0196abf2ec build: Minor build system updates 2023-03-23 02:35:08 +01:00
mintsuki
2ea3f7e9d8 build: Minor build system updates 2023-03-23 01:02:58 +01:00
mintsuki
3bf159d81c compress: Rename modified tinfgzip wrapper to gzip 2023-03-16 22:49:24 +01:00
mintsuki
9663318102 build: Remove useless unset commands from common GNUmakefile 2023-03-16 17:01:41 +01:00
mintsuki
c202cce72c build: Use DEFAULT_VAR for all overridable default makefile vars 2023-03-16 16:09:02 +01:00
mintsuki
813c1e6c95 Revert "build: bootstrap: Do not manually install install-sh"
This reverts commit 5f5c98866e1cfb7dd9ff0bf665a1ee1e5b8ae288.
2023-03-16 04:38:59 +01:00
mintsuki
fadb9a7c13 build: Misc updates for new freestanding-toolchain 2023-03-16 03:38:53 +01:00
mintsuki
7d6125d413 build: Fix up some makefile variable names 2023-03-16 02:49:45 +01:00
mintsuki
f71f506b0a build: configure: Change some variable names to be more friendly 2023-03-16 02:28:50 +01:00
mintsuki
08647f7d5c decompressor: Move tinf directory to decompressor directory 2023-03-16 01:23:11 +01:00
mintsuki
c7a7539d23 build: configure: Exit on freestanding-toolchain error 2023-03-14 22:35:11 +01:00
mintsuki
5f5c98866e build: bootstrap: Do not manually install install-sh 2023-03-14 20:07:05 +01:00
mintsuki
7dc04b42cc build: Add and use PROG_ABSPATH autoconf macro 2023-03-14 19:51:22 +01:00
mintsuki
9009404a11 build: Updates for newer freestanding-toolchain 2023-03-14 17:20:46 +01:00
mintsuki
674f490f7b misc: bootstrap: Fix freestanding-toolchain presence check 2023-03-14 12:08:14 +01:00
mintsuki
b072a08f72 misc: Do not remove freestanding-toolchain from release tarball 2023-03-13 20:51:44 +01:00
mintsuki
8d61d0ab3a misc: Use freestanding-toolchain instead of cross-detect 2023-03-13 20:40:32 +01:00
mintsuki
d1e4b9946c docs: LICENSE.md -> LICENSE 2023-03-10 14:01:49 +01:00
mintsuki
828e3790a4 chainload: LoadOptionsSize should be in bytes. Fixes #254 2023-03-08 15:40:11 +01:00
mintsuki
ca69475609 protocol: Specify that kernel must be physically contiguous 2023-03-08 07:34:06 +01:00
mintsuki
246276a538 chainload: BIOS: do not rely on 0x7c00 being free 2023-03-07 13:07:28 +01:00
mintsuki
980c122475 vga_textmode: Minor cursor-related bug fixes 2023-03-07 13:07:28 +01:00
mintsuki
4ef529b4eb misc: Load BIOS port at 0xf000 instead of 0x8000 2023-03-07 02:21:09 +01:00
mintsuki
5bc6fbca3b misc: Change example wallpaper 2023-03-06 22:22:58 +01:00
mintsuki
fc4e283ad5 stb_image: Fix free/realloc wrappers to handle being passed NULL 2023-03-05 19:01:31 +01:00
mintsuki
0f4beb1bfd gterm: Fix NULL dereference bug when no wallpaper used 2023-03-05 09:49:28 +01:00
mintsuki
9d6c64954c gh: Remove issue templates 2023-03-05 09:21:11 +01:00
mintsuki
1dd75a18ac compress/gz: Add hack to allow macOS compressed GZs to load with stbi 2023-03-05 09:08:37 +01:00
mintsuki
8bb12244be image: Use stbi_image_free() instead of freeing buffer ourselves 2023-03-05 08:47:38 +01:00
mintsuki
753bb820ae stb_image: More proper implementation of malloc/free/realloc macros 2023-03-05 08:29:27 +01:00
mintsuki
5f84ade177 docs: Minor README.md formatting fix 2023-03-05 08:01:41 +01:00
mintsuki
959c44658e image: Use stb_image for image loading 2023-03-05 07:57:54 +01:00
mintsuki
11ef3bced2 build: Honour CROSS_CPPFLAGS 2023-02-25 01:38:26 +01:00
mintsuki
a786c26a26 build: Install markdown docs on install; distclean fix 2023-02-21 03:32:27 +01:00
mintsuki
8ee9dc1ebd build: Only install limine-deploy.1 man page if built 2023-02-21 01:35:57 +01:00
mintsuki
d17e220e61 docs: Add man pages for host executables 2023-02-21 00:15:04 +01:00
mintsuki
9bcad9d258 build: Very minor QOL fixes 2023-02-20 22:24:21 +01:00
mintsuki
b4649f8808 docs: Update PHILOSOPHY.md to note reason for ext* driver inclusion 2023-02-20 05:10:33 +01:00
mintsuki
1e65ada438 Revert "fs: Drop ext* support"
This reverts commit caaf4f94a5ae2c866416d83ef50f1ba47ebc365d.
2023-02-20 05:10:33 +01:00
mintsuki
c924d7b7e5 build: Misc quality-of-life fixes 2023-02-19 10:07:21 +01:00
mintsuki
ce7a552723 misc: Let freestanding-headers handle limits.h 2023-02-18 09:41:30 +01:00
mintsuki
c7f344784c menu: Fix issue introduced in 48053fd2 where TIMEOUT=0 would not show interface 2023-02-16 07:18:04 +01:00
mintsuki
48053fd206 misc: Fix bug on trunk where returns to menu from panic would crash 2023-02-16 03:54:10 +01:00
mintsuki
e909489635 vga_textmode: Unbreak on trunk 2023-02-16 03:21:06 +01:00
mintsuki
a3f814b5f7 uri/tinfgzip: Minor fixes and layering improvement 2023-02-16 02:05:11 +01:00
mintsuki
3ae87be595 uri: Fix minor use-after-free bug 2023-02-15 21:09:46 +01:00
mintsuki
9b07351208 uri: Prevent memory leak when opening compressed files 2023-02-15 21:05:55 +01:00
mintsuki
82aec4b1b2 docs: Update PHILOSOPHY.md noting that ext2/3/4 has been dropped 2023-02-15 12:28:16 +01:00
mintsuki
143d3d85de stb/image: Comment out problematic functions 2023-02-15 11:53:07 +01:00
mintsuki
1099993b14 stb: Ignore some warnings coming from stb_image.h 2023-02-15 11:31:28 +01:00
mintsuki
71b3ae548b compress: Replace tinf's inflate implementation with stb_image's zlib 2023-02-15 11:21:53 +01:00
mintsuki
caaf4f94a5 fs: Drop ext* support 2023-02-15 11:21:53 +01:00
mintsuki
bcac8b6256 build: Use separate STRIP program in host Makefile 2023-02-12 23:13:26 +01:00
mintsuki
d744fc8c63 build: Further fixes related to cd8188d8 2023-02-12 23:13:26 +01:00
mintsuki
ec34c86d58 build: Update for latest cross-detect 2023-02-12 22:20:38 +01:00
mintsuki
8b7dc549f7 build: Misc configure.ac improvements, install-strip fix ups 2023-02-12 20:14:51 +01:00
mintsuki
7e46840b86 build: Update for latest cross-detect 2023-02-12 07:39:17 +01:00
mintsuki
87bea2fe0d host/enroll-config: Bring up to standard with deploy 2023-02-08 22:52:54 +01:00
mintsuki
8d427d7699 host/enroll-config: Fix buffer overflow 2023-02-08 21:59:02 +01:00
mintsuki
cd8188d832 build: Fix race condition in root GNUmakefile.in 2023-02-07 05:09:52 +01:00
mintsuki
fb4b02a451 docs: README.md: Document secure boot and config hash enrolling 2023-02-07 00:49:40 +01:00
mintsuki
8c7655eacd docs: Misc README.md fixes and updates 2023-02-07 00:42:13 +01:00
mintsuki
c30afde043 config: Do not allow recovering from checksum mismatch panic 2023-02-07 00:28:51 +01:00
mintsuki
843be07536 config: No longer allow continuing boot on checksum mismatches 2023-02-07 00:23:10 +01:00
mintsuki
8c7a98310a misc: Add support for enrolling config blake2b hash in executable 2023-02-06 23:58:19 +01:00
mintsuki
191ad51eaa docs: Add PHILOSOPHY.md 2023-02-06 20:24:57 +01:00
mintsuki
5c1b96b393 protocol: Update copyright date in limine.h 2023-02-06 19:28:51 +01:00
mintsuki
a7721872dd term: Expose support for out-of-band output control 2023-01-20 20:14:38 +01:00
mintsuki
28dd8a1062 file: Fix several bugs to do with handling of path field 2023-01-20 17:27:41 +01:00
mintsuki
2091aa9c21 Revert "Revert "Revert "ci: Build and check using Alpine instead of Arch"""
This reverts commit 8caf7b5b7550cb9b2a58df2097b4ae239d2f82da.
2023-01-20 16:25:15 +01:00
mint
41d4b3af54
Merge pull request #246 from Qwinci/trunk
limine: Add UEFI PXE support
2023-01-17 22:56:35 +01:00
Qwinci
3dd0a6fb41
limine: Add UEFI PXE support
based on @qookei's original patch with small changes.
2023-01-17 18:47:36 +02:00
mintsuki
ac1c5d1b95 efi/chainload: Support passing of command lines. Addresses #244 2023-01-14 12:49:22 +01:00
mintsuki
a085af55ec misc: Update copyright for 2023 2023-01-11 06:36:13 +01:00
mintsuki
8caf7b5b75 Revert "Revert "ci: Build and check using Alpine instead of Arch""
This reverts commit ce4046d559db69b4d1415edfe147f63367e99be5.
2022-12-30 09:04:45 +01:00
mintsuki
a0d8c7b2ab ci: Remove website upload portion of workflow 2022-12-30 08:53:36 +01:00
mintsuki
2ee939725e term: Compatibility with new terminal code 2022-12-30 07:58:46 +01:00
mintsuki
1aba6b3aeb lib/gterm: Remove now-useless full_refresh() call 2022-12-16 03:53:42 +01:00
mintsuki
10bbba0066 docs: Document TERM_BACKGROUND_BRIGHT and TERM_FOREGROUND_BRIGHT 2022-12-16 03:33:29 +01:00
mintsuki
b3c08f8122 term: Compatibility with latest terminal changes 2022-12-14 16:35:03 +01:00
mintsuki
fc6b69f0ac host/limine-deploy: Add quiet option. Closes #243 2022-12-13 13:18:18 +01:00
mintsuki
382d88913d docs/protocol: Fix syntax highlighting of struct limine_video_mode 2022-12-08 12:25:43 +01:00
mint
040a15817f
Merge pull request #240 from TornaxO7/add_docs_to_stack
adding bytes description to stack_size
2022-12-08 12:10:42 +01:00
TornaxO7
98bfcc6dbd
adding bytes description to stack_size 2022-12-06 14:22:24 +01:00
mint
6df8a35698
Merge pull request #239 from Lockna/errata-protocol
docs/protocol: Fix wording for reserved/reclaimable
2022-12-01 01:18:01 +01:00
Raphael O
3fc36e9ac1
docs/protocol: Fix wording for reserved/reclaimable
Switch from bootloader-reserved to bootloader-reclaimable so that the memory regions reserved and bootloader-reclaimable are not confused.
2022-11-30 21:19:58 +01:00
mintsuki
25c6c18c8b Revert "fs: Drop ext* support"
This reverts commit ba5aca6fd81b40544eaab0a2a3baa6f24fce0947.
2022-11-30 01:48:00 +01:00
mintsuki
0748cf5bf2 Revert "fs: Fix unused variable warning introduced in ba5aca6f"
This reverts commit a48036141fdf3443dc1d9c43a856076c4250cb5b.
2022-11-30 01:48:00 +01:00
mintsuki
a48036141f fs: Fix unused variable warning introduced in ba5aca6f 2022-11-29 17:05:01 +01:00
mintsuki
ba5aca6fd8 fs: Drop ext* support 2022-11-29 16:55:43 +01:00
mint
32d7aa1815
Merge pull request #238 from qookei/fix-aa64-fbs
limine: Fix caching mode detection for multiple framebuffers on AArch64
2022-11-25 03:21:51 +01:00
Kacper Słomiński
04d22b1e52 limine: Fix caching mode detection for multiple framebuffers on AArch64 2022-11-23 01:03:06 +01:00
mintsuki
ffaaabf14a readline: Fix issue arising from terminal's wraparound handling fix 2022-11-19 08:04:17 +01:00
mintsuki
c2854bde82 gop: Fix small issue causing IA-32 UEFI port not to build 2022-11-19 06:35:41 +01:00
mintsuki
f9399fd5a3 disk: Fix issue where _p struct was not zeroed out in create_disk_index() 2022-11-19 06:35:41 +01:00
mint
15127263ca
Merge pull request #236 from beakeyz/memleakfix_disk_create_index
Fixed little memory leak in the UEFI build
2022-11-19 00:37:55 +01:00
mintsuki
d39baeaa80 video: Initial support for multiple framebuffers 2022-11-18 23:59:31 +01:00
beakeyz
28187433f9 Fixed little memory leak in the UEFI build that would make the bootloader crash on systems with larger disks 2022-11-18 22:28:28 +00:00
mintsuki
9b68f081cf docs: Add packaging status to README.md 2022-11-15 11:25:51 +01:00
mintsuki
bf4c0f7d7a gop: Remove ConOut logic 2022-11-15 11:25:51 +01:00
mint
99f8c7b187
Merge pull request #234 from raccog/trunk
readline: Fix command line scrolling and cursor wrap-around
2022-11-14 07:45:27 +01:00
mintsuki
e924aa5f26 gop: Use ConOut to obtain GOP whenever possible 2022-11-14 07:35:06 +01:00
mintsuki
970292460d limine.h: Use C90 style comments for license header 2022-11-14 07:35:06 +01:00
mintsuki
60c115658c Revert "gop: Allow user to select which GOP to use in config. Addresses #233"
This reverts commit d82dc64b93150d00e457a99c364b4c85f12bd35d.
2022-11-14 07:35:06 +01:00
mintsuki
20572082c1 Revert "gop: Fix implicit declaration warning introduced in d82dc64b"
This reverts commit c477414c5cfeefd98e4be75cec0e54408de7dbd4.
2022-11-14 07:35:06 +01:00
Ryan Cohen
07d8dd2c68
readline: Fix command line scrolling and cursor wrap-around
Fixes `cursor_fwd` to wrap the cursor to the first column when it passes
the bottom right corner of the screen.

Fixes `readline` to update the command line's row position when the
cursor wrap-around causes the screen to scroll up.
2022-11-13 13:49:00 -05:00
mintsuki
c477414c5c gop: Fix implicit declaration warning introduced in d82dc64b 2022-11-12 00:34:20 +01:00
mintsuki
d82dc64b93 gop: Allow user to select which GOP to use in config. Addresses #233 2022-11-11 23:40:56 +01:00
mintsuki
22c041ff08 limine.h: Add license header 2022-11-05 15:44:08 +01:00
mintsuki
1258f01bc2 Revert "smp/x86: Free up trampoline memory after use"
This reverts commit ae771dd8a19aeb3f8ba5b310dc454b668b94403a.
2022-11-02 15:28:07 +01:00
mintsuki
144c481ed5 docs/protocol: Clarify file address alignment 2022-10-30 13:58:01 +01:00
mintsuki
7e403e0059 multiboot2: Support load_addr == -1 2022-10-30 11:19:02 +01:00
mintsuki
ae771dd8a1 smp/x86: Free up trampoline memory after use 2022-10-29 16:17:57 +02:00
mintsuki
49f4ccd312 pmm: Work around potential memmap data race in EFI init_memmap() 2022-10-17 06:28:53 +02:00
mintsuki
09faf82bc4 pmm: Fix AllocatePages() call to take pages count; remove useless alignment check 2022-10-17 04:41:11 +02:00
mintsuki
d8193abc98 pmm: Avoid throwing away big memory ranges that fail to AllocatePages() indiscriminately 2022-10-17 04:34:27 +02:00
mintsuki
ce4046d559 Revert "ci: Build and check using Alpine instead of Arch"
This reverts commit 502f77b30fd82caea3ac7e6fe519df78b37924bc.
2022-10-16 01:31:36 +02:00
mintsuki
7e1d4a9870 linux: Revert 793d0293 2022-10-14 14:28:17 +02:00
mintsuki
3c541576f3 disk: Fix wrong parameter passed to ReadBlocks() 2022-10-14 06:59:35 +02:00
mintsuki
c7e62083fd docs: Document blake2b checksums related things 2022-10-14 06:07:53 +02:00
mintsuki
f0d6aa8033 docs: Fix formatting issue in PROTOCOL.md 2022-10-14 06:07:53 +02:00
mintsuki
c14bb6059f gop: Do not zero default_res out erroneously 2022-10-14 05:34:54 +02:00
mintsuki
e0aec79cb6 limine: Add support for framebuffer modes listing 2022-10-14 05:19:13 +02:00
mintsuki
01ee09373c file: Reimplement a1bcf3c0 without use-after-free bug 2022-10-14 05:15:17 +02:00
mintsuki
502f77b30f ci: Build and check using Alpine instead of Arch 2022-10-14 00:02:55 +02:00
mintsuki
42b1db1063 misc: Update references to hardcoded directories 2022-10-14 00:02:55 +02:00
mintsuki
b30d2dc978 disk: UEFI: Add BLOCK_IO fallback for volume_from_efi_handle() 2022-10-14 00:02:55 +02:00
mintsuki
da5896b764 disk: On UEFI, improve optical vs non-optical detection 2022-10-14 00:02:55 +02:00
mintsuki
6022f5bf23 elf: Add overlapping PHDR detection 2022-10-10 04:35:28 +02:00
mintsuki
96fe1aa2e0 disk: Only use BLOCK_IO as fallback to DISK_IO when determining optical 2022-10-09 10:58:07 +02:00
mintsuki
d265cad7b6 disk: On BIOS, change how optical is determined 2022-10-09 10:58:07 +02:00
mintsuki
ce33e9dff3 limine: Fix bug which triggered on no-NX where wrong register was used for rd/wrmsr 2022-10-09 07:31:26 +02:00
mintsuki
fa40b927cd docs: Update README.md 2022-10-07 09:14:30 +02:00
mintsuki
d10d2baded menu: Add arrows to indicate overflow for many menu entries 2022-10-07 08:49:13 +02:00
mintsuki
af80341c8c misc: Dynamically allocate EFI memmap copy 2022-10-07 07:49:47 +02:00
mintsuki
53d20619ec menu: Properly handly high number of entries 2022-10-07 07:35:08 +02:00
mintsuki
2557aa8f46 misc: Increase EFI_COPY_MAX_ENTRIES to 2048 2022-10-07 06:23:49 +02:00
mintsuki
4ba1b2fd9d limine/smp: Fix stack offset accidentally added twice 2022-10-06 18:39:55 +02:00
mintsuki
3d95c8960c misc: Add limine subdir to stage3 and config search paths. Closes #225 2022-10-06 06:29:11 +02:00
mint
23f2c7dbac
Merge pull request #228 from czapek1337/some-fixes
Some minor fixes
2022-10-06 06:05:37 +02:00
czapek1337
02c26a8738
efi: Fallback to volume scan instead of panicking 2022-10-06 05:58:39 +02:00
mintsuki
b1319408dd menu: Add missing valid keys 2022-10-06 05:41:21 +02:00
mintsuki
7f09259c57 term: Misc improvements for SERIAL=yes on EFI 2022-10-06 05:41:21 +02:00
mintsuki
610a98d8b2 term: Unbreak textmode + serial combo 2022-10-06 05:41:21 +02:00
mintsuki
6e1c792e41 gterm: Prevent memory leak gterm_init() failure 2022-10-06 05:41:21 +02:00
mintsuki
fb994e61c6 limine: Fix NULL term dereference bug if gterm_init fails 2022-10-06 05:41:21 +02:00
czapek1337
44a3f3f2f7
disk: Use BLOCK_IO instead of DISK_IO 2022-10-06 05:38:06 +02:00
czapek1337
68e936e7f4
readline: Fallback to SystemTable->ConIn 2022-10-06 05:37:22 +02:00
mintsuki
ac34ec411f term: Better ensure term is not accessed when NULL 2022-10-05 15:01:01 +02:00
mintsuki
ec9d384bf2 limine: Do not panic if failing to set up terminal or framebuffer 2022-10-05 14:32:54 +02:00
mintsuki
cc8ff90865 menu: Use fallback terminal instead of panicking on gterm_init() fail 2022-10-05 14:32:54 +02:00
mintsuki
6cbb9c4577 limine: Fix bug where NULL term was accessed. Fixes #227 2022-10-05 14:32:54 +02:00
mintsuki
ffa6d4e0c7 limine: Reimplement proper callback functionality 2022-10-04 21:53:19 +02:00
mintsuki
d187c576d8 term: Make term_notready() static 2022-10-04 21:00:39 +02:00
mintsuki
ff8c5f318c term: Gate BIOS specific code behind ifdefs 2022-10-04 20:47:19 +02:00
mintsuki
f977548e84 term: Reimplement context control 2022-10-04 20:39:50 +02:00
mintsuki
48a7c12e5b term: Misc fixes and improvements 2022-10-04 19:10:38 +02:00
mintsuki
d3c8a66918 term: Misc fixes and improvements 2022-10-04 08:21:59 +02:00
mintsuki
b34954bb43 term: Misc fixes and improvements 2022-10-04 07:24:42 +02:00
mintsuki
45312e66ae term: Add builtin font 2022-10-04 06:04:31 +02:00
mintsuki
f6ba5991b5 term: Misc minor bug fixes 2022-10-04 05:39:48 +02:00
mintsuki
0f1d86e7e4 term: Tidy up VGA textmode wrapper code 2022-10-04 02:34:11 +02:00
mintsuki
8849d08eeb term: Tidy up gterm wrapper code 2022-10-04 01:37:19 +02:00
mintsuki
4d855fc17e term: Move to use external, portable terminal 2022-10-04 00:58:00 +02:00
mintsuki
e466501f92 pmm: Misc bug fixes in pmm 2022-09-28 01:16:39 +02:00
mintsuki
96c184fdf6 term: Misc bug fixes in fallback backends 2022-09-28 01:16:39 +02:00
mintsuki
7f046f67b9 build: Use variables to determine installable files instead of ignoring errors 2022-09-28 01:16:39 +02:00
mintsuki
e5d786158f docs: Update README.md in preparation for version naming scheme change 2022-09-27 06:48:05 +02:00
mintsuki
0d7b1e1148 term: Do not reset mode on UEFI fallback init 2022-09-27 06:36:04 +02:00
mintsuki
00e9f2ce46 multiboot: Fix warnings when building BIOS port 2022-09-27 05:55:00 +02:00
mintsuki
a2ba71eb1d multiboot: Allow for headless boots 2022-09-27 05:46:39 +02:00
mintsuki
c849bfc10b pmm: Obtain raw memmap from untouched_memmap rather than EFI memmap. Addresses #222 and https://forum.puppylinux.com/viewtopic.php?t=6881 2022-09-27 04:59:29 +02:00
mintsuki
bd7c3602bb pmm: Keep first page on sanitiser call in get_raw_memmap() 2022-09-26 02:42:32 +02:00
mintsuki
97c928a354 pmm: Backport some other stuff reverted in 4a4409e1 2022-09-25 23:10:58 +02:00
mintsuki
64c897a82d pmm: Backport fa6f6077 and 74a3a1c6 2022-09-25 20:37:17 +02:00
mintsuki
714d8ac2ce Revert "file: Convert file to a memfile as soon as possible"
This reverts commit a1bcf3c09bc691925e0607b4f282c59cf8575d6a.
2022-09-24 04:10:45 +02:00
mintsuki
4a4409e1b2 pmm: Undo most of what was done between 85603ec8 and 74a3a1c6 2022-09-24 03:57:55 +02:00
mintsuki
0cb98610f0 panic: Fix build on non-BIOS targets 2022-09-23 20:59:02 +02:00
mintsuki
e062b4ed7d term: Move more of it to stage 3 2022-09-23 20:53:14 +02:00
mintsuki
e67a75fe09 Revert "linux/efi: Perform efi_memmap_size=0 workaround for 32 on 64 as well"
This reverts commit b9f41799b42bc017c34ea2f49aabf4592f951c5a.
2022-09-23 01:00:44 +02:00
mintsuki
34a53292f7 build: Update install commands to be more quiet on non-fatal fail 2022-09-23 00:44:06 +02:00
mintsuki
b9f41799b4 linux/efi: Perform efi_memmap_size=0 workaround for 32 on 64 as well 2022-09-22 18:10:08 +02:00
mintsuki
390372533f build: Update build option dependencies and names 2022-09-22 15:58:59 +02:00
mintsuki
b229d0cdf3 config: On UEFI, scan the volume containing the EFI executable first. Addresses #219 2022-09-22 15:12:11 +02:00
mintsuki
0a28a0959b build: Honor LIBS variable 2022-09-20 23:10:19 +02:00
mintsuki
dab2a35b3e build: Honor CPPFLAGS variable 2022-09-20 21:28:12 +02:00
mintsuki
d5ff44676b menu: Fix regression when pressing a key during quiet timeout wait. Addresses in part #220 2022-09-20 15:25:24 +02:00
mintsuki
b1bfa2d2d8 build: Fix issue introduced in 87e09dba 2022-09-20 10:02:33 +02:00
mintsuki
a6189abdc1 misc: Fix bugs introduced in 3181293a 2022-09-20 09:54:35 +02:00
mintsuki
e89d834457 disk/efi: Improve firmware error handling 2022-09-19 20:48:42 +02:00
mintsuki
87e09dba61 build: Plug back limine_stage2only.elf into the BIOS build system 2022-09-19 02:31:23 +02:00
mintsuki
59bbd1f657 menu: Avoid reinitialising fallback terminal on first runs 2022-09-18 11:52:31 +02:00
mintsuki
26f6ac3bb2 smp: Fix indentation 2022-09-18 11:30:21 +02:00
mintsuki
dc5ed66e67 efi: Limit amount of tries to get boot volume from handle 2022-09-18 10:39:39 +02:00
mintsuki
f86a421209 misc: Fix up some no_unwind globals 2022-09-17 15:09:08 +02:00
mintsuki
0ae552a25c misc: Misc stage 2 related improvements 2022-09-17 13:53:57 +02:00
mintsuki
7f14f2f0d0 misc: Improve printing effectively on panics and errors 2022-09-17 10:40:14 +02:00
mintsuki
e76c8d47a9 multiboot2: Fix broken EFI memmap length calculation 2022-09-15 22:31:50 +02:00
mintsuki
50b524838a efi: Ensure panics are (hopefully) always visible 2022-09-15 13:31:42 +02:00
mintsuki
886523359c efi/disk: Use blake2b to calculate unique sector hash 2022-09-15 12:53:47 +02:00
mintsuki
430e841903 build: Do not request readelf from cross-detect when not needed 2022-09-15 06:56:32 +02:00
mintsuki
708868c889 build: Change name of --enable-uefi-x86_64 option to --enable-uefi-x86-64 2022-09-15 06:38:04 +02:00
mintsuki
a95d475c89 build: Only check nasm and gzip presence as needed 2022-09-15 06:33:29 +02:00
mintsuki
2b71eaedb6 smp: Fix aarch64 issue introduced in 0f04f686 2022-09-14 15:39:52 +02:00
mintsuki
0f04f6860a smp: Remove hacks needed for stivale 2022-09-14 14:54:55 +02:00
mintsuki
7e6aad3113 build: Fix stage2 map 2022-09-14 02:20:12 +02:00
mintsuki
ae4605936a misc: Minor cleanup after #216 2022-09-14 02:20:12 +02:00
mint
c1e98f26c9
Merge pull request #216 from czapek1337/blake2b
Implement blake2b hash function and checksum validation
2022-09-13 09:30:45 +02:00
czapek1337
9680a1ad51
uri: Add checksum validation 2022-09-13 01:14:55 +02:00
czapek1337
71eb143611
print: Specifier for printing URIs 2022-09-12 14:10:36 +02:00
czapek1337
a1bcf3c09b
file: Convert file to a memfile as soon as possible 2022-09-12 14:10:36 +02:00
czapek1337
8906518cd2
crypt: Implement blake2b hash function 2022-09-12 14:10:36 +02:00
mint
f8d714317b
Merge pull request #217 from Andy-Python-Programmer/trunk
DTB: ensure the `dtb_ptr` is an HHDM address
2022-09-12 09:27:18 +02:00
Andy-Python-Programmer
528be7230f
DTB: ensure the dtb_ptr is an HHDM address
* Ensure that the `dtb_ptr` is an HHDM address
* If DTB is not found, do not generate the response

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2022-09-12 17:25:35 +10:00
mintsuki
82eb809111 elf: Fix issue where KASLR was applied to non reloc executables 2022-09-11 23:07:13 +02:00
55 changed files with 1700 additions and 1025 deletions

View File

@ -10,7 +10,7 @@ jobs:
steps:
- name: Install dependencies
run: pacman --noconfirm -Syu && pacman --needed --noconfirm -S base-devel git autoconf automake nasm curl mtools llvm clang lld aarch64-linux-gnu-gcc
run: pacman --noconfirm -Syu && pacman --needed --noconfirm -S base-devel git autoconf automake nasm curl mtools llvm clang lld aarch64-linux-gnu-gcc riscv64-linux-gnu-gcc
- name: Checkout code
uses: actions/checkout@v3
@ -26,3 +26,6 @@ jobs:
- name: Build the bootloader (GNU, aarch64)
run: ./bootstrap && ./configure TOOLCHAIN_FOR_TARGET=aarch64-linux-gnu --enable-werror --enable-uefi-aarch64 && make all && make maintainer-clean
- name: Build the bootloader (GNU, riscv64)
run: ./bootstrap && ./configure TOOLCHAIN_FOR_TARGET=riscv64-linux-gnu --enable-werror --enable-uefi-riscv64 && make all && make maintainer-clean

View File

@ -41,29 +41,17 @@ jobs:
- name: Build the bootloader
run: make -C build
- name: Clean limine-version
run: rm build/bin/limine-version
- name: Clean limine
run: rm build/bin/limine
- name: Clean limine-enroll-config
run: rm build/bin/limine-enroll-config
- name: Build limine for Windows
run: make -C build/bin CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" CPPFLAGS="-D__USE_MINGW_ANSI_STDIO" limine
- name: Build limine-enroll-config-win32
run: make -C build/bin CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" CPPFLAGS="-D__USE_MINGW_ANSI_STDIO" limine-enroll-config
- name: Strip limine-enroll-config-win32
run: i686-w64-mingw32-strip build/bin/limine-enroll-config.exe
- name: Clean limine-deploy
run: rm build/bin/limine-deploy
- name: Build limine-deploy-win32
run: make -C build/bin CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" CPPFLAGS="-D__USE_MINGW_ANSI_STDIO" limine-deploy
- name: Strip limine-deploy-win32
run: i686-w64-mingw32-strip build/bin/limine-deploy.exe
- name: Strip limine for Windows
run: i686-w64-mingw32-strip build/bin/limine.exe
- name: Copy LICENSE to bin
run: cp LICENSE build/bin/
run: cp COPYING build/bin/LICENSE
- name: Copy install-sh to bin
run: cp build-aux/install-sh build/bin/
@ -71,8 +59,8 @@ jobs:
- name: Copy limine.h to bin
run: cp limine.h build/bin/
- name: Remove limine-hdd.bin
run: rm build/bin/limine-hdd.bin
- name: Remove limine-bios-hdd.bin
run: rm build/bin/limine-bios-hdd.bin
- name: Push binaries to binary branch
run: |

6
.gitignore vendored
View File

@ -29,20 +29,20 @@
/freestanding-toolchain
/configure
/configure.ac.save
/INSTALL
/build-aux
/aclocal.m4
/*~
/config.status
/config.log
/autom4te.cache
/man/man1/limine-version.1
/man/man1/limine-deploy.1
/man/man1/limine-enroll-config.1
/man/man1/limine.1
/GNUmakefile
/config.h
/common-bios
/common-uefi-ia32
/common-uefi-x86-64
/common-uefi-aarch64
/common-uefi-riscv64
/decompressor-build
/stage1.stamp

View File

@ -199,4 +199,4 @@ Macros must always be placed inside `${...}` where `...` is the arbitrary macro
Limine automatically defines these macros:
* `ARCH` - This built-in macro expands to the architecture of the machine. Possible values are: `x86-64`, `ia-32`, `aarch64`. In the case of IA-32, BIOS or UEFI, the macro will always expand to `x86-64` if the 64-bit extensions are available, else `ia-32`.
* `ARCH` - This built-in macro expands to the architecture of the machine. Possible values are: `x86-64`, `ia-32`, `aarch64`, `riscv64`. In the case of IA-32, BIOS or UEFI, the macro will always expand to `x86-64` if the 64-bit extensions are available, else `ia-32`.

View File

View File

@ -40,10 +40,10 @@ override BUILD_BIOS := @BUILD_BIOS@
override BUILD_UEFI_X86_64 := @BUILD_UEFI_X86_64@
override BUILD_UEFI_IA32 := @BUILD_UEFI_IA32@
override BUILD_UEFI_AARCH64 := @BUILD_UEFI_AARCH64@
override BUILD_CD_EFI := @BUILD_CD_EFI@
override BUILD_PXE := @BUILD_PXE@
override BUILD_CD := @BUILD_CD@
override BUILD_LIMINE_DEPLOY := @BUILD_LIMINE_DEPLOY@
override BUILD_UEFI_RISCV64 := @BUILD_UEFI_RISCV64@
override BUILD_UEFI_CD := @BUILD_UEFI_CD@
override BUILD_BIOS_PXE := @BUILD_BIOS_PXE@
override BUILD_BIOS_CD := @BUILD_BIOS_CD@
override DEFAULT_CC := @CC@
$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC)))
@ -108,76 +108,66 @@ all: $(call MKESCAPE,$(BINDIR))/Makefile
$(MAKE) all1
.PHONY: all1
all1: limine-version limine-enroll-config $(BUILD_UEFI_X86_64) $(BUILD_UEFI_IA32) $(BUILD_UEFI_AARCH64) $(BUILD_BIOS)
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
all1: $(BUILD_UEFI_X86_64) $(BUILD_UEFI_IA32) $(BUILD_UEFI_AARCH64) $(BUILD_UEFI_RISCV64) $(BUILD_BIOS)
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine'
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin'
$(call MKESCAPE,$(BINDIR))/limine-hdd.h: $(call MKESCAPE,$(BINDIR))/limine-hdd.bin
$(call MKESCAPE,$(BINDIR))/limine-bios-hdd.h: $(call MKESCAPE,$(BINDIR))/limine-bios-hdd.bin
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
cd '$(call SHESCAPE,$(BINDIR))' && '$(call SHESCAPE,$(SRCDIR))/host/hgen.sh' >limine-hdd.h
cd '$(call SHESCAPE,$(BINDIR))' && '$(call SHESCAPE,$(SRCDIR))/host/hgen.sh' >limine-bios-hdd.h
$(call MKESCAPE,$(BINDIR))/limine-deploy: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine-deploy.c $(call MKESCAPE,$(BINDIR))/limine-hdd.h
cp '$(call SHESCAPE,$(SRCDIR))/host/limine-deploy.c' '$(call SHESCAPE,$(BINDIR))/'
$(MAKE) -C '$(call SHESCAPE,$(BINDIR))' limine-deploy
ifeq ($(BUILD_BIOS),limine-bios)
$(call MKESCAPE,$(BINDIR))/limine: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine.c $(call MKESCAPE,$(BINDIR))/limine-bios-hdd.h
else
override LIMINE_NO_BIOS := -DLIMINE_NO_BIOS
$(call MKESCAPE,$(BINDIR))/limine-version: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine-version.c
$(SED) 's/@LIMINE_VERSION@/@PACKAGE_VERSION@/g' <'$(call SHESCAPE,$(SRCDIR))/host/limine-version.c' >'$(call SHESCAPE,$(BINDIR))/limine-version.c'
$(MAKE) -C '$(call SHESCAPE,$(BINDIR))' limine-version
$(call MKESCAPE,$(BINDIR))/limine-enroll-config: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine-enroll-config.c
cp '$(call SHESCAPE,$(SRCDIR))/host/limine-enroll-config.c' '$(call SHESCAPE,$(BINDIR))/'
$(MAKE) -C '$(call SHESCAPE,$(BINDIR))' limine-enroll-config
$(call MKESCAPE,$(BINDIR))/limine: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine.c
endif
$(SED) 's/%VERSION%/@PACKAGE_VERSION@/g;s/%COPYRIGHT%/@LIMINE_COPYRIGHT@/g' <'$(call SHESCAPE,$(SRCDIR))/host/limine.c' >'$(call SHESCAPE,$(BINDIR))/limine.c'
CPPFLAGS="$(CPPFLAGS) $(LIMINE_NO_BIOS)" $(MAKE) -C '$(call SHESCAPE,$(BINDIR))' limine
$(call MKESCAPE,$(BINDIR))/Makefile: $(call MKESCAPE,$(SRCDIR))/host/Makefile $(call MKESCAPE,$(SRCDIR))/host/.gitignore
mkdir -p '$(call SHESCAPE,$(BINDIR))'
cp '$(call SHESCAPE,$(SRCDIR))/host/Makefile' '$(call SHESCAPE,$(SRCDIR))/host/.gitignore' '$(call SHESCAPE,$(BINDIR))/'
.PHONY: limine-deploy
limine-deploy:
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-deploy'
.PHONY: limine-version
limine-version:
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-version'
.PHONY: limine-enroll-config
limine-enroll-config:
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-enroll-config'
.PHONY: limine
limine:
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine'
.PHONY: clean
clean: limine-bios-clean limine-uefi-ia32-clean limine-uefi-x86-64-clean limine-uefi-aarch64-clean
clean: limine-bios-clean limine-uefi-ia32-clean limine-uefi-x86-64-clean limine-uefi-aarch64-clean limine-uefi-riscv64-clean
rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
.PHONY: install
install: all
$(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(docdir))'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/LICENSE' '$(call SHESCAPE,$(DESTDIR)$(docdir))/'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/COPYING' '$(call SHESCAPE,$(DESTDIR)$(docdir))/'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/CONFIG.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/PROTOCOL.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/PHILOSOPHY.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/README.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/'
$(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1'
$(INSTALL_DATA) '$(call SHESCAPE,$(BUILDDIR))/man/man1/limine-version.1' '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/'
ifneq ($(BUILD_LIMINE_DEPLOY),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BUILDDIR))/man/man1/limine-deploy.1' '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/'
endif
$(INSTALL_DATA) '$(call SHESCAPE,$(BUILDDIR))/man/man1/limine-enroll-config.1' '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/'
$(INSTALL_DATA) '$(call SHESCAPE,$(BUILDDIR))/man/man1/limine.1' '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/'
$(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(datarootdir))'
$(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine'
ifeq ($(BUILD_BIOS),limine-bios)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine.sys' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios.sys' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
ifneq ($(BUILD_CD),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
ifneq ($(BUILD_BIOS_CD),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
ifneq ($(BUILD_CD_EFI),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
ifneq ($(BUILD_UEFI_CD),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
ifneq ($(BUILD_PXE),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
ifneq ($(BUILD_BIOS_PXE),no)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios-pxe.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
ifeq ($(BUILD_UEFI_AARCH64),limine-uefi-aarch64)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTAA64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
ifeq ($(BUILD_UEFI_RISCV64),limine-uefi-riscv64)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTRISCV64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
ifeq ($(BUILD_UEFI_X86_64),limine-uefi-x86-64)
$(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/'
endif
@ -187,75 +177,62 @@ endif
$(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(includedir))'
$(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/limine.h' '$(call SHESCAPE,$(DESTDIR)$(includedir))/'
$(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(bindir))'
$(INSTALL_PROGRAM) '$(call SHESCAPE,$(BINDIR))/limine-version' '$(call SHESCAPE,$(DESTDIR)$(bindir))/'
$(INSTALL_PROGRAM) '$(call SHESCAPE,$(BINDIR))/limine-enroll-config' '$(call SHESCAPE,$(DESTDIR)$(bindir))/'
ifneq ($(BUILD_LIMINE_DEPLOY),no)
$(INSTALL_PROGRAM) '$(call SHESCAPE,$(BINDIR))/limine-deploy' '$(call SHESCAPE,$(DESTDIR)$(bindir))/'
endif
$(INSTALL_PROGRAM) '$(call SHESCAPE,$(BINDIR))/limine' '$(call SHESCAPE,$(DESTDIR)$(bindir))/'
.PHONY: install-strip
install-strip: install
$(STRIP) '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine-version'
$(STRIP) '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine-enroll-config'
ifneq ($(BUILD_LIMINE_DEPLOY),no)
$(STRIP) '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine-deploy'
endif
$(STRIP) '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine'
.PHONY: uninstall
uninstall:
rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSE'
rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/COPYING'
rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/CONFIG.md'
rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/PROTOCOL.md'
rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/PHILOSOPHY.md'
rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/README.md'
rm -f '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/limine-version.1'
rm -f '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/limine-deploy.1'
rm -f '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/limine-enroll-config.1'
rm -f '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine-version'
rm -f '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine-enroll-config'
rm -f '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine-deploy'
rm -f '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/limine.1'
rm -f '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine'
rm -rf '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine'
rm -f '$(call SHESCAPE,$(DESTDIR)$(includedir))/limine.h'
$(call MKESCAPE,$(BUILDDIR))/stage1.stamp: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor-build/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/common-bios/stage2.bin.gz
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm -Wall $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-hdd.bin'
ifneq ($(BUILD_CD),no)
cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm -Wall $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-cd.bin'
cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm -Wall $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-hdd.bin'
ifneq ($(BUILD_BIOS_CD),no)
cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm -Wall $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-cd.bin'
endif
ifneq ($(BUILD_PXE),no)
cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm -Wall $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin'
ifneq ($(BUILD_BIOS_PXE),no)
cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm -Wall $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-pxe.bin'
endif
cp '$(call SHESCAPE,$(BUILDDIR))/common-bios/limine.sys' '$(call SHESCAPE,$(BINDIR))/'
cp '$(call SHESCAPE,$(BUILDDIR))/common-bios/limine-bios.sys' '$(call SHESCAPE,$(BINDIR))/'
touch '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
.PHONY: limine-bios
limine-bios: common-bios decompressor
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
ifneq ($(BUILD_LIMINE_DEPLOY),no)
$(MAKE) limine-deploy
endif
$(call MKESCAPE,$(BINDIR))/limine-cd-efi.bin: $(if $(BUILD_UEFI_IA32),$(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if $(BUILD_UEFI_X86_64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI) $(if $(BUILD_UEFI_AARCH64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI)
ifneq ($(BUILD_CD_EFI),no)
$(call MKESCAPE,$(BINDIR))/limine-uefi-cd.bin: $(if $(BUILD_UEFI_IA32),$(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if $(BUILD_UEFI_X86_64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI) $(if $(BUILD_UEFI_AARCH64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI) $(if $(BUILD_UEFI_RISCV64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI)
ifneq ($(BUILD_UEFI_CD),no)
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
rm -f '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' bs=512 count=2880 2>/dev/null
( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' -f 1440 :: && \
mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' ::/EFI && \
mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' ::/EFI/BOOT && \
rm -f '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin'
dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' bs=512 count=2880 2>/dev/null
( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' -f 1440 :: && \
mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' ::/EFI && \
mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' ::/EFI/BOOT && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' ::/EFI/BOOT ) || true ) && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' ::/EFI/BOOT ) || true ) && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' ::/EFI/BOOT ) || true ) && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ::/EFI/BOOT ) || true ) && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ::/EFI/BOOT ) || true ) && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' ::/EFI/BOOT ) || true ) \
) || rm -f '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' ::/EFI/BOOT ) || true ) \
) || rm -f '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin'
endif
.PHONY: limine-cd-efi
limine-cd-efi:
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
.PHONY: limine-uefi-cd
limine-uefi-cd:
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin'
$(call MKESCAPE,$(BINDIR))/BOOTX64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
@ -284,6 +261,15 @@ limine-uefi-aarch64:
$(MAKE) common-uefi-aarch64
$(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTAA64.EFI'
$(call MKESCAPE,$(BINDIR))/BOOTRISCV64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' '$(call SHESCAPE,$(BINDIR))/'
.PHONY: limine-uefi-riscv64
limine-uefi-riscv64:
$(MAKE) common-uefi-riscv64
$(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTRISCV64.EFI'
.PHONY: limine-bios-clean
limine-bios-clean: common-bios-clean decompressor-clean
@ -296,18 +282,22 @@ limine-uefi-ia32-clean: common-uefi-ia32-clean
.PHONY: limine-uefi-aarch64-clean
limine-uefi-aarch64-clean: common-uefi-aarch64-clean
.PHONY: limine-uefi-riscv64-clean
limine-uefi-riscv64-clean: common-uefi-riscv64-clean
.PHONY: dist
dist:
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"
$(MKDIR_P) '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"
cp -r '$(call SHESCAPE,$(SRCDIR))'/.git '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)"/
cd '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)" && git checkout .
cd '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)" && git log --oneline --decorate > ChangeLog
cd '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)" && ./bootstrap
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/common/flanterm/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/freestanding-headers/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/libgcc-binaries/.git"
rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/libgcc-binaries/.gitignore"
libgcc_needed="i686 x86_64-no-red-zone aarch64"; \
libgcc_needed="i686 x86_64-no-red-zone aarch64 riscv64-softfloat"; \
for f in $$libgcc_needed; do \
mv '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/libgcc-binaries/libgcc-$$f.a" '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/libgcc-binaries/libgcc-$$f.a.save"; \
done; \
@ -332,11 +322,11 @@ dist:
.PHONY: distclean
distclean: clean
rm -rf ovmf* config.log config.status GNUmakefile config.h toolchain-files man/man1/limine-version.1 man/man1/limine-deploy.1 man/man1/limine-enroll-config.1
rm -rf ovmf* config.log config.status GNUmakefile config.h toolchain-files man/man1/limine.1
.PHONY: maintainer-clean
maintainer-clean: distclean
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/stb/stb_image.h decompressor/tinf freestanding-headers libgcc-binaries limine-efi freestanding-toolchain configure build-aux *'~' autom4te.cache aclocal.m4 *.tar.xz *.tar.gz
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/stb/stb_image.h decompressor/tinf freestanding-headers libgcc-binaries limine-efi freestanding-toolchain configure INSTALL build-aux *'~' autom4te.cache aclocal.m4 *.tar.xz *.tar.gz
.PHONY: common-uefi-x86-64
common-uefi-x86-64:
@ -360,6 +350,17 @@ common-uefi-aarch64:
common-uefi-aarch64-clean:
rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64'
.PHONY: common-uefi-riscv64
common-uefi-riscv64:
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' all \
TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-riscv64-toolchain.mk' \
TARGET=uefi-riscv64 \
BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64'
.PHONY: common-uefi-riscv64-clean
common-uefi-riscv64-clean:
rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64'
.PHONY: common-uefi-ia32
common-uefi-ia32:
$(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' all \

View File

@ -168,8 +168,8 @@ everything is mapped with `PBMT=PMA`).
### x86-64
`rip` will be the entry point as defined as part of the executable file format,
unless the an Entry Point feature is requested (see below), in which case,
the value of `rip` is going to be taken from there.
unless the Entry Point feature is requested (see below), in which case, the value
of `rip` is going to be taken from there.
At entry all segment registers are loaded as 64 bit code/data segments, limits
and bases are ignored since this is 64-bit mode.
@ -212,7 +212,7 @@ All other general purpose registers are set to 0.
### aarch64
`PC` will be the entry point as defined as part of the executable file format,
unless the an Entry Point feature is requested (see below), in which case,
unless the Entry Point feature is requested (see below), in which case,
the value of `PC` is going to be taken from there.
The contents of the `VBAR_EL1` register are undefined, and the kernel must load
@ -253,8 +253,8 @@ Vector registers are in an undefined state.
At entry the machine is executing in Supervisor mode.
`pc` will be the entry point as defined as part of the executable file format,
unless the an Entry Point feature is requested (see below), in which case,
the value of `pc` is going to be taken from there.
unless the Entry Point feature is requested (see below), in which case, the
value of `pc` is going to be taken from there.
`x1`(`ra`) is set to 0, the kernel must not return from the entry point.

View File

@ -23,6 +23,7 @@ Donations welcome, but absolutely not mandatory!
* IA-32 (32-bit x86)
* x86-64
* aarch64 (arm64)
* riscv64
### Supported boot protocols
* Linux
@ -48,7 +49,7 @@ opening issues or pull requests related to this.
For 32-bit x86 systems, support is only ensured starting with those with
Pentium Pro (i686) class CPUs.
All x86-64 and aarch64 (UEFI) systems are supported.
All x86-64, aarch64, and riscv64 (UEFI) systems are supported.
## Packaging status
@ -61,16 +62,16 @@ are shipped in the `-binary` branches and tags of this repository
(see [branches](https://github.com/limine-bootloader/limine/branches/all) and
[tags](https://github.com/limine-bootloader/limine/tags)).
For example, to clone the latest binary release of the `v4.x` branch one can do
For example, to clone the latest binary release of the `v5.x` branch one can do
```bash
git clone https://github.com/limine-bootloader/limine.git --branch=v4.x-branch-binary --depth=1
git clone https://github.com/limine-bootloader/limine.git --branch=v5.x-branch-binary --depth=1
```
or, to clone a specific binary point release (for example `v4.20231024.eol`)
or, to clone a specific binary point release (for example `v5.20231024.0`)
```bash
git clone https://github.com/limine-bootloader/limine.git --branch=v4.20231024.eol-binary --depth=1
git clone https://github.com/limine-bootloader/limine.git --branch=v5.20231024.0-binary --depth=1
```
In order to rebuild host utilities like `limine-deploy`, simply run `make` in the binary
In order to rebuild host utilities like `limine`, simply run `make` in the binary
release directory.
Host utility binaries are provided for Windows.
@ -85,7 +86,7 @@ Host utility binaries are provided for Windows.
In order to build Limine, the following programs have to be installed:
common UNIX tools (also known as `coreutils`),
`GNU make`, `grep`, `sed`, `find`, `awk`, `gzip`, `nasm`, `mtools`
(optional, necessary to build `limine-cd-efi.bin`).
(optional, necessary to build `limine-uefi-cd.bin`).
Furthermore, `gcc` or `llvm/clang` must also be installed, alongside
the respective binutils.
@ -145,17 +146,17 @@ Limine can be booted with secure boot if the executable is signed and the key us
sign it is added to the firmware's keychain. This should be done in combination with enrolling
the BLAKE2B hash of the Limine config file into the Limine EFI executable image itself for
verification purposes.
For more information see the `limine-enroll-config` program and [the philosophy](/PHILOSOPHY.md).
For more information see the `limine enroll-config` program and [the philosophy](/PHILOSOPHY.md).
### BIOS/MBR
In order to install Limine on a MBR device (which can just be a raw image file),
run `limine-deploy` as such:
run `limine bios-install` as such:
```bash
limine-deploy <path to device/image>
limine bios-install <path to device/image>
```
The boot device must contain the `limine.sys` and `limine.cfg` files in
The boot device must contain the `limine-bios.sys` and `limine.cfg` files in
either the root, `limine`, `boot`, or `boot/limine` directory of one of the
partitions, formatted with a supported file system.
@ -163,30 +164,30 @@ partitions, formatted with a supported file system.
If using a GPT formatted device, there are 2 options one can follow for
installation:
* Specifying a dedicated stage 2 partition.
* Letting `limine-deploy` attempt to embed stage 2 within GPT structures.
* Letting `limine bios-install` attempt to embed stage 2 within GPT structures.
In case one wants to specify a stage 2 partition, create a partition on the GPT
device of at least 32KiB in size, and pass the 1-based number of the partition
to `limine-deploy` as a second argument; such as:
to `limine bios-install` as a second argument; such as:
```bash
limine-deploy <path to device/image> <1-based stage 2 partition number>
limine bios-install <path to device/image> <1-based stage 2 partition number>
```
In case one wants to let `limine-deploy` embed stage 2 within GPT's structures,
simply omit the partition number, and invoke `limine-deploy` the same as one
In case one wants to let `limine bios-install` embed stage 2 within GPT's structures,
simply omit the partition number, and invoke `limine bios-install` the same as one
would do for an MBR partitioned device.
The boot device must contain the `limine.sys` and `limine.cfg` files in
The boot device must contain the `limine-bios.sys` and `limine.cfg` files in
either the root, `limine`, `boot`, or `boot/limine` directory of one of the
partitions, formatted with a supported file system.
### BIOS/UEFI hybrid ISO creation
In order to create a hybrid ISO with Limine, place the
`limine-cd-efi.bin`, `limine-cd.bin`, `limine.sys`, and `limine.cfg` files
`limine-uefi-cd.bin`, `limine-bios-cd.bin`, `limine-bios.sys`, and `limine.cfg` files
into a directory which will serve as the root of the created ISO.
(`limine.sys` and `limine.cfg` must either be in the root, `limine`, `boot`, or
`boot/limine` directory; `limine-cd-efi.bin` and `limine-cd.bin` can reside
(`limine-bios.sys` and `limine.cfg` must either be in the root, `limine`, `boot`, or
`boot/limine` directory; `limine-uefi-cd.bin` and `limine-bios-cd.bin` can reside
anywhere).
After that, create a `<ISO root directory>/EFI/BOOT` directory and copy the
@ -195,43 +196,43 @@ relevant Limine EFI executables over (such as `BOOTX64.EFI`).
Place any other file you want to be on the final ISO in said directory, then
run:
```
xorriso -as mkisofs -b <relative path of limine-cd.bin> \
xorriso -as mkisofs -b <relative path of limine-bios-cd.bin> \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot <relative path of limine-cd-efi.bin> \
--efi-boot <relative path of limine-uefi-cd.bin> \
-efi-boot-part --efi-boot-image --protective-msdos-label \
<root directory> -o image.iso
```
*Note: `xorriso` is required.*
And do not forget to also run `limine-deploy` on the generated image:
And do not forget to also run `limine bios-install` on the generated image:
```
limine-deploy image.iso
limine bios-install image.iso
```
`<relative path of limine-cd.bin>` is the relative path of
`limine-cd.bin` inside the root directory.
For example, if it was copied in `<root directory>/boot/limine-cd.bin`,
it would be `boot/limine-cd.bin`.
`<relative path of limine-bios-cd.bin>` is the relative path of
`limine-bios-cd.bin` inside the root directory.
For example, if it was copied in `<root directory>/boot/limine-bios-cd.bin`,
it would be `boot/limine-bios-cd.bin`.
`<relative path of limine-cd-efi.bin>` is the relative path of
`limine-cd-efi.bin` inside the root directory.
`<relative path of limine-uefi-cd.bin>` is the relative path of
`limine-uefi-cd.bin` inside the root directory.
For example, if it was copied in
`<root directory>/boot/limine-cd-efi.bin`, it would be
`boot/limine-cd-efi.bin`.
`<root directory>/boot/limine-uefi-cd.bin`, it would be
`boot/limine-uefi-cd.bin`.
### BIOS/PXE boot
The `limine-pxe.bin` binary is a valid PXE boot image.
The `limine-bios-pxe.bin` binary is a valid PXE boot image.
In order to boot Limine from PXE it is necessary to setup a DHCP server with
support for PXE booting. This can either be accomplished using a single DHCP
server or your existing DHCP server and a proxy DHCP server such as dnsmasq.
`limine.cfg` and `limine.sys` are expected to be on the server used for boot.
`limine.cfg` and `limine-bios.sys` are expected to be on the server used for boot.
### UEFI/PXE boot
The `BOOT*.EFI` files are compatible with UEFI PXE.
The steps needed to boot Limine are the same as with BIOS PXE,
except that the `limine.sys` file is not needed on the server.
except that the `limine-bios.sys` file is not needed on the server.
### Configuration
The `limine.cfg` file contains Limine's configuration.

View File

@ -26,7 +26,9 @@ fi
[ -d limine-efi ] || git clone https://github.com/limine-bootloader/limine-efi.git $SHALLOW_CLONE_FLAG
[ -d libgcc-binaries ] || git clone https://github.com/mintsuki/libgcc-binaries.git $SHALLOW_CLONE_FLAG
AUTOMAKE_LIBDIR="$(automake --print-libdir)"
cp "${AUTOMAKE_LIBDIR}/INSTALL" ./
mkdir -p build-aux
cp "$(automake --print-libdir)/install-sh" build-aux
cp "${AUTOMAKE_LIBDIR}/install-sh" build-aux/
autoreconf -fvi -Wall

View File

@ -35,7 +35,6 @@ override CFLAGS_FOR_TARGET += \
-Wextra \
-Wshadow \
-Wvla \
-Wno-deprecated-declarations \
$(WERROR_FLAG) \
-std=gnu11 \
-nostdinc \
@ -116,6 +115,29 @@ ifeq ($(TARGET),uefi-aarch64)
-DUEFI
endif
ifeq ($(TARGET),uefi-riscv64)
override CFLAGS_FOR_TARGET += \
-fPIE \
-fshort-wchar
ifeq ($(CC_FOR_TARGET_IS_CLANG),yes)
override CFLAGS_FOR_TARGET += -march=rv64imac
else
override CFLAGS_FOR_TARGET += -march=rv64imac_zicsr_zifencei
endif
override CFLAGS_FOR_TARGET += \
-mabi=lp64 \
-mno-relax
override CPPFLAGS_FOR_TARGET := \
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/riscv64' \
$(CPPFLAGS_FOR_TARGET) \
-DUEFI \
-D__riscv64
endif
override LDFLAGS_FOR_TARGET += \
-nostdlib \
-z max-page-size=0x1000
@ -158,6 +180,16 @@ ifeq ($(TARGET),uefi-aarch64)
-z text
endif
ifeq ($(TARGET),uefi-riscv64)
override LDFLAGS_FOR_TARGET += \
-m elf64lriscv \
--no-relax \
-static \
-pie \
--no-dynamic-linker \
-z text
endif
override C_FILES := $(shell find . -type f -name '*.c')
ifeq ($(TARGET),bios)
override ASMX86_FILES := $(shell find . -type f -name '*.asm_x86')
@ -187,19 +219,27 @@ ifeq ($(TARGET),uefi-aarch64)
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM64_FILES:.asm_aarch64=.o) $(ASM64U_FILES:.asm_uefi_aarch64=.o))
endif
ifeq ($(TARGET),uefi-riscv64)
override ASM64_FILES := $(shell find . -type f -name '*.asm_riscv64')
override ASM64U_FILES := $(shell find . -type f -name '*.asm_uefi_riscv64')
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM64_FILES:.asm_riscv64=.o) $(ASM64U_FILES:.asm_uefi_riscv64=.o))
endif
override HEADER_DEPS := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.d))
.PHONY: all
ifeq ($(TARGET),bios)
all: $(call MKESCAPE,$(BUILDDIR))/limine.sys $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz
all: $(call MKESCAPE,$(BUILDDIR))/limine-bios.sys $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz
else ifeq ($(TARGET),uefi-x86-64)
all: $(call MKESCAPE,$(BUILDDIR))/BOOTX64.EFI
else ifeq ($(TARGET),uefi-ia32)
all: $(call MKESCAPE,$(BUILDDIR))/BOOTIA32.EFI
else ifeq ($(TARGET),uefi-aarch64)
all: $(call MKESCAPE,$(BUILDDIR))/BOOTAA64.EFI
else ifeq ($(TARGET),uefi-riscv64)
all: $(call MKESCAPE,$(BUILDDIR))/BOOTRISCV64.EFI
endif
ifeq ($(TARGET),bios)
@ -207,7 +247,7 @@ ifeq ($(TARGET),bios)
$(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz: $(call MKESCAPE,$(BUILDDIR))/stage2.bin
gzip -n -9 < '$(call SHESCAPE,$<)' > '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/stage2.bin: $(call MKESCAPE,$(BUILDDIR))/limine.sys
$(call MKESCAPE,$(BUILDDIR))/stage2.bin: $(call MKESCAPE,$(BUILDDIR))/limine-bios.sys
dd if='$(call SHESCAPE,$<)' bs=$$(( 0x$$("$(READELF_FOR_TARGET)" -S '$(call SHESCAPE,$(BUILDDIR))/limine.elf' | $(GREP) '\.text\.stage3' | $(SED) 's/^.*] //' | $(AWK) '{print $$3}' | $(SED) 's/^0*//') - 0xf000 )) count=1 of='$(call SHESCAPE,$@)' 2>/dev/null
$(call MKESCAPE,$(BUILDDIR))/stage2.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
@ -222,7 +262,7 @@ $(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nos
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
rm -f '$(call SHESCAPE,$(BUILDDIR))/full.map.S' '$(call SHESCAPE,$(BUILDDIR))/full.map.d'
$(call MKESCAPE,$(BUILDDIR))/limine.sys: $(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf $(call MKESCAPE,$(BUILDDIR))/limine.elf
$(call MKESCAPE,$(BUILDDIR))/limine-bios.sys: $(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf $(call MKESCAPE,$(BUILDDIR))/limine.elf
$(OBJCOPY_FOR_TARGET) -O binary '$(call SHESCAPE,$(BUILDDIR))/limine.elf' '$(call SHESCAPE,$@)'
chmod -x '$(call SHESCAPE,$@)'
@ -390,6 +430,51 @@ $(call MKESCAPE,$(BUILDDIR))/limine.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi
'$(call OBJESCAPE,$^)' $(LDFLAGS_FOR_TARGET) -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET),uefi-riscv64)
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
cd '$(call SHESCAPE,$(BUILDDIR))' && \
'$(call SHESCAPE,$(SRCDIR))/gensyms.sh' '$(call SHESCAPE,$<)' full 64 '\.text'
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -c '$(call SHESCAPE,$(BUILDDIR))/full.map.S' -o '$(call SHESCAPE,$@)'
rm -f '$(call SHESCAPE,$(BUILDDIR))/full.map.S' '$(call SHESCAPE,$(BUILDDIR))/full.map.d'
$(call MKESCAPE,$(BUILDDIR))/BOOTRISCV64.EFI: $(call MKESCAPE,$(BUILDDIR))/limine.elf
$(OBJCOPY_FOR_TARGET) -O binary '$(call SHESCAPE,$<)' '$(call SHESCAPE,$@)'
chmod -x '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-riscv64.S.o: limine-efi
$(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_riscv64.c.o: limine-efi
.PHONY: limine-efi
limine-efi: $(call MKESCAPE,$(BUILDDIR))/limine-efi
$(MAKE) -C '$(call SHESCAPE,$(BUILDDIR))/limine-efi/gnuefi' \
CC="$(CC_FOR_TARGET)" \
CFLAGS="$(BASE_CFLAGS)" \
CPPFLAGS='-nostdinc -I$(call SHESCAPE,$(SRCDIR))/../freestanding-headers' \
ARCH=riscv64
$(call MKESCAPE,$(BUILDDIR))/linker_nomap.ld: linker_uefi_riscv64.ld.in
$(MKDIR_P) '$(call SHESCAPE,$(BUILDDIR))'
$(CC_FOR_TARGET) -x c -E -P -undef -DLINKER_NOMAP linker_uefi_riscv64.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-riscv64.S.o $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_riscv64.c.o $(OBJ) ../libgcc-binaries/libgcc-riscv64-softfloat.a
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld'
$(LD_FOR_TARGET) \
-T'$(call SHESCAPE,$(BUILDDIR))/linker_nomap.ld' \
'$(call OBJESCAPE,$^)' $(LDFLAGS_FOR_TARGET) -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/linker.ld: linker_uefi_riscv64.ld.in
$(MKDIR_P) '$(call SHESCAPE,$(BUILDDIR))'
$(CC_FOR_TARGET) -x c -E -P -undef linker_uefi_riscv64.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(call MKESCAPE,$(BUILDDIR))/limine.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/crt0-efi-riscv64.S.o $(call MKESCAPE,$(BUILDDIR))/limine-efi/gnuefi/reloc_riscv64.c.o $(OBJ) ../libgcc-binaries/libgcc-riscv64-softfloat.a $(call MKESCAPE,$(BUILDDIR))/full.map.o
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker.ld'
$(LD_FOR_TARGET) \
-T'$(call SHESCAPE,$(BUILDDIR))/linker.ld' \
'$(call OBJESCAPE,$^)' $(LDFLAGS_FOR_TARGET) -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET),uefi-ia32)
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
@ -450,6 +535,12 @@ $(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/limine-efi
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET),uefi-riscv64)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/limine-efi
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET),uefi-ia32)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/limine-efi
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
@ -510,6 +601,16 @@ $(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_uefi_aarch64
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -x assembler-with-cpp -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET),uefi-riscv64)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_riscv64
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -x assembler-with-cpp -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_uefi_riscv64
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(CPPFLAGS_FOR_TARGET) -x assembler-with-cpp -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
endif
ifeq ($(TARGET),uefi-ia32)
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_ia32
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"

View File

@ -0,0 +1,11 @@
.section .text
.global efi_main
.extern uefi_entry
efi_main:
.option norelax
mv fp, zero
mv ra, zero
j uefi_entry
.section .note.GNU-stack,"",%progbits

View File

@ -32,7 +32,7 @@ bool stage3_loaded = false;
static bool stage3_found = false;
extern symbol stage3_addr;
extern symbol limine_sys_size;
extern symbol limine_bios_sys_size;
extern symbol build_id_s2;
extern symbol build_id_s3;
@ -41,10 +41,10 @@ static bool stage3_init(struct volume *part) {
bool old_cif = case_insensitive_fopen;
case_insensitive_fopen = true;
if ((stage3 = fopen(part, "/limine.sys")) == NULL
&& (stage3 = fopen(part, "/limine/limine.sys")) == NULL
&& (stage3 = fopen(part, "/boot/limine.sys")) == NULL
&& (stage3 = fopen(part, "/boot/limine/limine.sys")) == NULL) {
if ((stage3 = fopen(part, "/limine-bios.sys")) == NULL
&& (stage3 = fopen(part, "/limine/limine-bios.sys")) == NULL
&& (stage3 = fopen(part, "/boot/limine-bios.sys")) == NULL
&& (stage3 = fopen(part, "/boot/limine/limine-bios.sys")) == NULL) {
case_insensitive_fopen = old_cif;
return false;
}
@ -52,8 +52,8 @@ static bool stage3_init(struct volume *part) {
stage3_found = true;
if (stage3->size != (size_t)limine_sys_size) {
print("limine.sys size incorrect.\n");
if (stage3->size != (size_t)limine_bios_sys_size) {
print("limine-bios.sys size incorrect.\n");
return false;
}
@ -64,7 +64,7 @@ static bool stage3_init(struct volume *part) {
fclose(stage3);
if (memcmp(build_id_s2 + 16, build_id_s3 + 16, 20) != 0) {
print("limine.sys build ID mismatch.\n");
print("limine-bios.sys build ID mismatch.\n");
return false;
}
@ -112,7 +112,7 @@ noreturn void entry(uint8_t boot_drive, int boot_from) {
if (!stage3_found) {
print("\n"
"!! Stage 3 file not found!\n"
"!! Have you copied limine.sys to the root, /boot, /limine, or /boot/limine\n"
"!! Have you copied limine-bios.sys to the root, /boot, /limine, or /boot/limine\n"
"!! directories of one of the partitions on the boot device?\n\n");
}

View File

@ -22,6 +22,7 @@
#include <drivers/disk.h>
#include <sys/lapic.h>
#include <lib/readline.h>
#include <sys/cpu.h>
void stage3_common(void);
@ -130,6 +131,18 @@ noreturn void stage3_common(void) {
init_io_apics();
#endif
#if defined (__riscv)
#if defined (UEFI)
RISCV_EFI_BOOT_PROTOCOL *rv_proto = get_riscv_boot_protocol();
if (rv_proto == NULL || rv_proto->GetBootHartId(rv_proto, &bsp_hartid) != EFI_SUCCESS) {
panic(false, "failed to get BSP's hartid");
}
#else
#error riscv: only UEFI is supported
#endif
init_riscv();
#endif
term_notready();
menu(true);

View File

@ -196,6 +196,8 @@ int init_config(size_t config_size) {
}
#elif defined (__aarch64__)
strcpy(arch_macro->value, "aarch64");
#elif defined (__riscv64)
strcpy(arch_macro->value, "riscv64");
#else
#error "Unspecified architecture"
#endif
@ -251,10 +253,17 @@ int init_config(size_t config_size) {
panic(true, "config: Malformed macro usage");
}
}
if (config_addr[i] != '=') {
if (config_addr[i++] != '=') {
i = orig_i;
goto next;
}
while (config_addr[i] != '\n' && config_addr[i] != 0) {
i++;
if (i >= config_size) {
bad_config = true;
panic(true, "config: Malformed macro usage");
}
}
continue;
}

View File

@ -28,11 +28,14 @@
#define ARCH_X86_64 0x3e
#define ARCH_X86_32 0x03
#define ARCH_AARCH64 0xb7
#define ARCH_RISCV 0xf3
#define BITS_LE 0x01
#define ELFCLASS64 0x02
#define ET_DYN 0x0003
#define SHT_RELA 0x00000004
#define R_X86_64_RELATIVE 0x00000008
#define R_AARCH64_RELATIVE 0x00000403
#define R_RISCV_RELATIVE 0x00000003
/* Indices into identification array */
#define EI_CLASS 4
@ -103,6 +106,8 @@ int elf_bits(uint8_t *elf) {
case ARCH_X86_64:
case ARCH_AARCH64:
return 64;
case ARCH_RISCV:
return (hdr->ident[EI_CLASS] == ELFCLASS64) ? 64 : 32;
case ARCH_X86_32:
return 32;
default:
@ -226,6 +231,8 @@ static bool elf64_apply_relocations(uint8_t *elf, struct elf64_hdr *hdr, void *b
case R_X86_64_RELATIVE:
#elif defined (__aarch64__)
case R_AARCH64_RELATIVE:
#elif defined (__riscv64)
case R_RISCV_RELATIVE:
#else
#error Unknown architecture
#endif
@ -281,6 +288,11 @@ bool elf64_load_section(uint8_t *elf, void *buffer, const char *name, size_t lim
printv("elf: Not an aarch64 ELF file.\n");
return false;
}
#elif defined (__riscv64)
if (hdr->machine != ARCH_RISCV && hdr->ident[EI_CLASS] == ELFCLASS64) {
printv("elf: Not a riscv64 ELF file.\n");
return false;
}
#else
#error Unknown architecture
#endif
@ -420,6 +432,10 @@ bool elf64_load(uint8_t *elf, uint64_t *entry_point, uint64_t *_slide, uint32_t
if (hdr->machine != ARCH_AARCH64) {
panic(true, "elf: Not an aarch64 ELF file.\n");
}
#elif defined (__riscv64)
if (hdr->machine != ARCH_RISCV && hdr->ident[EI_CLASS] == ELFCLASS64) {
panic(true, "elf: Not a riscv64 ELF file.\n");
}
#else
#error Unknown architecture
#endif

View File

@ -110,6 +110,46 @@ uint32_t hex2bin(uint8_t *str, uint32_t size) {
#if defined (UEFI)
#if defined (__riscv)
RISCV_EFI_BOOT_PROTOCOL *get_riscv_boot_protocol(void) {
EFI_GUID boot_proto_guid = RISCV_EFI_BOOT_PROTOCOL_GUID;
RISCV_EFI_BOOT_PROTOCOL *proto;
// LocateProtocol() is available from EFI version 1.1
if (gBS->Hdr.Revision >= ((1 << 16) | 10)) {
if (gBS->LocateProtocol(&boot_proto_guid, NULL, (void **)&proto) == EFI_SUCCESS) {
return proto;
}
}
UINTN bufsz = 0;
if (gBS->LocateHandle(ByProtocol, &boot_proto_guid, NULL, &bufsz, NULL) != EFI_BUFFER_TOO_SMALL)
return NULL;
EFI_HANDLE *handles_buf = ext_mem_alloc(bufsz);
if (handles_buf == NULL)
return NULL;
if (bufsz < sizeof(EFI_HANDLE))
goto error;
if (gBS->LocateHandle(ByProtocol, &boot_proto_guid, NULL, &bufsz, handles_buf) != EFI_SUCCESS)
goto error;
if (gBS->HandleProtocol(handles_buf[0], &boot_proto_guid, (void **)&proto) != EFI_SUCCESS)
goto error;
pmm_free(handles_buf, bufsz);
return proto;
error:
pmm_free(handles_buf, bufsz);
return NULL;
}
#endif
no_unwind bool efi_boot_services_exited = false;
bool efi_exit_boot_services(void) {
@ -163,6 +203,8 @@ retry:
asm volatile ("cli" ::: "memory");
#elif defined (__aarch64__)
asm volatile ("msr daifset, #15" ::: "memory");
#elif defined (__riscv64)
asm volatile ("csrci sstatus, 0x2" ::: "memory");
#else
#error Unknown architecture
#endif

View File

@ -10,6 +10,9 @@
#include <lib/libc.h>
#if defined (UEFI)
# include <efi.h>
# if defined (__riscv64)
# include <protocol/riscv/efiboot.h>
# endif
#endif
#if defined (UEFI)
@ -57,7 +60,7 @@ uint64_t strtoui(const char *s, const char **end, int base);
#if defined (__i386__)
void memcpy32to64(uint64_t, uint64_t, uint64_t);
#elif defined (__x86_64__) || defined (__aarch64__)
#elif defined (__x86_64__) || defined (__aarch64__) || defined(__riscv64)
# define memcpy32to64(X, Y, Z) memcpy((void *)(uintptr_t)(X), (void *)(uintptr_t)(Y), Z)
#else
#error Unknown architecture
@ -95,6 +98,11 @@ noreturn void common_spinup(void *fnptr, int args, ...);
noreturn void enter_in_el1(uint64_t entry, uint64_t sp, uint64_t sctlr,
uint64_t mair, uint64_t tcr, uint64_t ttbr0,
uint64_t ttbr1, uint64_t target_x0);
#elif defined (__riscv64)
noreturn void riscv_spinup(uint64_t entry, uint64_t sp, uint64_t satp);
#if defined (UEFI)
RISCV_EFI_BOOT_PROTOCOL *get_riscv_boot_protocol(void);
#endif
#else
#error Unknown architecture
#endif

View File

@ -74,7 +74,7 @@ noreturn void panic(bool allow_menu, const char *fmt, ...) {
for (;;) {
#if defined (__x86_64__) || defined (__i386__)
asm ("hlt");
#elif defined (__aarch64__)
#elif defined (__aarch64__) || defined (__riscv64)
asm ("wfi");
#else
#error Unknown architecture

View File

@ -0,0 +1,47 @@
.section .text
.global riscv_spinup
riscv_spinup:
.option norelax
csrci sstatus, 0x2
csrw sie, zero
csrw stvec, zero
mv t0, a0
mv sp, a1
csrw satp, a2
mv a0, zero
mv a1, zero
mv a2, zero
mv a3, zero
mv a4, zero
mv a5, zero
mv a6, zero
mv a7, zero
mv s0, zero
mv s1, zero
mv s2, zero
mv s3, zero
mv s4, zero
mv s5, zero
mv s6, zero
mv s7, zero
mv s8, zero
mv s9, zero
mv s10, zero
mv s11, zero
mv t1, zero
mv t2, zero
mv t3, zero
mv t4, zero
mv t5, zero
mv t6, zero
mv tp, zero
mv gp, zero
mv ra, zero
jr t0
.section .note.GNU-stack,"",%progbits

View File

@ -346,7 +346,7 @@ void _term_write(struct flanterm_context *term, uint64_t buf, uint64_t count) {
}
bool native = false;
#if defined (__x86_64__) || defined (__aarch64__)
#if defined (__x86_64__) || defined (__aarch64__) || defined (__riscv64)
native = true;
#elif !defined (__i386__)
#error Unknown architecture

View File

@ -54,6 +54,8 @@ void print_stacktrace(size_t *base_ptr) {
"movq %%rbp, %0"
#elif defined (__aarch64__)
"mov %0, x29"
#elif defined (__riscv64)
"mv %0, fp; addi %0, %0, -16"
#endif
: "=r"(base_ptr)
:: "memory"
@ -73,7 +75,11 @@ void print_stacktrace(size_t *base_ptr) {
print(" [%p]\n", ret_addr);
if (!old_bp)
break;
#if defined (__riscv)
base_ptr = (void *)(old_bp - 16);
#else
base_ptr = (void*)old_bp;
#endif
}
print("End of trace. ");
}

View File

@ -93,7 +93,7 @@ SECTIONS
.note.gnu.build-id : {
*(.note.gnu.build-id)
limine_sys_size = . - 0xf000;
limine_bios_sys_size = . - 0xf000;
} :data_s3
.bss : {

View File

@ -0,0 +1,81 @@
OUTPUT_FORMAT(elf64-littleriscv)
OUTPUT_ARCH(riscv:rv64)
ENTRY(_start)
PHDRS
{
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ;
rodata PT_LOAD FLAGS((1 << 2)) ;
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ;
dynamic PT_DYNAMIC FLAGS((1 << 1) | (1 << 2)) ;
}
SECTIONS
{
. = 0;
__slide = .;
__image_base = ABSOLUTE(.);
__image_size = ABSOLUTE(__image_end - __image_base);
.text : {
*(.pe_header)
. = ALIGN(0x1000);
__text_start = ABSOLUTE(.);
*(.text .text.*)
} :text
. = ALIGN(0x1000);
__text_end = ABSOLUTE(.);
__text_size = ABSOLUTE(__text_end - __text_start);
.rodata : {
__reloc_start = ABSOLUTE(.);
*(.dummy_reloc)
. = ALIGN(0x1000);
__reloc_end = ABSOLUTE(.);
__reloc_size = ABSOLUTE(__reloc_end - __reloc_start);
__data_start = ABSOLUTE(.);
*(.rodata .rodata.*)
#ifdef LINKER_NOMAP
full_map = .;
#else
*(.full_map)
#endif
} :rodata
.data : {
data_begin = .;
*(.data .data.*)
*(.sdata .sdata.*)
*(.sbss .sbss.*)
*(.bss .bss.*)
*(COMMON)
data_end = .;
*(.no_unwind)
} :data
.got : {
*(.got .got.*)
} :data
.dynamic : {
*(.dynamic)
. = ALIGN(0x1000);
} :data :dynamic
__data_end = ABSOLUTE(.);
__data_size = ABSOLUTE(__data_end - __data_start);
__image_end = ABSOLUTE(.);
/DISCARD/ : {
*(.eh_frame)
*(.note .note.*)
}
}

View File

@ -977,21 +977,21 @@ noreturn void boot(char *config) {
linux_load(config, cmdline);
#else
quiet = false;
print("TODO: Linux is not available on aarch64.\n\n");
print("TODO: Linux is not available on aarch64 or riscv64.\n\n");
#endif
} else if (!strcmp(proto, "multiboot1") || !strcmp(proto, "multiboot")) {
#if defined (__x86_64__) || defined (__i386__)
multiboot1_load(config, cmdline);
#else
quiet = false;
print("Multiboot 1 is not available on aarch64.\n\n");
print("Multiboot 1 is not available on aarch64 or riscv64.\n\n");
#endif
} else if (!strcmp(proto, "multiboot2")) {
#if defined (__x86_64__) || defined (__i386__)
multiboot2_load(config, cmdline);
#else
quiet = false;
print("Multiboot 2 is not available on aarch64.\n\n");
print("Multiboot 2 is not available on aarch64 or riscv64.\n\n");
#endif
} else if (!strcmp(proto, "chainload_next")) {
chainload_next(config, cmdline);

View File

@ -0,0 +1,24 @@
.section .data
.p2align 3
stack_at_first_entry:
.8byte 0
.section .text
.global menu
.extern _menu
menu:
.option norelax
lla t0, stack_at_first_entry
ld t1, (t0)
beqz t1, 1f
mv sp, t1
j 2f
1: sd sp, (t0)
2: mv fp, zero
mv ra, zero
j _menu
.section .note.GNU-stack,"",%progbits

View File

@ -243,6 +243,152 @@ level4:
pml1[pml1_entry] = (pt_entry_t)(phys_addr | real_flags | PT_FLAG_4K_PAGE);
}
#elif defined (__riscv64)
#define PT_FLAG_VALID ((uint64_t)1 << 0)
#define PT_FLAG_READ ((uint64_t)1 << 1)
#define PT_FLAG_WRITE ((uint64_t)1 << 2)
#define PT_FLAG_EXEC ((uint64_t)1 << 3)
#define PT_FLAG_USER ((uint64_t)1 << 4)
#define PT_FLAG_ACCESSED ((uint64_t)1 << 6)
#define PT_FLAG_DIRTY ((uint64_t)1 << 7)
#define PT_FLAG_PBMT_NC ((uint64_t)1 << 62)
#define PT_PADDR_MASK ((uint64_t)0x003ffffffffffc00)
#define PT_FLAG_RWX (PT_FLAG_READ | PT_FLAG_WRITE | PT_FLAG_EXEC)
#define PT_TABLE_FLAGS PT_FLAG_VALID
#define PT_IS_TABLE(x) (((x) & (PT_FLAG_VALID | PT_FLAG_RWX)) == PT_FLAG_VALID)
#define PT_IS_LARGE(x) (((x) & (PT_FLAG_VALID | PT_FLAG_RWX)) > PT_FLAG_VALID)
#define PT_TO_VMM_FLAGS(x) (pt_to_vmm_flags_internal(x))
#define pte_new(addr, flags) (((pt_entry_t)(addr) >> 2) | (flags))
#define pte_addr(pte) (((pte) & PT_PADDR_MASK) << 2)
static uint64_t pt_to_vmm_flags_internal(pt_entry_t entry) {
uint64_t flags = 0;
if (entry & PT_FLAG_WRITE)
flags |= VMM_FLAG_WRITE;
if (!(entry & PT_FLAG_EXEC))
flags |= VMM_FLAG_NOEXEC;
if (entry & PT_FLAG_PBMT_NC)
flags |= VMM_FLAG_FB;
return flags;
}
uint64_t paging_mode_higher_half(int paging_mode) {
switch (paging_mode) {
case PAGING_MODE_RISCV_SV39:
return 0xffffffc000000000;
case PAGING_MODE_RISCV_SV48:
return 0xffff800000000000;
case PAGING_MODE_RISCV_SV57:
return 0xff00000000000000;
default:
panic(false, "paging_mode_higher_half: invalid mode");
}
}
int paging_mode_va_bits(int paging_mode) {
switch (paging_mode) {
case PAGING_MODE_RISCV_SV39:
return 39;
case PAGING_MODE_RISCV_SV48:
return 48;
case PAGING_MODE_RISCV_SV57:
return 57;
default:
panic(false, "paging_mode_va_bits: invalid mode");
}
}
int vmm_max_paging_mode(void)
{
static int max_level;
if (max_level > 0)
goto done;
pt_entry_t *table = ext_mem_alloc(PT_SIZE);
// Test each paging mode starting with Sv57.
// Since writes to `satp` with an invalid MODE have no effect, and pages can be mapped at
// any level, we can identity map the entire lower half (very likely guaranteeing everything
// this code needs will be mapped) and check if enabling the paging mode succeeds.
int lvl = 4;
for (; lvl >= 2; lvl--) {
pt_entry_t entry = PT_FLAG_ACCESSED | PT_FLAG_DIRTY | PT_FLAG_RWX | PT_FLAG_VALID;
for (int i = 0; i < 256; i++) {
table[i] = entry;
entry += page_sizes[lvl] >> 2;
}
uint64_t satp = ((uint64_t)(6 + lvl) << 60) | ((uint64_t)table >> 12);
csr_write("satp", satp);
if (csr_read("satp") == satp) {
max_level = lvl;
break;
}
}
csr_write("satp", 0);
pmm_free(table, PT_SIZE);
if (max_level == 0)
panic(false, "vmm: paging is not supported");
done:
return 6 + max_level;
}
static pt_entry_t pbmt_nc = 0;
pagemap_t new_pagemap(int paging_mode) {
pagemap_t pagemap;
pagemap.paging_mode = paging_mode;
pagemap.max_page_size = paging_mode - 6;
pagemap.top_level = ext_mem_alloc(PT_SIZE);
if (riscv_check_isa_extension("svpbmt", NULL, NULL)) {
printv("riscv: Svpbmt extension is supported.\n");
pbmt_nc = PT_FLAG_PBMT_NC;
}
return pagemap;
}
void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_t flags, enum page_size page_size) {
// Truncate the requested page size to the maximum supported.
if (page_size > pagemap.max_page_size)
page_size = pagemap.max_page_size;
// Convert VMM_FLAG_* into PT_FLAG_*.
// Set the ACCESSED and DIRTY flags to avoid faults.
pt_entry_t ptflags = PT_FLAG_VALID | PT_FLAG_READ | PT_FLAG_ACCESSED | PT_FLAG_DIRTY;
if (flags & VMM_FLAG_WRITE)
ptflags |= PT_FLAG_WRITE;
if (!(flags & VMM_FLAG_NOEXEC))
ptflags |= PT_FLAG_EXEC;
if (flags & VMM_FLAG_FB)
ptflags |= pbmt_nc;
// Start at the highest level.
// The values of `enum page_size` map to the level index at which that size is mapped.
int level = pagemap.max_page_size;
pt_entry_t *table = pagemap.top_level;
for (;;) {
int index = (virt_addr >> (12 + 9 * level)) & 0x1ff;
// Stop when we reach the level for the requested page size.
if (level == (int)page_size) {
table[index] = pte_new(phys_addr, ptflags);
break;
}
table = get_next_level(pagemap, table, virt_addr, page_size, level, index);
level--;
}
}
#else
#error Unknown architecture
#endif

View File

@ -77,8 +77,45 @@ void vmm_assert_4k_pages(void);
pagemap_t new_pagemap(int lv);
void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_t flags, enum page_size page_size);
#elif defined (__riscv64)
// We use fake flags here because these don't properly map onto the
// RISC-V flags.
#define VMM_FLAG_WRITE ((uint64_t)1 << 0)
#define VMM_FLAG_NOEXEC ((uint64_t)1 << 1)
#define VMM_FLAG_FB ((uint64_t)1 << 2)
#define VMM_MAX_LEVEL 5
#define PAGING_MODE_RISCV_SV39 8
#define PAGING_MODE_RISCV_SV48 9
#define PAGING_MODE_RISCV_SV57 10
int paging_mode_va_bits(int paging_mode);
enum page_size {
Size4KiB,
Size2MiB,
Size1GiB,
Size512GiB,
Size256TiB
};
typedef struct {
enum page_size max_page_size;
int paging_mode;
void *top_level;
} pagemap_t;
uint64_t paging_mode_higher_half(int paging_mode);
int vmm_max_paging_mode(void);
pagemap_t new_pagemap(int paging_mode);
void map_page(pagemap_t pagemap, uint64_t virt_addr, uint64_t phys_addr, uint64_t flags, enum page_size page_size);
#else
#error Unknown architecture
#endif
int vmm_max_paging_mode(void);
#endif

View File

@ -180,7 +180,7 @@ extern symbol limine_spinup_32;
| ((uint64_t)1 << 8) /* TTBR0 Inner WB RW-Allocate */ \
| ((uint64_t)(tsz) << 0)) /* Address bits in TTBR0 */
#else
#elif !defined (__riscv64)
#error Unknown architecture
#endif
@ -279,28 +279,6 @@ static void *_get_request(uint64_t id[4]) {
#define FEAT_START do {
#define FEAT_END } while (0);
#if defined (__i386__)
extern symbol limine_term_write_entry;
void *limine_rt_stack = NULL;
uint64_t limine_term_callback_ptr = 0;
uint64_t limine_term_write_ptr = 0;
void limine_term_callback(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
#endif
static uint64_t term_arg;
static void (*actual_callback)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
static void callback_shim(struct flanterm_context *ctx, uint64_t a, uint64_t b, uint64_t c, uint64_t d) {
(void)ctx;
actual_callback(term_arg, a, b, c, d);
}
// TODO pair with specific terminal
static void term_write_shim(uint64_t context, uint64_t buf, uint64_t count) {
(void)context;
_term_write(terms[0], buf, count);
}
noreturn void limine_load(char *config, char *cmdline) {
#if defined (__x86_64__) || defined (__i386__)
uint32_t eax, ebx, ecx, edx;
@ -428,20 +406,27 @@ noreturn void limine_load(char *config, char *cmdline) {
paging_mode = max_paging_mode = PAGING_MODE_AARCH64_4LVL;
// TODO(qookie): aarch64 also has optional 5 level paging when using 4K pages
#elif defined (__riscv64)
max_paging_mode = vmm_max_paging_mode();
paging_mode = max_paging_mode >= PAGING_MODE_RISCV_SV48 ? PAGING_MODE_RISCV_SV48 : PAGING_MODE_RISCV_SV39;
#else
#error Unknown architecture
#endif
#if defined (__riscv64)
#define paging_mode_limine_to_vmm(x) (PAGING_MODE_RISCV_SV39 + (x))
#define paging_mode_vmm_to_limine(x) ((x) - PAGING_MODE_RISCV_SV39)
#else
#define paging_mode_limine_to_vmm(x) (x)
#define paging_mode_vmm_to_limine(x) (x)
#endif
bool have_paging_mode_request = false;
bool paging_mode_set = false;
FEAT_START
struct limine_paging_mode_request *pm_request = get_request(LIMINE_PAGING_MODE_REQUEST);
if (pm_request == NULL)
break;
have_paging_mode_request = true;
if (pm_request->mode > LIMINE_PAGING_MODE_MAX) {
print("warning: ignoring invalid mode in paging mode request\n");
@ -461,35 +446,6 @@ FEAT_START
pm_response->mode = paging_mode_vmm_to_limine(paging_mode);
pm_request->response = reported_addr(pm_response);
FEAT_END
// 5 level paging feature & HHDM slide
FEAT_START
struct limine_5_level_paging_request *lv5pg_request = get_request(LIMINE_5_LEVEL_PAGING_REQUEST);
if (lv5pg_request == NULL)
break;
if (have_paging_mode_request) {
print("paging: ignoring 5-level paging request in favor of paging mode request\n");
break;
}
#if defined (__x86_64__) || defined (__i386__)
if (max_paging_mode < PAGING_MODE_X86_64_5LVL)
break;
paging_mode = PAGING_MODE_X86_64_5LVL;
#elif defined (__aarch64__)
if (max_paging_mode < PAGING_MODE_AARCH64_5LVL)
break;
paging_mode = PAGING_MODE_AARCH64_5LVL;
#else
#error Unknown architecture
#endif
set_paging_mode(paging_mode, kaslr);
paging_mode_set = true;
void *lv5pg_response = ext_mem_alloc(sizeof(struct limine_5_level_paging_response));
lv5pg_request->response = reported_addr(lv5pg_response);
FEAT_END
if (!paging_mode_set) {
@ -812,92 +768,9 @@ FEAT_END
parse_resolution(&req_width, &req_height, &req_bpp, resolution);
}
uint64_t *term_fb_ptr = NULL;
uint64_t term_fb_addr;
struct fb_info *fbs;
size_t fbs_count;
// Terminal feature
FEAT_START
struct limine_terminal_request *terminal_request = get_request(LIMINE_TERMINAL_REQUEST);
if (terminal_request == NULL) {
break; // next feature
}
struct limine_terminal_response *terminal_response =
ext_mem_alloc(sizeof(struct limine_terminal_response));
terminal_response->revision = 1;
struct limine_terminal *terminal = ext_mem_alloc(sizeof(struct limine_terminal));
quiet = false;
serial = false;
char *term_conf_override_s = config_get_value(config, 0, "TERM_CONFIG_OVERRIDE");
if (term_conf_override_s != NULL && strcmp(term_conf_override_s, "yes") == 0) {
if (!gterm_init(&fbs, &fbs_count, config, req_width, req_height)) {
goto term_fail;
}
} else {
if (!gterm_init(&fbs, &fbs_count, NULL, req_width, req_height)) {
goto term_fail;
}
}
if (0) {
term_fail:
pmm_free(terminal, sizeof(struct limine_terminal));
pmm_free(terminal_response, sizeof(struct limine_terminal_response));
break; // next feature
}
if (terminal_request->callback != 0) {
terms[0]->callback = callback_shim;
#if defined (__i386__)
actual_callback = (void *)limine_term_callback;
limine_term_callback_ptr = terminal_request->callback;
#elif defined (__x86_64__) || defined (__aarch64__)
actual_callback = (void *)terminal_request->callback;
#else
#error Unknown architecture
#endif
}
term_arg = reported_addr(terminal);
#if defined (__i386__)
if (limine_rt_stack == NULL) {
limine_rt_stack = ext_mem_alloc(16384) + 16384;
}
limine_term_write_ptr = (uintptr_t)term_write_shim;
terminal_response->write = (uintptr_t)(void *)limine_term_write_entry;
#elif defined (__x86_64__) || defined (__aarch64__)
terminal_response->write = (uintptr_t)term_write_shim;
#else
#error Unknown architecture
#endif
term_fb_ptr = &terminal->framebuffer;
term_fb_addr = reported_addr((void *)(((struct flanterm_fb_context *)terms[0])->framebuffer));
terminal->columns = terms[0]->cols;
terminal->rows = terms[0]->rows;
uint64_t *term_list = ext_mem_alloc(1 * sizeof(uint64_t));
term_list[0] = reported_addr(terminal);
terminal_response->terminal_count = 1;
terminal_response->terminals = reported_addr(term_list);
terminal_request->response = reported_addr(terminal_response);
goto skip_fb_init;
FEAT_END
term_notready();
fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp);
@ -905,7 +778,6 @@ FEAT_END
goto no_fb;
}
skip_fb_init:
for (size_t i = 0; i < fbs_count; i++) {
memmap_alloc_range(fbs[i].framebuffer_addr,
(uint64_t)fbs[i].framebuffer_pitch * fbs[i].framebuffer_height,
@ -915,7 +787,7 @@ skip_fb_init:
// Framebuffer feature
FEAT_START
struct limine_framebuffer_request *framebuffer_request = get_request(LIMINE_FRAMEBUFFER_REQUEST);
if (framebuffer_request == NULL && term_fb_ptr == NULL) {
if (framebuffer_request == NULL) {
break; // next feature
}
@ -964,14 +836,6 @@ FEAT_START
if (framebuffer_request != NULL) {
framebuffer_request->response = reported_addr(framebuffer_response);
}
if (term_fb_ptr != NULL) {
for (size_t i = 0; i < fbs_count; i++) {
if (fbp[i].address == term_fb_addr) {
*term_fb_ptr = reported_addr(&fbp[i]);
break;
}
}
}
FEAT_END
no_fb:
@ -1094,6 +958,8 @@ FEAT_START
smp_info = init_smp(&cpu_count, &bsp_mpidr,
pagemap, LIMINE_MAIR(fb_attr), LIMINE_TCR(tsz, pa), LIMINE_SCTLR);
#elif defined (__riscv64)
smp_info = init_smp(&cpu_count, pagemap);
#else
#error Unknown architecture
#endif
@ -1115,6 +981,8 @@ FEAT_START
smp_response->bsp_lapic_id = bsp_lapic_id;
#elif defined (__aarch64__)
smp_response->bsp_mpidr = bsp_mpidr;
#elif defined (__riscv64)
smp_response->bsp_hartid = bsp_hartid;
#else
#error Unknown architecture
#endif
@ -1197,9 +1065,6 @@ FEAT_START
memmap_request->response = reported_addr(memmap_response);
FEAT_END
// Clear terminal for kernels that will use the Limine terminal
FOR_TERM(flanterm_write(TERM, "\e[2J\e[H", 7));
#if defined (__x86_64__) || defined (__i386__)
#if defined (BIOS)
// If we're going 64, we might as well call this BIOS interrupt
@ -1241,6 +1106,11 @@ FEAT_END
enter_in_el1(entry_point, reported_stack, LIMINE_SCTLR, LIMINE_MAIR(fb_attr), LIMINE_TCR(tsz, pa),
(uint64_t)pagemap.top_level[0],
(uint64_t)pagemap.top_level[1], 0);
#elif defined (__riscv64)
uint64_t reported_stack = reported_addr(stack);
uint64_t satp = make_satp(pagemap.paging_mode, pagemap.top_level);
riscv_spinup(entry_point, reported_stack, satp);
#else
#error Unknown architecture
#endif

View File

@ -1,120 +0,0 @@
section .bss
user_stack:
resq 1
user_cs: resq 1
user_ds: resq 1
user_es: resq 1
user_ss: resq 1
section .text
extern term_write
extern limine_rt_stack
extern limine_term_callback_ptr
extern limine_term_write_ptr
global limine_term_callback
limine_term_callback:
bits 32
push ebp
mov ebp, esp
push ebx
push esi
push edi
; Go 64
push 0x28
push .mode64
retfd
bits 64
.mode64:
mov eax, 0x30
mov ds, ax
mov es, ax
mov ss, ax
mov rdi, [rbp + 8]
mov rsi, [rbp + 16]
mov rdx, [rbp + 24]
mov rcx, [rbp + 32]
mov r8, [rbp + 40]
mov rbx, rsp
mov rsp, [user_stack]
call [limine_term_callback_ptr]
mov rsp, rbx
; Go 32
push 0x18
push .mode32
retfq
bits 32
.mode32:
mov eax, 0x20
mov ds, ax
mov es, ax
mov ss, ax
pop edi
pop esi
pop ebx
pop ebp
ret
global limine_term_write_entry
limine_term_write_entry:
bits 64
push rbx
push rbp
push r12
push r13
push r14
push r15
mov [user_stack], rsp
mov esp, [limine_rt_stack]
mov word [user_cs], cs
mov word [user_ds], ds
mov word [user_es], es
mov word [user_ss], ss
push rdx
push rsi
push rdi
push 0x18
push .mode32
retfq
bits 32
.mode32:
mov eax, 0x20
mov ds, ax
mov es, ax
mov ss, ax
call [limine_term_write_ptr]
add esp, 24
push dword [user_cs]
push .mode64
retfd
bits 64
.mode64:
mov ds, word [user_ds]
mov es, word [user_es]
mov ss, word [user_ss]
mov rsp, [user_stack]
pop r15
pop r14
pop r13
pop r12
pop rbp
pop rbx
ret

View File

@ -1,140 +0,0 @@
extern _GLOBAL_OFFSET_TABLE_
section .bss
user_stack:
resq 1
user_cs: resq 1
user_ds: resq 1
user_es: resq 1
user_ss: resq 1
section .text
extern term_write
extern limine_rt_stack
extern limine_term_callback_ptr
extern limine_term_write_ptr
global limine_term_callback
limine_term_callback:
bits 32
push ebp
mov ebp, esp
push ebx
push esi
push edi
; Go 64
push 0x28
call .p1
.p1:
add dword [esp], .mode64 - .p1
retfd
bits 64
.mode64:
mov eax, 0x30
mov ds, ax
mov es, ax
mov ss, ax
mov rdi, [rbp + 8]
mov rsi, [rbp + 16]
mov rdx, [rbp + 24]
mov rcx, [rbp + 32]
mov r8, [rbp + 40]
call .get_got
.get_got:
pop rax
add rax, _GLOBAL_OFFSET_TABLE_ + $$ - .get_got wrt ..gotpc
mov rbx, rsp
mov rsp, [rax + user_stack wrt ..gotoff]
call [rax + limine_term_callback_ptr wrt ..gotoff]
mov rsp, rbx
; Go 32
push 0x18
call .p2
.p2:
add qword [rsp], .mode32 - .p2
retfq
bits 32
.mode32:
mov eax, 0x20
mov ds, ax
mov es, ax
mov ss, ax
pop edi
pop esi
pop ebx
pop ebp
ret
bits 64
global limine_term_write_entry
limine_term_write_entry:
push rbx
push rbp
push r12
push r13
push r14
push r15
call .get_got
.get_got:
pop rbx
add ebx, _GLOBAL_OFFSET_TABLE_ + $$ - .get_got wrt ..gotpc
mov [rbx + user_stack wrt ..gotoff], rsp
mov esp, [rbx + limine_rt_stack wrt ..gotoff]
mov word [rbx + user_cs wrt ..gotoff], cs
mov word [rbx + user_ds wrt ..gotoff], ds
mov word [rbx + user_es wrt ..gotoff], es
mov word [rbx + user_ss wrt ..gotoff], ss
push rdx
push rsi
push rdi
push 0x18
call .p1
.p1:
add qword [rsp], .mode32 - .p1
retfq
bits 32
.mode32:
mov eax, 0x20
mov ds, ax
mov es, ax
mov ss, ax
call [ebx + limine_term_write_ptr wrt ..gotoff]
add esp, 24
push dword [ebx + user_cs wrt ..gotoff]
call .p2
.p2:
add dword [esp], .mode64 - .p2
retfd
bits 64
.mode64:
mov ds, word [rbx + user_ds wrt ..gotoff]
mov es, word [rbx + user_es wrt ..gotoff]
mov ss, word [rbx + user_ss wrt ..gotoff]
mov rsp, [rbx + user_stack wrt ..gotoff]
pop r15
pop r14
pop r13
pop r12
pop rbp
pop rbx
ret

View File

@ -287,6 +287,63 @@ inline int current_el(void) {
return v;
}
#elif defined (__riscv64)
inline uint64_t rdtsc(void) {
uint64_t v;
asm ("rdtime %0" : "=r"(v));
return v;
}
#define csr_read(csr) ({\
size_t v;\
asm volatile ("csrr %0, " csr : "=r"(v));\
v;\
})
#define csr_write(csr, v) ({\
size_t old;\
asm volatile ("csrrw %0, " csr ", %1" : "=r"(old) : "r"(v));\
old;\
})
#define make_satp(mode, ppn) (((size_t)(mode) << 60) | ((size_t)(ppn) >> 12))
#define locked_read(var) ({ \
typeof(*var) locked_read__ret; \
asm volatile ( \
"ld %0, (%1); fence r, rw" \
: "=r"(locked_read__ret) \
: "r"(var) \
: "memory" \
); \
locked_read__ret; \
})
extern size_t bsp_hartid;
struct riscv_hart {
struct riscv_hart *next;
const char *isa_string;
size_t hartid;
uint32_t acpi_uid;
uint8_t mmu_type;
uint8_t flags;
};
#define RISCV_HART_COPROC ((uint8_t)1 << 0) // is a coprocessor
#define RISCV_HART_HAS_MMU ((uint8_t)1 << 1) // `mmu_type` field is valid
extern struct riscv_hart *hart_list;
bool riscv_check_isa_extension_for(size_t hartid, const char *ext, size_t *maj, size_t *min);
static inline bool riscv_check_isa_extension(const char *ext, size_t *maj, size_t *min) {
return riscv_check_isa_extension_for(bsp_hartid, ext, maj, min);
}
void init_riscv(void);
#else
#error Unknown architecture
#endif

261
common/sys/cpu_riscv.c Normal file
View File

@ -0,0 +1,261 @@
#if defined(__riscv)
#include <lib/acpi.h>
#include <lib/misc.h>
#include <lib/print.h>
#include <sys/cpu.h>
#include <mm/pmm.h>
#include <stddef.h>
#include <stdint.h>
// ACPI RISC-V Hart Capabilities Table
struct rhct {
struct sdt header;
uint32_t flags;
uint64_t time_base_frequency;
uint32_t nodes_len;
uint32_t nodes_offset;
uint8_t nodes[];
} __attribute__((packed));
#define RHCT_ISA_STRING 0
#define RHCT_CMO 1
#define RHCT_MMU 2
#define RHCT_HART_INFO 65535
struct rhct_header {
uint16_t type; // node type
uint16_t size; // node size (bytes)
uint16_t revision; // node revision
} __attribute__((packed));
// One `struct rhct_hart_info` structure exists per hart in the system.
// The `offsets` array points to other entries in the RHCT associated with the
// hart.
struct rhct_hart_info {
struct rhct_header header;
uint16_t offsets_len;
uint32_t acpi_processor_uid;
uint32_t offsets[];
} __attribute__((packed));
struct rhct_isa_string {
struct rhct_header header;
uint16_t isa_string_len;
const char isa_string[];
} __attribute__((packed));
#define RISCV_MMU_TYPE_SV39 0
#define RISCV_MMU_TYPE_SV48 1
#define RISCV_MMU_TYPE_SV57 2
struct rhct_mmu {
struct rhct_header header;
uint8_t reserved0;
uint8_t mmu_type;
} __attribute__((packed));
size_t bsp_hartid;
struct riscv_hart *hart_list;
static struct riscv_hart *bsp_hart;
static struct riscv_hart *riscv_get_hart(size_t hartid) {
for (struct riscv_hart *hart = hart_list; hart != NULL; hart = hart->next) {
if (hart->hartid == hartid) {
return hart;
}
}
panic(false, "no `struct riscv_hart` for hartid %u", hartid);
}
static inline struct rhct_hart_info *rhct_get_hart_info(struct rhct *rhct, uint32_t acpi_uid) {
uint32_t offset = rhct->nodes_offset;
for (uint32_t i = 0; i < rhct->nodes_len; i++) {
struct rhct_hart_info *node = (void *)((uintptr_t)rhct + offset);
if (node->header.type == RHCT_HART_INFO && node->acpi_processor_uid == acpi_uid) {
return node;
}
offset += node->header.size;
}
return NULL;
}
void init_riscv(void) {
struct madt *madt = acpi_get_table("APIC", 0);
struct rhct *rhct = acpi_get_table("RHCT", 0);
if (madt == NULL || rhct == NULL) {
panic(false, "riscv: requires acpi");
}
for (uint8_t *madt_ptr = (uint8_t *)madt->madt_entries_begin;
(uintptr_t)madt_ptr < (uintptr_t)madt + madt->header.length; madt_ptr += *(madt_ptr + 1)) {
if (*madt_ptr != 0x18) {
continue;
}
struct madt_riscv_intc *intc = (struct madt_riscv_intc *)madt_ptr;
// Ignore harts we can't do anything with.
if (!(intc->flags & MADT_RISCV_INTC_ENABLED ||
intc->flags & MADT_RISCV_INTC_ONLINE_CAPABLE)) {
continue;
}
uint32_t acpi_uid = intc->acpi_processor_uid;
size_t hartid = intc->hartid;
struct rhct_hart_info *hart_info = rhct_get_hart_info(rhct, acpi_uid);
if (hart_info == NULL) {
panic(false, "riscv: missing rhct node for hartid %u", hartid);
}
const char *isa_string = NULL;
uint8_t mmu_type = 0;
uint8_t flags = 0;
for (uint32_t i = 0; i < hart_info->offsets_len; i++) {
const struct rhct_header *node = (void *)((uintptr_t)rhct + hart_info->offsets[i]);
switch (node->type) {
case RHCT_ISA_STRING:
isa_string = ((struct rhct_isa_string *)node)->isa_string;
break;
case RHCT_MMU:
mmu_type = ((struct rhct_mmu *)node)->mmu_type;
flags |= RISCV_HART_HAS_MMU;
break;
}
}
if (isa_string == NULL) {
print("riscv: missing isa string for hartid %u, skipping.\n", hartid);
continue;
}
if (strncmp("rv64", isa_string, 4) && strncmp("rv32", isa_string, 4)) {
print("riscv: skipping hartid %u with invalid isa string: %s", hartid, isa_string);
}
struct riscv_hart *hart = ext_mem_alloc(sizeof(struct riscv_hart));
if (hart == NULL) {
panic(false, "out of memory");
}
hart->hartid = hartid;
hart->acpi_uid = acpi_uid;
hart->isa_string = isa_string;
hart->mmu_type = mmu_type;
hart->flags = flags;
hart->next = hart_list;
hart_list = hart;
if (hart->hartid == bsp_hartid) {
bsp_hart = hart;
}
}
if (bsp_hart == NULL) {
panic(false, "riscv: missing `struct riscv_hart` for BSP");
}
if (strncasecmp(bsp_hart->isa_string, "rv64i", 5)) {
panic(false, "unsupported cpu: %s", bsp_hart->isa_string);
}
for (struct riscv_hart *hart = hart_list; hart != NULL; hart = hart->next) {
if (hart != bsp_hart && strcmp(bsp_hart->isa_string, hart->isa_string)) {
hart->flags |= RISCV_HART_COPROC;
}
}
}
struct isa_extension {
const char *name;
size_t name_len;
uint32_t ver_maj;
uint32_t ver_min;
};
// Parse the next sequence of digit characters into an integer.
static bool parse_number(const char **s, size_t *_n) {
size_t n = 0;
bool parsed = false;
while (isdigit(**s)) {
n *= 10;
n += *(*s)++ - '0';
parsed = true;
}
*_n = n;
return parsed;
}
// Parse the next extension from an ISA string.
static bool parse_extension(const char **s, struct isa_extension *ext) {
if (**s == '\0') {
return false;
}
const char *name = *s;
size_t name_len = 1;
if (**s == 's' || **s == 'S' || **s == 'x' || **s == 'X' || **s == 'z' || **s == 'Z') {
while (isalpha((*s)[name_len])) {
name_len++;
}
}
*s += name_len;
size_t maj = 0, min = 0;
if (parse_number(s, &maj)) {
if (**s == 'p') {
*s += 1;
parse_number(s, &min);
}
}
while (**s == '_') {
*s += 1;
}
if (ext) {
ext->name = name;
ext->name_len = name_len;
ext->ver_maj = maj;
ext->ver_min = min;
}
return true;
}
static bool extension_matches(const struct isa_extension *ext, const char *name) {
for (size_t i = 0; i < ext->name_len; i++) {
const char c1 = tolower(ext->name[i]);
const char c2 = tolower(*name++);
if (c2 == '\0' || c1 != c2) {
return false;
}
}
// Make sure `name` is not longer.
return *name == '\0';
}
bool riscv_check_isa_extension_for(size_t hartid, const char *name, size_t *maj, size_t *min) {
// Skip the `rv{32,64}` prefix so it's not parsed as extensions.
const char *isa_string = riscv_get_hart(hartid)->isa_string + 4;
struct isa_extension ext;
while (parse_extension(&isa_string, &ext)) {
if (!extension_matches(&ext, name)) {
continue;
}
if (maj) {
*maj = ext.ver_maj;
}
if (min) {
*min = ext.ver_min;
}
return true;
}
return false;
}
#endif

View File

@ -0,0 +1,19 @@
.section .text
.global sbicall
sbicall:
.option norelax
mv t0, a0
mv t1, a1
mv a0, a2
mv a1, a3
mv a2, a4
mv a3, a5
mv a4, a6
mv a5, a7
mv a7, t0
mv a6, t1
ecall
ret
.section .note.GNU-stack,"",%progbits

32
common/sys/sbi.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef __SYS__SBI_H__
#define __SYS__SBI_H__
#include <stddef.h>
#include <stdint.h>
struct sbiret {
long error;
long value;
};
#define SBI_SUCCESS ((long)0)
#define SBI_ERR_FAILED ((long)-1)
#define SBI_ERR_NOT_SUPPORTED ((long)-2)
#define SBI_ERR_INVALID_PARAM ((long)-3)
#define SBI_ERR_DENIED ((long)-4)
#define SBI_ERR_INVALID_ADDRESS ((long)-5)
#define SBI_ERR_ALREADY_AVAILABLE ((long)-6)
#define SBI_ERR_ALREADY_STARTED ((long)-7)
#define SBI_ERR_ALREADY_STOPPED ((long)-8)
extern struct sbiret sbicall(int eid, int fid, ...);
#define SBI_EID_HSM 0x48534d
static inline struct sbiret sbi_hart_start(unsigned long hartid,
unsigned long start_addr,
unsigned long opaque) {
return sbicall(SBI_EID_HSM, 0, hartid, start_addr, opaque);
}
#endif

View File

@ -13,6 +13,9 @@
#include <mm/pmm.h>
#define LIMINE_NO_POINTERS
#include <limine.h>
#if defined (__riscv64)
#include <sys/sbi.h>
#endif
extern symbol smp_trampoline_start;
extern size_t smp_trampoline_size;
@ -507,6 +510,80 @@ struct limine_smp_info *init_smp(size_t *cpu_count,
return NULL;
}
#elif defined (__riscv64)
struct trampoline_passed_info {
uint64_t smp_tpl_booted_flag;
uint64_t smp_tpl_satp;
uint64_t smp_tpl_info_struct;
};
static bool smp_start_ap(size_t hartid, size_t satp, struct limine_smp_info *info_struct) {
static struct trampoline_passed_info passed_info;
passed_info.smp_tpl_booted_flag = 0;
passed_info.smp_tpl_satp = satp;
passed_info.smp_tpl_info_struct = (uint64_t)info_struct;
asm volatile ("" ::: "memory");
struct sbiret ret = sbi_hart_start(hartid, (size_t)smp_trampoline_start, (size_t)&passed_info);
if (ret.error != SBI_SUCCESS)
return false;
for (int i = 0; i < 1000000; i++) {
if (locked_read(&passed_info.smp_tpl_booted_flag) == 1)
return true;
}
return false;
}
struct limine_smp_info *init_smp(size_t *cpu_count, pagemap_t pagemap) {
size_t num_cpus = 0;
for (struct riscv_hart *hart = hart_list; hart != NULL; hart = hart->next) {
if (!(hart->flags & RISCV_HART_COPROC)) {
num_cpus += 1;
}
}
struct limine_smp_info *ret = ext_mem_alloc(num_cpus * sizeof(struct limine_smp_info));
if (ret == NULL) {
panic(false, "out of memory");
}
*cpu_count = 0;
for (struct riscv_hart *hart = hart_list; hart != NULL; hart = hart->next) {
if (hart->flags & RISCV_HART_COPROC) {
continue;
}
struct limine_smp_info *info_struct = &ret[*cpu_count];
info_struct->hartid = hart->hartid;
info_struct->processor_id = hart->acpi_uid;
// Don't try to start the BSP.
if (hart->hartid == bsp_hartid) {
*cpu_count += 1;
continue;
}
printv("smp: Found candidate AP for bring-up. Hart ID: %u\n", hart->hartid);
// Try to start the AP.
size_t satp = make_satp(pagemap.paging_mode, pagemap.top_level);
if (!smp_start_ap(hart->hartid, satp, info_struct)) {
print("smp: FAILED to bring-up AP\n");
continue;
}
(*cpu_count)++;
continue;
}
return ret;
}
#else
#error Unknown architecture
#endif

View File

@ -27,6 +27,12 @@ struct limine_smp_info *init_smp(size_t *cpu_count,
uint64_t mair,
uint64_t tcr,
uint64_t sctlr);
#elif defined (__riscv64)
struct limine_smp_info *init_smp(size_t *cpu_count,
pagemap_t pagemap);
#else
#error Unknown architecture
#endif

View File

@ -0,0 +1,67 @@
.section .text
.global smp_trampoline_start
smp_trampoline_start:
.option norelax
// The AP begins executing here with the following state:
// satp = 0
// sstatus.SIE = 0
// a0 = hartid
// a1 = struct trampoline_passed_info *
//
// All other registers are undefined.
ld a0, 16(a1)
ld t0, 8(a1)
csrw satp, t0
// Tell the BSP we've started.
li t0, 1
fence rw, w
sd t0, (a1)
// Zero all the things.
// Preserve a0
mv a1, zero
mv a2, zero
mv a3, zero
mv a4, zero
mv a5, zero
mv a6, zero
mv a7, zero
mv s0, zero
mv s1, zero
mv s2, zero
mv s3, zero
mv s4, zero
mv s5, zero
mv s6, zero
mv s7, zero
mv s8, zero
mv s9, zero
mv s10, zero
mv s11, zero
mv t1, zero
mv t2, zero
mv t3, zero
mv t4, zero
mv t5, zero
mv t6, zero
mv tp, zero
mv ra, zero
csrw sie, zero
csrw stvec, zero
// Wait for kernel to tell us where to go.
0: .4byte 0x0100000f // pause
ld t0, 24(a0)
fence r, rw
beqz t0, 0b
// Load sp from reserved field of info struct
ld sp, 16(a0)
jr t0
.section .note.GNU-stack,"",%progbits

View File

@ -120,21 +120,21 @@ AC_ARG_ENABLE([all],
[AS_HELP_STRING([--enable-all], [enable ALL ports and targets])],
[BUILD_ALL="$enableval"])
BUILD_CD="$BUILD_ALL"
BUILD_BIOS_CD="$BUILD_ALL"
AC_ARG_ENABLE([bios-cd],
[AS_HELP_STRING([--enable-bios-cd], [enable building the x86 BIOS CD image])],
[BUILD_CD="$enableval"])
[BUILD_BIOS_CD="$enableval"])
AC_SUBST([BUILD_CD])
AC_SUBST([BUILD_BIOS_CD])
BUILD_PXE="$BUILD_ALL"
BUILD_BIOS_PXE="$BUILD_ALL"
AC_ARG_ENABLE([bios-pxe],
[AS_HELP_STRING([--enable-bios-pxe], [enable building the x86 BIOS PXE image])],
[BUILD_PXE="$enableval"])
[BUILD_BIOS_PXE="$enableval"])
AC_SUBST([BUILD_PXE])
AC_SUBST([BUILD_BIOS_PXE])
BUILD_BIOS="$BUILD_ALL"
@ -142,13 +142,11 @@ AC_ARG_ENABLE([bios],
[AS_HELP_STRING([--enable-bios], [enable building the x86 BIOS port])],
[BUILD_BIOS="$enableval"])
BUILD_LIMINE_DEPLOY="$BUILD_BIOS"
if test "x$BUILD_BIOS" = "xno"; then
if test "x$BUILD_CD" = "xyes"; then
if test "x$BUILD_BIOS_CD" = "xyes"; then
BUILD_BIOS="yes"
fi
if test "x$BUILD_PXE" = "xyes"; then
if test "x$BUILD_BIOS_PXE" = "xyes"; then
BUILD_BIOS="yes"
fi
fi
@ -178,7 +176,6 @@ else
fi
AC_SUBST([BUILD_BIOS])
AC_SUBST([BUILD_LIMINE_DEPLOY])
BUILD_UEFI_IA32="$BUILD_ALL"
@ -266,24 +263,52 @@ fi
AC_SUBST([BUILD_UEFI_AARCH64])
BUILD_CD_EFI="$BUILD_ALL"
BUILD_UEFI_RISCV64="$BUILD_ALL"
AC_ARG_ENABLE([uefi-riscv64],
[AS_HELP_STRING([--enable-uefi-riscv64], [enable building the riscv64 UEFI port])],
[BUILD_UEFI_RISCV64="$enableval"])
if test "x$BUILD_UEFI_RISCV64" = "xno"; then
BUILD_UEFI_RISCV64=""
else
mkdir -p toolchain-files
CC="$CC" \
ARCHITECTURE=riscv64 \
FREESTANDING_TOOLCHAIN_SUFFIX="_FOR_TARGET" \
FREESTANDING_TOOLCHAIN="$TOOLCHAIN_FOR_TARGET" \
WANT_FREESTANDING_CC=yes \
FREESTANDING_CC="$CC_FOR_TARGET" \
WANT_FREESTANDING_LD=yes \
FREESTANDING_LD="$LD_FOR_TARGET" \
WANT_FREESTANDING_OBJCOPY=yes \
FREESTANDING_OBJCOPY="$OBJCOPY_FOR_TARGET" \
WANT_FREESTANDING_OBJDUMP=yes \
FREESTANDING_OBJDUMP="$OBJDUMP_FOR_TARGET" \
"$SRCDIR/freestanding-toolchain" >"toolchain-files/uefi-riscv64-toolchain.mk" || exit 1
BUILD_UEFI_RISCV64="limine-uefi-riscv64"
fi
AC_SUBST([BUILD_UEFI_RISCV64])
BUILD_UEFI_CD="$BUILD_ALL"
AC_ARG_ENABLE([uefi-cd],
[AS_HELP_STRING([--enable-uefi-cd], [enable building limine-cd-efi.bin])],
[BUILD_CD_EFI="$enableval"])
[AS_HELP_STRING([--enable-uefi-cd], [enable building limine-uefi-cd.bin])],
[BUILD_UEFI_CD="$enableval"])
if ! test "x$BUILD_CD_EFI" = "xno"; then
if ! test "x$BUILD_UEFI_CD" = "xno"; then
AC_CHECK_PROG([MTOOLS_FOUND], [mcopy], [yes])
if ! test "x$MTOOLS_FOUND" = "xyes"; then
if test "x$BUILD_CD_EFI" = "xyes"; then
AC_MSG_ERROR([mtools not found, install mtools to build limine-cd-efi.bin])
if test "x$BUILD_UEFI_CD" = "xyes"; then
AC_MSG_ERROR([mtools not found, install mtools to build limine-uefi-cd.bin])
fi
AC_MSG_WARN([mtools not found, install mtools to build limine-cd-efi.bin])
BUILD_CD_EFI="no"
AC_MSG_WARN([mtools not found, install mtools to build limine-uefi-cd.bin])
BUILD_UEFI_CD="no"
fi
fi
AC_SUBST([BUILD_CD_EFI])
AC_SUBST([BUILD_UEFI_CD])
if test "x$NEED_NASM" = "xyes"; then
AC_CHECK_PROG([NASM_FOUND], [nasm], [yes])
@ -311,7 +336,7 @@ m4_define([DEFAULT_LDFLAGS_FOR_TARGET], [])
AC_ARG_VAR([LDFLAGS_FOR_TARGET], [linker flags for Limine @<:@default: ]DEFAULT_LDFLAGS_FOR_TARGET[@:>@])
test "x$LDFLAGS_FOR_TARGET" = "x" && LDFLAGS_FOR_TARGET="DEFAULT_LDFLAGS_FOR_TARGET"
LIMINE_COPYRIGHT=$($GREP Copyright "$SRCDIR/LICENSE")
LIMINE_COPYRIGHT=$($GREP Copyright "$SRCDIR/COPYING")
AC_SUBST([LIMINE_COPYRIGHT])
AC_PREFIX_DEFAULT([/usr/local])
@ -320,5 +345,5 @@ if ! test -f limine.h; then
cp "$SRCDIR/limine.h" ./
fi
AC_CONFIG_FILES([man/man1/limine-version.1 man/man1/limine-deploy.1 man/man1/limine-enroll-config.1 GNUmakefile config.h])
AC_CONFIG_FILES([man/man1/limine.1 GNUmakefile config.h])
AC_OUTPUT

8
host/.gitignore vendored
View File

@ -1,6 +1,2 @@
limine-deploy
limine-deploy.exe
limine-version
limine-version.exe
limine-enroll-config
limine-enroll-config.exe
limine
limine.exe

View File

@ -7,43 +7,32 @@ PREFIX ?= /usr/local
CFLAGS ?= -g -O2 -pipe
.PHONY: all
all: limine-deploy limine-version limine-enroll-config
all: limine
.PHONY: install
install: all
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/share'
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/share/limine'
$(INSTALL) -m 644 limine.sys '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-cd.bin '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-cd-efi.bin '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-pxe.bin '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-bios.sys '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-bios-cd.bin '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-uefi-cd.bin '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 limine-bios-pxe.bin '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 BOOTX64.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 BOOTIA32.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 BOOTAA64.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -m 644 BOOTRISCV64.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/include'
$(INSTALL) -m 644 limine.h '$(DESTDIR)$(PREFIX)/include/'
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/bin'
$(INSTALL) limine-deploy '$(DESTDIR)$(PREFIX)/bin/'
$(INSTALL) limine-version '$(DESTDIR)$(PREFIX)/bin/'
$(INSTALL) limine-enroll-config '$(DESTDIR)$(PREFIX)/bin/'
$(INSTALL) limine '$(DESTDIR)$(PREFIX)/bin/'
.PHONY: install-strip
install-strip: install
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine-deploy'
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine-version'
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine-enroll-config'
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine'
.PHONY: clean
clean:
rm -f limine-deploy limine-deploy.exe
rm -f limine-version limine-version.exe
rm -f limine-enroll-config limine-enroll-config.exe
rm -f limine limine.exe
limine-deploy: limine-deploy.c limine-hdd.h
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine-deploy.c $(LIBS) -o $@
limine-version: limine-version.c
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine-version.c $(LIBS) -o $@
limine-enroll-config: limine-enroll-config.c
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine-enroll-config.c $(LIBS) -o $@
limine: limine.c
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine.c $(LIBS) -o $@

View File

@ -9,7 +9,7 @@ cat <<EOF
const uint8_t binary_limine_hdd_bin_data[] = {
EOF
od -v -An -t x1 <limine-hdd.bin | "$SED" '/^$/d;s/ */ /g;s/ *$//g;s/ /, 0x/g;s/^, / /g;s/$/,/g;s/^ , / /g'
od -v -An -t x1 <limine-bios-hdd.bin | "$SED" '/^$/d;s/ */ /g;s/ *$//g;s/ /, 0x/g;s/^, / /g;s/$/,/g;s/^ , / /g'
cat <<EOF
};

View File

@ -1,143 +0,0 @@
#undef IS_WINDOWS
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define IS_WINDOWS 1
#endif
#include <stddef.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CONFIG_B2SUM_SIGNATURE "++CONFIG_B2SUM_SIGNATURE++"
static void usage(const char *name) {
printf("Usage: %s <Limine executable> <BLAKE2B of config file>\n", name);
printf("\n");
printf(" --reset Remove enrolled BLAKE2B, will not check config integrity\n");
printf("\n");
printf(" --quiet Do not print verbose diagnostic messages\n");
printf("\n");
printf(" --help | -h Display this help message\n");
printf("\n");
}
static void remove_arg(int *argc, char *argv[], int index) {
for (int i = index; i < *argc - 1; i++) {
argv[i] = argv[i + 1];
}
(*argc)--;
argv[*argc] = NULL;
}
int main(int argc, char *argv[]) {
int ret = EXIT_FAILURE;
char *bootloader = NULL;
FILE *bootloader_file = NULL;
bool quiet = false;
bool reset = false;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
usage(argv[0]);
return EXIT_SUCCESS;
} else if (strcmp(argv[i], "--quiet") == 0) {
remove_arg(&argc, argv, i);
quiet = true;
} else if (strcmp(argv[i], "--reset") == 0) {
remove_arg(&argc, argv, i);
reset = true;
}
}
if (argc <= (reset ? 1 : 2)) {
usage(argv[0]);
#ifdef IS_WINDOWS
system("pause");
#endif
return EXIT_FAILURE;
}
if (!reset && strlen(argv[2]) != 128) {
fprintf(stderr, "ERROR: BLAKE2B specified is not 128 characters long\n");
goto cleanup;
}
bootloader_file = fopen(argv[1], "r+b");
if (bootloader_file == NULL) {
perror("ERROR");
goto cleanup;;
}
if (fseek(bootloader_file, 0, SEEK_END) != 0) {
perror("ERROR");
goto cleanup;
}
size_t bootloader_size = ftell(bootloader_file);
rewind(bootloader_file);
bootloader = malloc(bootloader_size);
if (bootloader == NULL) {
perror("ERROR");
goto cleanup;
}
if (fread(bootloader, bootloader_size, 1, bootloader_file) != 1) {
perror("ERROR");
goto cleanup;
}
char *checksum_loc = NULL;
size_t checked_count = 0;
const char *config_b2sum_sign = CONFIG_B2SUM_SIGNATURE;
for (size_t i = 0; i < bootloader_size - ((sizeof(CONFIG_B2SUM_SIGNATURE) - 1) + 128) + 1; i++) {
if (bootloader[i] != config_b2sum_sign[checked_count]) {
checked_count = 0;
continue;
}
checked_count++;
if (checked_count == sizeof(CONFIG_B2SUM_SIGNATURE) - 1) {
checksum_loc = &bootloader[i + 1];
break;
}
}
if (checksum_loc == NULL) {
fprintf(stderr, "ERROR: Checksum location not found in provided executable\n");
goto cleanup;
}
if (!reset) {
memcpy(checksum_loc, argv[2], 128);
} else {
memset(checksum_loc, '0', 128);
}
if (fseek(bootloader_file, 0, SEEK_SET) != 0) {
perror("ERROR");
goto cleanup;
}
if (fwrite(bootloader, bootloader_size, 1, bootloader_file) != 1) {
perror("ERROR");
goto cleanup;
}
if (!quiet) {
fprintf(stderr, "Config file BLAKE2B successfully %s!\n", reset ? "reset" : "enrolled");
}
ret = EXIT_SUCCESS;
cleanup:
if (bootloader != NULL) {
free(bootloader);
}
if (bootloader_file != NULL) {
fclose(bootloader_file);
}
return ret;
}

View File

@ -1,7 +0,0 @@
#include <stdio.h>
#define LIMINE_VERSION "@LIMINE_VERSION@"
int main(void) {
puts(LIMINE_VERSION);
}

View File

@ -12,7 +12,21 @@
#include <inttypes.h>
#include <limits.h>
#include "limine-hdd.h"
#ifndef LIMINE_NO_BIOS
#include "limine-bios-hdd.h"
#endif
static void remove_arg(int *argc, char *argv[], int index) {
for (int i = index; i < *argc - 1; i++) {
argv[i] = argv[i + 1];
}
(*argc)--;
argv[*argc] = NULL;
}
#ifndef LIMINE_NO_BIOS
static bool quiet = false;
@ -277,37 +291,37 @@ static bool device_cache_block(uint64_t block) {
return true;
}
struct undeploy_data {
struct uninstall_data {
void *data;
uint64_t loc;
uint64_t count;
};
#define UNDEPLOY_DATA_MAX 256
#define UNINSTALL_DATA_MAX 256
static bool undeploying = false;
static struct undeploy_data undeploy_data[UNDEPLOY_DATA_MAX];
static struct undeploy_data undeploy_data_rev[UNDEPLOY_DATA_MAX];
static uint64_t undeploy_data_i = 0;
static const char *undeploy_file = NULL;
static bool uninstalling = false;
static struct uninstall_data uninstall_data[UNINSTALL_DATA_MAX];
static struct uninstall_data uninstall_data_rev[UNINSTALL_DATA_MAX];
static uint64_t uninstall_data_i = 0;
static const char *uninstall_file = NULL;
static void reverse_undeploy_data(void) {
for (size_t i = 0, j = undeploy_data_i - 1; i < undeploy_data_i; i++, j--) {
undeploy_data_rev[j] = undeploy_data[i];
static void reverse_uninstall_data(void) {
for (size_t i = 0, j = uninstall_data_i - 1; i < uninstall_data_i; i++, j--) {
uninstall_data_rev[j] = uninstall_data[i];
}
memcpy(undeploy_data, undeploy_data_rev, undeploy_data_i * sizeof(struct undeploy_data));
memcpy(uninstall_data, uninstall_data_rev, uninstall_data_i * sizeof(struct uninstall_data));
}
static void free_undeploy_data(void) {
for (size_t i = 0; i < undeploy_data_i; i++) {
free(undeploy_data[i].data);
static void free_uninstall_data(void) {
for (size_t i = 0; i < uninstall_data_i; i++) {
free(uninstall_data[i].data);
}
}
static bool store_undeploy_data(const char *filename) {
static bool store_uninstall_data(const char *filename) {
if (!quiet) {
fprintf(stderr, "Storing undeploy data to file: `%s`...\n", filename);
fprintf(stderr, "Storing uninstall data to file: `%s`...\n", filename);
}
FILE *udfile = fopen(filename, "wb");
@ -315,18 +329,18 @@ static bool store_undeploy_data(const char *filename) {
goto error;
}
if (fwrite(&undeploy_data_i, sizeof(uint64_t), 1, udfile) != 1) {
if (fwrite(&uninstall_data_i, sizeof(uint64_t), 1, udfile) != 1) {
goto error;
}
for (size_t i = 0; i < undeploy_data_i; i++) {
if (fwrite(&undeploy_data[i].loc, sizeof(uint64_t), 1, udfile) != 1) {
for (size_t i = 0; i < uninstall_data_i; i++) {
if (fwrite(&uninstall_data[i].loc, sizeof(uint64_t), 1, udfile) != 1) {
goto error;
}
if (fwrite(&undeploy_data[i].count, sizeof(uint64_t), 1, udfile) != 1) {
if (fwrite(&uninstall_data[i].count, sizeof(uint64_t), 1, udfile) != 1) {
goto error;
}
if (fwrite(undeploy_data[i].data, undeploy_data[i].count, 1, udfile) != 1) {
if (fwrite(uninstall_data[i].data, uninstall_data[i].count, 1, udfile) != 1) {
goto error;
}
}
@ -342,9 +356,9 @@ error:
return false;
}
static bool load_undeploy_data(const char *filename) {
static bool load_uninstall_data(const char *filename) {
if (!quiet) {
fprintf(stderr, "Loading undeploy data from file: `%s`...\n", filename);
fprintf(stderr, "Loading uninstall data from file: `%s`...\n", filename);
}
FILE *udfile = fopen(filename, "rb");
@ -352,22 +366,22 @@ static bool load_undeploy_data(const char *filename) {
goto error;
}
if (fread(&undeploy_data_i, sizeof(uint64_t), 1, udfile) != 1) {
if (fread(&uninstall_data_i, sizeof(uint64_t), 1, udfile) != 1) {
goto error;
}
for (size_t i = 0; i < undeploy_data_i; i++) {
if (fread(&undeploy_data[i].loc, sizeof(uint64_t), 1, udfile) != 1) {
for (size_t i = 0; i < uninstall_data_i; i++) {
if (fread(&uninstall_data[i].loc, sizeof(uint64_t), 1, udfile) != 1) {
goto error;
}
if (fread(&undeploy_data[i].count, sizeof(uint64_t), 1, udfile) != 1) {
if (fread(&uninstall_data[i].count, sizeof(uint64_t), 1, udfile) != 1) {
goto error;
}
undeploy_data[i].data = malloc(undeploy_data[i].count);
if (undeploy_data[i].data == NULL) {
uninstall_data[i].data = malloc(uninstall_data[i].count);
if (uninstall_data[i].data == NULL) {
goto error;
}
if (fread(undeploy_data[i].data, undeploy_data[i].count, 1, udfile) != 1) {
if (fread(uninstall_data[i].data, uninstall_data[i].count, 1, udfile) != 1) {
goto error;
}
}
@ -407,16 +421,16 @@ static bool _device_read(void *_buffer, uint64_t loc, size_t count) {
}
static bool _device_write(const void *_buffer, uint64_t loc, size_t count) {
if (undeploying) {
if (uninstalling) {
goto skip_save;
}
if (undeploy_data_i >= UNDEPLOY_DATA_MAX) {
fprintf(stderr, "Internal error: Too many undeploy data entries!\n");
if (uninstall_data_i >= UNINSTALL_DATA_MAX) {
fprintf(stderr, "Internal error: Too many uninstall data entries!\n");
return false;
}
struct undeploy_data *ud = &undeploy_data[undeploy_data_i];
struct uninstall_data *ud = &uninstall_data[uninstall_data_i];
ud->data = malloc(count);
if (ud->data == NULL) {
@ -453,31 +467,31 @@ skip_save:;
progress += chunk;
}
if (!undeploying) {
undeploy_data_i++;
if (!uninstalling) {
uninstall_data_i++;
}
return true;
}
static void undeploy(void) {
undeploying = true;
static void uninstall(void) {
uninstalling = true;
cache_state = CACHE_CLEAN;
cached_block = (uint64_t)-1;
for (size_t i = 0; i < undeploy_data_i; i++) {
struct undeploy_data *ud = &undeploy_data[i];
for (size_t i = 0; i < uninstall_data_i; i++) {
struct uninstall_data *ud = &uninstall_data[i];
bool retry = false;
while (!_device_write(ud->data, ud->loc, ud->count)) {
if (retry) {
fprintf(stderr, "ERROR: Undeploy data index %zu failed to write. Undeploy may be incomplete!\n", i);
fprintf(stderr, "ERROR: Uninstall data index %zu failed to write. Uninstall may be incomplete!\n", i);
break;
}
if (!quiet) {
fprintf(stderr, "Warning: Undeploy data index %zu failed to write, retrying...\n", i);
fprintf(stderr, "Warning: Uninstall data index %zu failed to write, retrying...\n", i);
}
if (!device_flush_cache()) {
fprintf(stderr, "ERROR: Device cache flush failure. Undeploy may be incomplete!\n");
fprintf(stderr, "ERROR: Device cache flush failure. Uninstall may be incomplete!\n");
}
cache_state = CACHE_CLEAN;
cached_block = (uint64_t)-1;
@ -486,11 +500,11 @@ static void undeploy(void) {
}
if (!device_flush_cache()) {
fprintf(stderr, "ERROR: Device cache flush failure. Undeploy may be incomplete!\n");
fprintf(stderr, "ERROR: Device cache flush failure. Uninstall may be incomplete!\n");
}
if (!quiet) {
fprintf(stderr, "Undeploy data restored successfully. Limine undeployed!\n");
fprintf(stderr, "Uninstall data restored successfully. Limine uninstalled!\n");
}
}
@ -506,17 +520,17 @@ static void undeploy(void) {
goto cleanup; \
} while (0)
static void usage(const char *name) {
printf("Usage: %s <device> [GPT partition index]\n", name);
static void bios_install_usage(const char *name) {
printf("Usage: %s bios-install <device> [GPT partition index]\n", name);
printf("\n");
printf(" --force-mbr Force MBR detection to work even if the\n");
printf(" safety checks fail (DANGEROUS!)\n");
printf("\n");
printf(" --undeploy Reverse the entire deployment procedure\n");
printf(" --uninstall Reverse the entire install procedure\n");
printf("\n");
printf(" --undeploy-data-file=<filename>\n");
printf(" Set the input (for --undeploy) or output file\n");
printf(" name of the file which contains undeploy data\n");
printf(" --uninstall-data-file=<filename>\n");
printf(" Set the input (for --uninstall) or output file\n");
printf(" name of the file which contains uninstall data\n");
printf("\n");
printf(" --quiet Do not print verbose diagnostic messages\n");
printf("\n");
@ -524,10 +538,10 @@ static void usage(const char *name) {
printf("\n");
}
int main(int argc, char *argv[]) {
static int bios_install(int argc, char *argv[]) {
int ok = EXIT_FAILURE;
int force_mbr = 0;
bool undeploy_mode = false;
bool uninstall_mode = false;
const uint8_t *bootloader_img = binary_limine_hdd_bin_data;
size_t bootloader_file_size = sizeof(binary_limine_hdd_bin_data);
uint8_t orig_mbr[70], timestamp[6];
@ -540,7 +554,7 @@ int main(int argc, char *argv[]) {
#endif
if (argc < 2) {
usage(argv[0]);
bios_install_usage(argv[-1]);
#ifdef IS_WINDOWS
system("pause");
#endif
@ -549,7 +563,7 @@ int main(int argc, char *argv[]) {
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
usage(argv[0]);
bios_install_usage(argv[-1]);
return EXIT_SUCCESS;
} else if (strcmp(argv[i], "--quiet") == 0) {
quiet = true;
@ -558,18 +572,18 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Warning: --force-mbr already set.\n");
}
force_mbr = 1;
} else if (strcmp(argv[i], "--undeploy") == 0) {
if (undeploy_mode && !quiet) {
fprintf(stderr, "Warning: --undeploy already set.\n");
} else if (strcmp(argv[i], "--uninstall") == 0) {
if (uninstall_mode && !quiet) {
fprintf(stderr, "Warning: --uninstall already set.\n");
}
undeploy_mode = true;
} else if (memcmp(argv[i], "--undeploy-data-file=", 21) == 0) {
if (undeploy_file != NULL && !quiet) {
fprintf(stderr, "Warning: --undeploy-data-file already set. Overriding...\n");
uninstall_mode = true;
} else if (memcmp(argv[i], "--uninstall-data-file=", 21) == 0) {
if (uninstall_file != NULL && !quiet) {
fprintf(stderr, "Warning: --uninstall-data-file already set. Overriding...\n");
}
undeploy_file = argv[i] + 21;
if (strlen(undeploy_file) == 0) {
fprintf(stderr, "ERROR: Undeploy data file has a zero-length name!\n");
uninstall_file = argv[i] + 21;
if (strlen(uninstall_file) == 0) {
fprintf(stderr, "ERROR: Uninstall data file has a zero-length name!\n");
return EXIT_FAILURE;
}
} else {
@ -584,28 +598,28 @@ int main(int argc, char *argv[]) {
if (device == NULL) {
fprintf(stderr, "ERROR: No device specified\n");
usage(argv[0]);
bios_install_usage(argv[-1]);
return EXIT_FAILURE;
}
if (!device_init()) {
goto undeploy_mode_cleanup;
goto uninstall_mode_cleanup;
}
if (undeploy_mode) {
if (undeploy_file == NULL) {
fprintf(stderr, "ERROR: Undeploy mode set but no --undeploy-data-file=... passed.\n");
goto undeploy_mode_cleanup;
if (uninstall_mode) {
if (uninstall_file == NULL) {
fprintf(stderr, "ERROR: Uninstall mode set but no --uninstall-data-file=... passed.\n");
goto uninstall_mode_cleanup;
}
if (!load_undeploy_data(undeploy_file)) {
goto undeploy_mode_cleanup;
if (!load_uninstall_data(uninstall_file)) {
goto uninstall_mode_cleanup;
}
undeploy();
uninstall();
ok = EXIT_SUCCESS;
goto undeploy_mode_cleanup;
goto uninstall_mode_cleanup;
}
// Probe for GPT and logical block size
@ -620,7 +634,7 @@ int main(int argc, char *argv[]) {
if (!force_mbr) {
gpt = 1;
if (!quiet) {
fprintf(stderr, "Deploying to GPT. Logical block size of %" PRIu64 " bytes.\n",
fprintf(stderr, "Installing to GPT. Logical block size of %" PRIu64 " bytes.\n",
lb_guesses[i]);
}
} else {
@ -810,7 +824,7 @@ int main(int argc, char *argv[]) {
}
if (!quiet) {
fprintf(stderr, "GPT partition specified. Deploying there instead of embedding.\n");
fprintf(stderr, "GPT partition specified. Installing there instead of embedding.\n");
}
stage2_loc_a = ENDSWAP(gpt_entry.starting_lba) * lb_size;
@ -912,7 +926,7 @@ int main(int argc, char *argv[]) {
}
} else {
if (!quiet) {
fprintf(stderr, "Deploying to MBR.\n");
fprintf(stderr, "Installing to MBR.\n");
}
}
@ -955,25 +969,25 @@ int main(int argc, char *argv[]) {
goto cleanup;
if (!quiet) {
fprintf(stderr, "Reminder: Remember to copy the limine.sys file in either\n"
fprintf(stderr, "Reminder: Remember to copy the limine-bios.sys file in either\n"
" the root, /boot, /limine, or /boot/limine directories of\n"
" one of the partitions on the device, or boot will fail!\n");
fprintf(stderr, "Limine deployed successfully!\n");
fprintf(stderr, "Limine BIOS stages installed successfully!\n");
}
ok = EXIT_SUCCESS;
cleanup:
reverse_undeploy_data();
reverse_uninstall_data();
if (ok != EXIT_SUCCESS) {
// If we failed, attempt to reverse deploy process
undeploy();
} else if (undeploy_file != NULL) {
store_undeploy_data(undeploy_file);
// If we failed, attempt to reverse install process
uninstall();
} else if (uninstall_file != NULL) {
store_uninstall_data(uninstall_file);
}
undeploy_mode_cleanup:
free_undeploy_data();
uninstall_mode_cleanup:
free_uninstall_data();
if (cache)
free(cache);
if (device != NULL)
@ -981,3 +995,173 @@ undeploy_mode_cleanup:
return ok;
}
#endif
#define CONFIG_B2SUM_SIGNATURE "++CONFIG_B2SUM_SIGNATURE++"
static void enroll_config_usage(const char *name) {
printf("Usage: %s enroll-config <Limine executable> <BLAKE2B of config file>\n", name);
printf("\n");
printf(" --reset Remove enrolled BLAKE2B, will not check config integrity\n");
printf("\n");
printf(" --quiet Do not print verbose diagnostic messages\n");
printf("\n");
printf(" --help | -h Display this help message\n");
printf("\n");
}
static int enroll_config(int argc, char *argv[]) {
int ret = EXIT_FAILURE;
char *bootloader = NULL;
FILE *bootloader_file = NULL;
bool quiet = false;
bool reset = false;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
enroll_config_usage(argv[-1]);
return EXIT_SUCCESS;
} else if (strcmp(argv[i], "--quiet") == 0) {
remove_arg(&argc, argv, i);
quiet = true;
} else if (strcmp(argv[i], "--reset") == 0) {
remove_arg(&argc, argv, i);
reset = true;
}
}
if (argc <= (reset ? 1 : 2)) {
enroll_config_usage(argv[-1]);
#ifdef IS_WINDOWS
system("pause");
#endif
return EXIT_FAILURE;
}
if (!reset && strlen(argv[2]) != 128) {
fprintf(stderr, "ERROR: BLAKE2B specified is not 128 characters long\n");
goto cleanup;
}
bootloader_file = fopen(argv[1], "r+b");
if (bootloader_file == NULL) {
perror("ERROR");
goto cleanup;;
}
if (fseek(bootloader_file, 0, SEEK_END) != 0) {
perror("ERROR");
goto cleanup;
}
size_t bootloader_size = ftell(bootloader_file);
rewind(bootloader_file);
bootloader = malloc(bootloader_size);
if (bootloader == NULL) {
perror("ERROR");
goto cleanup;
}
if (fread(bootloader, bootloader_size, 1, bootloader_file) != 1) {
perror("ERROR");
goto cleanup;
}
char *checksum_loc = NULL;
size_t checked_count = 0;
const char *config_b2sum_sign = CONFIG_B2SUM_SIGNATURE;
for (size_t i = 0; i < bootloader_size - ((sizeof(CONFIG_B2SUM_SIGNATURE) - 1) + 128) + 1; i++) {
if (bootloader[i] != config_b2sum_sign[checked_count]) {
checked_count = 0;
continue;
}
checked_count++;
if (checked_count == sizeof(CONFIG_B2SUM_SIGNATURE) - 1) {
checksum_loc = &bootloader[i + 1];
break;
}
}
if (checksum_loc == NULL) {
fprintf(stderr, "ERROR: Checksum location not found in provided executable\n");
goto cleanup;
}
if (!reset) {
memcpy(checksum_loc, argv[2], 128);
} else {
memset(checksum_loc, '0', 128);
}
if (fseek(bootloader_file, 0, SEEK_SET) != 0) {
perror("ERROR");
goto cleanup;
}
if (fwrite(bootloader, bootloader_size, 1, bootloader_file) != 1) {
perror("ERROR");
goto cleanup;
}
if (!quiet) {
fprintf(stderr, "Config file BLAKE2B successfully %s!\n", reset ? "reset" : "enrolled");
}
ret = EXIT_SUCCESS;
cleanup:
if (bootloader != NULL) {
free(bootloader);
}
if (bootloader_file != NULL) {
fclose(bootloader_file);
}
return ret;
}
#define LIMINE_VERSION "%VERSION%"
#define LIMINE_COPYRIGHT "%COPYRIGHT%"
static int version(void) {
puts("Limine " LIMINE_VERSION);
puts(LIMINE_COPYRIGHT);
puts("Limine is distributed under the terms of the BSD-2-Clause license.");
puts("There is ABSOLUTELY NO WARRANTY, to the extent permitted by law.");
return EXIT_SUCCESS;
}
static void general_usage(const char *name) {
printf("Usage: %s <command> <args...>\n", name);
printf("\n");
printf("Valid commands: help, version, bios-install, enroll-config\n");
}
int main(int argc, char *argv[]) {
if (argc <= 1) {
general_usage(argv[0]);
return EXIT_FAILURE;
}
if (strcmp(argv[1], "help") == 0
|| strcmp(argv[1], "--help") == 0
|| strcmp(argv[1], "-h") == 0) {
general_usage(argv[0]);
return EXIT_SUCCESS;
} else if (strcmp(argv[1], "bios-install") == 0) {
#ifndef LIMINE_NO_BIOS
return bios_install(argc - 1, &argv[1]);
#else
fprintf(stderr, "ERROR: Limine has been compiled without BIOS support.\n");
return EXIT_FAILURE;
#endif
} else if (strcmp(argv[1], "enroll-config") == 0) {
return enroll_config(argc - 1, &argv[1]);
} else if (strcmp(argv[1], "version") == 0
|| strcmp(argv[1], "--version") == 0) {
return version();
}
general_usage(argv[0]);
return EXIT_FAILURE;
}

View File

@ -1,39 +0,0 @@
.TH LIMINE-DEPLOY 1 "version @PACKAGE_VERSION@" "@REGEN_DATE@"
.SH NAME
limine-deploy \- install BIOS port's early stages to device
.SH SYNOPSIS
.B limine-deploy
.RI "<device> [ GPT partition index ]"
.SH DESCRIPTION
\fBlimine-deploy\fR installs the BIOS port's early stages to the specified device.
.SH OPTIONS
.TP
.BR \-h ", " \-\-help
Show the available command-line options and exit
.TP
.BR \-\-force-mbr
Force MBR detection to work even if the safety checks fail (\fIDANGEROUS\fR!)
.TP
.BR \-\-undeploy
Reverse the entire deployment procedure
.TP
.BR \-\-undeploy-data-file= \fIfilename
Set the input (for --undeploy) or output file name of the file which contains undeploy data
.TP
.BR \-\-quiet
Do not print verbose diagnostic messages
.SH BUGS
Please report bugs via
.IR @PACKAGE_BUGREPORT@ .
.SH HOMEPAGE
.I @PACKAGE_URL@
.SH SEE ALSO
.BR limine-version (1)
.BR limine-enroll-config (1)

View File

@ -1,34 +0,0 @@
.TH LIMINE-ENROLL-CONFIG 1 "version @PACKAGE_VERSION@" "@REGEN_DATE@"
.SH NAME
limine-enroll-config \- embed config hash into Limine executable
.SH SYNOPSIS
.B limine-enroll-config
.RI "<Limine executable> <BLAKE2B of config file>"
.SH DESCRIPTION
\fBlimine-enroll-config\fR embeds the config file's BLAKE2B hash into a valid Limine bootloader
executable, such as its EFI executable or limine.sys, for tampering prevention purposes.
.SH OPTIONS
.TP
.BR \-h ", " \-\-help
Show the available command-line options and exit
.TP
.BR \-\-reset
Remove enrolled BLAKE2B, will not check config intergrity
.TP
.BR \-\-quiet
Do not print verbose diagnostic messages
.SH BUGS
Please report bugs via
.IR @PACKAGE_BUGREPORT@ .
.SH HOMEPAGE
.I @PACKAGE_URL@
.SH SEE ALSO
.BR limine-version (1)
.BR limine-deploy (1)

View File

@ -1,22 +0,0 @@
.TH LIMINE-VERSION 1 "version @PACKAGE_VERSION@" "@REGEN_DATE@"
.SH NAME
limine-version \- print Limine version
.SH SYNOPSIS
.B limine-version
.SH DESCRIPTION
\fBlimine-version\fR prints the version number of the installed copy of Limine
to standard output.
.SH BUGS
Please report bugs via
.IR @PACKAGE_BUGREPORT@ .
.SH HOMEPAGE
.I https://limine-bootloader.org/
.SH SEE ALSO
.BR limine-deploy (1)
.BR limine-enroll-config (1)

18
man/man1/limine.1.in Normal file
View File

@ -0,0 +1,18 @@
.TH LIMINE 1 "version @PACKAGE_VERSION@" "@REGEN_DATE@"
.SH NAME
limine \- Multiplexer to several Limine-related utilities.
.SH SYNOPSIS
.B limine
.RI "<command> <args...>"
.SH DESCRIPTION
\fBlimine\fR provides a series of Limine-related utilities condensed in a single executable.
.SH BUGS
Please report bugs via
.IR @PACKAGE_BUGREPORT@ .
.SH HOMEPAGE
.I @PACKAGE_URL@

56
test.mk
View File

@ -11,6 +11,10 @@ ovmf-aa64:
$(MKDIR_P) ovmf-aa64
cd ovmf-aa64 && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASEAARCH64_QEMU_EFI.fd
ovmf-rv64:
$(MKDIR_P) ovmf-rv64
cd ovmf-rv64 && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASERISCV64_VIRT_CODE.fd && dd if=/dev/zero of=OVMF.fd bs=1 count=0 seek=33554432
ovmf-ia32:
$(MKDIR_P) ovmf-ia32
cd ovmf-ia32 && curl -o OVMF.fd https://retrage.github.io/edk2-nightly/bin/RELEASEIa32_OVMF.fd
@ -33,7 +37,7 @@ ext2-test:
$(MAKE) test-clean
$(MAKE) test.hdd
$(MAKE) limine-bios
$(MAKE) limine-deploy
$(MAKE) limine
$(MAKE) -C test TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-x86_64-toolchain.mk'
rm -rf test_image/
mkdir test_image
@ -48,7 +52,7 @@ ext2-test:
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
$(BINDIR)/limine-deploy test.hdd
$(BINDIR)/limine bios-install test.hdd
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
.PHONY: fat12-test
@ -56,7 +60,7 @@ fat12-test:
$(MAKE) test-clean
$(MAKE) test.hdd
$(MAKE) limine-bios
$(MAKE) limine-deploy
$(MAKE) limine
$(MAKE) -C test TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-x86_64-toolchain.mk'
rm -rf test_image/
mkdir test_image
@ -71,7 +75,7 @@ fat12-test:
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
$(BINDIR)/limine-deploy test.hdd
$(BINDIR)/limine bios-install test.hdd
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
.PHONY: fat16-test
@ -79,7 +83,7 @@ fat16-test:
$(MAKE) test-clean
$(MAKE) test.hdd
$(MAKE) limine-bios
$(MAKE) limine-deploy
$(MAKE) limine
$(MAKE) -C test TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-x86_64-toolchain.mk'
rm -rf test_image/
mkdir test_image
@ -94,7 +98,7 @@ fat16-test:
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
$(BINDIR)/limine-deploy test.hdd
$(BINDIR)/limine bios-install test.hdd
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
.PHONY: legacy-fat16-test
@ -103,7 +107,7 @@ legacy-fat16-test:
$(MAKE) mbrtest.hdd
fdisk -l mbrtest.hdd
$(MAKE) limine-bios
$(MAKE) limine-deploy
$(MAKE) limine
$(MAKE) -C test TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-x86_64-toolchain.mk'
rm -rf test_image/
mkdir test_image
@ -118,7 +122,7 @@ legacy-fat16-test:
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
$(BINDIR)/limine-deploy mbrtest.hdd
$(BINDIR)/limine bios-install mbrtest.hdd
qemu-system-i386 -cpu pentium2 -m 16M -M isapc -net none -hda mbrtest.hdd -debugcon stdio
.PHONY: fat32-test
@ -126,7 +130,7 @@ fat32-test:
$(MAKE) test-clean
$(MAKE) test.hdd
$(MAKE) limine-bios
$(MAKE) limine-deploy
$(MAKE) limine
$(MAKE) -C test TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-x86_64-toolchain.mk'
rm -rf test_image/
mkdir test_image
@ -141,7 +145,7 @@ fat32-test:
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
$(BINDIR)/limine-deploy test.hdd
$(BINDIR)/limine bios-install test.hdd
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
.PHONY: iso9660-test
@ -154,7 +158,7 @@ iso9660-test:
$(MKDIR_P) test_image/boot
sudo cp -rv $(BINDIR)/* test_image/boot/
sudo cp -rv test/* test_image/boot/
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table test_image/ -o test.iso
xorriso -as mkisofs -b boot/limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table test_image/ -o test.iso
qemu-system-x86_64 -net none -smp 4 -cdrom test.iso -debugcon stdio
.PHONY: full-hybrid-test
@ -168,8 +172,8 @@ full-hybrid-test:
$(MKDIR_P) test_image/boot
sudo cp -rv $(BINDIR)/* test_image/boot/
sudo cp -rv test/* test_image/boot/
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot boot/limine-cd-efi.bin -efi-boot-part --efi-boot-image --protective-msdos-label test_image/ -o test.iso
$(BINDIR)/limine-deploy test.iso
xorriso -as mkisofs -b boot/limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot boot/limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label test_image/ -o test.iso
$(BINDIR)/limine bios-install test.iso
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-x64/OVMF.fd -net none -smp 4 -cdrom test.iso -debugcon stdio
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-x64/OVMF.fd -net none -smp 4 -hda test.iso -debugcon stdio
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-ia32/OVMF.fd -net none -smp 4 -cdrom test.iso -debugcon stdio
@ -186,7 +190,7 @@ pxe-test:
$(MKDIR_P) test_image/boot
sudo cp -rv $(BINDIR)/* test_image/boot/
sudo cp -rv test/* test_image/boot/
qemu-system-x86_64 -smp 4 -netdev user,id=n0,tftp=./test_image,bootfile=boot/limine-pxe.bin -device rtl8139,netdev=n0,mac=00:00:00:11:11:11 -debugcon stdio
qemu-system-x86_64 -smp 4 -netdev user,id=n0,tftp=./test_image,bootfile=boot/limine-bios-pxe.bin -device rtl8139,netdev=n0,mac=00:00:00:11:11:11 -debugcon stdio
.PHONY: uefi-x86-64-test
uefi-x86-64-test:
@ -236,6 +240,30 @@ uefi-aa64-test:
rm -rf test_image loopback_dev
qemu-system-aarch64 -m 512M -M virt -cpu cortex-a72 -bios ovmf-aa64/OVMF.fd -net none -smp 4 -device ramfb -device qemu-xhci -device usb-kbd -hda test.hdd -serial stdio
.PHONY: uefi-rv64-test
uefi-rv64-test:
$(MAKE) ovmf-rv64
$(MAKE) test-clean
$(MAKE) test.hdd
$(MAKE) limine-uefi-riscv64
$(MAKE) -C test TOOLCHAIN_FILE='$(call SHESCAPE,$(BUILDDIR))/toolchain-files/uefi-riscv64-toolchain.mk'
rm -rf test_image/
mkdir test_image
sudo losetup -Pf --show test.hdd > loopback_dev
sudo partprobe `cat loopback_dev`
sudo mkfs.fat -F 32 `cat loopback_dev`p1
sudo mount `cat loopback_dev`p1 test_image
sudo mkdir test_image/boot
sudo cp -rv $(BINDIR)/* test_image/boot/
sudo cp -rv test/* test_image/boot/
sudo $(MKDIR_P) test_image/EFI/BOOT
sudo cp $(BINDIR)/BOOTRISCV64.EFI test_image/EFI/BOOT/
sync
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
qemu-system-riscv64 -m 512M -M virt -cpu rv64 -drive if=pflash,unit=0,format=raw,file=ovmf-rv64/OVMF.fd -net none -smp 4 -device ramfb -device qemu-xhci -device usb-kbd -device virtio-blk-device,drive=hd0 -drive id=hd0,format=raw,file=test.hdd -serial stdio
.PHONY: uefi-ia32-test
uefi-ia32-test:
$(MAKE) ovmf-ia32

1
test/.gitignore vendored
View File

@ -1,3 +1,4 @@
test.o
test.elf
flanterm
limine.h

View File

@ -20,6 +20,10 @@ ifneq ($(findstring aarch64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override LDFLAGS += \
-m aarch64elf
endif
ifneq ($(findstring riscv64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override LDFLAGS += \
-m elf64lriscv
endif
override LDFLAGS += \
-Tlinker.ld \
@ -69,6 +73,15 @@ override CFLAGS += \
-mgeneral-regs-only
endif
ifneq ($(findstring riscv64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override CFLAGS += \
-march=rv64imac \
-mabi=lp64 \
-mno-relax
override LDFLAGS += \
--no-relax
endif
override CFLAGS_MB := \
-std=c11 \
-nostdinc \
@ -91,10 +104,14 @@ else
all: test.elf
endif
flanterm:
mkdir -p flanterm
cp -rv ../common/flanterm/* ./flanterm/
limine.h:
cp -v ../limine.h ./
test.elf: limine.o e9print.o memory.o
test.elf: limine.o e9print.o memory.o flanterm/flanterm.o flanterm/backends/fb.o
$(LD) $^ $(LDFLAGS) -o $@
multiboot2.elf: multiboot2_trampoline.o
@ -109,7 +126,7 @@ multiboot.elf: multiboot_trampoline.o
$(CC) $(CFLAGS_MB) -c e9print.c -o e9print.o
$(LD) $^ memory.o multiboot.o e9print.o $(LDFLAGS_MB1) -o $@
%.o: %.c limine.h
%.o: %.c flanterm limine.h
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.asm
@ -119,4 +136,4 @@ clean:
rm -rf test.elf limine.o e9print.o memory.o
rm -rf multiboot2.o multiboot2.elf multiboot2_trampoline.o
rm -rf multiboot.o multiboot_trampoline.o multiboot.elf
rm -rf limine.h
rm -rf flanterm limine.h

View File

@ -2,16 +2,22 @@
#include <stddef.h>
#include <stdint.h>
void (*limine_print)(const char *buf, size_t size) = NULL;
#if defined (_LIMINE_PROTO)
#include <flanterm/flanterm.h>
extern struct flanterm_context *ft_ctx;
#endif
static const char CONVERSION_TABLE[] = "0123456789abcdef";
void e9_putc(char c) {
if (limine_print != NULL)
limine_print(&c, 1);
#if defined (__x86_64__) || defined (__i386__)
__asm__ __volatile__ ("outb %0, %1" :: "a" (c), "Nd" (0xe9) : "memory");
#endif
#if defined (_LIMINE_PROTO)
if (ft_ctx != NULL) {
flanterm_write(ft_ctx, &c, 1);
}
#endif
}
void e9_print(const char *msg) {

View File

@ -3,8 +3,6 @@
#include <stdarg.h>
#include <stddef.h>
extern void (*limine_print)(const char *buf, size_t size);
void e9_putc(char c);
void e9_print(const char *msg);
void e9_puts(const char *msg);

View File

@ -2,6 +2,8 @@
#include <stddef.h>
#include <limine.h>
#include <e9print.h>
#include <flanterm/flanterm.h>
#include <flanterm/backends/fb.h>
static void limine_main(void);
@ -135,14 +137,6 @@ struct limine_smp_request _smp_request = {
__attribute__((section(".limine_reqs")))
void *smp_req = &_smp_request;
struct limine_terminal_request _terminal_request = {
.id = LIMINE_TERMINAL_REQUEST,
.revision = 0, .response = NULL
};
__attribute__((section(".limine_reqs")))
void *terminal_req = &_terminal_request;
struct limine_dtb_request _dtb_request = {
.id = LIMINE_DTB_REQUEST,
.revision = 0, .response = NULL
@ -226,6 +220,8 @@ void ap_entry(struct limine_smp_info *info) {
#elif defined (__aarch64__)
e9_printf("My GIC CPU Interface no.: %x", info->gic_iface_no);
e9_printf("My MPIDR: %x", info->mpidr);
#elif defined (__riscv)
e9_printf("My Hart ID: %x", info->hartid);
#endif
__atomic_fetch_add(&ctr, 1, __ATOMIC_SEQ_CST);
@ -238,19 +234,26 @@ void ap_entry(struct limine_smp_info *info) {
extern char kernel_start[];
static void write_shim(const char *s, uint64_t l) {
struct limine_terminal *terminal = _terminal_request.response->terminals[0];
_terminal_request.response->write(terminal, s, l);
}
struct flanterm_context *ft_ctx = NULL;
static void limine_main(void) {
if (_terminal_request.response) {
limine_print = write_shim;
}
e9_printf("\nWe're alive");
struct limine_framebuffer *fb = framebuffer_request.response->framebuffers[0];
ft_ctx = flanterm_fb_simple_init(
fb->address,
fb->width,
fb->height,
fb->pitch,
fb->red_mask_size,
fb->red_mask_shift,
fb->green_mask_size,
fb->green_mask_shift,
fb->blue_mask_size,
fb->blue_mask_shift
);
uint64_t kernel_slide = (uint64_t)kernel_start - 0xffffffff80000000;
e9_printf("Kernel slide: %x", kernel_slide);
@ -422,6 +425,8 @@ FEAT_START
e9_printf("BSP LAPIC ID: %x", smp_response->bsp_lapic_id);
#elif defined (__aarch64__)
e9_printf("BSP MPIDR: %x", smp_response->bsp_mpidr);
#elif defined (__riscv)
e9_printf("BSP Hart ID: %x", smp_response->bsp_hartid);
#endif
e9_printf("CPU count: %d", smp_response->cpu_count);
for (size_t i = 0; i < smp_response->cpu_count; i++) {
@ -432,6 +437,8 @@ FEAT_START
#elif defined (__aarch64__)
e9_printf("GIC CPU Interface no.: %x", cpu->gic_iface_no);
e9_printf("MPIDR: %x", cpu->mpidr);
#elif defined (__riscv)
e9_printf("Hart ID: %x", cpu->hartid);
#endif
@ -439,6 +446,8 @@ FEAT_START
if (cpu->lapic_id != smp_response->bsp_lapic_id) {
#elif defined (__aarch64__)
if (cpu->mpidr != smp_response->bsp_mpidr) {
#elif defined (__riscv)
if (cpu->hartid != smp_response->bsp_hartid) {
#endif
uint32_t old_ctr = __atomic_load_n(&ctr, __ATOMIC_SEQ_CST);
@ -450,24 +459,6 @@ FEAT_START
}
FEAT_END
FEAT_START
e9_printf("");
if (_terminal_request.response == NULL) {
e9_printf("Terminal not passed");
break;
}
struct limine_terminal_response *term_response = _terminal_request.response;
e9_printf("Terminal feature, revision %d", term_response->revision);
e9_printf("%d terminal(s)", term_response->terminal_count);
for (size_t i = 0; i < term_response->terminal_count; i++) {
struct limine_terminal *terminal = term_response->terminals[i];
e9_printf("Columns: %d", terminal->columns);
e9_printf("Rows: %d", terminal->rows);
e9_printf("Using framebuffer: %x", terminal->framebuffer);
}
e9_printf("Write function at: %x", term_response->write);
FEAT_END
FEAT_START
e9_printf("");
if (_dtb_request.response == NULL) {

View File

@ -30,6 +30,7 @@ SECTIONS
.data : {
*(.data .data.*)
*(.sdata .sdata.*)
} :data
.dynamic : {
@ -37,6 +38,7 @@ SECTIONS
} :data :dynamic
.bss : {
*(.sbss .sbss.*)
*(.bss .bss.*)
*(COMMON)
} :data