mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-01 18:39:16 +00:00
Compare commits
113 Commits
Kernel-mem
...
1824c99ca0
Author | SHA1 | Date | |
---|---|---|---|
1824c99ca0 | |||
e8b61e6d7f | |||
69bc044b09 | |||
c86d24030e | |||
4ced264c3c | |||
a25c5f4a96 | |||
c0acbf8790 | |||
7ce73ab813 | |||
0ab1833034 | |||
495a0ea609 | |||
72232d8bd2 | |||
6bd705f06a | |||
0912d4b383 | |||
4350393610 | |||
a8ff50541a | |||
a4c5ab7ef3 | |||
e147e1eff5 | |||
c09bdee89a | |||
3fa7acb116 | |||
749a1b1810 | |||
210e06429c | |||
137f16bc55 | |||
995ef471ab | |||
58f3442c6d | |||
3af04bce80 | |||
75c8dbd31b | |||
fbe9fbfbd1 | |||
e6933acfb0 | |||
07abdd9f6c | |||
9cb66f395b | |||
eb602e12c2 | |||
61b1e95629 | |||
2bb997597e | |||
463d16f8bc | |||
6cf3c62c83 | |||
3a85a5586f | |||
363200d443 | |||
d4001003a3 | |||
8bfed94ba9 | |||
04edfd46bb | |||
082f2fb6f2 | |||
94cdd71e1e | |||
c22c079628 | |||
6024a2347b | |||
c723a5f82d | |||
a6d2d51870 | |||
fb186f6615 | |||
0160fa3c72 | |||
d77d6892a0 | |||
2b1ec40dc3 | |||
a1fa698bc3 | |||
4c0cb59aa7 | |||
f015ff606f | |||
df0c17b50f | |||
9a9ee7e571 | |||
e7e248bc3a | |||
bbc6212cfa | |||
170922e1be | |||
100927547d | |||
073f582752 | |||
edd13c30c5 | |||
6dae34debd | |||
dea36a0228 | |||
8dd3179aaa | |||
0699d7962d | |||
e4403cdbd6 | |||
5632c7cb10 | |||
efb3a80ffd | |||
5d3bb391a4 | |||
b3f304f2c5 | |||
e23e793574 | |||
522158913f | |||
12a768a592 | |||
9ea2f4266e | |||
eb7c13dd45 | |||
8f04f8a374 | |||
1695418dcb | |||
b208862de2 | |||
a8481d4260 | |||
c84757af48 | |||
80afbedf39 | |||
911caf7203 | |||
95a8d6fb6f | |||
b471645743 | |||
cc6ec04814 | |||
1dbee4660e | |||
81af8a48cb | |||
0807ea5a9a
|
|||
79d267631a
|
|||
cbd671292d
|
|||
37c3ee8e99
|
|||
7d85dd5dd8
|
|||
17abdcaf1e
|
|||
f038f6110e
|
|||
3798ec0f58
|
|||
fe5e4e3eec
|
|||
6f17b29963
|
|||
8b026175bb
|
|||
828dab1875
|
|||
7948d0c6e5
|
|||
ce3cf8162a
|
|||
640b902045
|
|||
0dbdacb8df
|
|||
220238eff8
|
|||
360afdbc9c
|
|||
f34a222bf1
|
|||
1b1d3e68fd
|
|||
f11c00a4e3
|
|||
ae07b07964
|
|||
23853cbb15
|
|||
00a37325f6
|
|||
ce4ebaf6c5
|
|||
5806c4feaf
|
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# EditorConfig is awesome: https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[.github/**]
|
||||
indent_style = space
|
||||
indent_size = 2
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -3,7 +3,7 @@
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: EnderIce2 # Replace with a single Ko-fi username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
|
431
.github/workflows/makefile.yml
vendored
431
.github/workflows/makefile.yml
vendored
@ -7,17 +7,158 @@ on:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
buildcompiler:
|
||||
name: Build Cross-Compiler & Toolchain
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache cross Folder
|
||||
id: cache-cross
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Update System
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: sudo apt update
|
||||
|
||||
- name: Install GCC Dependencies
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: sudo apt --no-install-recommends -y install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libzstd-dev libisl-dev m4 automake gettext gperf dejagnu guile-3.0 guile-3.0-dev expect tcl autogen tex-common sphinx-common git ssh diffutils patch autoconf2.69 libtool wget dpkg
|
||||
|
||||
- name: Check autoconf
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
if [ "$(autoconf --version | head -n 1 | awk '{print $NF}')" != "2.69" ]; then
|
||||
echo "Autoconf version is not 2.69, performing additional steps..."
|
||||
wget https://launchpad.net/ubuntu/+archive/primary/+files/autoconf_2.69-11.1_all.deb
|
||||
sudo dpkg --force-all -i ./autoconf_2.69-11.1_all.deb
|
||||
fi
|
||||
|
||||
- name: Check automake
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
if [ "$(automake --version | head -n 1 | awk '{print $NF}')" != "1.15.1" ]; then
|
||||
echo "Automake version is not 1.15.1, performing additional steps..."
|
||||
wget https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz
|
||||
tar -xzf automake-1.15.1.tar.gz
|
||||
cd automake-1.15.1
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
fi
|
||||
|
||||
- name: Clone All
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools __clone_all_no_qemu
|
||||
|
||||
- name: Compile Binutils
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_binutils
|
||||
|
||||
- name: Compile GCC
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_gcc
|
||||
|
||||
- name: Clean Up
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd tools
|
||||
rm -rf binutils-gdb gcc
|
||||
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler]
|
||||
permissions:
|
||||
security-events: write
|
||||
packages: read
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: c-cpp
|
||||
build-mode: manual
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for cache
|
||||
id: check-cache
|
||||
run: |
|
||||
if [ -z "${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}" ]; then
|
||||
echo "No cache found, cancelling job."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
|
||||
- if: matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'If you are using a "manual" build mode for one or more of the' \
|
||||
'languages you are analyzing, replace this with the commands to build' \
|
||||
'your code, for example:'
|
||||
echo ' make bootstrap'
|
||||
echo ' make release'
|
||||
exit 0
|
||||
|
||||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo
|
||||
make --quiet -C tools do_limine
|
||||
make --quiet prepare
|
||||
|
||||
- name: Cache cross
|
||||
id: cache-cross
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Build OS
|
||||
run: |
|
||||
make build_userspace
|
||||
make build_drivers
|
||||
make build_kernel
|
||||
make build_userspace
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
deploydoc:
|
||||
name: Deploy Documentation to GitHub Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Update System
|
||||
run: sudo apt update
|
||||
|
||||
- name: Install Doxygen
|
||||
run: sudo apt-get install doxygen make -y
|
||||
run: sudo apt --no-install-recommends -y install doxygen make
|
||||
|
||||
- name: Generate Documentation
|
||||
run: make doxygen
|
||||
@ -30,310 +171,190 @@ jobs:
|
||||
with:
|
||||
folder: doxygen-doc
|
||||
|
||||
buildcompiler:
|
||||
name: Build Cross-Compiler & Toolchain
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache cross Folder
|
||||
id: cache-cross
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Update System
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Install GCC Dependencies
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: sudo apt install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libzstd-dev libisl-dev autoconf m4 automake gettext gperf dejagnu guile-3.0 guile-3.0-dev expect tcl autogen tex-common sphinx-common git ssh diffutils patch -y
|
||||
|
||||
- name: Clone All
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools __clone_all_no_qemu
|
||||
|
||||
- name: Compile Binutils amd64
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_binutils_64
|
||||
|
||||
- name: Compile Binutils i386
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_binutils_32
|
||||
|
||||
- name: Compile GCC amd64
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_gcc_64
|
||||
|
||||
- name: Compile GCC i386
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_gcc_32
|
||||
|
||||
- name: Clean Up
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd tools
|
||||
rm -rf binutils-gdb gcc build-binutils64 build-gcc64 build-binutils32 build-gcc32
|
||||
|
||||
compilegnuefi:
|
||||
name: Build GNU-EFI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache gnu-efi Folder
|
||||
id: cache-gnuefi
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: Lynx/gnu-efi
|
||||
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
|
||||
|
||||
- name: Update System
|
||||
if: steps.cache-gnuefi.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Install MinGW compiler
|
||||
if: steps.cache-gnuefi.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get install make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
|
||||
|
||||
- name: Get GNU-EFI source code and compile it
|
||||
if: steps.cache-gnuefi.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C Lynx prepare
|
||||
|
||||
analyze:
|
||||
name: Analyze with CodeQL
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler, compilegnuefi]
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install rustc xorriso mtools genisoimage ovmf nasm doxygen make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo -y
|
||||
make --quiet -C tools do_limine
|
||||
make --quiet -C Drivers prepare
|
||||
make --quiet -C Userspace prepare
|
||||
make --quiet -C Lynx prepare
|
||||
make --quiet -C Kernel prepare
|
||||
|
||||
- name: Cache cross
|
||||
id: cache-cross
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Cache gnuefi
|
||||
id: cache-gnuefi
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: Lynx/gnu-efi
|
||||
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
|
||||
|
||||
- name: Build OS
|
||||
run: |
|
||||
make build_lynx
|
||||
make build_userspace
|
||||
make build_drivers
|
||||
make build_kernel
|
||||
make build_userspace
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
|
||||
compile64:
|
||||
compile_amd64:
|
||||
name: Build amd64
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler, compilegnuefi]
|
||||
needs: [buildcompiler]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Update & Install Required Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
|
||||
sudo apt update
|
||||
sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64
|
||||
make --quiet -C tools do_limine
|
||||
make --quiet -C Drivers prepare
|
||||
make --quiet -C Userspace prepare
|
||||
make --quiet -C Lynx prepare
|
||||
make --quiet -C Kernel prepare
|
||||
make --quiet prepare
|
||||
|
||||
- name: Cache cross Folder
|
||||
id: cache-cross
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Cache gnu-efi Folder
|
||||
id: cache-gnuefi
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: Lynx/gnu-efi
|
||||
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
|
||||
|
||||
- name: Configure Makefile.conf
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
|
||||
- name: Configure config.mk
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
|
||||
- name: Compile Debug and Release ISO
|
||||
run: |
|
||||
make build
|
||||
mv Fennix.iso Fennix-debug.iso
|
||||
make clean
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./Makefile.conf && cat Makefile.conf | grep DEBUG
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
make build
|
||||
mv Fennix.iso Fennix-release.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-debug.iso)
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-amd64-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-amd64-release
|
||||
path: Fennix-release.iso
|
||||
|
||||
compile32:
|
||||
compile_i386:
|
||||
name: Build i386
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler, compilegnuefi]
|
||||
needs: [buildcompiler]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Update & Install Required Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
|
||||
sudo apt update
|
||||
sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64
|
||||
make --quiet -C tools do_limine
|
||||
make --quiet -C Drivers prepare
|
||||
make --quiet -C Userspace prepare
|
||||
make --quiet -C Lynx prepare
|
||||
make --quiet -C Kernel prepare
|
||||
make --quiet prepare
|
||||
|
||||
- name: Cache cross Folder
|
||||
id: cache-cross
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Cache gnu-efi Folder
|
||||
id: cache-gnuefi
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: Lynx/gnu-efi
|
||||
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
|
||||
|
||||
- name: Configure Makefile.conf
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
|
||||
- name: Configure config.mk
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH
|
||||
|
||||
- name: Compile Debug and Release ISO
|
||||
run: |
|
||||
make build
|
||||
mv Fennix.iso Fennix-debug.iso
|
||||
make clean
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./Makefile.conf && cat Makefile.conf | grep DEBUG
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
make build
|
||||
mv Fennix.iso Fennix-release.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-debug.iso)
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-i386-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-i386-release
|
||||
path: Fennix-release.iso
|
||||
|
||||
compilearm64:
|
||||
if: ${{ false }} # Disabled until we can get it to work
|
||||
compile_aarch64:
|
||||
name: Build aarch64
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler, compilegnuefi]
|
||||
needs: [buildcompiler]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Update & Install Required Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
|
||||
sudo apt update
|
||||
sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64
|
||||
make --quiet -C tools do_limine
|
||||
make --quiet -C Drivers prepare
|
||||
make --quiet -C Userspace prepare
|
||||
make --quiet -C Lynx prepare
|
||||
make --quiet -C Kernel prepare
|
||||
make --quiet prepare
|
||||
|
||||
- name: Cache cross Folder
|
||||
id: cache-cross
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Cache gnu-efi Folder
|
||||
id: cache-gnuefi
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: Lynx/gnu-efi
|
||||
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
|
||||
|
||||
- name: Configure Makefile.conf
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
|
||||
- name: Configure config.mk
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
|
||||
- name: Compile Debug and Release ISO
|
||||
run: |
|
||||
make build
|
||||
mv Fennix.iso Fennix-debug.iso
|
||||
make clean
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./Makefile.conf && cat Makefile.conf | grep DEBUG
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
make build
|
||||
mv Fennix.iso Fennix-release.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-debug.iso)
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-aarch64-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-aarch64-release
|
||||
path: Fennix-release.iso
|
||||
|
||||
compile_arm:
|
||||
name: Build arm
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Update & Install Required Packages
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --no-install-recommends -y install rustc xorriso mtools genisoimage ovmf nasm doxygen make meson gcc-10 g++-10 gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64
|
||||
make --quiet -C tools do_limine
|
||||
make --quiet prepare
|
||||
|
||||
- name: Cache cross Folder
|
||||
id: cache-cross
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Configure config.mk
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = arm/' ./config.mk && cat config.mk | grep OSARCH
|
||||
|
||||
- name: Compile Debug and Release ISO
|
||||
run: |
|
||||
make build
|
||||
mv Fennix.iso Fennix-debug.iso
|
||||
make clean
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
make build
|
||||
mv Fennix.iso Fennix-release.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-debug.iso)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-arm-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-arm-release
|
||||
path: Fennix-release.iso
|
||||
|
13
.gitignore
vendored
13
.gitignore
vendored
@ -2,18 +2,6 @@ iso_tmp_data
|
||||
initrd_tmp_data
|
||||
initrd/usr/include/*
|
||||
!initrd/usr/include/.gitkeep
|
||||
tools/*
|
||||
!tools/ExtMemDbg
|
||||
!tools/stage2_eltorito
|
||||
!tools/*.md
|
||||
!tools/*.css
|
||||
!tools/README.md
|
||||
!tools/website
|
||||
!tools/Makefile
|
||||
!tools/*.c
|
||||
!tools/*.cpp
|
||||
!tools/*.cfg
|
||||
!tools/SSDT1.dat
|
||||
doxygen-doc
|
||||
initrd.tar
|
||||
.dccache
|
||||
@ -28,3 +16,4 @@ initrd.tar
|
||||
*.so
|
||||
*.o
|
||||
*.dmp
|
||||
*.pcap
|
||||
|
@ -87,11 +87,11 @@ build64:
|
||||
- make --quiet -C Userspace prepare
|
||||
- make --quiet -C Lynx prepare
|
||||
- make --quiet -C Kernel prepare
|
||||
- sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
|
||||
- sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
- make build
|
||||
- mv Fennix.iso Fennix-debug.iso
|
||||
- make clean
|
||||
- sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./Makefile.conf && cat Makefile.conf | grep DEBUG
|
||||
- sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
- make build
|
||||
- mv Fennix.iso Fennix-release.iso
|
||||
artifacts:
|
||||
@ -111,11 +111,11 @@ build32:
|
||||
- make --quiet -C Userspace prepare
|
||||
- make --quiet -C Lynx prepare
|
||||
- make --quiet -C Kernel prepare
|
||||
- sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
|
||||
- sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH
|
||||
- make build
|
||||
- mv Fennix.iso Fennix-debug.iso
|
||||
- make clean
|
||||
- sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./Makefile.conf && cat Makefile.conf | grep DEBUG
|
||||
- sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
- make build
|
||||
- mv Fennix.iso Fennix-release.iso
|
||||
artifacts:
|
||||
@ -134,11 +134,11 @@ buildarm64:
|
||||
- make --quiet -C Userspace prepare
|
||||
- make --quiet -C Lynx prepare
|
||||
- make --quiet -C Kernel prepare
|
||||
- sed -i 's/.*OSARCH = .*/OSARCH = arm64/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
|
||||
- sed -i 's/.*OSARCH = .*/OSARCH = arm64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
- make build
|
||||
- mv Fennix.iso Fennix-debug.iso
|
||||
- make clean
|
||||
- sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./Makefile.conf && cat Makefile.conf | grep DEBUG
|
||||
- sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
- make build
|
||||
- mv Fennix.iso Fennix-release.iso
|
||||
artifacts:
|
||||
|
20
.vscode/c_boilerplates.code-snippets
vendored
20
.vscode/c_boilerplates.code-snippets
vendored
@ -1,20 +0,0 @@
|
||||
{
|
||||
"Fennix Kernel Header": {
|
||||
"scope": "c",
|
||||
"prefix": [
|
||||
"head",
|
||||
],
|
||||
"body": [
|
||||
"#ifndef __FENNIX_KERNEL_${2:header}_H__",
|
||||
"#define __FENNIX_KERNEL_${2:header}_H__",
|
||||
"",
|
||||
"#include <types.h>",
|
||||
"",
|
||||
"$0",
|
||||
"",
|
||||
"#endif // !__FENNIX_KERNEL_${2:header}_H__",
|
||||
""
|
||||
],
|
||||
"description": "Create kernel header."
|
||||
}
|
||||
}
|
135
.vscode/launch.json
vendored
Normal file
135
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Kernel (x64)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/../Kernel/fennix.elf",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"targetArchitecture": "x64",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerServerAddress": "/tmp/gdb-fennix",
|
||||
"miDebuggerPath": "${workspaceFolder}/../tools/cross/bin/x86_64-fennix-gdb",
|
||||
"externalConsole": false,
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "set breakpoint pending on",
|
||||
"description": "Make breakpoint pending on future shared library load."
|
||||
},
|
||||
{
|
||||
"text": "add-symbol-file ${workspaceFolder}/../initrd_tmp_data/bin/utest",
|
||||
"description": "Load /bin/utest",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"text": "source ${workspaceFolder}/../tools/.gdbinit"
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "launch-qemu"
|
||||
},
|
||||
{
|
||||
"name": "Debug Kernel (x86)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/../Kernel/fennix.elf",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"targetArchitecture": "x86",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerServerAddress": "/tmp/gdb-fennix",
|
||||
"miDebuggerPath": "${workspaceFolder}/../tools/cross/bin/i386-fennix-gdb",
|
||||
"externalConsole": false,
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "set breakpoint pending on",
|
||||
"description": "Make breakpoint pending on future shared library load."
|
||||
},
|
||||
{
|
||||
"text": "add-symbol-file ${workspaceFolder}/../initrd_tmp_data/bin/utest",
|
||||
"description": "Load /bin/utest",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"text": "source ${workspaceFolder}/../tools/.gdbinit"
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "launch-qemu"
|
||||
},
|
||||
{
|
||||
"name": "Debug Kernel (arm64)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/../Kernel/fennix.elf",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"targetArchitecture": "arm64",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerServerAddress": "/tmp/gdb-fennix",
|
||||
"miDebuggerPath": "${workspaceFolder}/../tools/cross/bin/aarch64-fennix-gdb",
|
||||
"externalConsole": false,
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "set breakpoint pending on",
|
||||
"description": "Make breakpoint pending on future shared library load."
|
||||
},
|
||||
{
|
||||
"text": "add-symbol-file ${workspaceFolder}/../initrd_tmp_data/bin/utest",
|
||||
"description": "Load /bin/utest",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"text": "source ${workspaceFolder}/../tools/.gdbinit"
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "launch-qemu"
|
||||
},
|
||||
{
|
||||
"name": "Debug Kernel (arm)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/../Kernel/fennix.elf",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"targetArchitecture": "arm",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerServerAddress": "/tmp/gdb-fennix",
|
||||
"miDebuggerPath": "${workspaceFolder}/../tools/cross/bin/arm-fennix-gdb",
|
||||
"externalConsole": false,
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "set breakpoint pending on",
|
||||
"description": "Make breakpoint pending on future shared library load."
|
||||
},
|
||||
{
|
||||
"text": "add-symbol-file ${workspaceFolder}/../initrd_tmp_data/bin/utest",
|
||||
"description": "Load /bin/utest",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"text": "source ${workspaceFolder}/../tools/.gdbinit"
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "launch-qemu"
|
||||
},
|
||||
{
|
||||
"type": "gdb",
|
||||
"request": "attach",
|
||||
"name": "Launch QEMU & attach to gdbserver (x64)",
|
||||
"executable": "${workspaceFolder}/../Kernel/fennix.elf",
|
||||
"target": "/tmp/gdb-fennix",
|
||||
"remote": true,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"valuesFormatting": "parseText",
|
||||
"gdbpath": "${workspaceFolder}/../tools/cross/bin/x86_64-fennix-gdb",
|
||||
"autorun": [
|
||||
"set auto-load safe-path ${workspaceFolder}",
|
||||
"source ${workspaceFolder}/../tools/.gdbinit",
|
||||
],
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"printCalls": false,
|
||||
"preLaunchTask": "launch-qemu"
|
||||
},
|
||||
]
|
||||
}
|
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"C_Cpp.errorSquiggles": "Enabled",
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"C_Cpp.autocompleteAddParentheses": true,
|
||||
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
|
||||
"C_Cpp.clang_format_style": "Visual Studio",
|
||||
@ -11,16 +11,10 @@
|
||||
"editor.cursorSmoothCaretAnimation": "on",
|
||||
"files.watcherExclude": {
|
||||
"**/tools/binutils-gdb/**": true,
|
||||
"**/tools/build-binutilsamd64/**": true,
|
||||
"**/tools/build-binutilsarm64/**": true,
|
||||
"**/tools/build-binutilsi386/**": true,
|
||||
"**/tools/build-gccamd64/**": true,
|
||||
"**/tools/build-gccarm64/**": true,
|
||||
"**/tools/build-gcci386/**": true,
|
||||
"**/tools/cross/**": true,
|
||||
"**/tools/gcc/**": true,
|
||||
"**/tools/limine/**": true,
|
||||
"**/tools/qemu/**": true,
|
||||
"**/tools/cross/**": true,
|
||||
"**/doxygen-doc/**": true,
|
||||
}
|
||||
}
|
28
.vscode/tasks.json
vendored
Normal file
28
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "launch-qemu",
|
||||
"type": "shell",
|
||||
"command": "make -C ../ build && make -C ../ vscode_debug_only",
|
||||
"isBackground": true,
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
13
Bootloader/.editorconfig
Normal file
13
Bootloader/.editorconfig
Normal file
@ -0,0 +1,13 @@
|
||||
# EditorConfig is awesome: https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
10
Bootloader/.gitignore
vendored
Normal file
10
Bootloader/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
gnu-efi
|
||||
include/*
|
||||
!include/stdbool.h
|
||||
!include/types.h
|
||||
*.o
|
||||
*.su
|
||||
*.EFI
|
||||
*.map
|
||||
*.bin
|
||||
*.elf
|
96
Bootloader/.vscode/c_boilerplates.code-snippets
vendored
Normal file
96
Bootloader/.vscode/c_boilerplates.code-snippets
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"Lynx Bootloader C++ Header": {
|
||||
"isFileTemplate": true,
|
||||
"scope": "c,cpp",
|
||||
"prefix": [
|
||||
"head",
|
||||
],
|
||||
"body": [
|
||||
"/*",
|
||||
"\tThis file is part of Lynx Bootloader.",
|
||||
"",
|
||||
"\tLynx Bootloader is free software: you can redistribute it and/or",
|
||||
"\tmodify it under the terms of the GNU General Public License as",
|
||||
"\tpublished by the Free Software Foundation, either version 3 of",
|
||||
"\tthe License, or (at your option) any later version.",
|
||||
"",
|
||||
"\tLynx Bootloader is distributed in the hope that it will be useful,",
|
||||
"\tbut WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"\tGNU General Public License for more details.",
|
||||
"",
|
||||
"\tYou should have received a copy of the GNU General Public License",
|
||||
"\talong with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.",
|
||||
"*/",
|
||||
"",
|
||||
"#pragma once",
|
||||
"",
|
||||
"$0",
|
||||
"",
|
||||
"$1",
|
||||
""
|
||||
],
|
||||
"description": "Create kernel header."
|
||||
},
|
||||
"Lynx Bootloader C Header": {
|
||||
"isFileTemplate": true,
|
||||
"scope": "c,cpp",
|
||||
"prefix": [
|
||||
"headc",
|
||||
],
|
||||
"body": [
|
||||
"/*",
|
||||
"\tThis file is part of Lynx Bootloader.",
|
||||
"",
|
||||
"\tLynx Bootloader is free software: you can redistribute it and/or",
|
||||
"\tmodify it under the terms of the GNU General Public License as",
|
||||
"\tpublished by the Free Software Foundation, either version 3 of",
|
||||
"\tthe License, or (at your option) any later version.",
|
||||
"",
|
||||
"\tLynx Bootloader is distributed in the hope that it will be useful,",
|
||||
"\tbut WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"\tGNU General Public License for more details.",
|
||||
"",
|
||||
"\tYou should have received a copy of the GNU General Public License",
|
||||
"\talong with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.",
|
||||
"*/",
|
||||
"",
|
||||
"#ifndef __LYNX_BOOTLOADER_${1:header}_H__",
|
||||
"#define __LYNX_BOOTLOADER_${1:header}_H__",
|
||||
"",
|
||||
"#include <types.h>",
|
||||
"",
|
||||
"$0",
|
||||
"",
|
||||
"#endif // !__LYNX_BOOTLOADER_${1:header}_H__",
|
||||
""
|
||||
],
|
||||
"description": "Create kernel header."
|
||||
},
|
||||
"License": {
|
||||
"isFileTemplate": true,
|
||||
"prefix": [
|
||||
"license",
|
||||
],
|
||||
"body": [
|
||||
"/*",
|
||||
"\tThis file is part of Lynx Bootloader.",
|
||||
"",
|
||||
"\tLynx Bootloader is free software: you can redistribute it and/or",
|
||||
"\tmodify it under the terms of the GNU General Public License as",
|
||||
"\tpublished by the Free Software Foundation, either version 3 of",
|
||||
"\tthe License, or (at your option) any later version.",
|
||||
"",
|
||||
"\tLynx Bootloader is distributed in the hope that it will be useful,",
|
||||
"\tbut WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"\tGNU General Public License for more details.",
|
||||
"",
|
||||
"\tYou should have received a copy of the GNU General Public License",
|
||||
"\talong with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.",
|
||||
"*/"
|
||||
],
|
||||
"description": "Create kernel license."
|
||||
}
|
||||
}
|
184
Bootloader/.vscode/c_cpp_properties.json
vendored
Normal file
184
Bootloader/.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Fennix x64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/x86_64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fno-pic",
|
||||
"-fno-pie",
|
||||
"-mno-red-zone",
|
||||
"-march=core2",
|
||||
"-pipe",
|
||||
"-mcmodel=kernel",
|
||||
"-fno-builtin",
|
||||
"-m64",
|
||||
"-fcoroutines",
|
||||
// Warnings
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wfloat-equal",
|
||||
"-Wpointer-arith",
|
||||
"-Wcast-align",
|
||||
"-Wredundant-decls",
|
||||
"-Winit-self",
|
||||
"-Wswitch-default",
|
||||
"-Wstrict-overflow=5",
|
||||
"-Wconversion",
|
||||
// C++ flags
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions",
|
||||
// Linker flags
|
||||
"-T${workspaceFolder}/arch/amd64/linker.ld",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-shared",
|
||||
// Debug flags
|
||||
"-ggdb3",
|
||||
"-O0",
|
||||
"-fdiagnostics-color=always",
|
||||
"-fverbose-asm",
|
||||
"-fstack-usage",
|
||||
"-fstack-check",
|
||||
"-fsanitize=undefined",
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix x32 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/i386-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x86",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fno-pic",
|
||||
"-fno-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-march=pentium",
|
||||
"-pipe",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
"-m32",
|
||||
"-fcoroutines",
|
||||
// Warnings
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wfloat-equal",
|
||||
"-Wpointer-arith",
|
||||
"-Wcast-align",
|
||||
"-Wredundant-decls",
|
||||
"-Winit-self",
|
||||
"-Wswitch-default",
|
||||
"-Wstrict-overflow=5",
|
||||
"-Wconversion",
|
||||
// C++ flags
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions",
|
||||
// Linker flags
|
||||
"-T${workspaceFolder}/arch/i386/linker.ld",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-shared",
|
||||
// Debug flags
|
||||
"-ggdb3",
|
||||
"-O0",
|
||||
"-fdiagnostics-color=always",
|
||||
"-fverbose-asm",
|
||||
"-fstack-usage",
|
||||
"-fstack-check",
|
||||
"-fsanitize=undefined",
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix Arm (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/arm-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "linux-gcc-arm",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix Aarch64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/aarch64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "linux-gcc-arm64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
1
Bootloader/.vscode/launch.json
vendored
Symbolic link
1
Bootloader/.vscode/launch.json
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../.vscode/launch.json
|
11
Bootloader/.vscode/preinclude.h
vendored
Normal file
11
Bootloader/.vscode/preinclude.h
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
#undef __linux__
|
||||
#undef __WIN32__
|
||||
#undef __WIN64__
|
||||
#undef _WIN32
|
||||
#undef _WIN64
|
||||
#undef __APPLE__
|
||||
#undef __clang__
|
||||
#define __vscode__ 1
|
||||
#define __kernel__ 1
|
||||
#define GIT_COMMIT "0000000000000000000000000000000000000000"
|
||||
#define GIT_COMMIT_SHORT "0000000"
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"C_Cpp.errorSquiggles": "Enabled",
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"C_Cpp.autocompleteAddParentheses": true,
|
||||
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
|
||||
"C_Cpp.clang_format_style": "Visual Studio",
|
||||
@ -14,6 +14,10 @@
|
||||
"clang-diagnostic-unknown-warning-option",
|
||||
"clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
|
||||
"clang-diagnostic-implicit-exception-spec-mismatch",
|
||||
"clang-diagnostic-unknown-attributes"
|
||||
"clang-diagnostic-unknown-attributes",
|
||||
"clang-diagnostic-user-defined-literals",
|
||||
"clang-diagnostic-non-pod-varargs",
|
||||
"clang-diagnostic-non-pod-varargs",
|
||||
"clang-diagnostic-non-pod-varargs"
|
||||
]
|
||||
}
|
1
Bootloader/.vscode/tasks.json
vendored
Symbolic link
1
Bootloader/.vscode/tasks.json
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../.vscode/tasks.json
|
56
Bootloader/Makefile
Normal file
56
Bootloader/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
GNUEFI_RELEASE_VERSION=3.0.18
|
||||
|
||||
GIT_COMMIT = $(shell git rev-parse HEAD)
|
||||
GIT_COMMIT_SHORT = $(shell git rev-parse --short HEAD)
|
||||
|
||||
export CC := $(__CONF_CC)
|
||||
export CXX := $(__CONF_CXX)
|
||||
export LD := $(__CONF_LD)
|
||||
export AS := $(__CONF_AS)
|
||||
export AR := $(__CONF_AR)
|
||||
export NM := $(__CONF_NM)
|
||||
export OBJCOPY := $(__CONF_OBJCOPY)
|
||||
export OBJDUMP := $(__CONF_OBJDUMP)
|
||||
export GDB := $(__CONF_GDB)
|
||||
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
prepare:
|
||||
ifeq ("$(wildcard ./gnu-efi)", "")
|
||||
wget https://freefr.dl.sourceforge.net/project/gnu-efi/gnu-efi-$(GNUEFI_RELEASE_VERSION).tar.bz2
|
||||
tar -xf gnu-efi-$(GNUEFI_RELEASE_VERSION).tar.bz2
|
||||
rm gnu-efi-$(GNUEFI_RELEASE_VERSION).tar.bz2
|
||||
mv ./gnu-efi-$(GNUEFI_RELEASE_VERSION) ./gnu-efi
|
||||
cp -a ./gnu-efi/inc/. ./include
|
||||
endif
|
||||
# echo "PREPARE > Compiling gnu-efi for x86_64"
|
||||
# make -C gnu-efi all ARCH=x86_64 \
|
||||
# AR=$(TOOLCHAIN_AMD64_PREFIX)ar \
|
||||
# AS=$(TOOLCHAIN_AMD64_PREFIX)as \
|
||||
# CC=$(TOOLCHAIN_AMD64_PREFIX)gcc \
|
||||
# LD=$(TOOLCHAIN_AMD64_PREFIX)ld
|
||||
# echo "PREPARE > Compiling gnu-efi for arm"
|
||||
# make -C gnu-efi all ARCH=arm \
|
||||
# AR=$(TOOLCHAIN_ARM_PREFIX)ar \
|
||||
# AS=$(TOOLCHAIN_ARM_PREFIX)as \
|
||||
# CC=$(TOOLCHAIN_ARM_PREFIX)gcc \
|
||||
# LD=$(TOOLCHAIN_ARM_PREFIX)ld \
|
||||
# CFLAGS="-I$(CURDIR)/gnu-efi/inc"
|
||||
# echo "PREPARE > Compiling gnu-efi for aarch64"
|
||||
# make -C gnu-efi all ARCH=aarch64 \
|
||||
# AR=$(TOOLCHAIN_AARCH64_PREFIX)ar \
|
||||
# AS=$(TOOLCHAIN_AARCH64_PREFIX)as \
|
||||
# CC=$(TOOLCHAIN_AARCH64_PREFIX)gcc \
|
||||
# LD=$(TOOLCHAIN_AARCH64_PREFIX)ld
|
||||
|
||||
build:
|
||||
$(MAKE) -C common build
|
||||
$(MAKE) -C firmware build
|
||||
# $(MAKE) -C uefi build
|
||||
|
||||
clean:
|
||||
$(MAKE) -C common clean
|
||||
$(MAKE) -C firmware clean
|
||||
# $(MAKE) -C uefi clean
|
||||
rm -f boot.bin
|
13
Bootloader/README.md
Normal file
13
Bootloader/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Lynx Bootloader
|
||||
|
||||
> [!CAUTION]
|
||||
> The project is in early stages of development and is not yet ready for production use.
|
||||
>
|
||||
> Use at your own risk.
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
### [bios](bios)
|
||||
|
||||
### [uefi](uefi)
|
19
Bootloader/common/Makefile
Normal file
19
Bootloader/common/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
define find-sources
|
||||
$(shell find ./ -type f -name '$1' -print0 | xargs -0)
|
||||
endef
|
||||
|
||||
BMP_SOURCES := $(call find-sources,*.bmp)
|
||||
PSF_SOURCES := $(call find-sources,*.psf)
|
||||
S_SOURCES := $(call find-sources,*.S)
|
||||
s_SOURCES := $(call find-sources,*.s)
|
||||
C_SOURCES := $(call find-sources,*.c)
|
||||
CXX_SOURCES := $(call find-sources,*.cpp)
|
||||
|
||||
OBJ = $(BMP_SOURCES:.bmp=.o) $(PSF_SOURCES:.psf=.o) $(s_SOURCES:.s=.o) $(S_SOURCES:.S=.o) $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)
|
||||
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build:
|
||||
|
||||
clean:
|
21
Bootloader/common/main.c
Normal file
21
Bootloader/common/main.c
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
8
Bootloader/firmware/Makefile
Normal file
8
Bootloader/firmware/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build:
|
||||
$(MAKE) -C $(OSARCH) build
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(OSARCH) clean
|
64
Bootloader/firmware/aarch64/Makefile
Normal file
64
Bootloader/firmware/aarch64/Makefile
Normal file
@ -0,0 +1,64 @@
|
||||
define find-sources
|
||||
$(shell find ./ -type f -name '$1' $(shell echo $(foreach board,$(filter-out $(BOARD_TYPE),$(AVAILABLE_BOARDS)), -not -path \"./$(board)/*\")) -print0 | xargs -0)
|
||||
endef
|
||||
|
||||
S_SOURCES := $(call find-sources,*.S)
|
||||
s_SOURCES := $(call find-sources,*.s)
|
||||
C_SOURCES := $(call find-sources,*.c)
|
||||
|
||||
define find-common-sources
|
||||
$(shell find ../../common -type f -name '$1' -print0 | xargs -0)
|
||||
endef
|
||||
|
||||
C_COMMON_SOURCES := $(call find-common-sources,*.c)
|
||||
|
||||
OBJ = $(s_SOURCES:.s=.o) $(S_SOURCES:.S=.o) $(C_SOURCES:.c=.o) $(C_COMMON_SOURCES:.c=.o)
|
||||
|
||||
LDFLAGS = -static -nostdlib -nodefaultlibs -nolibc \
|
||||
-Wl,-static,--no-dynamic-linker,-ztext \
|
||||
-zmax-page-size=0x1000 \
|
||||
-Wl,-Map boot.map -fno-pic -fno-pie
|
||||
|
||||
CFLAGS := \
|
||||
$(INCLUDE_DIR) \
|
||||
-D__kernel__='1' \
|
||||
-DGIT_COMMIT='"$(GIT_COMMIT)"' \
|
||||
-DGIT_COMMIT_SHORT='"$(GIT_COMMIT_SHORT)"' \
|
||||
-fno-pic -fno-pie -fno-builtin -I../../include
|
||||
|
||||
CFLAGS += -mcmodel=large
|
||||
LDFLAGS += -T$(BOARD_TYPE)/linker.ld
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always
|
||||
# CFLAGS += -fsanitize=undefined
|
||||
CFLAGS += -fstack-check -fverbose-asm
|
||||
LDFLAGS += -ggdb3 -O0
|
||||
ASFLAGS += -g --gstabs+ --gdwarf-5 -D
|
||||
endif # DEBUG
|
||||
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build: boot.bin
|
||||
|
||||
boot.bin: $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(LDFLAGS) $(OBJ) -o tmp.elf
|
||||
$(OBJCOPY) tmp.elf -O binary ../../boot.bin
|
||||
# rm tmp.elf
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(CFLAGS) -fstack-protector-all -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.s
|
||||
$(info Compiling $<)
|
||||
$(AS) $(ASFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) boot.map
|
1
Bootloader/firmware/aarch64/raspi3
Symbolic link
1
Bootloader/firmware/aarch64/raspi3
Symbolic link
@ -0,0 +1 @@
|
||||
./raspi4
|
49
Bootloader/firmware/aarch64/raspi4/boot.S
Normal file
49
Bootloader/firmware/aarch64/raspi4/boot.S
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
.section ".text.boot"
|
||||
|
||||
.extern __bss_start
|
||||
.extern __bss_end
|
||||
.extern __bss_size
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
/* Keep only the main core */
|
||||
mrs x1, mpidr_el1
|
||||
and x1, x1, #3
|
||||
cbz x1, 2f
|
||||
|
||||
/* Halt */
|
||||
1: wfe
|
||||
b 1b
|
||||
|
||||
/* Initialize the stack */
|
||||
2: ldr x1, =_start
|
||||
mov sp, x1
|
||||
|
||||
/* Clear the BSS */
|
||||
ldr x1, =__bss_start
|
||||
ldr w2, =__bss_size
|
||||
3: cbz w2, 4f
|
||||
str xzr, [x1], #8
|
||||
sub w2, w2, #1
|
||||
cbnz w2, 3b
|
||||
|
||||
/* Start the kernel */
|
||||
4: bl _aarch64_start
|
||||
b 1b
|
32
Bootloader/firmware/aarch64/raspi4/init.c
Normal file
32
Bootloader/firmware/aarch64/raspi4/init.c
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <types.h>
|
||||
|
||||
uintptr_t __stack_chk_guard = 0;
|
||||
|
||||
__noreturn __no_stack_protector void __stack_chk_fail(void)
|
||||
{
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
int main();
|
||||
__attribute__((section(".bootstrap.text"))) void _aarch64_start(uint64_t dtb_ptr32, uint64_t x1, uint64_t x2, uint64_t x3)
|
||||
{
|
||||
main();
|
||||
}
|
70
Bootloader/firmware/aarch64/raspi4/linker.ld
Normal file
70
Bootloader/firmware/aarch64/raspi4/linker.ld
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf64-littleaarch64")
|
||||
OUTPUT_ARCH(aarch64)
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80000;
|
||||
__start = .;
|
||||
__text_start = .;
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.text.boot))
|
||||
*(.text)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__text_end = .;
|
||||
|
||||
__rodata_start = .;
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__rodata_end = .;
|
||||
|
||||
__data_start = .;
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__data_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
bss = .;
|
||||
*(.bss)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__bss_end = .;
|
||||
__bss_size = __bss_end - __bss_start; /* SIZEOF(.bss); */
|
||||
__end = .;
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.comment*)
|
||||
*(.gnu*)
|
||||
*(.note*)
|
||||
*(.eh_frame*)
|
||||
}
|
||||
}
|
6
Bootloader/firmware/amd64/Makefile
Normal file
6
Bootloader/firmware/amd64/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build:
|
||||
|
||||
clean:
|
6
Bootloader/firmware/arm/Makefile
Normal file
6
Bootloader/firmware/arm/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build:
|
||||
|
||||
clean:
|
6
Bootloader/firmware/i386/Makefile
Normal file
6
Bootloader/firmware/i386/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build:
|
||||
|
||||
clean:
|
26
Bootloader/include/stdbool.h
Normal file
26
Bootloader/include/stdbool.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __STDBOOL_H__
|
||||
#define __STDBOOL_H__
|
||||
|
||||
|
||||
typedef int bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#endif /* __STDBOOL_H__ */
|
496
Bootloader/include/types.h
Normal file
496
Bootloader/include/types.h
Normal file
@ -0,0 +1,496 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_KERNEL_TYPES_H__
|
||||
#define __FENNIX_KERNEL_TYPES_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* It doesn't do anything.
|
||||
*
|
||||
* Used to specify a function that is dependent on the architecture.
|
||||
* It's architecture specific variant is defined in arch/<arch>/...
|
||||
*/
|
||||
#define arch
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERNC extern "C"
|
||||
#define START_EXTERNC \
|
||||
EXTERNC \
|
||||
{
|
||||
#define END_EXTERNC \
|
||||
}
|
||||
#else // __cplusplus
|
||||
#define EXTERNC
|
||||
#define START_EXTERNC
|
||||
#define END_EXTERNC
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else // __cplusplus
|
||||
#define NULL ((void *)0)
|
||||
#endif // __cplusplus
|
||||
|
||||
#define asm __asm__
|
||||
#define asmv __asm__ volatile
|
||||
|
||||
#define inf_loop while (1)
|
||||
#define ilp inf_loop; /* Used for debugging */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define foreach for
|
||||
#define in :
|
||||
|
||||
#define forItr(itr, container) \
|
||||
for (auto itr = container.begin(); \
|
||||
itr != container.end(); ++itr)
|
||||
|
||||
#define r_cst(t, v) reinterpret_cast<t>(v)
|
||||
#define c_cst(t, v) const_cast<t>(v)
|
||||
#define s_cst(t, v) static_cast<t>(v)
|
||||
#define d_cst(t, v) dynamic_cast<t>(v)
|
||||
#endif // __cplusplus
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
#define CONCAT(x, y) x##y
|
||||
|
||||
#ifndef __va_list__
|
||||
typedef __builtin_va_list va_list;
|
||||
#endif
|
||||
|
||||
#define va_start(v, l) __builtin_va_start(v, l)
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v, l) __builtin_va_arg(v, l)
|
||||
|
||||
#define ALIGN_UP(x, align) ((__typeof__(x))(((uintptr_t)(x) + ((align) - 1)) & (~((align) - 1))))
|
||||
#define ALIGN_DOWN(x, align) ((__typeof__(x))((x) & (~((align) - 1))))
|
||||
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
|
||||
#define RGB_TO_HEX(r, g, b) ((r << 16) | (g << 8) | (b))
|
||||
|
||||
#define MAX(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
|
||||
#define MIN(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
|
||||
#define ROUND_UP(x, y) (((x) + (y) - 1) & ~((y) - 1))
|
||||
#define ROUND_DOWN(x, y) ((x) & ~((y) - 1))
|
||||
|
||||
#define VPOKE(type, address) (*((volatile type *)(address)))
|
||||
#define POKE(type, address) (*((type *)(address)))
|
||||
|
||||
#ifndef __SIG_ATOMIC_TYPE__
|
||||
#define __SIG_ATOMIC_TYPE__ int
|
||||
#endif
|
||||
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
|
||||
typedef __INT_LEAST8_TYPE__ int_least8_t;
|
||||
typedef __INT_LEAST16_TYPE__ int_least16_t;
|
||||
typedef __INT_LEAST32_TYPE__ int_least32_t;
|
||||
typedef __INT_LEAST64_TYPE__ int_least64_t;
|
||||
|
||||
typedef __UINT_LEAST8_TYPE__ uint_least8_t;
|
||||
typedef __UINT_LEAST16_TYPE__ uint_least16_t;
|
||||
typedef __UINT_LEAST32_TYPE__ uint_least32_t;
|
||||
typedef __UINT_LEAST64_TYPE__ uint_least64_t;
|
||||
|
||||
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
||||
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
||||
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
||||
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
||||
|
||||
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
||||
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
||||
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
||||
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
||||
|
||||
typedef __INTPTR_TYPE__ intptr_t;
|
||||
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
#ifndef __cplusplus
|
||||
typedef __WCHAR_TYPE__ wchar_t;
|
||||
#endif
|
||||
typedef __WINT_TYPE__ wint_t;
|
||||
typedef __SIG_ATOMIC_TYPE__ sig_atomic_t;
|
||||
// TODO: ssize_t
|
||||
typedef intptr_t ssize_t;
|
||||
|
||||
#if defined(__amd64__) || defined(__aarch64__)
|
||||
typedef int64_t off_t;
|
||||
typedef int64_t off64_t;
|
||||
typedef uint32_t mode_t;
|
||||
typedef uint64_t dev_t;
|
||||
typedef uint64_t ino64_t;
|
||||
typedef uint64_t ino_t;
|
||||
typedef uint32_t nlink_t;
|
||||
typedef int64_t blksize_t;
|
||||
typedef int64_t blkcnt_t;
|
||||
typedef int64_t blkcnt64_t;
|
||||
typedef int64_t time_t;
|
||||
typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef int64_t clock_t;
|
||||
typedef int32_t pid_t;
|
||||
#elif defined(__i386__) || defined(__arm__)
|
||||
typedef int32_t off_t;
|
||||
typedef long long off64_t;
|
||||
typedef uint32_t mode_t;
|
||||
typedef int32_t dev_t;
|
||||
typedef int32_t ino64_t;
|
||||
typedef int32_t ino_t;
|
||||
typedef uint32_t nlink_t;
|
||||
typedef int blksize_t;
|
||||
typedef int32_t blkcnt_t;
|
||||
typedef int32_t blkcnt64_t;
|
||||
typedef int32_t time_t;
|
||||
typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef long clock_t;
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
template <typename T>
|
||||
class ptr_t
|
||||
{
|
||||
T ptr;
|
||||
|
||||
public:
|
||||
ptr_t() : ptr(nullptr) {}
|
||||
ptr_t(T p) : ptr(p) {}
|
||||
ptr_t(int p) : ptr((T)(uintptr_t)p) {}
|
||||
ptr_t(const ptr_t<T> &other) : ptr(other.ptr) {}
|
||||
|
||||
operator T() { return ptr; }
|
||||
operator uintptr_t() { return (uintptr_t)ptr; }
|
||||
|
||||
operator bool() { return (void *)(uintptr_t)ptr != nullptr; }
|
||||
|
||||
ptr_t<T> &operator=(const ptr_t<T> &other)
|
||||
{
|
||||
ptr = other.ptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_t<T> &operator+=(uintptr_t offset)
|
||||
{
|
||||
ptr = (T)((uintptr_t)ptr + offset);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ptr_t<T> &operator-=(uintptr_t offset)
|
||||
{
|
||||
ptr = (T)((uintptr_t)ptr - offset);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const ptr_t<T> &other) const { return ptr == other.ptr; }
|
||||
bool operator==(auto other) const { return (uintptr_t)ptr == (uintptr_t)other; }
|
||||
|
||||
bool operator!=(const ptr_t<T> &other) const { return ptr != other.ptr; }
|
||||
bool operator!=(auto other) const { return (uintptr_t)ptr != (uintptr_t)other; }
|
||||
|
||||
bool operator>(const ptr_t<T> &other) const { return ptr > other.ptr; }
|
||||
bool operator>(auto other) const { return (uintptr_t)ptr > (uintptr_t)other; }
|
||||
|
||||
bool operator<(const ptr_t<T> &other) const { return ptr < other.ptr; }
|
||||
bool operator<(auto other) const { return (uintptr_t)ptr < (uintptr_t)other; }
|
||||
|
||||
bool operator>=(const ptr_t<T> &other) const { return ptr >= other.ptr; }
|
||||
bool operator>=(auto other) const { return (uintptr_t)ptr >= (uintptr_t)other; }
|
||||
|
||||
bool operator<=(const ptr_t<T> &other) const { return ptr <= other.ptr; }
|
||||
bool operator<=(auto other) const { return (uintptr_t)ptr <= (uintptr_t)other; }
|
||||
|
||||
ptr_t<T> operator+(auto offset) const { return ptr_t<T>((void *)((uintptr_t)ptr + offset)); }
|
||||
ptr_t<T> operator-(auto offset) const { return ptr_t<T>((void *)((uintptr_t)ptr - offset)); }
|
||||
|
||||
T operator->() { return ptr; }
|
||||
T operator*() { return *ptr; }
|
||||
};
|
||||
#endif // __cplusplus
|
||||
|
||||
#define INT8_MAX __INT8_MAX__
|
||||
#define INT8_MIN (-INT8_MAX - 1)
|
||||
#define UINT8_MAX __UINT8_MAX__
|
||||
#define INT16_MAX __INT16_MAX__
|
||||
#define INT16_MIN (-INT16_MAX - 1)
|
||||
#define UINT16_MAX __UINT16_MAX__
|
||||
#define INT32_MAX __INT32_MAX__
|
||||
#define INT32_MIN (-INT32_MAX - 1)
|
||||
#define UINT32_MAX __UINT32_MAX__
|
||||
#define INT64_MAX __INT64_MAX__
|
||||
#define INT64_MIN (-INT64_MAX - 1)
|
||||
#define UINT64_MAX __UINT64_MAX__
|
||||
|
||||
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
|
||||
#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
|
||||
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
|
||||
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
|
||||
#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
|
||||
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
|
||||
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
|
||||
#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
|
||||
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
|
||||
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
|
||||
#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
|
||||
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
|
||||
|
||||
#define INT_FAST8_MAX __INT_FAST8_MAX__
|
||||
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
|
||||
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
|
||||
#define INT_FAST16_MAX __INT_FAST16_MAX__
|
||||
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
|
||||
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
|
||||
#define INT_FAST32_MAX __INT_FAST32_MAX__
|
||||
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
|
||||
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
|
||||
#define INT_FAST64_MAX __INT_FAST64_MAX__
|
||||
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
|
||||
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
|
||||
|
||||
#define INTPTR_MAX __INTPTR_MAX__
|
||||
#define INTPTR_MIN (-INTPTR_MAX - 1)
|
||||
#define UINTPTR_MAX __UINTPTR_MAX__
|
||||
|
||||
#define INTMAX_MAX __INTMAX_MAX__
|
||||
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
||||
#define UINTMAX_MAX __UINTMAX_MAX__
|
||||
|
||||
#define PTRDIFF_MAX __PTRDIFF_MAX__
|
||||
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
|
||||
|
||||
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
|
||||
#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
|
||||
|
||||
#define SIZE_MAX __SIZE_MAX__
|
||||
|
||||
#define WCHAR_MAX __WCHAR_MAX__
|
||||
#define WCHAR_MIN __WCHAR_MIN__
|
||||
|
||||
#define WINT_MAX __WINT_MAX__
|
||||
#define WINT_MIN __WINT_MIN__
|
||||
|
||||
#if defined(__amd64__)
|
||||
#define BREAK __asm__ __volatile__("int $0x3" \
|
||||
: \
|
||||
: \
|
||||
: "memory");
|
||||
#elif defined(__i386__)
|
||||
#define BREAK __asm__ __volatile__("int $0x3" \
|
||||
: \
|
||||
: \
|
||||
: "memory");
|
||||
#elif defined(__aarch64__)
|
||||
#define BREAK __asm__ __volatile__("brk #0" \
|
||||
: \
|
||||
: \
|
||||
: "memory");
|
||||
#endif
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
typedef __INT48_TYPE__ int48_t;
|
||||
typedef __UINT48_TYPE__ uint48_t;
|
||||
typedef int48_t int_least48_t;
|
||||
typedef uint48_t uint_least48_t;
|
||||
typedef int48_t int_fast48_t;
|
||||
typedef uint48_t uint_fast48_t;
|
||||
#else // __INT48_TYPE__
|
||||
typedef __INT64_TYPE__ int48_t;
|
||||
typedef __UINT64_TYPE__ uint48_t;
|
||||
typedef int48_t int_least48_t;
|
||||
typedef uint48_t uint_least48_t;
|
||||
typedef int48_t int_fast48_t;
|
||||
typedef uint48_t uint_fast48_t;
|
||||
#endif // __INT48_TYPE__
|
||||
|
||||
#define b4(x) ((x & 0x0F) << 4 | (x & 0xF0) >> 4)
|
||||
#define b8(x) ((x) & 0xFF)
|
||||
#define b16(x) __builtin_bswap16(x)
|
||||
#define b32(x) __builtin_bswap32(x)
|
||||
#define b48(x) (((((x) & 0x0000000000ff) << 40) | \
|
||||
(((x) & 0x00000000ff00) << 24) | \
|
||||
(((x) & 0x000000ff0000) << 8) | \
|
||||
(((x) & 0x0000ff000000) >> 8) | \
|
||||
(((x) & 0x00ff00000000) >> 24) | \
|
||||
(((x) & 0xff0000000000) >> 40)))
|
||||
#define b64(x) __builtin_bswap64(x)
|
||||
|
||||
/* https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html */
|
||||
|
||||
/** No optimization (the default); generates
|
||||
* unoptimized code but has the fastest compilation time.
|
||||
*/
|
||||
#define O0 __attribute__((optimize("O0")))
|
||||
|
||||
/** Moderate optimization;
|
||||
* optimizes reasonably well but does not degrade
|
||||
* compilation time significantly. */
|
||||
#define O1 __attribute__((optimize("O1")))
|
||||
|
||||
/** Full optimization; generates highly
|
||||
* optimized code and has the slowest compilation time.
|
||||
*/
|
||||
#define O2 __attribute__((optimize("O2")))
|
||||
|
||||
/** Full optimization as in -O2;
|
||||
* also uses more aggressive automatic inlining of
|
||||
* subprograms within a unit (Inlining of Subprograms)
|
||||
* and attempts to vectorize loops. */
|
||||
#define O3 __attribute__((optimize("O3")))
|
||||
|
||||
/** Optimize space usage (code and data)
|
||||
* of resulting program.
|
||||
*/
|
||||
#define Os __attribute__((optimize("Os")))
|
||||
|
||||
/** Disregard strict standards compliance.
|
||||
* -Ofast enables all -O3 optimizations.
|
||||
* It also enables optimizations that are not valid for
|
||||
* all standard-compliant programs.
|
||||
*/
|
||||
#define Ofast __attribute__((optimize("Ofast")))
|
||||
|
||||
/** Optimize for size.
|
||||
* -Oz enables all -Os optimizations that do not typically
|
||||
* increase code size.
|
||||
*/
|
||||
#define Oz __attribute__((optimize("Oz")))
|
||||
|
||||
/** Optimize for debugging.
|
||||
* -Og enables optimizations that do not interfere with
|
||||
* debugging.
|
||||
*/
|
||||
#define Og __attribute__((optimize("Og")))
|
||||
|
||||
#define __unused __attribute__((unused))
|
||||
#define __packed __attribute__((packed))
|
||||
#define __naked __attribute__((naked))
|
||||
#define __aligned(x) __attribute__((aligned(x)))
|
||||
#define __section(x) __attribute__((section(x)))
|
||||
#define __noreturn __attribute__((noreturn))
|
||||
#define __weak __attribute__((weak))
|
||||
#define __alias(x) __attribute__((alias(x)))
|
||||
#define __always_inline __attribute__((always_inline))
|
||||
#define __noinline __attribute__((noinline))
|
||||
#define __pure __attribute__((pure))
|
||||
#define __const __attribute__((const))
|
||||
#define __malloc __attribute__((malloc))
|
||||
#define __returns_twice __attribute__((returns_twice))
|
||||
#define __used __attribute__((used))
|
||||
#define __deprecated __attribute__((deprecated))
|
||||
#define __deprecated_msg(x) __attribute__((deprecated(x)))
|
||||
#define __weakref(x) __attribute__((weakref(x)))
|
||||
#define __weakrefalias(x) __attribute__((weakref(#x)))
|
||||
#define __visibility(x) __attribute__((visibility(x)))
|
||||
#define __constructor __attribute__((constructor))
|
||||
#define __destructor __attribute__((destructor))
|
||||
#define __cleanup(x) __attribute__((cleanup(x)))
|
||||
#define __fallthrough __attribute__((fallthrough))
|
||||
#define __nonnull(x) __attribute__((nonnull x))
|
||||
#define __nonnull_all __attribute__((nonnull))
|
||||
#define __returns_nonnull __attribute__((returns_nonnull))
|
||||
#define __sentinel __attribute__((sentinel))
|
||||
#define __sentinel_all __attribute__((sentinel(0)))
|
||||
#define __format(x, y, z) __attribute__((format(x, y, z)))
|
||||
#define __format_arg(x) __attribute__((format_arg(x)))
|
||||
#define __nonnull_params(x) __attribute__((nonnull x))
|
||||
#define __nonnull_all __attribute__((nonnull))
|
||||
#define __warn_unused_result __attribute__((warn_unused_result))
|
||||
#define __no_stack_protector __attribute__((no_stack_protector))
|
||||
#define __no_instrument_function __attribute__((no_instrument_function))
|
||||
#define __no_debug __attribute__((no_debug))
|
||||
#define __target(x) __attribute__((target(x)))
|
||||
#define __min_vector_width(x) __attribute__((min_vector_width(x)))
|
||||
|
||||
// sanitizer
|
||||
#define __no_sanitize(x) __attribute__((no_sanitize(x)))
|
||||
#define __no_sanitize_address __attribute__((no_sanitize_address))
|
||||
#define __no_sanitize_thread __attribute__((no_sanitize_thread))
|
||||
#define __no_sanitize_undefined __attribute__((no_sanitize_undefined))
|
||||
#define __no_sanitize_coverage __attribute__((no_sanitize_coverage))
|
||||
|
||||
#define __synchronize __sync_synchronize()
|
||||
#define __sync __synchronize
|
||||
|
||||
#define __unreachable __builtin_unreachable()
|
||||
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
|
||||
#define NoSecurityAnalysis __no_stack_protector __no_sanitize_address __no_sanitize_undefined __no_sanitize_thread
|
||||
#define nsa NoSecurityAnalysis
|
||||
|
||||
#define NIF __no_instrument_function
|
||||
|
||||
#define int3 \
|
||||
__asm__ __volatile__("int3" \
|
||||
: \
|
||||
: \
|
||||
: "memory")
|
||||
|
||||
#define StackPush(stack, type, value) \
|
||||
*((type *)--stack) = value
|
||||
|
||||
#define StackPop(stack, type) \
|
||||
*((type *)stack++)
|
||||
|
||||
#define ReturnLogError(ret, format, ...) \
|
||||
{ \
|
||||
trace(format, ##__VA_ARGS__); \
|
||||
return ret; \
|
||||
} \
|
||||
while (0) \
|
||||
__builtin_unreachable()
|
||||
|
||||
#define AssertReturnError(condition, ret) \
|
||||
do \
|
||||
{ \
|
||||
if (__builtin_expect(!!(!(condition)), 0)) \
|
||||
{ \
|
||||
error("\"%s\" failed!", #condition); \
|
||||
return ret; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif // !__FENNIX_KERNEL_TYPES_H__
|
137
Bootloader/uefi/Makefile
Normal file
137
Bootloader/uefi/Makefile
Normal file
@ -0,0 +1,137 @@
|
||||
BOOT_FILENAME = BOOTX64.EFI
|
||||
|
||||
GNUEFI_RELEASE_VERSION=3.0.18
|
||||
|
||||
GIT_COMMIT = $(shell git rev-parse HEAD)
|
||||
GIT_COMMIT_SHORT = $(shell git rev-parse --short HEAD)
|
||||
|
||||
HEADERS := $(sort $(dir $(wildcard ../include/*)))
|
||||
INCLUDE_DIR = -I../include
|
||||
|
||||
define find-sources
|
||||
$(shell find ./ -type f -name '$1' -print0 | xargs -0)
|
||||
endef
|
||||
|
||||
BMP_SOURCES := $(call find-sources,*.bmp)
|
||||
PSF_SOURCES := $(call find-sources,*.psf)
|
||||
S_SOURCES := $(call find-sources,*.S)
|
||||
s_SOURCES := $(call find-sources,*.s)
|
||||
C_SOURCES := $(call find-sources,*.c)
|
||||
CXX_SOURCES := $(call find-sources,*.cpp)
|
||||
|
||||
OBJ = $(BMP_SOURCES:.bmp=.o) $(PSF_SOURCES:.psf=.o) $(s_SOURCES:.s=.o) $(S_SOURCES:.S=.o) $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)
|
||||
|
||||
LDFLAGS = -static -nostdlib -nodefaultlibs -nolibc \
|
||||
-Wl,-static,--no-dynamic-linker,-ztext \
|
||||
-zmax-page-size=0x1000 \
|
||||
-Wl,-Map kernel.map -fno-pic -fno-pie
|
||||
|
||||
# Disable all warnings by adding "-w" in WARNCFLAG and if you want to treat the warnings as errors, add "-Werror"
|
||||
# -Wconversion this may be re-added later
|
||||
WARNCFLAG = -Wall -Wextra \
|
||||
-Wfloat-equal -Wpointer-arith -Wcast-align \
|
||||
-Wredundant-decls -Winit-self -Wswitch-default \
|
||||
-Wstrict-overflow=5 -Wno-error=cpp -Werror \
|
||||
-Wno-unused-parameter -Wno-error=format
|
||||
|
||||
CFLAG_STACK_PROTECTOR := -fstack-protector-all
|
||||
|
||||
# https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
|
||||
CFLAGS := \
|
||||
$(INCLUDE_DIR) \
|
||||
-D__kernel__='1' \
|
||||
-DKERNEL_NAME='"$(OSNAME)"' \
|
||||
-DKERNEL_ARCH='"$(OSARCH)"' \
|
||||
-DKERNEL_VERSION='"$(KERNEL_VERSION)"' \
|
||||
-DGIT_COMMIT='"$(GIT_COMMIT)"' \
|
||||
-DGIT_COMMIT_SHORT='"$(GIT_COMMIT_SHORT)"' \
|
||||
-fno-pic -fno-pie -fno-builtin
|
||||
|
||||
ifeq ($(OSARCH), amd64)
|
||||
CFLAGS += -march=core2 -mcmodel=kernel -m64 -mno-red-zone
|
||||
LDFLAGS += -T../linker.ld
|
||||
else ifeq ($(OSARCH), i386)
|
||||
CFLAGS += -march=pentium -m32 -mno-red-zone
|
||||
LDFLAGS += -T../linker.ld
|
||||
else ifeq ($(OSARCH), arm)
|
||||
CFLAGS += -march=armv7-a -mfloat-abi=softfp -ggdb3
|
||||
LDFLAGS += -T../linker.ld
|
||||
WARNCFLAG += -w
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
CFLAGS += -march=armv9.4-a -mtune=cortex-a72 -mlittle-endian -mcmodel=large
|
||||
LDFLAGS += -T../linker.ld
|
||||
endif # OSARCH
|
||||
|
||||
# -finstrument-functions for __cyg_profile_func_enter & __cyg_profile_func_exit. Used for profiling and debugging.
|
||||
ifeq ($(DEBUG), 1)
|
||||
# CFLAGS += --coverage
|
||||
# CFLAGS += -pg
|
||||
# CFLAGS += -finstrument-functions
|
||||
CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always -fstack-usage -fsanitize=undefined
|
||||
ifeq ($(OSARCH), amd64)
|
||||
CFLAGS += -fverbose-asm
|
||||
endif # amd64
|
||||
ifeq ($(OSARCH), arm)
|
||||
CFLAGS += -fstack-check -fverbose-asm
|
||||
endif # arm
|
||||
ifeq ($(OSARCH), aarch64)
|
||||
CFLAGS += -fstack-check -fverbose-asm
|
||||
endif # aarch64
|
||||
LDFLAGS += -ggdb3 -O0
|
||||
ASFLAGS += -g --gstabs+ --gdwarf-5 -D
|
||||
WARNCFLAG += -Wno-unused-function -Wno-maybe-uninitialized -Wno-builtin-declaration-mismatch -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable
|
||||
endif # DEBUG
|
||||
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
build: $(BOOT_FILENAME)
|
||||
|
||||
$(BOOT_FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(LD) -shared -Bsymbolic -L../gnu-efi/x86_64/lib -L../gnu-efi/x86_64/gnuefi -T../gnu-efi/gnuefi/elf_x86_64_efi.lds ../gnu-efi/x86_64/gnuefi/crt0-efi-x86_64.o $(OBJ) -o tmp.so -lgnuefi -lefi
|
||||
objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --target efi-app-x86_64 --subsystem=10 tmp.so BOOTX64.EFI
|
||||
rm tmp.so
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) -I../include -fpic -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) -I../include -fpic -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.s
|
||||
$(info Compiling $<)
|
||||
$(AS) $(ASFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.psf
|
||||
ifeq ($(OSARCH), amd64)
|
||||
$(OBJCOPY) -O elf64-x86-64 -I binary $< $@
|
||||
else ifeq ($(OSARCH), i386)
|
||||
$(OBJCOPY) -O elf32-i386 -I binary $< $@
|
||||
else ifeq ($(OSARCH), arm)
|
||||
$(OBJCOPY) -O elf32-littlearm -I binary $< $@
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
$(OBJCOPY) -O elf64-littleaarch64 -I binary $< $@
|
||||
endif
|
||||
$(NM) $@
|
||||
|
||||
%.o: %.bmp
|
||||
ifeq ($(OSARCH), amd64)
|
||||
$(OBJCOPY) -O elf64-x86-64 -I binary $< $@
|
||||
else ifeq ($(OSARCH), i386)
|
||||
$(OBJCOPY) -O elf32-i386 -I binary $< $@
|
||||
else ifeq ($(OSARCH), arm)
|
||||
$(OBJCOPY) -O elf32-littlearm -I binary $< $@
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
$(OBJCOPY) -O elf64-littlearch64 -I binary $< $@
|
||||
endif
|
||||
$(NM) $@
|
||||
|
||||
clean:
|
||||
rm -f kernel.map kernel_dump.map kernel_dump_intel.map $(OBJ) $(STACK_USAGE_OBJ) $(GCNO_OBJ) $(BOOT_FILENAME)
|
27
Bootloader/uefi/main.c
Normal file
27
Bootloader/uefi/main.c
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
This file is part of Lynx Bootloader.
|
||||
|
||||
Lynx Bootloader is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Lynx Bootloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Lynx Bootloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
{
|
||||
InitializeLib(ImageHandle, SystemTable);
|
||||
SystemTable->BootServices->SetWatchdogTimer(0, 0, 0, NULL);
|
||||
Print(L"Lynx Bootloader © EnderIce2 2025\n");
|
||||
return EFI_SUCCESS;
|
||||
}
|
128
CODE_OF_CONDUCT.md
Normal file
128
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
enderice2@protonmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
70
CONTRIBUTING.md
Normal file
70
CONTRIBUTING.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Contributing to Fennix
|
||||
|
||||
We welcome contributions to Fennix! Whether you are reporting a bug, suggesting a feature, or submitting a pull request, we’re excited to collaborate with you.
|
||||
|
||||
## Table of Contents
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||
- [Reporting Issues](#reporting-issues)
|
||||
- [Style Guide](#style-guide)
|
||||
|
||||
---
|
||||
|
||||
## How to Contribute
|
||||
|
||||
1. **Check existing issues or discussions** to see if your idea has already been mentioned or if someone is already working on it.
|
||||
2. If you’re new to the project, consider contributing to [good first issues](https://github.com/EnderIce2/Fennix/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
|
||||
3. Fork the repository and create a new branch for your changes.
|
||||
|
||||
---
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Be respectful and inclusive while interacting with the community.
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Fork this repository and clone your fork.
|
||||
2. Set up your development environment according to the [README.md](README.md) or any other setup guide provided.
|
||||
3. Ensure all tests pass before submitting changes. Add tests for new features where applicable.
|
||||
|
||||
---
|
||||
|
||||
## Pull Request Guidelines
|
||||
|
||||
1. Keep pull requests focused on a single issue or feature.
|
||||
2. Write clear, descriptive commit messages.
|
||||
3. Ensure all tests pass before submitting your PR.
|
||||
4. Include a detailed description of your changes and reference any relevant issue numbers.
|
||||
5. Be open to feedback and revise your pull request if requested.
|
||||
6. Mark your pull request as a draft if it’s still a work in progress.
|
||||
|
||||
---
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
1. Check if the issue has already been reported.
|
||||
2. Include a clear and descriptive title.
|
||||
3. Provide detailed steps to reproduce the problem (if applicable).
|
||||
4. Mention your environment details (e.g., OS, version, etc.).
|
||||
5. Attach screenshots or logs if they help explain the issue.
|
||||
|
||||
---
|
||||
|
||||
## Style Guide
|
||||
|
||||
Follow the coding style used in the repository to ensure consistency. Adhere to:
|
||||
- Use CamelCase for all names.
|
||||
- Start function and global declaration names with an uppercase letter.
|
||||
- Start local variable names with a lowercase letter.
|
||||
- Maintain consistent formatting and commenting guidelines.
|
||||
|
||||
Refer to the [style guide document](STYLE_GUIDE.md) if available.
|
||||
|
||||
---
|
||||
|
||||
Thank you for contributing! Your effort makes Fennix better for everyone. If you have any questions, feel free to reach out by opening an issue or joining our discussions.
|
125
CREDITS.md
Normal file
125
CREDITS.md
Normal file
@ -0,0 +1,125 @@
|
||||
# Credits and References
|
||||
|
||||
This project has been influenced and inspired by other projects and resources.
|
||||
|
||||
License information can be found in the [LICENSES.md](LICENSES.md) file.
|
||||
|
||||
## General
|
||||
- [OSDev Wiki](https://wiki.osdev.org/Main_Page)
|
||||
- [GCC x86 Built-in Functions](https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html#x86-Built-in-Functions)
|
||||
- [GCC Common Function Attributes](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes)
|
||||
- [LemonOS Project](https://github.com/LemonOSProject/LemonOS)
|
||||
- [ToaruOS](https://github.com/klange/toaruos)
|
||||
- [Various SIMD functions](https://wiki.osdev.org/User:01000101/optlib/)
|
||||
|
||||
## C++ STL
|
||||
- [cppreference.com](https://cppreference.com)
|
||||
|
||||
## Virtual terminal
|
||||
- [vtconsole](https://github.com/sleepy-monax/vtconsole)
|
||||
|
||||
## Font
|
||||
- [Tamsyn Font](http://www.fial.com/~scott/tamsyn-font/)
|
||||
|
||||
## CPU XCR0 Structure
|
||||
- [CPU Registers x86 - XCR0](https://wiki.osdev.org/CPU_Registers_x86#XCR0)
|
||||
|
||||
## CPUID 0x7
|
||||
- [CPUID](https://en.wikipedia.org/wiki/CPUID)
|
||||
|
||||
## Network
|
||||
- [Beej's Guide to Network Programming](https://web.archive.org/web/20051210132103/http://users.pcnet.ro/dmoroian/beej/Beej.html)
|
||||
- [UDP Socket Programming](https://web.archive.org/web/20060229214053/http://www.cs.rutgers.edu/~pxk/417/notes/sockets/udp.html)
|
||||
- [EtherType](https://en.wikipedia.org/wiki/EtherType)
|
||||
- [Linux Network Packet Reception](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/performance_tuning_guide/s-network-packet-reception)
|
||||
- [Linux Kernel Networking Labs](https://linux-kernel-labs.github.io/refs/heads/master/labs/networking.html)
|
||||
- [smoltcp](https://github.com/smoltcp-rs/smoltcp)
|
||||
- [Understanding Linux Network Internals](https://www.cs.unh.edu/~cruse/cs326f04/RTL8139D_DataSheet.pdf)
|
||||
- [Address Resolution Protocol (ARP)](https://en.wikipedia.org/wiki/Address_Resolution_Protocol)
|
||||
- [C++ Operators](https://en.cppreference.com/w/cpp/language/operators)
|
||||
- [Dynamic Host Configuration Protocol (DHCP)](https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol)
|
||||
- [RTL8139 Programmer's Guide](https://www.cs.usfca.edu/~cruse/cs326f04/RTL8139_ProgrammersGuide.pdf)
|
||||
- [RTL8139CP Datasheet](http://realtek.info/pdf/rtl8139cp.pdf)
|
||||
- [IPv4](https://en.wikipedia.org/wiki/IPv4)
|
||||
- [ICMP Parameters](https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml)
|
||||
|
||||
## Loading ELF Shared Libraries and Dynamic Linking
|
||||
- [How To Write Shared Libraries](https://www.akkadia.org/drepper/dsohowto.pdf)
|
||||
- [Dynamic Linker](https://wiki.osdev.org/Dynamic_Linker)
|
||||
- [Nightingale OS](https://github.com/tyler569/nightingale)
|
||||
- [PLT and GOT: The Key to Code Sharing and Dynamic Libraries](https://www.technovelty.org/linux/plt-and-got-the-key-to-code-sharing-and-dynamic-libraries.html)
|
||||
- [YouTube Video on Dynamic Linking](https://www.youtube.com/watch?v=kUk5pw4w0h4)
|
||||
- [Oracle: Position Independent Code](https://docs.oracle.com/cd/E19683-01/817-3677/chapter6-42444/index.html)
|
||||
- [PLT and GOT Explained](https://ir0nstone.gitbook.io/notes/types/stack/aslr/plt_and_got)
|
||||
|
||||
## Inter-Process Communication (IPC)
|
||||
- [Oracle IPC](https://docs.oracle.com/cd/E19048-01/chorus5/806-6897/architecture-103/index.html)
|
||||
- [Inter-Process Communication in OS](https://www.scaler.com/topics/operating-system/inter-process-communication-in-os/)
|
||||
- [IPC on Wikipedia](https://en.wikipedia.org/wiki/Inter-process_communication)
|
||||
- [GeeksforGeeks IPC Guide](https://www.geeksforgeeks.org/inter-process-communication-ipc/)
|
||||
|
||||
## PCI (Peripheral Component Interconnect)
|
||||
- [OSDev PCI](https://wiki.osdev.org/PCI)
|
||||
- [PCI Configuration Space](https://en.wikipedia.org/wiki/PCI_configuration_space)
|
||||
|
||||
## Audio
|
||||
- [FFmpeg Audio Types](https://trac.ffmpeg.org/wiki/audio%20types)
|
||||
- [AC97 on OSDev](https://wiki.osdev.org/AC97)
|
||||
- [AC97 Revision 2.3 Specification](https://inst.eecs.berkeley.edu//~cs150/Documents/ac97_r23.pdf)
|
||||
|
||||
## Intrinsics (x86)
|
||||
- [Microsoft x86 Intrinsics](https://learn.microsoft.com/en-us/cpp/intrinsics/x86-intrinsics-list)
|
||||
- [Intel Intrinsics Guide](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html)
|
||||
|
||||
## CPUID Information
|
||||
- [AMD CPUID Instruction](https://www.amd.com/system/files/TechDocs/40332.pdf)
|
||||
- [CPUID Instruction Note](https://www.scss.tcd.ie/~jones/CS4021/processor-identification-cpuid-instruction-note.pdf)
|
||||
|
||||
## SMBIOS (System Management BIOS)
|
||||
- [DMTF DSP0134](https://www.dmtf.org/dsp/DSP0134)
|
||||
- [DSP0134 Version 3.6.0](https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.6.0.pdf)
|
||||
- [OSDev SMBIOS](https://wiki.osdev.org/System_Management_BIOS)
|
||||
|
||||
## EDBA (Effective Direct Bus Access)
|
||||
- [Memory Map (x86)](https://wiki.osdev.org/Memory_Map_(x86))
|
||||
|
||||
## UMIP, SMAP, and SMEP
|
||||
- [Control Register on Wikipedia](https://en.wikipedia.org/wiki/Control_register)
|
||||
- [Control Register and UMIP](https://web.archive.org/web/20160312223150/http://ncsi.com/nsatc11/presentations/wednesday/emerging_technologies/fischer.pdf)
|
||||
- [Supervisor Mode Access Prevention (SMEP)](https://en.wikipedia.org/wiki/Supervisor_Mode_Access_Prevention)
|
||||
|
||||
## Atomic Operations
|
||||
- [C++ Atomic Operations](https://en.cppreference.com/w/cpp/atomic/atomic)
|
||||
|
||||
## ELF (Executable and Linkable Format)
|
||||
- [ELF Header Format](https://www.sco.com/developers/gabi/latest/ch4.eheader.html)
|
||||
- [ELF File Format Specification](https://refspecs.linuxfoundation.org/elf/elf.pdf)
|
||||
- [Oracle: Executable and Linkable Format](https://docs.oracle.com/cd/E19683-01/817-3677/chapter6-42444/index.html)
|
||||
- [Oracle: ELF Program Headers](https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-83432/index.html)
|
||||
- [YouTube Video on ELF](https://www.youtube.com/watch?v=nC1U1LJQL8o)
|
||||
- [Stevens' UNIX Network Programming](https://stevens.netmeister.org/631/elf.html)
|
||||
- [Linux Kernel ELF Header](https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h)
|
||||
|
||||
## C++ ABI (Application Binary Interface)
|
||||
- [GCC libstdc++ Source](https://github.com/gcc-mirror/gcc/tree/master/libstdc%2B%2B-v3)
|
||||
- [Itanium C++ ABI](https://itanium-cxx-abi.github.io/cxx-abi/abi.html)
|
||||
|
||||
## signal.h
|
||||
- [POSIX signal.h](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html)
|
||||
- [Linux signal(7) Manual](https://man7.org/linux/man-pages/man7/signal.7.html)
|
||||
|
||||
## PS/2
|
||||
- [Scan Codes](https://www.win.tue.nl/~aeb/linux/kbd/scancodes-11.html)
|
||||
- [PS/2 Keyboard on OSDev](https://wiki.osdev.org/PS2_Keyboard)
|
||||
- [PS/2 Mouse on OSDev](https://wiki.osdev.org/PS2_Mouse)
|
||||
- [Mouse Input on OSDev](https://wiki.osdev.org/Mouse_Input)
|
||||
- [I/O Ports on OSDev](https://wiki.osdev.org/I/O_ports)
|
||||
- [PS/2 Controller on OSDev](https://wiki.osdev.org/%228042%22_PS/2_Controller)
|
||||
- [AIP on OSDev](https://wiki.osdev.org/Advanced_Integrated_Peripheral)
|
||||
|
||||
## UART
|
||||
- [Interfacing the Serial / RS232 Port V5.0](http://www.senet.com.au/~cpeacock)
|
||||
|
||||
---
|
||||
|
||||
Special thanks to all contributors and the creators of the referenced projects and resources!
|
42
Doxyfile
42
Doxyfile
@ -44,14 +44,14 @@ PROJECT_NUMBER = 1.0.0
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
# quick idea about the purpose of the project. Keep the description short.
|
||||
|
||||
PROJECT_BRIEF = "Opeating System from scratch made in C and C++"
|
||||
PROJECT_BRIEF = "Full Documentation"
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO =
|
||||
PROJECT_LOGO = tools/doxygen/favicon.ico
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
@ -246,7 +246,7 @@ INHERIT_DOCS = YES
|
||||
# of the file/class/namespace that contains it.
|
||||
# The default value is: NO.
|
||||
|
||||
SEPARATE_MEMBER_PAGES = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
|
||||
# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
|
||||
# uses this value to replace tabs by spaces in code fragments.
|
||||
@ -424,7 +424,7 @@ SUBGROUPING = YES
|
||||
# SEPARATE_MEMBER_PAGES.
|
||||
# The default value is: NO.
|
||||
|
||||
INLINE_GROUPED_CLASSES = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
|
||||
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
|
||||
# with only public data fields or simple typedef fields will be shown inline in
|
||||
@ -614,7 +614,7 @@ HIDE_COMPOUND_REFERENCE= NO
|
||||
# the files that are included by a file in the documentation of that file.
|
||||
# The default value is: YES.
|
||||
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_INCLUDE_FILES = NO
|
||||
|
||||
# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
|
||||
# grouped member an include statement to the documentation, telling the reader
|
||||
@ -794,7 +794,7 @@ CITE_BIB_FILES =
|
||||
# messages are off.
|
||||
# The default value is: NO.
|
||||
|
||||
QUIET = NO
|
||||
QUIET = YES
|
||||
|
||||
# The WARNINGS tag can be used to turn on/off the warning messages that are
|
||||
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
|
||||
@ -864,7 +864,14 @@ WARN_LOGFILE =
|
||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = Kernel Lynx Userspace Drivers tools/doxymds/main.md
|
||||
INPUT = tools/doxygen/index.md \
|
||||
tools/doxygen/api.md \
|
||||
tools/doxygen/develop.md \
|
||||
README \
|
||||
Userspace/README.md \
|
||||
Drivers/README.md \
|
||||
Kernel/README.md \
|
||||
Kernel/include/interface
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@ -955,7 +962,7 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = .vscode tools
|
||||
EXCLUDE = .vscode .github
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@ -1064,7 +1071,7 @@ FILTER_SOURCE_PATTERNS =
|
||||
# (index.html). This can be useful if you have a project on for instance GitHub
|
||||
# and want to reuse the introduction page also for the doxygen output.
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE = tools/doxymds/main.md
|
||||
USE_MDFILE_AS_MAINPAGE = tools/doxygen/index.md
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
@ -1224,7 +1231,7 @@ GENERATE_HTML = YES
|
||||
# The default directory is: html.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_OUTPUT = doxygen-doc/fulldoc
|
||||
HTML_OUTPUT = doxygen-doc/docs
|
||||
|
||||
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
|
||||
# generated HTML page (for example: .htm, .php, .asp).
|
||||
@ -1251,7 +1258,7 @@ HTML_FILE_EXTENSION = .html
|
||||
# of the possible markers and block names see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_HEADER =
|
||||
HTML_HEADER = tools/doxygen/header.html
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
||||
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
||||
@ -1286,7 +1293,8 @@ HTML_STYLESHEET =
|
||||
# list). For an example see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET = tools/doxygen-awesome.css tools/custom.css
|
||||
HTML_EXTRA_STYLESHEET = tools/doxygen/theme/doxygen-awesome.css \
|
||||
tools/doxygen/custom.css
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
@ -1296,7 +1304,11 @@ HTML_EXTRA_STYLESHEET = tools/doxygen-awesome.css tools/custom.css
|
||||
# files will be copied as-is; there are no commands or markers available.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_EXTRA_FILES = tools/doxygen/theme/doxygen-awesome-darkmode-toggle.js \
|
||||
tools/doxygen/theme/doxygen-awesome-fragment-copy-button.js \
|
||||
tools/doxygen/theme/doxygen-awesome-paragraph-link.js \
|
||||
tools/doxygen/theme/doxygen-awesome-interactive-toc.js \
|
||||
tools/doxygen/theme/doxygen-awesome-tabs.js
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
@ -1335,7 +1347,7 @@ HTML_COLORSTYLE_GAMMA = 80
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_TIMESTAMP = YES
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
@ -2071,7 +2083,7 @@ MAN_OUTPUT = man
|
||||
# The default value is: .3.
|
||||
# This tag requires that the tag GENERATE_MAN is set to YES.
|
||||
|
||||
MAN_EXTENSION = .3
|
||||
MAN_EXTENSION = .2
|
||||
|
||||
# The MAN_SUBDIR tag determines the name of the directory created within
|
||||
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
|
||||
|
13
Drivers/.editorconfig
Normal file
13
Drivers/.editorconfig
Normal file
@ -0,0 +1,13 @@
|
||||
# EditorConfig is awesome: https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
253
Drivers/.vscode/c_cpp_properties.json
vendored
253
Drivers/.vscode/c_cpp_properties.json
vendored
@ -1,120 +1,137 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Fennix x64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"__debug_vscode__",
|
||||
"KERNEL_NAME=\"Fennix\"",
|
||||
"KERNEL_VERSION=\"1.0\"",
|
||||
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
|
||||
"GIT_COMMIT_SHORT=\"0000000\"",
|
||||
"a64",
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/x86_64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-mno-sse",
|
||||
"-mno-sse2",
|
||||
"-march=x86-64",
|
||||
"-pipe",
|
||||
"-ffunction-sections",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
|
||||
// C++ flags
|
||||
"-fexceptions",
|
||||
|
||||
// Linker flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-Wl,-eDriverEntry",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext,--no-warn-rwx-segment",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-static",
|
||||
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix x32 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"__debug_vscode__",
|
||||
"KERNEL_NAME=\"Fennix\"",
|
||||
"KERNEL_VERSION=\"1.0\"",
|
||||
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
|
||||
"GIT_COMMIT_SHORT=\"0000000\"",
|
||||
"a32",
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/i386-elf-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x86",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-mno-sse",
|
||||
"-mno-sse2",
|
||||
"-march=i386",
|
||||
"-pipe",
|
||||
"-ffunction-sections",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
|
||||
// C++ flags
|
||||
"-fexceptions",
|
||||
|
||||
// Linker flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-Wl,-eDriverEntry",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext,--no-warn-rwx-segment",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-static",
|
||||
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Fennix x64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"__debug_vscode__",
|
||||
"KERNEL_NAME=\"Fennix\"",
|
||||
"KERNEL_VERSION=\"1.0\"",
|
||||
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
|
||||
"GIT_COMMIT_SHORT=\"0000000\"",
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/x86_64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-mno-sse",
|
||||
"-mno-sse2",
|
||||
"-march=x86-64",
|
||||
"-pipe",
|
||||
"-ffunction-sections",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
// C++ flags
|
||||
"-fexceptions",
|
||||
// Linker flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-Wl,-eDriverEntry",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext,--no-warn-rwx-segment",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-static",
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix x32 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"__debug_vscode__",
|
||||
"KERNEL_NAME=\"Fennix\"",
|
||||
"KERNEL_VERSION=\"1.0\"",
|
||||
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
|
||||
"GIT_COMMIT_SHORT=\"0000000\"",
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/i386-elf-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x86",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-mno-sse",
|
||||
"-mno-sse2",
|
||||
"-march=i386",
|
||||
"-pipe",
|
||||
"-ffunction-sections",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
// C++ flags
|
||||
"-fexceptions",
|
||||
// Linker flags
|
||||
"-fPIC",
|
||||
"-fPIE",
|
||||
"-pie",
|
||||
"-Wl,-eDriverEntry",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext,--no-warn-rwx-segment",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-static",
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix Aarch64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"__debug_vscode__",
|
||||
"KERNEL_NAME=\"Fennix\"",
|
||||
"KERNEL_VERSION=\"1.0\"",
|
||||
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
|
||||
"GIT_COMMIT_SHORT=\"0000000\"",
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/aarch64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "linux-gcc-arm64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
1
Drivers/.vscode/launch.json
vendored
Symbolic link
1
Drivers/.vscode/launch.json
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../.vscode/launch.json
|
1
Drivers/.vscode/tasks.json
vendored
Symbolic link
1
Drivers/.vscode/tasks.json
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../.vscode/tasks.json
|
2659
Drivers/Doxyfile
2659
Drivers/Doxyfile
File diff suppressed because it is too large
Load Diff
@ -1,29 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2022, EnderIce2
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,13 +1,60 @@
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
export CC := $(__CONF_CC)
|
||||
export CXX := $(__CONF_CXX)
|
||||
export LD := $(__CONF_LD)
|
||||
export AS := $(__CONF_AS)
|
||||
export OBJDUMP := $(__CONF_OBJDUMP)
|
||||
|
||||
export OUTPUT_DIR := $(CURDIR)/out/
|
||||
export INCLUDE_DIR := $(CURDIR)/include
|
||||
|
||||
DRIVER_LDFLAGS = -nostdlib -nodefaultlibs -nolibc -zmax-page-size=0x1000 \
|
||||
-Wl,-Map file.map -fvisibility=hidden -Wl,--dynamic-linker=/boot/fennix.elf
|
||||
|
||||
ifeq ($(OSARCH), amd64)
|
||||
DRIVER_CFLAGS = -fPIC -fPIE -pie -mno-80387 -mno-mmx -mno-3dnow \
|
||||
-mno-red-zone -mno-sse -mno-sse2 \
|
||||
-march=x86-64 -pipe -ffunction-sections \
|
||||
-msoft-float -fno-builtin
|
||||
|
||||
else ifeq ($(OSARCH), i386)
|
||||
DRIVER_CFLAGS = -fPIC -fPIE -pie -mno-80387 -mno-mmx -mno-3dnow \
|
||||
-mno-red-zone -mno-sse -mno-sse2 -ffunction-sections \
|
||||
-march=i386 -pipe -msoft-float -fno-builtin
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
DRIVER_CFLAGS = -pipe -fno-builtin -fPIC
|
||||
endif
|
||||
|
||||
DRIVER_CFLAGS += -I$(CURDIR)/include
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
DRIVER_CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always -fstack-usage
|
||||
ifeq ($(OSARCH), amd64)
|
||||
DRIVER_CFLAGS += -fverbose-asm
|
||||
endif
|
||||
ifneq ($(OSARCH), aarch64)
|
||||
DRIVER_CFLAGS += -fstack-check
|
||||
endif
|
||||
DRIVER_LDFLAGS += -ggdb3 -O0
|
||||
endif
|
||||
|
||||
export DRIVER_LDFLAGS
|
||||
export DRIVER_CFLAGS
|
||||
|
||||
build:
|
||||
cp -rf ../Kernel/include/interface/* include/
|
||||
mkdir -p out
|
||||
make -C library build
|
||||
ifneq ($(filter amd64 i386,$(OSARCH)),)
|
||||
make -C audio build
|
||||
make -C input build
|
||||
make -C misc build
|
||||
make -C network build
|
||||
make -C storage build
|
||||
make -C filesystem build
|
||||
endif
|
||||
|
||||
prepare:
|
||||
$(info Nothing to prepare)
|
||||
@ -15,9 +62,11 @@ prepare:
|
||||
clean:
|
||||
rm -rf out
|
||||
make -C library clean
|
||||
ifneq ($(filter amd64 i386,$(OSARCH)),)
|
||||
make -C audio clean
|
||||
make -C input clean
|
||||
make -C misc clean
|
||||
make -C network clean
|
||||
make -C storage clean
|
||||
make -C filesystem clean
|
||||
endif
|
||||
|
@ -1,11 +1 @@
|
||||
# Drivers
|
||||
|
||||
Drivers for [Fennix](https://github.com/Fennix-Project/Fennix).
|
||||
|
||||
---
|
||||
|
||||
Use `Fennix` repo to build the operating system.
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/Fennix-Project/Fennix.git
|
||||
```
|
||||
|
@ -1,7 +1,9 @@
|
||||
build:
|
||||
make -C ac97 build
|
||||
make -C hda build
|
||||
MAKE_TARGETS := build clean
|
||||
DIRECTORIES := $(sort $(dir $(wildcard ./*/)))
|
||||
|
||||
clean:
|
||||
make -C ac97 clean
|
||||
make -C hda clean
|
||||
.PHONY: $(MAKE_TARGETS) $(DIRECTORIES)
|
||||
|
||||
$(MAKE_TARGETS): $(DIRECTORIES)
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = ac97.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = hda.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,54 +0,0 @@
|
||||
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
|
||||
CPP = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)g++
|
||||
LD = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ld
|
||||
AS = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)as
|
||||
OBJDUMP = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)objdump
|
||||
|
||||
DRIVER_LDFLAGS := -nostdlib -nodefaultlibs -nolibc -zmax-page-size=0x1000 \
|
||||
-Wl,-Map file.map -fvisibility=hidden -Wl,--dynamic-linker=/boot/fennix.elf
|
||||
|
||||
ifeq ($(OSARCH), amd64)
|
||||
|
||||
DRIVER_CFLAGS := -fPIC -fPIE -pie -mno-80387 -mno-mmx -mno-3dnow \
|
||||
-mno-red-zone -mno-sse -mno-sse2 \
|
||||
-march=x86-64 -pipe -ffunction-sections \
|
||||
-msoft-float -fno-builtin
|
||||
|
||||
else ifeq ($(OSARCH), i386)
|
||||
|
||||
DRIVER_CFLAGS := -fPIC -fPIE -pie -mno-80387 -mno-mmx -mno-3dnow \
|
||||
-mno-red-zone -mno-sse -mno-sse2 -ffunction-sections \
|
||||
-march=i386 -pipe -msoft-float -fno-builtin
|
||||
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
|
||||
DRIVER_CFLAGS += -pipe -fno-builtin -fPIC
|
||||
|
||||
endif
|
||||
|
||||
DRIVER_CFLAGS += -I../../include
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
DRIVER_CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always -fstack-usage
|
||||
ifeq ($(OSARCH), amd64)
|
||||
DRIVER_CFLAGS += -fverbose-asm
|
||||
endif
|
||||
ifneq ($(OSARCH), aarch64)
|
||||
DRIVER_CFLAGS += -fstack-check
|
||||
endif
|
||||
DRIVER_LDFLAGS += -ggdb3 -O0
|
||||
endif
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CPP) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
@ -1,5 +1,9 @@
|
||||
build:
|
||||
make -C fat build
|
||||
MAKE_TARGETS := build clean
|
||||
DIRECTORIES := $(sort $(dir $(wildcard ./*/)))
|
||||
|
||||
clean:
|
||||
make -C fat clean
|
||||
.PHONY: $(MAKE_TARGETS) $(DIRECTORIES)
|
||||
|
||||
$(MAKE_TARGETS): $(DIRECTORIES)
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = fat.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
This file is part of Fennix Drivers.
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Drivers is free software: you can redistribute it and/or
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Drivers is distributed in the hope that it will be useful,
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Drivers. If not, see <https://www.gnu.org/licenses/>.
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_API_AIP_H__
|
||||
|
@ -15,8 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_KERNEL_ERRNO_H__
|
||||
#define __FENNIX_KERNEL_ERRNO_H__
|
||||
#ifndef __FENNIX_API_ERRNO_H__
|
||||
#define __FENNIX_API_ERRNO_H__
|
||||
|
||||
/**
|
||||
* The documentation for these error codes are from:
|
||||
@ -416,8 +416,8 @@ typedef enum
|
||||
* Not a directory. A component of the specified pathname exists, but
|
||||
* it is not a directory, when a directory was expected; or an
|
||||
* attempt was made to create a non-directory file, and the specified
|
||||
* pathname contains at least one non- <slash> character and ends
|
||||
* with one or more trailing <slash> characters.
|
||||
* pathname contains at least one non- \<slash\> character and ends
|
||||
* with one or more trailing \<slash\> characters.
|
||||
*/
|
||||
ENOTDIR = 57,
|
||||
|
||||
@ -588,17 +588,18 @@ typedef enum
|
||||
__ERRNO_MAX
|
||||
} KernelErrors;
|
||||
|
||||
#include <types.h>
|
||||
EXTERNC int *__errno_location(void) __attribute__((const));
|
||||
#define errno (*__errno_location())
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int *__errno_location(void) __attribute__((const));
|
||||
char *strerror(int errnum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !__FENNIX_KERNEL_ERRNO_H__
|
||||
#define errno (*__errno_location())
|
||||
|
||||
#endif // !__FENNIX_API_ERRNO_H__
|
||||
|
@ -146,10 +146,10 @@ static_assert(sizeof(blkcnt_t) == 8, "blkcnt_t must be 64 bits");
|
||||
#else
|
||||
static_assert(sizeof(dev_t) == 4, "dev_t must be 32 bits");
|
||||
static_assert(sizeof(ino_t) == 4, "ino_t must be 32 bits");
|
||||
static_assert(sizeof(mode_t) == 2, "mode_t must be 16 bits");
|
||||
static_assert(sizeof(nlink_t) == 2, "nlink_t must be 16 bits");
|
||||
static_assert(sizeof(uid_t) == 2, "uid_t must be 16 bits");
|
||||
static_assert(sizeof(gid_t) == 2, "gid_t must be 16 bits");
|
||||
static_assert(sizeof(mode_t) == 4, "mode_t must be 32 bits");
|
||||
static_assert(sizeof(nlink_t) == 4, "nlink_t must be 32 bits");
|
||||
static_assert(sizeof(uid_t) == 4, "uid_t must be 32 bits");
|
||||
static_assert(sizeof(gid_t) == 4, "gid_t must be 32 bits");
|
||||
static_assert(sizeof(off_t) == 4, "off_t must be 32 bits");
|
||||
static_assert(sizeof(time_t) == 4, "time_t must be 32 bits");
|
||||
static_assert(sizeof(blksize_t) == 4, "blksize_t must be 32 bits");
|
||||
@ -348,6 +348,7 @@ struct SuperBlockOperations
|
||||
* Write all pending changes to the disk.
|
||||
*
|
||||
* @param Info Inode to synchronize. If NULL, synchronize all inodes.
|
||||
* @param Node Inode to synchronize.
|
||||
*
|
||||
* @return Zero on success, otherwise an error code.
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ extern "C"
|
||||
: "dN"(Port), "a"(Data));
|
||||
}
|
||||
|
||||
static inline uint8_t mmioin8(uint64_t Address)
|
||||
static inline uint8_t mmioin8(uintptr_t Address)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
@ -85,7 +85,7 @@ extern "C"
|
||||
return Result;
|
||||
}
|
||||
|
||||
static inline uint16_t mmioin16(uint64_t Address)
|
||||
static inline uint16_t mmioin16(uintptr_t Address)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
@ -95,7 +95,7 @@ extern "C"
|
||||
return Result;
|
||||
}
|
||||
|
||||
static inline uint32_t mmioin32(uint64_t Address)
|
||||
static inline uint32_t mmioin32(uintptr_t Address)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
@ -105,17 +105,17 @@ extern "C"
|
||||
return Result;
|
||||
}
|
||||
|
||||
static inline uint64_t mmioin64(uint64_t Address)
|
||||
static inline uintptr_t mmioin64(uintptr_t Address)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
uint64_t Result = *(volatile uint64_t *)Address;
|
||||
uintptr_t Result = *(volatile uintptr_t *)Address;
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
return Result;
|
||||
}
|
||||
|
||||
static inline void mmioout8(uint64_t Address, uint8_t Data)
|
||||
static inline void mmioout8(uintptr_t Address, uint8_t Data)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
@ -124,7 +124,7 @@ extern "C"
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline void mmioout16(uint64_t Address, uint16_t Data)
|
||||
static inline void mmioout16(uintptr_t Address, uint16_t Data)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
@ -133,7 +133,7 @@ extern "C"
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline void mmioout32(uint64_t Address, uint32_t Data)
|
||||
static inline void mmioout32(uintptr_t Address, uint32_t Data)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
@ -142,11 +142,11 @@ extern "C"
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline void mmioout64(uint64_t Address, uint64_t Data)
|
||||
static inline void mmioout64(uintptr_t Address, uintptr_t Data)
|
||||
{
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
*(volatile uint64_t *)Address = Data;
|
||||
*(volatile uintptr_t *)Address = Data;
|
||||
__asm__ volatile("" ::
|
||||
: "memory");
|
||||
}
|
||||
@ -175,10 +175,10 @@ extern "C"
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline void mmoutq(void *Address, uint64_t Value)
|
||||
static inline void mmoutq(void *Address, uintptr_t Value)
|
||||
{
|
||||
__asm__ volatile("mov %1, %0"
|
||||
: "=m"((*(uint64_t *)(Address)))
|
||||
: "=m"((*(uintptr_t *)(Address)))
|
||||
: "r"(Value)
|
||||
: "memory");
|
||||
}
|
||||
@ -213,12 +213,12 @@ extern "C"
|
||||
return Result;
|
||||
}
|
||||
|
||||
static inline uint64_t mminq(void *Address)
|
||||
static inline uintptr_t mminq(void *Address)
|
||||
{
|
||||
uint64_t Result;
|
||||
uintptr_t Result;
|
||||
__asm__ volatile("mov %1, %0"
|
||||
: "=r"(Result)
|
||||
: "m"((*(uint64_t *)(Address)))
|
||||
: "m"((*(uintptr_t *)(Address)))
|
||||
: "memory");
|
||||
return Result;
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
This file is part of Fennix Drivers.
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Drivers is free software: you can redistribute it and/or
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Drivers is distributed in the hope that it will be useful,
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Drivers. If not, see <https://www.gnu.org/licenses/>.
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_API_PCI_H__
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -71,7 +71,7 @@ typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef int64_t clock_t;
|
||||
typedef int32_t pid_t;
|
||||
#elif defined(__LP32__)
|
||||
#else
|
||||
typedef int32_t off_t;
|
||||
typedef long long off64_t;
|
||||
typedef __INT32_TYPE__ mode_t;
|
||||
|
@ -1,5 +1,9 @@
|
||||
build:
|
||||
make -C aip build
|
||||
MAKE_TARGETS := build clean
|
||||
DIRECTORIES := $(sort $(dir $(wildcard ./*/)))
|
||||
|
||||
clean:
|
||||
make -C aip clean
|
||||
.PHONY: $(MAKE_TARGETS) $(DIRECTORIES)
|
||||
|
||||
$(MAKE_TARGETS): $(DIRECTORIES)
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = aip.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,21 +1,14 @@
|
||||
# Config file
|
||||
include ../../Makefile.conf
|
||||
|
||||
FILENAME = libkernel.so
|
||||
|
||||
CC = ../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
|
||||
CPP = ../../$(COMPILER_PATH)/$(COMPILER_ARCH)g++
|
||||
LD = ../../$(COMPILER_PATH)/$(COMPILER_ARCH)ld
|
||||
AS = ../../$(COMPILER_PATH)/$(COMPILER_ARCH)as
|
||||
AR = ../../$(COMPILER_PATH)/$(COMPILER_ARCH)ar
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S' -not -path "./crt/*")
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c' -not -path "./crt/*")
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp' -not -path "./crt/*")
|
||||
HEADERS = $(sort $(dir $(wildcard ../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(ASM_SOURCES:.asm=.o) $(S_SOURCES:.S=.o) $(PSF_SOURCES:.psf=.o) $(BMP_SOURCES:.bmp=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
INCLUDE_DIR = ../include
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp' -not -path "./crt/*")
|
||||
HEADERS = $(sort $(dir $(wildcard $(INCLUDE_DIR)/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(ASM_SOURCES:.asm=.o) $(S_SOURCES:.S=.o) $(PSF_SOURCES:.psf=.o) $(BMP_SOURCES:.bmp=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
LDFLAGS := -fPIC -fPIE -pie -nostdlib -nodefaultlibs -nolibc \
|
||||
-zmax-page-size=0x1000 -Wl,-Map libkernel.map -shared
|
||||
@ -43,7 +36,15 @@ CFLAGS += -pipe -fno-builtin -fPIC
|
||||
|
||||
endif
|
||||
|
||||
CRT_CFLAGS := -fPIC -fPIE -pie -mno-red-zone -std=c++20 -I../include
|
||||
CRT_CFLAGS := -fPIC -fPIE -pie -std=c++20 -I$(INCLUDE_DIR)
|
||||
|
||||
ifeq ($(OSARCH), amd64)
|
||||
CRT_CFLAGS += -mno-red-zone
|
||||
else ifeq ($(OSARCH), i386)
|
||||
CRT_CFLAGS += -mno-red-zone
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
CRT_CFLAGS +=
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always -fstack-usage
|
||||
@ -60,12 +61,12 @@ endif
|
||||
endif
|
||||
|
||||
build: $(FILENAME)
|
||||
$(CPP) $(CRT_CFLAGS) -c crt/crt0.cpp -o dcrt0.o
|
||||
mv dcrt0.o ../out/dcrt0.o
|
||||
$(CXX) $(CRT_CFLAGS) -c crt/crt0.cpp -o dcrt0.o
|
||||
mv dcrt0.o $(OUTPUT_DIR)dcrt0.o
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(LDFLAGS) $(OBJ) -o ../out/$(FILENAME)
|
||||
$(CC) $(LDFLAGS) $(OBJ) -o $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
@ -73,7 +74,7 @@ $(FILENAME): $(OBJ)
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CPP) $(CFLAGS) $(WARNCFLAG) -std=c++20 -fexceptions -c $< -o $@
|
||||
$(CXX) $(CFLAGS) $(WARNCFLAG) -std=c++20 -fexceptions -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
|
@ -73,7 +73,11 @@ DefineFunction(void, KernelPrint, const char *format, ...)
|
||||
{
|
||||
__builtin_va_list args;
|
||||
__builtin_va_start(args, format);
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
__KernelPrint(DriverID, (long)format, (long)args);
|
||||
#elif defined(__aarch64__)
|
||||
__KernelPrint(DriverID, (long)format, (long)__builtin_va_arg(args, void *));
|
||||
#endif
|
||||
__builtin_va_end(args);
|
||||
}
|
||||
|
||||
@ -81,7 +85,11 @@ DefineFunction(void, KernelLog, const char *format, ...)
|
||||
{
|
||||
__builtin_va_list args;
|
||||
__builtin_va_start(args, format);
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
__KernelLog(DriverID, (long)format, (long)args);
|
||||
#elif defined(__aarch64__)
|
||||
__KernelLog(DriverID, (long)format, (long)__builtin_va_arg(args, void *));
|
||||
#endif
|
||||
__builtin_va_end(args);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
build:
|
||||
make -C example build
|
||||
make -C vmware build
|
||||
MAKE_TARGETS := build clean
|
||||
DIRECTORIES := $(sort $(dir $(wildcard ./*/)))
|
||||
|
||||
clean:
|
||||
make -C example clean
|
||||
make -C vmware clean
|
||||
.PHONY: $(MAKE_TARGETS) $(DIRECTORIES)
|
||||
|
||||
$(MAKE_TARGETS): $(DIRECTORIES)
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = example.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -66,15 +66,14 @@ int DriverProbe()
|
||||
* This function is to test if the driver is compatible
|
||||
* with the hardware.
|
||||
* Example: Like if there is a PCI device that the driver
|
||||
* is for, or a CPU feature that etc.
|
||||
* is for, or a CPU feature etc.
|
||||
*
|
||||
* Return 0 if the driver is compatible with the hardware.
|
||||
* Otherwise, return a value that is not 0.
|
||||
*
|
||||
* Note: In this function you cannot use variables that
|
||||
* have constructors or destructors. Before DriverEntry,
|
||||
* the constructors are called and after DriverFinalize,
|
||||
* the destructors are called.
|
||||
* the destructors.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = vmware.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -107,6 +107,8 @@ typedef struct
|
||||
#define MESSAGE_RECV_PAYLOAD ToMsg(MSG_RECVPAYLOAD)
|
||||
#define MESSAGE_RECV_STATUS ToMsg(MSG_RECVSTATUS)
|
||||
|
||||
#if defined(__amd64__)
|
||||
|
||||
#define VM_PORT(cmd, in_ebx, isi, idi, \
|
||||
flags, magic, \
|
||||
ax, bx, cx, dx, si, di) \
|
||||
@ -169,6 +171,23 @@ typedef struct
|
||||
"D"(idi), \
|
||||
"r"(bp) : "memory", "cc")
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
#define VM_PORT(cmd, in_ebx, isi, idi, \
|
||||
flags, magic, \
|
||||
ax, bx, cx, dx, si, di)
|
||||
|
||||
#define VM_PORT_HB_OUT(cmd, in_ecx, isi, idi, \
|
||||
flags, \
|
||||
magic, bp, ax, \
|
||||
bx, cx, dx, si, di)
|
||||
|
||||
#define VM_PORT_HB_IN(cmd, in_ecx, isi, idi, \
|
||||
flags, magic, bp, \
|
||||
ax, bx, cx, dx, si, di)
|
||||
|
||||
#endif
|
||||
|
||||
/* TODO:
|
||||
- use vmcall or vmmcall instead of "out" and "in" if available
|
||||
*/
|
||||
|
@ -1,7 +1,9 @@
|
||||
build:
|
||||
make -C e1000 build
|
||||
make -C rtl8139 build
|
||||
MAKE_TARGETS := build clean
|
||||
DIRECTORIES := $(sort $(dir $(wildcard ./*/)))
|
||||
|
||||
clean:
|
||||
make -C e1000 clean
|
||||
make -C rtl8139 clean
|
||||
.PHONY: $(MAKE_TARGETS) $(DIRECTORIES)
|
||||
|
||||
$(MAKE_TARGETS): $(DIRECTORIES)
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = e1000.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = rtl8139.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = ahci.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
@ -1,22 +1,35 @@
|
||||
# Config files
|
||||
include ../../../Makefile.conf
|
||||
include ../../config.mk
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CPP_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
HEADERS = $(sort $(dir $(wildcard ../../include/*)))
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CPP_SOURCES:.cpp=.su)
|
||||
OBJ = $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o) $(S_SOURCES:.S=.o)
|
||||
STACK_USAGE_OBJ = $(C_SOURCES:.c=.su) $(CXX_SOURCES:.cpp=.su)
|
||||
|
||||
FILENAME = ata.drv
|
||||
FILENAME = $(notdir $(shell pwd)).drv
|
||||
|
||||
build: $(FILENAME)
|
||||
mv $(FILENAME) ../../out/$(FILENAME)
|
||||
mv $(FILENAME) $(OUTPUT_DIR)$(FILENAME)
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) ../../out/dcrt0.o -L../../out -lkernel -o $@
|
||||
$(CC) $(DRIVER_LDFLAGS) $(OBJ) $(OUTPUT_DIR)dcrt0.o -L$(OUTPUT_DIR) -lkernel -o $@
|
||||
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(DRIVER_CFLAGS) $(WARNCFLAG) -std=c++20 -fno-exceptions -fno-rtti -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f file.map $(OBJ) $(STACK_USAGE_OBJ)
|
||||
|
15
Fennix Bootloader.code-workspace
Normal file
15
Fennix Bootloader.code-workspace
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "./Bootloader"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.cwd": "../",
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"git.alwaysSignOff": true,
|
||||
"git.defaultBranchName": "master",
|
||||
"git.openRepositoryInParentFolders": "always",
|
||||
"C_Cpp.autoAddFileAssociations": false
|
||||
}
|
||||
}
|
@ -5,108 +5,11 @@
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.cwd": "../",
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"cSpell.words": [
|
||||
"ABAR",
|
||||
"ABSPOINTER",
|
||||
"AHCI",
|
||||
"BIST",
|
||||
"Cardbus",
|
||||
"CFIEN",
|
||||
"cmdret",
|
||||
"cmpb",
|
||||
"driverinfo",
|
||||
"ECTRL",
|
||||
"EEPROM",
|
||||
"Fennix",
|
||||
"GETVERSION",
|
||||
"HBAPRDT",
|
||||
"IFCS",
|
||||
"inportb",
|
||||
"inportl",
|
||||
"inportw",
|
||||
"INTX",
|
||||
"KAPI",
|
||||
"LEDS",
|
||||
"LPBK",
|
||||
"LSTA",
|
||||
"mminb",
|
||||
"mminl",
|
||||
"mminq",
|
||||
"mminw",
|
||||
"mmioin",
|
||||
"mmioout",
|
||||
"mmoutb",
|
||||
"mmoutl",
|
||||
"mmoutw",
|
||||
"NABM",
|
||||
"NABMB",
|
||||
"NABMBOFF",
|
||||
"outportb",
|
||||
"outportl",
|
||||
"outportw",
|
||||
"PCIBAR",
|
||||
"PCMOUT",
|
||||
"PCNET",
|
||||
"PCTRL",
|
||||
"PMCF",
|
||||
"PORTHB",
|
||||
"PRDT",
|
||||
"Prefetchable",
|
||||
"RCTL",
|
||||
"RCTRL",
|
||||
"RDMTS",
|
||||
"RDTR",
|
||||
"rpci",
|
||||
"RSRPD",
|
||||
"RTCL",
|
||||
"RTLC",
|
||||
"RTLIB",
|
||||
"RTLIL",
|
||||
"RTLIW",
|
||||
"RTLOB",
|
||||
"RTLOL",
|
||||
"RTLOW",
|
||||
"RXDCTL",
|
||||
"RXDESCHEAD",
|
||||
"RXDESCHI",
|
||||
"RXDESCLEN",
|
||||
"RXDESCLO",
|
||||
"RXDESCTAIL",
|
||||
"Sata",
|
||||
"SATAPI",
|
||||
"SECRC",
|
||||
"SEMB",
|
||||
"SWXOFF",
|
||||
"tclo",
|
||||
"TCTL",
|
||||
"TCTRL",
|
||||
"TFES",
|
||||
"TIPG",
|
||||
"TSAD",
|
||||
"TSTA",
|
||||
"TXDESCHEAD",
|
||||
"TXDESCHI",
|
||||
"TXDESCLEN",
|
||||
"TXDESCLO",
|
||||
"TXDESCTAIL",
|
||||
"TYPEMATIC",
|
||||
"ubit",
|
||||
"Virtio",
|
||||
"Wmissing"
|
||||
],
|
||||
"files.associations": {
|
||||
"*.su": "tsv",
|
||||
"driver.h": "c",
|
||||
"base.h": "c",
|
||||
"types.h": "c",
|
||||
"syscall.h": "c",
|
||||
"aip.h": "c",
|
||||
"input.h": "c",
|
||||
"errno.h": "c",
|
||||
"io.h": "c",
|
||||
"rtl8139.hpp": "c",
|
||||
"net.h": "c"
|
||||
}
|
||||
"git.alwaysSignOff": true,
|
||||
"git.defaultBranchName": "master",
|
||||
"git.openRepositoryInParentFolders": "always",
|
||||
"C_Cpp.autoAddFileAssociations": false
|
||||
}
|
||||
}
|
||||
}
|
@ -5,513 +5,8 @@
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.cwd": "../",
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"files.associations": {
|
||||
"*.su": "tsv",
|
||||
"thread": "cpp",
|
||||
"bitset": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"semaphore": "cpp",
|
||||
"memory": "cpp",
|
||||
"limits": "cpp",
|
||||
"climits": "cpp",
|
||||
"iterator": "cpp",
|
||||
"ranges": "cpp",
|
||||
"cassert": "cpp",
|
||||
"concepts": "cpp",
|
||||
"cctype": "cpp",
|
||||
"tuple": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"system_error": "cpp",
|
||||
"coroutine": "cpp",
|
||||
"static_vector": "cpp",
|
||||
"string_view": "cpp",
|
||||
"compare": "cpp",
|
||||
"limine.h": "c",
|
||||
"types.h": "c",
|
||||
"binfo.h": "c",
|
||||
"liballoc_1_1.h": "c",
|
||||
"cstring": "cpp",
|
||||
"cargs.h": "c",
|
||||
"memory.hpp": "c",
|
||||
"convert.h": "c",
|
||||
"limits.h": "c",
|
||||
"assert.h": "c",
|
||||
"cwalk.h": "c",
|
||||
"md5.h": "c",
|
||||
"stdint.h": "c",
|
||||
"debug.h": "c",
|
||||
"ubsan.h": "c",
|
||||
"kernel.h": "c",
|
||||
"filesystem.hpp": "c",
|
||||
"vector.hpp": "c",
|
||||
"string.hpp": "c",
|
||||
"nc.hpp": "c",
|
||||
"vector": "c",
|
||||
"task.hpp": "c",
|
||||
"recovery.hpp": "c",
|
||||
"symbols.hpp": "c",
|
||||
"cstddef": "cpp",
|
||||
"atomic.hpp": "c",
|
||||
"atomic": "cpp",
|
||||
"syscalls.h": "c",
|
||||
"cmath": "cpp",
|
||||
"typeinfo": "c",
|
||||
"exception": "cpp",
|
||||
"errno.h": "c",
|
||||
"float.h": "c",
|
||||
"mutex": "cpp",
|
||||
"type_trails": "cpp",
|
||||
"utility": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"stdio.h": "c",
|
||||
"string": "cpp",
|
||||
"list": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"unistd.h": "c",
|
||||
"unordered_map": "cpp",
|
||||
"sched.h": "c",
|
||||
"mman.h": "c",
|
||||
"string.h": "c",
|
||||
"macro.hpp": "c",
|
||||
"stddef.h": "c",
|
||||
"cfloat": "c",
|
||||
"type_traits": "cpp",
|
||||
"stdlib.h": "c",
|
||||
"new": "cpp",
|
||||
"ostream": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"ios": "cpp",
|
||||
"locale": "cpp",
|
||||
"unwind.h": "c",
|
||||
"memory.h": "c",
|
||||
"physical.hpp": "c",
|
||||
"swap_pt.hpp": "c",
|
||||
"brk.hpp": "c",
|
||||
"bitmap.hpp": "c",
|
||||
"lock.hpp": "c",
|
||||
"virtual.hpp": "c",
|
||||
"table.hpp": "c",
|
||||
"vma.hpp": "c",
|
||||
"abi.h": "c",
|
||||
"kstack.hpp": "c",
|
||||
"stack.hpp": "c",
|
||||
"optional": "cpp"
|
||||
},
|
||||
"cSpell.words": [
|
||||
"AABBCC",
|
||||
"AAFF",
|
||||
"AAFFAA",
|
||||
"ABAR",
|
||||
"ABIVERSION",
|
||||
"ABSPOINTER",
|
||||
"ACPI",
|
||||
"ACPINVS",
|
||||
"addralign",
|
||||
"AEFF",
|
||||
"AFAFAF",
|
||||
"AHBA",
|
||||
"AHCI",
|
||||
"ALTLBA",
|
||||
"APERF",
|
||||
"apic",
|
||||
"APICID",
|
||||
"archaux",
|
||||
"AROS",
|
||||
"ARRAYSZ",
|
||||
"auxv",
|
||||
"BABABA",
|
||||
"BADRAM",
|
||||
"BGRT",
|
||||
"bimi",
|
||||
"binfo",
|
||||
"biosdev",
|
||||
"BIST",
|
||||
"BITALG",
|
||||
"BLOCKDEV",
|
||||
"BLOCKDEVICE",
|
||||
"BNDCFGS",
|
||||
"bochs",
|
||||
"bootanim",
|
||||
"bootdev",
|
||||
"Bootloader",
|
||||
"brontobyte",
|
||||
"CACACA",
|
||||
"calloc",
|
||||
"Cardbus",
|
||||
"CCCCCCCPU",
|
||||
"CHARDEV",
|
||||
"CHARDEVICE",
|
||||
"charsize",
|
||||
"clac",
|
||||
"CLOUDABI",
|
||||
"CMCI",
|
||||
"CMOS",
|
||||
"cntvct",
|
||||
"COMNULL",
|
||||
"copydoc",
|
||||
"cpudata",
|
||||
"CPUID",
|
||||
"crashdata",
|
||||
"CSTAR",
|
||||
"CTLS",
|
||||
"cutlim",
|
||||
"DADADA",
|
||||
"daif",
|
||||
"daifclr",
|
||||
"daifset",
|
||||
"DAPI",
|
||||
"DBGP",
|
||||
"DEBUGCTL",
|
||||
"defragment",
|
||||
"dfdesc",
|
||||
"dialup",
|
||||
"Didx",
|
||||
"DLAB",
|
||||
"Drivermemcpy",
|
||||
"Drivermemset",
|
||||
"Driversprintf",
|
||||
"drvdir",
|
||||
"DRVER",
|
||||
"DSDT",
|
||||
"DUID",
|
||||
"dynstr",
|
||||
"dynsym",
|
||||
"EBDA",
|
||||
"edid",
|
||||
"EEPROM",
|
||||
"EFER",
|
||||
"Ehdr",
|
||||
"ehsize",
|
||||
"EISA",
|
||||
"ELFABI",
|
||||
"ELFCLASS",
|
||||
"ELFDATA",
|
||||
"ELFMAG",
|
||||
"ELFOSABI",
|
||||
"EMMINTRIN",
|
||||
"endregion",
|
||||
"Ensoniq",
|
||||
"EVTSEL",
|
||||
"EXECFN",
|
||||
"exobyte",
|
||||
"EXTD",
|
||||
"FADT",
|
||||
"FAFAFA",
|
||||
"FAFAFAI",
|
||||
"Fargc",
|
||||
"Fargv",
|
||||
"fcreat",
|
||||
"fctprintf",
|
||||
"Femto",
|
||||
"FENIXOS",
|
||||
"FENNIX",
|
||||
"FFAA",
|
||||
"FFAAAA",
|
||||
"FFSMBIOS",
|
||||
"FFXSR",
|
||||
"filestatus",
|
||||
"FMAPS",
|
||||
"fonthdr",
|
||||
"Framebuffer",
|
||||
"FSGSBASE",
|
||||
"fsmi",
|
||||
"fxrstor",
|
||||
"fxsave",
|
||||
"Gamepad",
|
||||
"Gameport",
|
||||
"geopbyte",
|
||||
"GETVERSION",
|
||||
"GFNI",
|
||||
"haddpd",
|
||||
"headersize",
|
||||
"HIPROC",
|
||||
"HPET",
|
||||
"hwaddress",
|
||||
"ICRHI",
|
||||
"ICRLO",
|
||||
"IDIV",
|
||||
"idtd",
|
||||
"IFHLNK",
|
||||
"infloop",
|
||||
"inportb",
|
||||
"inportl",
|
||||
"inportw",
|
||||
"INTFASTX",
|
||||
"INTLEASTX",
|
||||
"INTX",
|
||||
"invlpg",
|
||||
"ioapic",
|
||||
"ioapicirq",
|
||||
"IOCTLFS",
|
||||
"IPCID",
|
||||
"IRET",
|
||||
"iretq",
|
||||
"isdelim",
|
||||
"ishld",
|
||||
"ishst",
|
||||
"itimerspec",
|
||||
"itrfb",
|
||||
"JMPREL",
|
||||
"KAPI",
|
||||
"KAPIPCI",
|
||||
"kcalloc",
|
||||
"kcon",
|
||||
"kdentry",
|
||||
"kdirent",
|
||||
"kernelctl",
|
||||
"kfree",
|
||||
"klog",
|
||||
"kmalloc",
|
||||
"kproc",
|
||||
"krealloc",
|
||||
"kthrd",
|
||||
"lapic",
|
||||
"lfanew",
|
||||
"LFLR",
|
||||
"lgdt",
|
||||
"liballoc",
|
||||
"LIBLIST",
|
||||
"lidt",
|
||||
"limine",
|
||||
"LMSLE",
|
||||
"LOPROC",
|
||||
"lsacpi",
|
||||
"LSTAR",
|
||||
"MADT",
|
||||
"MADTIO",
|
||||
"malloc",
|
||||
"MCFG",
|
||||
"memdbg",
|
||||
"memmap",
|
||||
"memsz",
|
||||
"MEMTEST",
|
||||
"mfence",
|
||||
"MIDR",
|
||||
"mminb",
|
||||
"mminl",
|
||||
"mminq",
|
||||
"mminw",
|
||||
"mmioin",
|
||||
"mmioout",
|
||||
"mmoutb",
|
||||
"mmoutl",
|
||||
"mmoutq",
|
||||
"mmoutw",
|
||||
"modbg",
|
||||
"Modulememcpy",
|
||||
"Modulememset",
|
||||
"Modulesprintf",
|
||||
"movaps",
|
||||
"movddup",
|
||||
"movdqa",
|
||||
"movdqu",
|
||||
"movntdq",
|
||||
"movntdqa",
|
||||
"movw",
|
||||
"MPERF",
|
||||
"MSRID",
|
||||
"MTRR",
|
||||
"MTRRCAP",
|
||||
"multiboot",
|
||||
"MWAIT",
|
||||
"newfstatat",
|
||||
"NIDENT",
|
||||
"NOBITS",
|
||||
"nullfd",
|
||||
"nullptr",
|
||||
"objptr",
|
||||
"OEMID",
|
||||
"Ofast",
|
||||
"okstat",
|
||||
"oldfd",
|
||||
"OPENVOS",
|
||||
"OPTMZ",
|
||||
"OSABI",
|
||||
"OSFXSR",
|
||||
"OSXMMEXCPT",
|
||||
"OSXSAVE",
|
||||
"Outof",
|
||||
"outportb",
|
||||
"outportl",
|
||||
"outportw",
|
||||
"PAGESZ",
|
||||
"palignr",
|
||||
"PCIDE",
|
||||
"pcmpistri",
|
||||
"PCNET",
|
||||
"PDBR",
|
||||
"PDPTE",
|
||||
"PEBS",
|
||||
"PERFEVTSEL",
|
||||
"PEXIT",
|
||||
"PFLA",
|
||||
"Phdrs",
|
||||
"pheader",
|
||||
"PHENT",
|
||||
"phentsize",
|
||||
"phnum",
|
||||
"phoff",
|
||||
"PHYSBASE",
|
||||
"PHYSMASK",
|
||||
"Pico",
|
||||
"PINBASED",
|
||||
"Pipefd",
|
||||
"PKRU",
|
||||
"PLTGOT",
|
||||
"PLTREL",
|
||||
"PLTRELSZ",
|
||||
"POPCNT",
|
||||
"PORTHB",
|
||||
"powerline",
|
||||
"Prefetchable",
|
||||
"PREINIT",
|
||||
"PROCBASED",
|
||||
"PROGBITS",
|
||||
"PTMX",
|
||||
"ptys",
|
||||
"pushfl",
|
||||
"pushfq",
|
||||
"Raphson",
|
||||
"RARP",
|
||||
"RBSTART",
|
||||
"rdmsr",
|
||||
"RDRAND",
|
||||
"rdseed",
|
||||
"rdtsc",
|
||||
"readcr",
|
||||
"readxcr",
|
||||
"realloc",
|
||||
"Realtek",
|
||||
"RELAENT",
|
||||
"RELASZ",
|
||||
"RELSZ",
|
||||
"Rodata",
|
||||
"RPCI",
|
||||
"rpmalloc",
|
||||
"RRGGBB",
|
||||
"RSDP",
|
||||
"RSDT",
|
||||
"RTIT",
|
||||
"SATA",
|
||||
"schedbg",
|
||||
"SERCOS",
|
||||
"serialports",
|
||||
"sfence",
|
||||
"sgdt",
|
||||
"SGXLEPUBKEYHASH",
|
||||
"Shdr",
|
||||
"Sheader",
|
||||
"shentsize",
|
||||
"shnum",
|
||||
"shoff",
|
||||
"showbuf",
|
||||
"shstrndx",
|
||||
"shstrtab",
|
||||
"sidt",
|
||||
"SIGCOMP",
|
||||
"sigsetsize",
|
||||
"SIVR",
|
||||
"SMAP",
|
||||
"SMBASE",
|
||||
"SMBIOSBIOS",
|
||||
"SMEP",
|
||||
"SMRR",
|
||||
"SMXE",
|
||||
"SNTP",
|
||||
"SRAT",
|
||||
"SSDT",
|
||||
"sspt",
|
||||
"SSSE",
|
||||
"stac",
|
||||
"strdbg",
|
||||
"STRSZ",
|
||||
"SVME",
|
||||
"swapgs",
|
||||
"Symbios",
|
||||
"SYMENT",
|
||||
"SYSENTER",
|
||||
"sysret",
|
||||
"sysretq",
|
||||
"Tamsyn",
|
||||
"targp",
|
||||
"TCCR",
|
||||
"TCLO",
|
||||
"TCPA",
|
||||
"TDCR",
|
||||
"TEXIT",
|
||||
"TEXTREL",
|
||||
"Thrd",
|
||||
"TICR",
|
||||
"tlbi",
|
||||
"Touchpad",
|
||||
"tracepagetable",
|
||||
"tskdbg",
|
||||
"ttbr",
|
||||
"uarch",
|
||||
"uartmemdmp",
|
||||
"ubsan",
|
||||
"UINTFASTX",
|
||||
"UINTLEASTX",
|
||||
"UINTX",
|
||||
"ultoa",
|
||||
"UMIP",
|
||||
"UMWAIT",
|
||||
"UNMAP",
|
||||
"Unmaskable",
|
||||
"Unreserving",
|
||||
"unseek",
|
||||
"Unswap",
|
||||
"unsynchronized",
|
||||
"UPDT",
|
||||
"UPID",
|
||||
"uroot",
|
||||
"UTID",
|
||||
"VAES",
|
||||
"VBMI",
|
||||
"vectorize",
|
||||
"vfctprintf",
|
||||
"vfsdbg",
|
||||
"Vidx",
|
||||
"Virtio",
|
||||
"VMCS",
|
||||
"VMFUNC",
|
||||
"vmouse",
|
||||
"VMXE",
|
||||
"VNNI",
|
||||
"VNNIW",
|
||||
"VPCLMULQDQ",
|
||||
"VPID",
|
||||
"VPOKE",
|
||||
"VPOPCNTDQ",
|
||||
"WAET",
|
||||
"weakrefalias",
|
||||
"Wignored",
|
||||
"Wmissing",
|
||||
"writecr",
|
||||
"writexcr",
|
||||
"wrmsr",
|
||||
"WWVB",
|
||||
"WWVH",
|
||||
"Xalloc",
|
||||
"xallocv",
|
||||
"Xclac",
|
||||
"xgetbv",
|
||||
"Xmemcpy",
|
||||
"Xmemset",
|
||||
"XSDT",
|
||||
"Xsize",
|
||||
"XSLC",
|
||||
"XSLF",
|
||||
"XSLM",
|
||||
"XSLR",
|
||||
"Xstac",
|
||||
"Xuintptr",
|
||||
"yottabyte",
|
||||
"zettabyte"
|
||||
],
|
||||
"editor.tabCompletion": "on",
|
||||
"diffEditor.codeLens": true,
|
||||
"editor.quickSuggestionsDelay": 100,
|
||||
@ -527,6 +22,10 @@
|
||||
"editor.cursorBlinking": "blink",
|
||||
"editor.cursorSmoothCaretAnimation": "on",
|
||||
"editor.cursorStyle": "line",
|
||||
"editor.cursorWidth": 2
|
||||
"editor.cursorWidth": 2,
|
||||
"git.alwaysSignOff": true,
|
||||
"git.defaultBranchName": "master",
|
||||
"git.openRepositoryInParentFolders": "always",
|
||||
"C_Cpp.autoAddFileAssociations": false
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "./Lynx"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"files.associations": {
|
||||
"*.su": "tsv",
|
||||
"limine.h": "c"
|
||||
},
|
||||
"cSpell.words": [
|
||||
"Bootloader",
|
||||
"COMNULL",
|
||||
"CPUID",
|
||||
"FENNIX",
|
||||
"JMPREL",
|
||||
"UBSAN"
|
||||
]
|
||||
}
|
||||
}
|
@ -5,67 +5,11 @@
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.cwd": "../",
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"files.associations": {
|
||||
"*.su": "tsv",
|
||||
"thread": "cpp",
|
||||
"bitset": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"fex.hpp": "c",
|
||||
"types.h": "c",
|
||||
"dlfcn.h": "c",
|
||||
"aux.h": "c",
|
||||
"stddef.h": "c",
|
||||
"stdio.h": "c",
|
||||
"syscalls.h": "c",
|
||||
"syslib.h": "c",
|
||||
"sysfile.h": "c",
|
||||
"ipc.h": "c",
|
||||
"sysbase.h": "c",
|
||||
"inttypes.h": "c",
|
||||
"doomkeys.h": "c",
|
||||
"doomgeneric.h": "c",
|
||||
"elf.h": "c",
|
||||
"init.h": "c",
|
||||
"unused_code": "cpp",
|
||||
"liballoc_1_1.h": "c",
|
||||
"errno.h": "c",
|
||||
"stdlib.h": "c",
|
||||
"stdarg.h": "c",
|
||||
"printf.h": "c",
|
||||
"ctype.h": "c",
|
||||
"unistd.h": "c",
|
||||
"stat.h": "c",
|
||||
"wait.h": "c",
|
||||
"base.h": "c",
|
||||
"ld.h": "c",
|
||||
"syscall.h": "c",
|
||||
"stdint.h": "c",
|
||||
"setjmp.h": "c",
|
||||
"limits.h": "c",
|
||||
"fcntl.h": "c",
|
||||
"pty.h": "c",
|
||||
"string.h": "c",
|
||||
"time.h": "c",
|
||||
"reboot.h": "c",
|
||||
"*.in": "c",
|
||||
"signal.h": "c",
|
||||
"alltypes.h": "c",
|
||||
"pr44328.C": "cpp"
|
||||
},
|
||||
"cSpell.words": [
|
||||
"auxv",
|
||||
"cmpq",
|
||||
"FENNIX",
|
||||
"JMPREL",
|
||||
"Krnl",
|
||||
"liballoc",
|
||||
"libinit",
|
||||
"oldpath",
|
||||
"preinit",
|
||||
"Shdr",
|
||||
"vfctprintf",
|
||||
"WAITSTATUS"
|
||||
]
|
||||
"git.alwaysSignOff": true,
|
||||
"git.defaultBranchName": "master",
|
||||
"git.openRepositoryInParentFolders": "always",
|
||||
"C_Cpp.autoAddFileAssociations": false
|
||||
}
|
||||
}
|
||||
}
|
14
Fennix Website.code-workspace
Normal file
14
Fennix Website.code-workspace
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "./tools/website"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"git.alwaysSignOff": true,
|
||||
"git.defaultBranchName": "master",
|
||||
"git.openRepositoryInParentFolders": "always",
|
||||
"C_Cpp.autoAddFileAssociations": false
|
||||
}
|
||||
}
|
@ -6,30 +6,9 @@
|
||||
],
|
||||
"settings": {
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"files.associations": {
|
||||
"*.su": "tsv",
|
||||
"thread": "cpp",
|
||||
"bitset": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"semaphore": "cpp",
|
||||
"memory": "cpp",
|
||||
"limits": "cpp",
|
||||
"climits": "cpp",
|
||||
"iterator": "cpp",
|
||||
"ranges": "cpp",
|
||||
"cassert": "cpp",
|
||||
"concepts": "cpp",
|
||||
"cctype": "cpp",
|
||||
"tuple": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"system_error": "cpp",
|
||||
"coroutine": "cpp",
|
||||
"static_vector": "cpp",
|
||||
"string_view": "cpp",
|
||||
"compare": "cpp",
|
||||
"ostream": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp"
|
||||
}
|
||||
"git.alwaysSignOff": true,
|
||||
"git.defaultBranchName": "master",
|
||||
"git.openRepositoryInParentFolders": "always",
|
||||
"C_Cpp.autoAddFileAssociations": false
|
||||
}
|
||||
}
|
13
Kernel/.editorconfig
Normal file
13
Kernel/.editorconfig
Normal file
@ -0,0 +1,13 @@
|
||||
# EditorConfig is awesome: https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
91
Kernel/.gdbinit
Normal file
91
Kernel/.gdbinit
Normal file
@ -0,0 +1,91 @@
|
||||
# Usage: add-symbol-file-all <filename> [<offset>]
|
||||
# remove-symbol-file-all <filename> [<offset>]
|
||||
#
|
||||
# Credit: https://stackoverflow.com/a/33087762/9352057
|
||||
# CC BY-SA 4.0
|
||||
|
||||
python
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
def relocatesections(filename, addr):
|
||||
p = subprocess.Popen(["readelf", "-S", filename], stdout = subprocess.PIPE)
|
||||
|
||||
sections = []
|
||||
textaddr = '0'
|
||||
for line in p.stdout.readlines():
|
||||
line = line.decode("utf-8").strip()
|
||||
if not line.startswith('[') or line.startswith('[Nr]'):
|
||||
continue
|
||||
|
||||
line = re.sub(r' +', ' ', line)
|
||||
line = re.sub(r'\[ *(\d+)\]', '\g<1>', line)
|
||||
fieldsvalue = line.split(' ')
|
||||
fieldsname = ['number', 'name', 'type', 'addr', 'offset', 'size', 'entsize', 'flags', 'link', 'info', 'addralign']
|
||||
sec = dict(zip(fieldsname, fieldsvalue))
|
||||
|
||||
if sec['number'] == '0':
|
||||
continue
|
||||
|
||||
sections.append(sec)
|
||||
|
||||
if sec['name'] == '.text':
|
||||
textaddr = sec['addr']
|
||||
|
||||
return (textaddr, sections)
|
||||
|
||||
|
||||
class AddSymbolFileAll(gdb.Command):
|
||||
"""The right version for add-symbol-file"""
|
||||
|
||||
def __init__(self):
|
||||
super(AddSymbolFileAll, self).__init__("add-symbol-file-all", gdb.COMMAND_USER)
|
||||
self.dont_repeat()
|
||||
|
||||
def invoke(self, arg, from_tty):
|
||||
argv = gdb.string_to_argv(arg)
|
||||
filename = argv[0]
|
||||
|
||||
if len(argv) > 1:
|
||||
offset = int(str(gdb.parse_and_eval(argv[1])), 0)
|
||||
else:
|
||||
offset = 0
|
||||
|
||||
(textaddr, sections) = relocatesections(filename, offset)
|
||||
|
||||
cmd = "add-symbol-file %s 0x%08x" % (filename, int(textaddr, 16) + offset)
|
||||
|
||||
for s in sections:
|
||||
addr = int(s['addr'], 16)
|
||||
if s['name'] == '.text' or addr == 0:
|
||||
continue
|
||||
|
||||
cmd += " -s %s 0x%08x" % (s['name'], addr + offset)
|
||||
|
||||
gdb.execute(cmd)
|
||||
|
||||
class RemoveSymbolFileAll(gdb.Command):
|
||||
"""The right version for remove-symbol-file"""
|
||||
|
||||
def __init__(self):
|
||||
super(RemoveSymbolFileAll, self).__init__("remove-symbol-file-all", gdb.COMMAND_USER)
|
||||
self.dont_repeat()
|
||||
|
||||
def invoke(self, arg, from_tty):
|
||||
argv = gdb.string_to_argv(arg)
|
||||
filename = argv[0]
|
||||
|
||||
if len(argv) > 1:
|
||||
offset = int(str(gdb.parse_and_eval(argv[1])), 0)
|
||||
else:
|
||||
offset = 0
|
||||
|
||||
(textaddr, _) = relocatesections(filename, offset)
|
||||
|
||||
cmd = "remove-symbol-file -a 0x%08x" % (int(textaddr, 16) + offset)
|
||||
gdb.execute(cmd)
|
||||
|
||||
|
||||
AddSymbolFileAll()
|
||||
RemoveSymbolFileAll()
|
||||
end
|
38
Kernel/.github/workflows/flawfinder.yml
vendored
38
Kernel/.github/workflows/flawfinder.yml
vendored
@ -1,38 +0,0 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
name: flawfinder
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "main" ]
|
||||
schedule:
|
||||
- cron: '21 1 * * 1'
|
||||
|
||||
jobs:
|
||||
flawfinder:
|
||||
name: Flawfinder
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: flawfinder_scan
|
||||
uses: david-a-wheeler/flawfinder@8e4a779ad59dbfaee5da586aa9210853b701959c
|
||||
with:
|
||||
arguments: '--sarif ./'
|
||||
output: 'flawfinder_results.sarif'
|
||||
|
||||
- name: Upload analysis results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: ${{github.workspace}}/flawfinder_results.sarif
|
4
Kernel/.gitignore
vendored
4
Kernel/.gitignore
vendored
@ -2,7 +2,5 @@
|
||||
*.su
|
||||
*.gcno
|
||||
*.map
|
||||
*.fsys
|
||||
fennix.elf
|
||||
*.log
|
||||
Files/*.psf
|
||||
.dccache
|
||||
|
85
Kernel/.vscode/c_boilerplates.code-snippets
vendored
85
Kernel/.vscode/c_boilerplates.code-snippets
vendored
@ -1,17 +1,69 @@
|
||||
{
|
||||
"Fennix Kernel Header": {
|
||||
"Fennix Kernel C++ Header": {
|
||||
"isFileTemplate": true,
|
||||
"scope": "c,cpp",
|
||||
"prefix": [
|
||||
"head",
|
||||
],
|
||||
"body": [
|
||||
"#ifndef __FENNIX_KERNEL_${2:header}_H__",
|
||||
"#define __FENNIX_KERNEL_${2:header}_H__",
|
||||
"/*",
|
||||
"\tThis file is part of Fennix Kernel.",
|
||||
"",
|
||||
"\tFennix Kernel is free software: you can redistribute it and/or",
|
||||
"\tmodify it under the terms of the GNU General Public License as",
|
||||
"\tpublished by the Free Software Foundation, either version 3 of",
|
||||
"\tthe License, or (at your option) any later version.",
|
||||
"",
|
||||
"\tFennix Kernel is distributed in the hope that it will be useful,",
|
||||
"\tbut WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"\tGNU General Public License for more details.",
|
||||
"",
|
||||
"\tYou should have received a copy of the GNU General Public License",
|
||||
"\talong with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.",
|
||||
"*/",
|
||||
"",
|
||||
"#pragma once",
|
||||
"",
|
||||
"$0",
|
||||
"",
|
||||
"$1",
|
||||
""
|
||||
],
|
||||
"description": "Create kernel header."
|
||||
},
|
||||
"Fennix Kernel C Header": {
|
||||
"isFileTemplate": true,
|
||||
"scope": "c,cpp",
|
||||
"prefix": [
|
||||
"headc",
|
||||
],
|
||||
"body": [
|
||||
"/*",
|
||||
"\tThis file is part of Fennix Kernel.",
|
||||
"",
|
||||
"\tFennix Kernel is free software: you can redistribute it and/or",
|
||||
"\tmodify it under the terms of the GNU General Public License as",
|
||||
"\tpublished by the Free Software Foundation, either version 3 of",
|
||||
"\tthe License, or (at your option) any later version.",
|
||||
"",
|
||||
"\tFennix Kernel is distributed in the hope that it will be useful,",
|
||||
"\tbut WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"\tGNU General Public License for more details.",
|
||||
"",
|
||||
"\tYou should have received a copy of the GNU General Public License",
|
||||
"\talong with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.",
|
||||
"*/",
|
||||
"",
|
||||
"#ifndef __FENNIX_KERNEL_${1:header}_H__",
|
||||
"#define __FENNIX_KERNEL_${1:header}_H__",
|
||||
"",
|
||||
"#include <types.h>",
|
||||
"",
|
||||
"$0",
|
||||
"",
|
||||
"#endif // !__FENNIX_KERNEL_${2:header}_H__",
|
||||
"#endif // !__FENNIX_KERNEL_${1:header}_H__",
|
||||
""
|
||||
],
|
||||
"description": "Create kernel header."
|
||||
@ -24,5 +76,30 @@
|
||||
"/** @brief $0 */"
|
||||
],
|
||||
"description": "Create kernel documentation brief."
|
||||
},
|
||||
"License": {
|
||||
"isFileTemplate": true,
|
||||
"prefix": [
|
||||
"license",
|
||||
],
|
||||
"body": [
|
||||
"/*",
|
||||
"\tThis file is part of Fennix Kernel.",
|
||||
"",
|
||||
"\tFennix Kernel is free software: you can redistribute it and/or",
|
||||
"\tmodify it under the terms of the GNU General Public License as",
|
||||
"\tpublished by the Free Software Foundation, either version 3 of",
|
||||
"\tthe License, or (at your option) any later version.",
|
||||
"",
|
||||
"\tFennix Kernel is distributed in the hope that it will be useful,",
|
||||
"\tbut WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||
"\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||
"\tGNU General Public License for more details.",
|
||||
"",
|
||||
"\tYou should have received a copy of the GNU General Public License",
|
||||
"\talong with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.",
|
||||
"*/"
|
||||
],
|
||||
"description": "Create kernel license."
|
||||
}
|
||||
}
|
241
Kernel/.vscode/c_cpp_properties.json
vendored
241
Kernel/.vscode/c_cpp_properties.json
vendored
@ -1,49 +1,196 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"__debug_vscode__",
|
||||
"KERNEL_NAME=\"Fennix\"",
|
||||
"KERNEL_VERSION=\"1.0\"",
|
||||
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
|
||||
"GIT_COMMIT_SHORT=\"0000000\"",
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// "-m32",
|
||||
"-mcmodel=kernel", /* 64-bit only */
|
||||
"-fno-rtti",
|
||||
"-fexceptions",
|
||||
"-fno-pic",
|
||||
"-fno-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-mno-sse",
|
||||
"-mno-sse2",
|
||||
"-march=nehalem",
|
||||
"-pipe",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext",
|
||||
"-shared",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-nostdinc++",
|
||||
"-fsanitize=undefined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Fennix x64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**",
|
||||
"${workspaceFolder}/include_std",
|
||||
"${workspaceFolder}/include_std/**",
|
||||
"${workspaceFolder}/arch/amd64/include"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/x86_64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fno-pic",
|
||||
"-fno-pie",
|
||||
"-mno-red-zone",
|
||||
"-march=core2",
|
||||
"-pipe",
|
||||
"-mcmodel=kernel",
|
||||
"-fno-builtin",
|
||||
"-m64",
|
||||
"-fcoroutines",
|
||||
// Warnings
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wfloat-equal",
|
||||
"-Wpointer-arith",
|
||||
"-Wcast-align",
|
||||
"-Wredundant-decls",
|
||||
"-Winit-self",
|
||||
"-Wswitch-default",
|
||||
"-Wstrict-overflow=5",
|
||||
"-Wconversion",
|
||||
// C++ flags
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions",
|
||||
// Linker flags
|
||||
"-T${workspaceFolder}/arch/amd64/linker.ld",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-shared",
|
||||
// Debug flags
|
||||
"-ggdb3",
|
||||
"-O0",
|
||||
"-fdiagnostics-color=always",
|
||||
"-fverbose-asm",
|
||||
"-fstack-usage",
|
||||
"-fstack-check",
|
||||
"-fsanitize=undefined",
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix x32 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**",
|
||||
"${workspaceFolder}/include_std",
|
||||
"${workspaceFolder}/include_std/**",
|
||||
"${workspaceFolder}/arch/i386/include"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/i386-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "gcc-x86",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// Compiler flags
|
||||
"-fno-pic",
|
||||
"-fno-pie",
|
||||
"-mno-80387",
|
||||
"-mno-mmx",
|
||||
"-mno-3dnow",
|
||||
"-mno-red-zone",
|
||||
"-march=pentium",
|
||||
"-pipe",
|
||||
"-msoft-float",
|
||||
"-fno-builtin",
|
||||
"-m32",
|
||||
"-fcoroutines",
|
||||
// Warnings
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wfloat-equal",
|
||||
"-Wpointer-arith",
|
||||
"-Wcast-align",
|
||||
"-Wredundant-decls",
|
||||
"-Winit-self",
|
||||
"-Wswitch-default",
|
||||
"-Wstrict-overflow=5",
|
||||
"-Wconversion",
|
||||
// C++ flags
|
||||
"-fno-rtti",
|
||||
"-fno-exceptions",
|
||||
// Linker flags
|
||||
"-T${workspaceFolder}/arch/i386/linker.ld",
|
||||
"-Wl,-static,--no-dynamic-linker,-ztext",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nolibc",
|
||||
"-zmax-page-size=0x1000",
|
||||
"-shared",
|
||||
// Debug flags
|
||||
"-ggdb3",
|
||||
"-O0",
|
||||
"-fdiagnostics-color=always",
|
||||
"-fverbose-asm",
|
||||
"-fstack-usage",
|
||||
"-fstack-check",
|
||||
"-fsanitize=undefined",
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix Arm (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**",
|
||||
"${workspaceFolder}/include_std",
|
||||
"${workspaceFolder}/include_std/**",
|
||||
"${workspaceFolder}/arch/aarch64/include"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/arm-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "linux-gcc-arm",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fennix Aarch64 (Linux, GCC, debug)",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/include/**",
|
||||
"${workspaceFolder}/include_std",
|
||||
"${workspaceFolder}/include_std/**",
|
||||
"${workspaceFolder}/arch/aarch64/include"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/.vscode/preinclude.h"
|
||||
],
|
||||
"defines": [
|
||||
"DEBUG=\"1\""
|
||||
],
|
||||
"compilerPath": "${workspaceFolder}/../tools/cross/bin/aarch64-fennix-gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20",
|
||||
"intelliSenseMode": "linux-gcc-arm64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools",
|
||||
"compilerArgs": [
|
||||
// VSCode flags
|
||||
"-ffreestanding",
|
||||
"-nostdinc",
|
||||
"-nostdinc++"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
16
Kernel/.vscode/extensions.json
vendored
16
Kernel/.vscode/extensions.json
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"pejmannikram.vscode-auto-scroll",
|
||||
"aaron-bond.better-comments",
|
||||
"ms-vscode.cpptools",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"naumovs.color-highlight",
|
||||
"cschlosser.doxdocgen",
|
||||
"ferrierbenjamin.fold-unfold-all-icone",
|
||||
"ajshort.include-autocomplete",
|
||||
"zixuanwang.linkerscript",
|
||||
"ibm.output-colorizer",
|
||||
"christian-kohler.path-intellisense",
|
||||
"Gruntfuggly.todo-tree"
|
||||
]
|
||||
}
|
40
Kernel/.vscode/launch.json
vendored
40
Kernel/.vscode/launch.json
vendored
@ -1,40 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach to a running QEMU instance",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/kernel.fsys",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"args": [],
|
||||
"targetArchitecture": "x64",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/usr/bin/gdb",
|
||||
"miDebuggerArgs": "",
|
||||
"externalConsole": false,
|
||||
"additionalSOLibSearchPath": "${workspaceRoot}",
|
||||
"customLaunchSetupCommands": [
|
||||
{
|
||||
"text": "target remote localhost:1234",
|
||||
"description": "Connect to QEMU remote debugger"
|
||||
}
|
||||
],
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"text": "set breakpoint pending on",
|
||||
"description": "Make breakpoint pending on future shared library load."
|
||||
},
|
||||
{
|
||||
"text": "file ${workspaceRoot}/kernel.fsys",
|
||||
"description": "Load binary."
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
1
Kernel/.vscode/launch.json
vendored
Symbolic link
1
Kernel/.vscode/launch.json
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../.vscode/launch.json
|
14
Kernel/.vscode/preinclude.h
vendored
Normal file
14
Kernel/.vscode/preinclude.h
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
#undef __linux__
|
||||
#undef __WIN32__
|
||||
#undef __WIN64__
|
||||
#undef _WIN32
|
||||
#undef _WIN64
|
||||
#undef __APPLE__
|
||||
#undef __clang__
|
||||
#define __vscode__ 1
|
||||
#define __kernel__ 1
|
||||
#define KERNEL_NAME "Fennix"
|
||||
#define KERNEL_ARCH "amd64"
|
||||
#define KERNEL_VERSION "1.0"
|
||||
#define GIT_COMMIT "0000000000000000000000000000000000000000"
|
||||
#define GIT_COMMIT_SHORT "0000000"
|
11
Kernel/.vscode/settings.json
vendored
11
Kernel/.vscode/settings.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"C_Cpp.errorSquiggles": "Enabled",
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"C_Cpp.autocompleteAddParentheses": true,
|
||||
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
|
||||
"C_Cpp.clang_format_style": "Visual Studio",
|
||||
@ -8,11 +8,16 @@
|
||||
"C_Cpp.default.cppStandard": "c++20",
|
||||
"C_Cpp.intelliSenseMemoryLimit": 16384,
|
||||
"editor.smoothScrolling": true,
|
||||
"editor.cursorSmoothCaretAnimation": true,
|
||||
"editor.cursorSmoothCaretAnimation": "on",
|
||||
"C_Cpp.codeAnalysis.clangTidy.checks.disabled": [
|
||||
"clang-analyzer-security.insecureAPI.strcpy",
|
||||
"clang-diagnostic-unknown-warning-option",
|
||||
"clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
|
||||
"clang-diagnostic-implicit-exception-spec-mismatch"
|
||||
"clang-diagnostic-implicit-exception-spec-mismatch",
|
||||
"clang-diagnostic-unknown-attributes",
|
||||
"clang-diagnostic-user-defined-literals",
|
||||
"clang-diagnostic-non-pod-varargs",
|
||||
"clang-diagnostic-non-pod-varargs",
|
||||
"clang-diagnostic-non-pod-varargs"
|
||||
]
|
||||
}
|
1
Kernel/.vscode/tasks.json
vendored
Symbolic link
1
Kernel/.vscode/tasks.json
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../.vscode/tasks.json
|
@ -1,10 +0,0 @@
|
||||
#include <types.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <cpu.hpp>
|
||||
|
||||
EXTERNC void arm64Entry(uint64_t dtb_ptr32, uint64_t x1, uint64_t x2, uint64_t x3)
|
||||
{
|
||||
trace("Hello, World!");
|
||||
CPU::Halt(true);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
#include <syscalls.hpp>
|
||||
|
||||
#include <cpu.hpp>
|
||||
|
||||
extern "C" __attribute__((naked, used, no_stack_protector)) void SystemCallHandlerStub()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
extern "C" uint64_t SystemCallsHandler(SyscallsFrame *regs);
|
||||
|
||||
void InitializeSystemCalls()
|
||||
{
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
#include <smp.hpp>
|
||||
|
||||
#include <interrupts.hpp>
|
||||
#include <memory.hpp>
|
||||
#include <cpu.hpp>
|
||||
|
||||
#include "../../../kernel.h"
|
||||
|
||||
volatile bool CPUEnabled = false;
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
static __attribute__((aligned(PAGE_SIZE))) CPUData CPUs[MAX_CPU] = {0};
|
||||
|
||||
CPUData *GetCPU(uint64_t id) { return &CPUs[id]; }
|
||||
|
||||
CPUData *GetCurrentCPU()
|
||||
{
|
||||
uint64_t ret = 0;
|
||||
|
||||
if (!CPUs[ret].IsActive)
|
||||
{
|
||||
error("CPU %d is not active!", ret);
|
||||
return &CPUs[0];
|
||||
}
|
||||
|
||||
if (CPUs[ret].Checksum != CPU_DATA_CHECKSUM)
|
||||
{
|
||||
error("CPU %d data is corrupted!", ret);
|
||||
return &CPUs[0];
|
||||
}
|
||||
return &CPUs[ret];
|
||||
}
|
||||
|
||||
namespace SMP
|
||||
{
|
||||
void Initialize(void *madt)
|
||||
{
|
||||
fixme("SMP::Initialize() is not implemented!");
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80000;
|
||||
_kernel_start = .;
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.text.boot))
|
||||
*(.text .text.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_text_end = .;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data .data.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_data_end = .;
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata .rodata.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_rodata_end = .;
|
||||
|
||||
.bss :
|
||||
{
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_end = .;
|
||||
_bss_size = _kernel_end - _kernel_rodata_end;
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.comment*)
|
||||
*(.note*)
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
// .section ".text.boot"
|
||||
//
|
||||
// .global _start
|
||||
// .org 0x80000
|
||||
// _start:
|
||||
// ldr x5, =_start
|
||||
// mov sp, x5
|
||||
// ldr x5, =_kernel_rodata_end
|
||||
// ldr w6, =_bss_size
|
||||
// 1: cbz w6, 2f
|
||||
// str xzr, [x5], #8
|
||||
// sub w6, w6, #1
|
||||
// cbnz w6, 1b
|
||||
// 2: bl arm64Entry
|
||||
// Halt:
|
||||
// wfe
|
||||
// b Halt
|
@ -1,17 +0,0 @@
|
||||
.section ".text.boot"
|
||||
|
||||
.global _start
|
||||
.org 0x80000
|
||||
_start:
|
||||
ldr x5, =_start
|
||||
mov sp, x5
|
||||
ldr x5, =_kernel_rodata_end
|
||||
ldr w6, =_bss_size
|
||||
1: cbz w6, 2f
|
||||
str xzr, [x5], #8
|
||||
sub w6, w6, #1
|
||||
cbnz w6, 1b
|
||||
2: bl arm64Entry
|
||||
Halt:
|
||||
wfe
|
||||
b Halt
|
@ -1 +0,0 @@
|
||||
// C++ constructor/destructor stuff
|
@ -1 +0,0 @@
|
||||
// C++ constructor/destructor stuff
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user