Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ on:
pull_request:
push:

# Cancel CI jobs when a new push invalidates an old pipeline. Merge queue
# runs are never cancelled because each entry gets a unique ref, giving
# them a unique concurrency group key.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
Expand Down
4 changes: 1 addition & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ let
sha256 = node.narHash;
};
pkgsSrc = fetchInput "nixpkgs";
pkgs-23-11Src = fetchInput "nixpkgs-23-11";
pkgs = import pkgsSrc { system = "x86_64-linux"; };
pkgs-23-11 = import pkgs-23-11Src { system = "x86_64-linux"; };
in
import ./nix/release.nix {
inherit pkgs pkgs-23-11;
inherit pkgs;
}
69 changes: 15 additions & 54 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
nixpkgs-23-11.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
Expand All @@ -28,7 +27,6 @@
let
project = import ./nix/release.nix {
inherit pkgs;
pkgs-23-11 = import inputs.nixpkgs-23-11 { inherit system; };
};
in
{
Expand All @@ -46,6 +44,8 @@
with pkgs;
[
clang-tools # format and tidy
cmake # needed for the setup hook that will then add catch2
catch2_3
ninja
]
++ self.checks.${system}.pre-commit.enabledPackages;
Expand All @@ -54,7 +54,7 @@
'';
};
};
formatter = pkgs.nixfmt-rfc-style;
formatter = pkgs.nixfmt-tree;
packages =
let
# Flattens a nested attribute set recursively, by constructing a
Expand Down
20 changes: 0 additions & 20 deletions nix/build-cmake-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,8 @@
catch2_3,
cmake,
nix-gitignore,
pkgs-23-11,
stdenv,
wrapBintoolsWith,
wrapCCWith,
}:
let
# With nixpkgs 24.05, our unit tests fails during runtime with a segmentation
# fault during test run initialization, which has nothing to do with the
# actual unit test.
# In nixpkgs 24.05, the glibc version 2.39 is introduced which does not
# work with catch2 version 3 thus we downgrade the glibc version to
# 2.38 (from nixpkgs 23.11) again to keep our code compiling
patchedGcc = wrapCCWith {
cc = pkgs-23-11.gcc-unwrapped;
libc = pkgs-23-11.glibc;
bintools = wrapBintoolsWith {
bintools = pkgs-23-11.bintools-unwrapped;
libc = pkgs-23-11.glibc;
};
};
in
stdenv.mkDerivation {
pname = "cyberus-guest-tests";
version = "0.0.0-dev";
Expand All @@ -45,7 +26,6 @@ stdenv.mkDerivation {

nativeBuildInputs = [
cmake
patchedGcc # keep in sync with CI file
];

# The ELFs are standalone kernels and don't need to go through these. This
Expand Down
4 changes: 2 additions & 2 deletions nix/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# variants (ELF32, ELF64, ISO, ELF) using the following attribute structure:
# `tests.<testname>.<variant>`.

{ pkgs, pkgs-23-11 }:
{ pkgs }:

let
lib = pkgs.lib;
Expand All @@ -33,7 +33,7 @@ let
"vmx"
];

cmakeProj = pkgs.callPackage ./build-cmake-project.nix { inherit pkgs-23-11; };
cmakeProj = pkgs.callPackage ./build-cmake-project.nix { };

# Extracts a single binary variant of a test.
# The result is a direct symlink to the boot item.
Expand Down
2 changes: 1 addition & 1 deletion nix/pre-commit-check.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pre-commit-hooks.run {
settings.noLambdaPatternNames = true;
};

nixfmt-rfc-style = {
nixfmt = {
enable = true;
excludes = [
"nix/sources.nix"
Expand Down
3 changes: 1 addition & 2 deletions nix/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

{
pkgs,
pkgs-23-11,
}:

let
Expand All @@ -17,7 +16,7 @@ let
# We don't use callPackage here, as we do not want `override` and
# `overrideAttrs` in the returned attrset.
tests = import ./build.nix {
inherit pkgs pkgs-23-11;
inherit pkgs;
};

testNames = builtins.attrNames tests;
Expand Down
22 changes: 20 additions & 2 deletions src/cmake/prep_and_use_linker_script.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,26 @@ function(prep_and_use_linker_script target-name source-file)
OUTPUT ${resulting-ld-script}
MAIN_DEPENDENCY ${source-file}
DEPFILE ${resulting-ld-script}.d
COMMAND ${CMAKE_CXX_COMPILER} ARGS -x c -E ${source-file} -P -o
${resulting-ld-script} ${ld-includes}
# Keep included linker-script headers in Ninja's dependency graph.
# -MF names the depfile and -MT names the generated script target.
COMMAND
${CMAKE_CXX_COMPILER} ARGS
# Treat the linker script as C preprocessor input.
-x c
# Preprocess only and emit header dependencies.
-E -MMD
# Write dependencies to the declared depfile.
-MF ${resulting-ld-script}.d
# Associate the dependencies with the generated linker script.
-MT ${resulting-ld-script}
# Preprocess this linker-script source.
${source-file}
# Suppress preprocessor line markers.
-P
# Write the preprocessed linker script here.
-o ${resulting-ld-script}
# Add the directory containing linker-script headers.
${ld-includes}
)
endif()
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
Expand Down
8 changes: 6 additions & 2 deletions src/lib/toyos/include/toyos/console/console_serial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ struct bda_serial_config
inline uint16_t find_serial_port_in_bda()
{
bda_serial_config* bda{ reinterpret_cast<bda_serial_config*>(bda_serial_config::BDA_SERIAL_ADDR) };
return find_if_or(
bda->ports, [](auto p) { return p; }, SERIAL_PORT_DEFAULT);
for (const auto port : bda->ports) {
if (port) {
return port;
}
}
return SERIAL_PORT_DEFAULT;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/include/toyos/page_table_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class paging_entry_base
{
return raw() & PR_MASK;
}
bool is_writeable() const
bool is_writable() const
{
return is_present() and (raw() & RW_MASK);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/include/toyos/pd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PDE : public paging_directory_entry_base

public:
void set_present(bool pres, tlb_invalidation invl);
void set_writeable(bool wr, tlb_invalidation invl);
void set_writable(bool wr, tlb_invalidation invl);
void set_usermode(bool mode, tlb_invalidation invl);
void set_pwt(bool pwt, tlb_invalidation invl);
void set_pcd(bool pcd, tlb_invalidation invl);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/include/toyos/pdpt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PDPTE : public paging_directory_entry_base

public:
void set_present(bool pres, tlb_invalidation invl);
void set_writeable(bool wr, tlb_invalidation invl);
void set_writable(bool wr, tlb_invalidation invl);
void set_usermode(bool mode, tlb_invalidation invl);
void set_pwt(bool pwt, tlb_invalidation invl);
void set_pcd(bool pcd, tlb_invalidation invl);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/include/toyos/pml4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PML4E : public paging_entry_base
explicit PML4E(const pml4_entry_t& config);

void set_present(bool pres, tlb_invalidation invl);
void set_writeable(bool wr, tlb_invalidation invl);
void set_writable(bool wr, tlb_invalidation invl);
void set_usermode(bool mode, tlb_invalidation invl);
void set_pwt(bool pwt, tlb_invalidation invl);
void set_pcd(bool pcd, tlb_invalidation invl);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/include/toyos/pt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PTE : public paging_entry_base
explicit PTE(const pt_entry_t& config);

void set_present(bool pres, tlb_invalidation invl);
void set_writeable(bool wr, tlb_invalidation invl);
void set_writable(bool wr, tlb_invalidation invl);
void set_usermode(bool mode, tlb_invalidation invl);
void set_pwt(bool pwt, tlb_invalidation invl);
void set_pcd(bool pcd, tlb_invalidation invl);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/src/pd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void PDE::set_present(bool pres, tlb_invalidation invl)
access_helper(pres, PR_MASK, invl);
}

void PDE::set_writeable(bool wr, tlb_invalidation invl)
void PDE::set_writable(bool wr, tlb_invalidation invl)
{
access_helper(wr, RW_MASK, invl);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/src/pdpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void PDPTE::set_present(bool pres, tlb_invalidation invl)
access_helper(pres, PR_MASK, invl);
}

void PDPTE::set_writeable(bool wr, tlb_invalidation invl)
void PDPTE::set_writable(bool wr, tlb_invalidation invl)
{
access_helper(wr, RW_MASK, invl);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toyos/src/pml4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void PML4E::set_present(bool pres, tlb_invalidation invl)
access_helper(pres, PR_MASK, invl);
}

void PML4E::set_writeable(bool wr, tlb_invalidation invl)
void PML4E::set_writable(bool wr, tlb_invalidation invl)
{
access_helper(wr, RW_MASK, invl);
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/toyos/src/printf/xprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ int snprintf(char* buff, unsigned long n, const char* fmt, ...)
#if defined(__clang__)
__attribute__((no_sanitize("undefined")))
#endif
int
vsnprintf(char* buff, unsigned long n, const char* fmt, va_list arp)
int vsnprintf(char* buff, unsigned long n, const char* fmt, va_list arp)
{
char* outptr = buff;
char* snprintf_limit = buff + n - (n ? 1 : 0);
Expand Down
Loading