mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-28 16:17:51 +01:00
Compare commits
7 Commits
dependabot
...
04b14863e5
| Author | SHA1 | Date | |
|---|---|---|---|
| 04b14863e5 | |||
| 78db65b84a | |||
| 53e6efa772 | |||
| 8520290a13 | |||
| 6c25a0b324 | |||
| a5f8b53855 | |||
| 57a636f49c |
95
.github/workflows/ficus.yml
vendored
95
.github/workflows/ficus.yml
vendored
@@ -2,13 +2,12 @@ name: Ficus build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Debug
|
||||
BUILD_PARALLEL: 3
|
||||
|
||||
jobs:
|
||||
build-ficus-toolchain:
|
||||
@@ -24,12 +23,94 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y cmake build-essential pax gcc g++ nasm bison bzip2 flex mtools texinfo libgmp-dev libmpfr-dev libmpc-dev xorriso
|
||||
|
||||
- name: Unpack prebuilt toolchain
|
||||
run: cd ${{github.workspace}} && tar xf toolchain_scripts/toolchain-s1-linux-aarch64.tar.xz
|
||||
- name: Cache generic toolchain
|
||||
id: cache-toolchain
|
||||
uses: actions/cache/restore@v4
|
||||
env:
|
||||
cache-name: cache-toolchain
|
||||
with:
|
||||
path: |
|
||||
toolchain/gcc-i686-elf-prefix
|
||||
toolchain/gcc-x86_64-elf-prefix
|
||||
toolchain/grub
|
||||
toolchain/limine
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('toolchain_scripts/*') }}
|
||||
|
||||
- name: Build ficus toolchain
|
||||
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
|
||||
name: Build generic toolchain
|
||||
run: source env.sh && toolchain_scripts/build-all.sh
|
||||
|
||||
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
|
||||
name: Strip toolchain
|
||||
continue-on-error: true
|
||||
run: find toolchain -type f | xargs strip
|
||||
|
||||
- name: Save generic toolchain
|
||||
id: cache-toolchain-save
|
||||
uses: actions/cache/save@v4
|
||||
env:
|
||||
cache-name: cache-toolchain
|
||||
with:
|
||||
path: |
|
||||
toolchain/gcc-i686-elf-prefix
|
||||
toolchain/gcc-x86_64-elf-prefix
|
||||
toolchain/grub
|
||||
toolchain/limine
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('toolchain_scripts/*') }}
|
||||
|
||||
- name: Cache s1 toolchain
|
||||
id: cache-toolchain-s1
|
||||
uses: actions/cache/restore@v4
|
||||
env:
|
||||
cache-name: cache-toolchain-s1
|
||||
with:
|
||||
path: |
|
||||
toolchain/gcc-x86_64-ficus-prefix
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}
|
||||
|
||||
- if: ${{ steps.cache-toolchain-s1.outputs.cache-hit != 'true' }}
|
||||
name: Build ficus toolchain s1
|
||||
run: source ${{github.workspace}}/env.sh && ${{github.workspace}}/ficus-toolchain/build-all.sh s1only
|
||||
|
||||
- if: ${{ steps.cache-toolchain-s1.outputs.cache-hit != 'true' }}
|
||||
name: Strip toolchain
|
||||
continue-on-error: true
|
||||
run: find toolchain -type f | xargs strip
|
||||
|
||||
- name: Save s1 toolchain
|
||||
id: cache-toolchain-s1-save
|
||||
uses: actions/cache/save@v4
|
||||
env:
|
||||
cache-name: cache-toolchain-s1
|
||||
with:
|
||||
path: |
|
||||
toolchain/gcc-x86_64-ficus-prefix
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}
|
||||
|
||||
- name: Cache s2 toolchain
|
||||
id: cache-toolchain-s2
|
||||
uses: actions/cache/restore@v4
|
||||
env:
|
||||
cache-name: cache-toolchain-s2
|
||||
with:
|
||||
path: |
|
||||
toolchain/gcc-x86_64-ficus-prefix
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}-${{ hashFiles('ficus-toolchain/newlib/**/*') }}
|
||||
|
||||
- if: ${{ steps.cache-toolchain-s2.outputs.cache-hit != 'true' }}
|
||||
name: Build ficus toolchain s2
|
||||
run: source ${{github.workspace}}/env.sh && ${{github.workspace}}/ficus-toolchain/build-all.sh s2only
|
||||
|
||||
- name: Save s2 toolchain
|
||||
id: cache-toolchain-s2-save
|
||||
uses: actions/cache/save@v4
|
||||
env:
|
||||
cache-name: cache-toolchain-s2
|
||||
with:
|
||||
path: |
|
||||
toolchain/gcc-x86_64-ficus-prefix
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ficus-toolchain/*.sh') }}-${{ hashFiles('ficus-toolchain/newlib/**/*') }}
|
||||
|
||||
- name: Tar the toolchain
|
||||
run: cd ${{github.workspace}} && tar -czvf toolchain-ficus.tar.xz toolchain sysroot
|
||||
|
||||
@@ -71,7 +152,7 @@ jobs:
|
||||
|
||||
- name: Build iso
|
||||
# Build your program with the given configuration
|
||||
run: source ${{github.workspace}}/env.sh && cmake --build ${{github.workspace}}/build --target iso --config ${{env.BUILD_TYPE}} --parallel ${{env.BUILD_PARALLEL}}
|
||||
run: source ${{github.workspace}}/env.sh && cmake --build ${{github.workspace}}/build --target iso --config ${{env.BUILD_TYPE}} --parallel $(nproc)
|
||||
|
||||
- name: Upload isos
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
7
.github/workflows/unit.yml
vendored
7
.github/workflows/unit.yml
vendored
@@ -2,15 +2,14 @@ name: Unit tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Debug
|
||||
TEST_MODE: UNIT
|
||||
BUILD_PARALLEL: 3
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -35,7 +34,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel ${{env.BUILD_PARALLEL}}
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
|
||||
|
||||
- name: Test
|
||||
# Execute tests defined by the CMake configuration.
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$FICUS_ROOT" ]; then
|
||||
echo "$FICUS_ROOT" is blank
|
||||
echo "$FICUS_ROOT" is blank
|
||||
fi
|
||||
|
||||
export PREFIX="$FICUS_ROOT/toolchain/gcc-x86_64-ficus-prefix/"
|
||||
export TARGET=x86_64-ficus
|
||||
export PATH="$PREFIX/bin:$PATH"
|
||||
|
||||
if [ -z "${BUILD_PARALLEL}" ]
|
||||
then
|
||||
if [ -z "${BUILD_PARALLEL}" ]; then
|
||||
export BUILD_PARALLEL=$(nproc)
|
||||
fi
|
||||
|
||||
if [ -z "${BUILD_PARALLEL}" ]
|
||||
then
|
||||
export BUILD_PARALLEL=$BUILD_PARALLEL
|
||||
fi
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
FbTty::FbTty(Framebuffer *fb) : _fb(fb) {
|
||||
_max_col = _fb->dimensions().x / 8;
|
||||
_max_row = _fb->dimensions().y / 16;
|
||||
_buf.resize(_max_col);
|
||||
for (auto &b: _buf) {
|
||||
b.resize(_max_row);
|
||||
}
|
||||
}
|
||||
void FbTty::putchar(char c) {
|
||||
if (c == '\n') {
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
#ifndef FBTTY_HPP
|
||||
#define FBTTY_HPP
|
||||
|
||||
#include <PS2Keyboard.hpp>
|
||||
#include <Tty.hpp>
|
||||
|
||||
#include <Vector.hpp>
|
||||
|
||||
class Framebuffer;
|
||||
class FbTty : public Tty {
|
||||
@@ -27,6 +28,8 @@ private:
|
||||
int _max_row = 0;
|
||||
int _max_col = 0;
|
||||
|
||||
Vector<Vector<char>> _buf;
|
||||
|
||||
void next_col();
|
||||
void next_row();
|
||||
|
||||
|
||||
@@ -146,6 +146,34 @@ public:
|
||||
return out;
|
||||
}
|
||||
|
||||
void resize(size_t size) {
|
||||
if (size == _cur_size) return;
|
||||
|
||||
if (size < _cur_size) {
|
||||
for (int i = size; i < _cur_size; i++) {
|
||||
if constexpr (!std::is_trivially_destructible<T>::value)
|
||||
std::destroy_at(_data + i);
|
||||
}
|
||||
_cur_size = size;
|
||||
compact();
|
||||
return;
|
||||
}
|
||||
|
||||
if (size > _cur_size) {
|
||||
if (_capacity < size) {
|
||||
_capacity = size;
|
||||
_data = (T *) krealloc(reinterpret_cast<char *>(_data), _capacity * sizeof(T));
|
||||
}
|
||||
for (int i = size; i < _cur_size; i++) {
|
||||
if constexpr (!std::is_trivially_constructible<T>::value)
|
||||
new (_data + i) T();
|
||||
else
|
||||
memset((char *) (_data + i), 0, sizeof(T));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
T *data() { return _data; }
|
||||
const T *data() const { return _data; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user