Skip to content

Commit

Permalink
Version 1.0 (bootloader and protocol both)
Browse files Browse the repository at this point in the history
  • Loading branch information
davmac314 committed Oct 29, 2023
1 parent b59145e commit fb5cf37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tosaithe

_Preliminary - no official release yet_
_Version 1.0_

Tosaithe is a minimalistic UEFI-firmware menu/bootloader. It can chain-load other EFI programs
and loaders, including Linux kernels, and has basic support for a bespoke boot protocol and
Expand Down
6 changes: 3 additions & 3 deletions doc/TSBP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TSBP - TOSAITHE BOOT PROTOCOL

_Preliminary revision_
_Version 1.0_

## Introduction

Expand Down Expand Up @@ -105,10 +105,10 @@ It contains the following fields:

- `uint32_t signature` - the Tosaithe Boot Protocol signature, corresponding to the byte sequence
of "TSBP". The correct value can be specified as `'T' + ('S' << 8) + ('B' << 16) + ('P' << 24)`.
- `uint32_t version` - the version of the protocol that the kernel implements. This should be 0 to
- `uint32_t version` - the version of the protocol that the kernel implements. This should be 1 to
match the version of the protocol documented here.
- `uint32_t min_reqd_version` - the minimum version of the protocol that the bootloader must
support in order to be able to load the kernel. This should be 0.
support in order to be able to load the kernel. This should be 1.
- `uint32_t flags` - flags specifying kernel requirements. Currently the following are defined:
- bits 0-1: framebuffer requirement. `00b` = not required, `01b` = required; other values
reserved.
Expand Down
2 changes: 1 addition & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ EfiMain (
EFI_con_out->SetAttribute(EFI_con_out, EFI_WHITE);
con_write(L"Tosaithe");
EFI_con_out->SetAttribute(EFI_con_out, EFI_LIGHTGRAY);
con_write(L" boot menu\r\n");
con_write(L" version 1.0 boot menu\r\n");

auto display_revision = [](uint32_t revision) {
unsigned revision_major = revision >> 16;
Expand Down
10 changes: 8 additions & 2 deletions src/tosaithe-proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,13 @@ EFI_STATUS load_tsbp(EFI_HANDLE ImageHandle, const EFI_DEVICE_PATH_PROTOCOL *exe
return EFI_LOAD_ERROR;
}

// TODO check suitable version
if (ts_entry_header->min_reqd_version > 1) {
con_write(L"Kernel requires a later version of TSBP protocol support\r\n");
return EFI_LOAD_ERROR;
}
if (ts_entry_header->version < 1) {
con_write(L"Kernel implements a too-old version of TSBP boot protocol\r\n");
}

uint64_t kern_stack_top = ts_entry_header->stack_ptr;

Expand Down Expand Up @@ -925,7 +931,7 @@ EFI_STATUS load_tsbp(EFI_HANDLE ImageHandle, const EFI_DEVICE_PATH_PROTOCOL *exe
// - not for the first 1MB of address, since that almost definitely should be covered by
// above cases we'll play it safe. This implies the entire first 1GB must be covered by <1GB
// pages.
// - We can share mappings between low- and high- half if it doesn't overlap kernel mapping
// - We can share tables between low- and high- half if they don't overlap kernel mapping
// - For the page table pages, we'll allocate the pages in chunks and use the chunk from start
// to end before allocating another chunk.

Expand Down

0 comments on commit fb5cf37

Please sign in to comment.