mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 23:44:31 +00:00
Compare commits
11 Commits
958a3ed263
...
15a9a21448
Author | SHA1 | Date | |
---|---|---|---|
15a9a21448 | |||
d4c4016c7c | |||
19055409cd | |||
839dfb74b2 | |||
0bfb45020f | |||
9e746c52bc | |||
3740b65263 | |||
77e51a6f2c | |||
42b8b6895f | |||
9da2650486 | |||
e01f488768 |
291
.github/workflows/makefile.yml
vendored
291
.github/workflows/makefile.yml
vendored
@ -7,6 +7,31 @@ on:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
deploydoc:
|
||||
name: Deploy Documentation to GitHub Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Doxygen
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt --no-install-recommends -y install doxygen make
|
||||
|
||||
- name: Generate Documentation
|
||||
run: make doxygen
|
||||
|
||||
- name: Copy GitHub Pages Website
|
||||
run: cp -r tools/website/* doxygen-doc/
|
||||
|
||||
- name: Deploy documentation
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
folder: doxygen-doc
|
||||
|
||||
buildcompiler:
|
||||
name: Build Cross-Compiler & Toolchain
|
||||
runs-on: ubuntu-latest
|
||||
@ -22,53 +47,21 @@ jobs:
|
||||
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'
|
||||
- name: Prepare Environment for Dev Container
|
||||
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
|
||||
sudo mkdir -p /tmp/.X11-unix
|
||||
sudo mkdir -p /run/user/1000/pulse
|
||||
sudo touch /tmp/.Xauthority
|
||||
sudo touch /run/user/1000/pulse/native
|
||||
echo "XAUTHORITY=/tmp/.Xauthority" >> $GITHUB_ENV
|
||||
|
||||
- name: Check automake
|
||||
- name: Run make ci-setup in dev container
|
||||
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
|
||||
uses: devcontainers/ci@v0.3
|
||||
with:
|
||||
push: never
|
||||
runCmd: |
|
||||
/usr/bin/make ci-setup
|
||||
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
@ -145,34 +138,8 @@ jobs:
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
deploydoc:
|
||||
name: Deploy Documentation to GitHub Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Update System
|
||||
run: sudo apt update
|
||||
|
||||
- name: Install Doxygen
|
||||
run: sudo apt --no-install-recommends -y install doxygen make
|
||||
|
||||
- name: Generate Documentation
|
||||
run: make doxygen
|
||||
|
||||
- name: Copy GitHub Pages Website
|
||||
run: cp -r tools/website/* doxygen-doc/
|
||||
|
||||
- name: Deploy documentation
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
folder: doxygen-doc
|
||||
|
||||
compile_amd64:
|
||||
name: Build amd64
|
||||
compile:
|
||||
name: Build OS
|
||||
runs-on: ubuntu-latest
|
||||
needs: [buildcompiler]
|
||||
steps:
|
||||
@ -180,13 +147,6 @@ jobs:
|
||||
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
|
||||
@ -194,167 +154,20 @@ jobs:
|
||||
path: tools/cross
|
||||
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
|
||||
|
||||
- name: Configure config.mk
|
||||
run: sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
|
||||
- name: Compile Debug and Release ISO
|
||||
- name: Prepare Environment for Dev Container
|
||||
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
|
||||
sudo mkdir -p /tmp/.X11-unix
|
||||
sudo touch /tmp/.Xauthority
|
||||
sudo touch /run/user/1000/pulse/native
|
||||
echo "XAUTHORITY=/tmp/.Xauthority" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Artifact (Fennix-debug.iso)
|
||||
- name: Run make ci-build in dev container
|
||||
uses: devcontainers/ci@v0.3
|
||||
with:
|
||||
runCmd: /usr/bin/make ci-build
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-amd64-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-amd64-release
|
||||
path: Fennix-release.iso
|
||||
|
||||
compile_i386:
|
||||
name: Build i386
|
||||
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 = 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/' ./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-i386-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Fennix-i386-release
|
||||
path: Fennix-release.iso
|
||||
|
||||
compile_aarch64:
|
||||
name: Build aarch64
|
||||
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 = 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/' ./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-aarch64-debug
|
||||
path: Fennix-debug.iso
|
||||
|
||||
- name: Upload Artifact (Fennix-release.iso)
|
||||
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
|
||||
name: Fennix
|
||||
path: artifacts/
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
iso_tmp_data
|
||||
artifacts
|
||||
initrd_tmp_data
|
||||
initrd/usr/include/*
|
||||
!initrd/usr/include/.gitkeep
|
||||
|
@ -22,6 +22,27 @@
|
||||
|
||||
#define scarg __UINTPTR_TYPE__
|
||||
|
||||
#ifdef __arm__
|
||||
#ifdef __thumb__
|
||||
#define __thumb_r7
|
||||
#define __arm_call(...)
|
||||
#warning "arm thumb code not implemented"
|
||||
#else /* __thumb__ */
|
||||
#define __thumb_r7 __asm__("r7")
|
||||
#define __arm_call(...) \
|
||||
__asm__ __volatile__("svc 0" \
|
||||
: "=r"(r0) \
|
||||
: __VA_ARGS__ \
|
||||
: "memory")
|
||||
#endif /* __thumb__ */
|
||||
|
||||
#ifdef __thumb2__
|
||||
#define __r7_operand "rI"(r7)
|
||||
#else /* __thumb2__ */
|
||||
#define __r7_operand "r"(r7)
|
||||
#endif /* __thumb2__ */
|
||||
#endif /* __arm__ */
|
||||
|
||||
/**
|
||||
* @brief Syscall wrapper with 0 arguments
|
||||
*
|
||||
@ -39,12 +60,17 @@ static inline scarg syscall0(scarg syscall)
|
||||
: "a"(syscall)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0");
|
||||
__arm_call(__r7_operand);
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0");
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0");
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(x0)
|
||||
: "r"(x8)
|
||||
@ -73,12 +99,17 @@ static inline scarg syscall1(scarg syscall, scarg arg1)
|
||||
: "a"(syscall), "D"(arg1)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
__arm_call(__r7_operand, "0"(r0));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0)
|
||||
@ -108,13 +139,19 @@ static inline scarg syscall2(scarg syscall, scarg arg1, scarg arg2)
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1)
|
||||
@ -145,14 +182,21 @@ static inline scarg syscall3(scarg syscall, scarg arg1, scarg arg2, scarg arg3)
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2)
|
||||
@ -185,15 +229,23 @@ static inline scarg syscall4(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3)
|
||||
@ -228,16 +280,25 @@ static inline scarg syscall5(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
register scarg r4 __asm__("r4") = arg5;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register long x4 __asm__("x4") = arg5;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
register scarg x4 __asm__("x4") = arg5;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4)
|
||||
@ -274,17 +335,27 @@ static inline scarg syscall6(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8), "r"(r9)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5), "g"(arg6)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
register scarg r4 __asm__("r4") = arg5;
|
||||
register scarg r5 __asm__("r5") = arg6;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register long x4 __asm__("x4") = arg5;
|
||||
register long x5 __asm__("x5") = arg6;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
register scarg x4 __asm__("x4") = arg5;
|
||||
register scarg x5 __asm__("x5") = arg6;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5)
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <cpu.hpp>
|
||||
#include <pci.hpp>
|
||||
@ -818,3 +820,5 @@ namespace Driver::AC97
|
||||
Panic,
|
||||
Probe);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <cpu.hpp>
|
||||
#include <pci.hpp>
|
||||
@ -68,3 +70,5 @@ namespace Driver::AdvancedIntegratedPeripheral
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Drivers. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include "aip.hpp"
|
||||
|
||||
#include <driver.hpp>
|
||||
@ -222,3 +224,5 @@ namespace Driver::AdvancedIntegratedPeripheral
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <interface/aip.h>
|
||||
#include <cpu.hpp>
|
||||
@ -258,3 +260,5 @@ namespace Driver::AdvancedIntegratedPeripheral
|
||||
Panic,
|
||||
Probe);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Drivers. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include "aip.hpp"
|
||||
|
||||
#include <driver.hpp>
|
||||
@ -261,3 +263,5 @@ namespace Driver::AdvancedIntegratedPeripheral
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Drivers. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <io.h>
|
||||
|
||||
@ -645,3 +647,5 @@ namespace Driver::AdvancedIntegratedPeripheral
|
||||
// ExPrint(keyBuf);
|
||||
// }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <cpu.hpp>
|
||||
#include <pci.hpp>
|
||||
@ -176,6 +178,11 @@ namespace Driver::VMwareToolBox
|
||||
|
||||
#elif defined(__i386__)
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
|
||||
#define VM_PORT(cmd, in_ebx, isi, idi, \
|
||||
flags, magic, \
|
||||
ax, bx, cx, dx, si, di)
|
||||
@ -915,3 +922,5 @@ namespace Driver::VMwareToolBox
|
||||
Panic,
|
||||
Probe);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <cpu.hpp>
|
||||
#include <pci.hpp>
|
||||
@ -483,3 +485,5 @@ namespace Driver::E1000
|
||||
Panic,
|
||||
Probe);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
|
||||
#include <driver.hpp>
|
||||
#include <cpu.hpp>
|
||||
#include <pci.hpp>
|
||||
@ -292,3 +294,5 @@ namespace Driver::RTL8139
|
||||
Panic,
|
||||
Probe);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -488,29 +488,120 @@ namespace CPU
|
||||
|
||||
struct FXState
|
||||
{
|
||||
/** @brief FPU control word */
|
||||
uint16_t fcw;
|
||||
/** @brief FPU status word */
|
||||
uint16_t fsw;
|
||||
/** @brief FPU tag words */
|
||||
uint8_t ftw;
|
||||
/** @brief Reserved (zero) */
|
||||
uint8_t Reserved;
|
||||
/** @brief FPU opcode */
|
||||
uint16_t fop;
|
||||
/** @brief PFU instruction pointer */
|
||||
uint64_t rip;
|
||||
/** @brief FPU data pointer */
|
||||
uint64_t rdp;
|
||||
/** @brief SSE control register */
|
||||
uint32_t mxcsr;
|
||||
/** @brief SSE control register mask */
|
||||
uint32_t mxcsrmask;
|
||||
/** @brief FPU registers (last 6 bytes reserved) */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
/* #MF Exception Masks */
|
||||
uint16_t IM : 1; /** Invalid-Operation Exception Mask */
|
||||
uint16_t DM : 1; /** Denormalized-Operand Exception Mask */
|
||||
uint16_t ZM : 1; /** Zero-Divide Exception Mask */
|
||||
uint16_t OM : 1; /** Overflow Exception Mask */
|
||||
uint16_t UM : 1; /** Underflow Exception Mask */
|
||||
uint16_t PM : 1; /** Precision Exception Mask */
|
||||
uint16_t __reserved0 : 2; /** Reserved */
|
||||
|
||||
/**
|
||||
* 00 Single precision
|
||||
* 01 reserved
|
||||
* 10 Double precision
|
||||
* 11 Double-extended precision (default)
|
||||
*/
|
||||
uint16_t PC : 2; /** Precision Control */
|
||||
|
||||
/**
|
||||
* 00 Round to nearest (default)
|
||||
* 01 Round down
|
||||
* 10 Round up
|
||||
* 11 Round towards zero
|
||||
*/
|
||||
uint16_t RC : 2; /** Rounding Control */
|
||||
uint16_t Infinity : 1; /** Infinity Bit (80287 compatibility) */
|
||||
uint16_t Reserved2 : 3; /** Reserved */
|
||||
};
|
||||
uint16_t raw;
|
||||
} FCW; /** FPU Control Word */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t IE : 1; /** Invalid-Operation Exception */
|
||||
uint16_t DE : 1; /** Denormalized-Operand Exception */
|
||||
uint16_t ZE : 1; /** Zero-Divide Exception */
|
||||
uint16_t OE : 1; /** Overflow Exception */
|
||||
uint16_t UE : 1; /** Underflow Exception */
|
||||
uint16_t PE : 1; /** Precision Exception */
|
||||
uint16_t SF : 1; /** Stack Fault */
|
||||
uint16_t ES : 1; /** Exception Status */
|
||||
uint16_t C0 : 1; /** Condition Code 0 */
|
||||
uint16_t C1 : 1; /** Condition Code 1 */
|
||||
uint16_t C2 : 1; /** Condition Code 2 */
|
||||
uint16_t TOP : 3; /** Top of Stack Pointer */
|
||||
uint16_t C3 : 1; /** Condition Code 3 */
|
||||
uint16_t B : 1; /** x87 Floating-Point Unit Busy */
|
||||
};
|
||||
uint16_t raw;
|
||||
} FSW; /** FPU Status Word */
|
||||
|
||||
/**
|
||||
* Tag Values
|
||||
*
|
||||
* 00 = Valid
|
||||
* 01 = Zero
|
||||
* 10 = Special
|
||||
* 11 = Empty
|
||||
*/
|
||||
uint8_t FTW; /** x87 Tag Word */
|
||||
|
||||
uint8_t __reserved0;
|
||||
uint16_t FOP; /** FPU Op Code */
|
||||
uint32_t EIP; /** PFU Instruction Pointer */
|
||||
uint32_t EDP; /** PFU Data Pointer */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
/* Exception Flags */
|
||||
uint32_t IE : 1; /** Invalid-Operation Exception */
|
||||
uint32_t DE : 1; /** Denormalized-Operand Exception */
|
||||
uint32_t ZE : 1; /** Zero-Divide Exception */
|
||||
uint32_t OE : 1; /** Overflow Exception */
|
||||
uint32_t UE : 1; /** Underflow Exception */
|
||||
uint32_t PE : 1; /** Precision Exception */
|
||||
uint32_t DAZ : 1; /** Denormals Are Zeros */
|
||||
|
||||
/* Exception Masks */
|
||||
uint32_t IM : 1; /** Invalid-Operation Mask */
|
||||
uint32_t DM : 1; /** Denormalized-Operand Mask */
|
||||
uint32_t ZM : 1; /** Zero-Divide Mask */
|
||||
uint32_t OM : 1; /** Overflow Mask */
|
||||
uint32_t UM : 1; /** Underflow Mask */
|
||||
uint32_t PM : 1; /** Precision Mask */
|
||||
|
||||
/**
|
||||
* 00 = round to nearest (default)
|
||||
* 01 = round down
|
||||
* 10 = round up
|
||||
* 11 = round toward zero
|
||||
*/
|
||||
uint32_t RC : 2; /** Floating-Point Rounding Control */
|
||||
uint32_t FZ : 1; /** Flush-to-Zero for Masked Underflow */
|
||||
uint32_t __reserved3 : 1;
|
||||
uint32_t MM : 1; /** Misaligned Exception Mask */
|
||||
uint32_t __reserved4 : 14;
|
||||
};
|
||||
uint32_t raw;
|
||||
} MXCSR; /** SSE Control Register */
|
||||
|
||||
uint32_t MXCSR_MASK; /** SSE Control Register Mask */
|
||||
|
||||
/** FPU registers (last 6 bytes reserved) */
|
||||
uint8_t st[8][16];
|
||||
/** @brief XMM registers */
|
||||
uint8_t xmm[16][16];
|
||||
} __packed;
|
||||
/** XMM registers */
|
||||
uint8_t xmm[8][16];
|
||||
} __packed __aligned(16);
|
||||
|
||||
/**
|
||||
* @brief CPUID
|
||||
|
@ -22,6 +22,27 @@
|
||||
|
||||
#define scarg __UINTPTR_TYPE__
|
||||
|
||||
#ifdef __arm__
|
||||
#ifdef __thumb__
|
||||
#define __thumb_r7
|
||||
#define __arm_call(...)
|
||||
#warning "arm thumb code not implemented"
|
||||
#else /* __thumb__ */
|
||||
#define __thumb_r7 __asm__("r7")
|
||||
#define __arm_call(...) \
|
||||
__asm__ __volatile__("svc 0" \
|
||||
: "=r"(r0) \
|
||||
: __VA_ARGS__ \
|
||||
: "memory")
|
||||
#endif /* __thumb__ */
|
||||
|
||||
#ifdef __thumb2__
|
||||
#define __r7_operand "rI"(r7)
|
||||
#else /* __thumb2__ */
|
||||
#define __r7_operand "r"(r7)
|
||||
#endif /* __thumb2__ */
|
||||
#endif /* __arm__ */
|
||||
|
||||
/**
|
||||
* @brief Syscall wrapper with 0 arguments
|
||||
*
|
||||
@ -39,12 +60,17 @@ static inline scarg syscall0(scarg syscall)
|
||||
: "a"(syscall)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0");
|
||||
__arm_call(__r7_operand);
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0");
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0");
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(x0)
|
||||
: "r"(x8)
|
||||
@ -73,12 +99,17 @@ static inline scarg syscall1(scarg syscall, scarg arg1)
|
||||
: "a"(syscall), "D"(arg1)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
__arm_call(__r7_operand, "0"(r0));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0)
|
||||
@ -108,13 +139,19 @@ static inline scarg syscall2(scarg syscall, scarg arg1, scarg arg2)
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1)
|
||||
@ -145,14 +182,21 @@ static inline scarg syscall3(scarg syscall, scarg arg1, scarg arg2, scarg arg3)
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2)
|
||||
@ -185,15 +229,23 @@ static inline scarg syscall4(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3)
|
||||
@ -228,16 +280,25 @@ static inline scarg syscall5(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
register scarg r4 __asm__("r4") = arg5;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register long x4 __asm__("x4") = arg5;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
register scarg x4 __asm__("x4") = arg5;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4)
|
||||
@ -274,17 +335,27 @@ static inline scarg syscall6(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8), "r"(r9)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5), "g"(arg6)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
register scarg r4 __asm__("r4") = arg5;
|
||||
register scarg r5 __asm__("r5") = arg6;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register long x4 __asm__("x4") = arg5;
|
||||
register long x5 __asm__("x5") = arg6;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
register scarg x4 __asm__("x4") = arg5;
|
||||
register scarg x5 __asm__("x5") = arg6;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5)
|
||||
|
86
Makefile
86
Makefile
@ -1,7 +1,7 @@
|
||||
|
||||
include config.mk
|
||||
|
||||
.PHONY: default tools clean
|
||||
.PHONY: default tools clean ci-build
|
||||
|
||||
# First rule
|
||||
default:
|
||||
@ -99,13 +99,13 @@ endif
|
||||
|
||||
# Install necessary packages, build cross-compiler etc...
|
||||
tools:
|
||||
make --quiet -C tools all
|
||||
$(MAKE) --quiet -C tools all
|
||||
|
||||
prepare:
|
||||
make --quiet -C Kernel prepare
|
||||
make --quiet -C Bootloader prepare
|
||||
make --quiet -C Drivers prepare
|
||||
make --quiet -C Userspace prepare
|
||||
$(MAKE) --quiet -C Kernel prepare
|
||||
$(MAKE) --quiet -C Bootloader prepare
|
||||
$(MAKE) --quiet -C Drivers prepare
|
||||
$(MAKE) --quiet -C Userspace prepare
|
||||
|
||||
setup:
|
||||
$(MAKE) prepare
|
||||
@ -114,32 +114,88 @@ setup:
|
||||
build: build_kernel build_bootloader build_userspace build_drivers build_image
|
||||
|
||||
dump:
|
||||
make --quiet -C Kernel dump
|
||||
$(MAKE) --quiet -C Kernel dump
|
||||
|
||||
rebuild: clean build
|
||||
|
||||
__ci-build-set-release:
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 0/' ./config.mk && cat config.mk | grep DEBUG
|
||||
|
||||
__ci-build-set-debug:
|
||||
sed -i 's/.*DEBUG = .*/DEBUG = 1/' ./config.mk && cat config.mk | grep DEBUG
|
||||
|
||||
ci-setup:
|
||||
$(MAKE) --quiet -C tools ci
|
||||
|
||||
ci-build:
|
||||
# amd64
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-amd64-debug.iso
|
||||
$(MAKE) clean
|
||||
$(MAKE) __ci-build-set-release
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-amd64-release.iso
|
||||
$(MAKE) clean
|
||||
# i386
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-i386-debug.iso
|
||||
$(MAKE) clean
|
||||
$(MAKE) __ci-build-set-release
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-i386-release.iso
|
||||
$(MAKE) clean
|
||||
# ARM
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = arm/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-arm-debug.iso
|
||||
$(MAKE) clean
|
||||
$(MAKE) __ci-build-set-release
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-arm-release.iso
|
||||
$(MAKE) clean
|
||||
# AArch64
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-aarch64-debug.iso
|
||||
$(MAKE) clean
|
||||
$(MAKE) __ci-build-set-release
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-aarch64-release.iso
|
||||
$(MAKE) clean
|
||||
# Restore original config
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
# Move all files to artifacts directory
|
||||
mkdir -p artifacts
|
||||
mv Fennix-*.iso artifacts/
|
||||
|
||||
ifeq ($(QUIET_BUILD), 1)
|
||||
MAKE_QUIET_FLAG = --quiet
|
||||
endif
|
||||
|
||||
build_kernel:
|
||||
ifeq ($(BUILD_KERNEL), 1)
|
||||
make -j$(shell nproc) $(MAKE_QUIET_FLAG) -C Kernel build
|
||||
$(MAKE) -j$(shell nproc) $(MAKE_QUIET_FLAG) -C Kernel build
|
||||
endif
|
||||
|
||||
build_bootloader:
|
||||
ifeq ($(BUILD_BOOTLOADER), 1)
|
||||
make $(MAKE_QUIET_FLAG) -C Bootloader build
|
||||
$(MAKE) $(MAKE_QUIET_FLAG) -C Bootloader build
|
||||
endif
|
||||
|
||||
build_drivers:
|
||||
ifeq ($(BUILD_DRIVERS), 1)
|
||||
make $(MAKE_QUIET_FLAG) -C Drivers build
|
||||
$(MAKE) $(MAKE_QUIET_FLAG) -C Drivers build
|
||||
endif
|
||||
|
||||
build_userspace:
|
||||
ifeq ($(BUILD_USERSPACE), 1)
|
||||
make $(MAKE_QUIET_FLAG) -C Userspace build
|
||||
$(MAKE) $(MAKE_QUIET_FLAG) -C Userspace build
|
||||
endif
|
||||
|
||||
build_image:
|
||||
@ -262,7 +318,7 @@ run: build qemu
|
||||
clean: clean_logs
|
||||
rm -rf doxygen-doc iso_tmp_data initrd_tmp_data
|
||||
rm -f initrd.tar $(OSNAME).iso $(OSNAME).img
|
||||
make -C Kernel clean
|
||||
make -C Userspace clean
|
||||
make -C Drivers clean
|
||||
make -C Bootloader clean
|
||||
$(MAKE) -C Kernel clean
|
||||
$(MAKE) -C Userspace clean
|
||||
$(MAKE) -C Drivers clean
|
||||
$(MAKE) -C Bootloader clean
|
||||
|
@ -22,6 +22,27 @@
|
||||
|
||||
#define scarg __UINTPTR_TYPE__
|
||||
|
||||
#ifdef __arm__
|
||||
#ifdef __thumb__
|
||||
#define __thumb_r7
|
||||
#define __arm_call(...)
|
||||
#warning "arm thumb code not implemented"
|
||||
#else /* __thumb__ */
|
||||
#define __thumb_r7 __asm__("r7")
|
||||
#define __arm_call(...) \
|
||||
__asm__ __volatile__("svc 0" \
|
||||
: "=r"(r0) \
|
||||
: __VA_ARGS__ \
|
||||
: "memory")
|
||||
#endif /* __thumb__ */
|
||||
|
||||
#ifdef __thumb2__
|
||||
#define __r7_operand "rI"(r7)
|
||||
#else /* __thumb2__ */
|
||||
#define __r7_operand "r"(r7)
|
||||
#endif /* __thumb2__ */
|
||||
#endif /* __arm__ */
|
||||
|
||||
/**
|
||||
* @brief Syscall wrapper with 0 arguments
|
||||
*
|
||||
@ -39,12 +60,17 @@ static inline scarg syscall0(scarg syscall)
|
||||
: "a"(syscall)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0");
|
||||
__arm_call(__r7_operand);
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0");
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0");
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(x0)
|
||||
: "r"(x8)
|
||||
@ -73,12 +99,17 @@ static inline scarg syscall1(scarg syscall, scarg arg1)
|
||||
: "a"(syscall), "D"(arg1)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
__arm_call(__r7_operand, "0"(r0));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0)
|
||||
@ -108,13 +139,19 @@ static inline scarg syscall2(scarg syscall, scarg arg1, scarg arg2)
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1)
|
||||
@ -145,14 +182,21 @@ static inline scarg syscall3(scarg syscall, scarg arg1, scarg arg2, scarg arg3)
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2)
|
||||
@ -185,15 +229,23 @@ static inline scarg syscall4(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3)
|
||||
@ -228,16 +280,25 @@ static inline scarg syscall5(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
register scarg r4 __asm__("r4") = arg5;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register long x4 __asm__("x4") = arg5;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
register scarg x4 __asm__("x4") = arg5;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4)
|
||||
@ -274,17 +335,27 @@ static inline scarg syscall6(scarg syscall, scarg arg1, scarg arg2, scarg arg3,
|
||||
: "a"(syscall), "D"(arg1), "S"(arg2), "d"(arg3), "r"(r10), "r"(r8), "r"(r9)
|
||||
: "rcx", "r11", "memory");
|
||||
#elif defined(__i386__)
|
||||
#warning "i386 syscall wrapper not implemented"
|
||||
__asm__ __volatile__("int $0x30"
|
||||
: "=a"(ret)
|
||||
: "a"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5), "g"(arg6)
|
||||
: "memory");
|
||||
#elif defined(__arm__)
|
||||
#warning "arm syscall wrapper not implemented"
|
||||
register scarg r7 __thumb_r7 = syscall;
|
||||
register scarg r0 __asm__("r0") = arg1;
|
||||
register scarg r1 __asm__("r1") = arg2;
|
||||
register scarg r2 __asm__("r2") = arg3;
|
||||
register scarg r3 __asm__("r3") = arg4;
|
||||
register scarg r4 __asm__("r4") = arg5;
|
||||
register scarg r5 __asm__("r5") = arg6;
|
||||
__arm_call(__r7_operand, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
|
||||
#elif defined(__aarch64__)
|
||||
register long x8 __asm__("x8") = syscall;
|
||||
register long x0 __asm__("x0") = arg1;
|
||||
register long x1 __asm__("x1") = arg2;
|
||||
register long x2 __asm__("x2") = arg3;
|
||||
register long x3 __asm__("x3") = arg4;
|
||||
register long x4 __asm__("x4") = arg5;
|
||||
register long x5 __asm__("x5") = arg6;
|
||||
register scarg x8 __asm__("x8") = syscall;
|
||||
register scarg x0 __asm__("x0") = arg1;
|
||||
register scarg x1 __asm__("x1") = arg2;
|
||||
register scarg x2 __asm__("x2") = arg3;
|
||||
register scarg x3 __asm__("x3") = arg4;
|
||||
register scarg x4 __asm__("x4") = arg5;
|
||||
register scarg x5 __asm__("x5") = arg6;
|
||||
__asm__ __volatile__("svc 0"
|
||||
: "=r"(ret)
|
||||
: "r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5)
|
||||
|
@ -24,7 +24,7 @@ build: $(DYNAMIC_NAME) $(STATIC_NAME)
|
||||
|
||||
$(DYNAMIC_NAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) -nostdlib -shared -fPIC -fPIE -e _start -Wl,-soname,$(DYNAMIC_NAME) $(SYSROOT) $(OBJ) -o $(DYNAMIC_NAME)
|
||||
$(CC) -nostdlib -shared -fPIC -fPIE -e _start -Wl,-soname,$(DYNAMIC_NAME) $(SYSROOT) $(OBJ) -o $(DYNAMIC_NAME) -lgcc
|
||||
cp $(DYNAMIC_NAME) $(OUTPUT_DIR)$(DYNAMIC_NAME)
|
||||
|
||||
$(STATIC_NAME): $(OBJ)
|
||||
|
@ -1,314 +0,0 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library 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 C Library 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 C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
float __addsf3(float a, float b);
|
||||
double __adddf3(double a, double b);
|
||||
long double __addtf3(long double a, long double b);
|
||||
long double __addxf3(long double a, long double b);
|
||||
float __subsf3(float a, float b);
|
||||
double __subdf3(double a, double b);
|
||||
long double __subtf3(long double a, long double b);
|
||||
long double __subxf3(long double a, long double b);
|
||||
float __mulsf3(float a, float b);
|
||||
double __muldf3(double a, double b);
|
||||
long double __multf3(long double a, long double b);
|
||||
long double __mulxf3(long double a, long double b);
|
||||
float __divsf3(float a, float b);
|
||||
double __divdf3(double a, double b);
|
||||
long double __divtf3(long double a, long double b);
|
||||
long double __divxf3(long double a, long double b);
|
||||
float __negsf2(float a);
|
||||
double __negdf2(double a);
|
||||
long double __negtf2(long double a);
|
||||
long double __negxf2(long double a);
|
||||
double __extendsfdf2(float a);
|
||||
long double __extendsftf2(float a);
|
||||
long double __extendsfxf2(float a);
|
||||
long double __extenddftf2(double a);
|
||||
long double __extenddfxf2(double a);
|
||||
double __truncxfdf2(long double a);
|
||||
double __trunctfdf2(long double a) { return (double)a; }
|
||||
float __truncxfsf2(long double a);
|
||||
float __trunctfsf2(long double a);
|
||||
float __truncdfsf2(double a);
|
||||
int __fixsfsi(float a);
|
||||
int __fixdfsi(double a);
|
||||
int __fixtfsi(long double a);
|
||||
int __fixxfsi(long double a);
|
||||
long __fixsfdi(float a);
|
||||
long __fixdfdi(double a);
|
||||
long __fixtfdi(long double a);
|
||||
long __fixxfdi(long double a);
|
||||
long long __fixsfti(float a);
|
||||
long long __fixdfti(double a);
|
||||
long long __fixtfti(long double a);
|
||||
long long __fixxfti(long double a);
|
||||
unsigned int __fixunssfsi(float a);
|
||||
unsigned int __fixunsdfsi(double a);
|
||||
unsigned int __fixunstfsi(long double a);
|
||||
unsigned int __fixunsxfsi(long double a);
|
||||
unsigned long __fixunssfdi(float a);
|
||||
unsigned long __fixunsdfdi(double a);
|
||||
unsigned long __fixunstfdi(long double a);
|
||||
unsigned long __fixunsxfdi(long double a);
|
||||
unsigned long long __fixunssfti(float a);
|
||||
unsigned long long __fixunsdfti(double a);
|
||||
unsigned long long __fixunstfti(long double a);
|
||||
unsigned long long __fixunsxfti(long double a);
|
||||
float __floatsisf(int i);
|
||||
double __floatsidf(int i);
|
||||
long double __floatsitf(int i);
|
||||
long double __floatsixf(int i);
|
||||
float __floatdisf(long i);
|
||||
double __floatdidf(long i);
|
||||
long double __floatditf(long i);
|
||||
long double __floatdixf(long i);
|
||||
float __floattisf(long long i);
|
||||
double __floattidf(long long i);
|
||||
long double __floattitf(long long i);
|
||||
long double __floattixf(long long i);
|
||||
float __floatunsisf(unsigned int i);
|
||||
double __floatunsidf(unsigned int i);
|
||||
long double __floatunsitf(unsigned int i);
|
||||
long double __floatunsixf(unsigned int i);
|
||||
float __floatundisf(unsigned long i);
|
||||
double __floatundidf(unsigned long i);
|
||||
long double __floatunditf(unsigned long i);
|
||||
long double __floatundixf(unsigned long i);
|
||||
float __floatuntisf(unsigned long long i);
|
||||
double __floatuntidf(unsigned long long i);
|
||||
long double __floatuntitf(unsigned long long i);
|
||||
long double __floatuntixf(unsigned long long i);
|
||||
// void __fixsfbitint(UBILtype *r, int32_t rprec, float a);
|
||||
// void __fixdfbitint(UBILtype *r, int32_t rprec, double a);
|
||||
// void __fixxfbitint(UBILtype *r, int32_t rprec, __float80 a);
|
||||
// void __fixtfbitint(UBILtype *r, int32_t rprec, _Float128 a);
|
||||
// float __floatbitintsf(UBILtype *i, int32_t iprec);
|
||||
// double __floatbitintdf(UBILtype *i, int32_t iprec);
|
||||
// __float80 __floatbitintxf(UBILtype *i, int32_t iprec);
|
||||
// _Float128 __floatbitinttf(UBILtype *i, int32_t iprec);
|
||||
// _Float16 __floatbitinthf(UBILtype *i, int32_t iprec);
|
||||
// __bf16 __floatbitintbf(UBILtype *i, int32_t iprec);
|
||||
int __cmpsf2(float a, float b);
|
||||
int __cmpdf2(double a, double b);
|
||||
int __cmptf2(long double a, long double b);
|
||||
int __unordsf2(float a, float b);
|
||||
int __unorddf2(double a, double b);
|
||||
int __unordtf2(long double a, long double b);
|
||||
int __eqsf2(float a, float b);
|
||||
int __eqdf2(double a, double b);
|
||||
int __eqtf2(long double a, long double b);
|
||||
int __nesf2(float a, float b);
|
||||
int __nedf2(double a, double b);
|
||||
int __netf2(long double a, long double b);
|
||||
int __gesf2(float a, float b);
|
||||
int __gedf2(double a, double b);
|
||||
int __getf2(long double a, long double b);
|
||||
int __ltsf2(float a, float b);
|
||||
int __ltdf2(double a, double b);
|
||||
int __lttf2(long double a, long double b) { return a < b; }
|
||||
int __lesf2(float a, float b);
|
||||
int __ledf2(double a, double b);
|
||||
int __letf2(long double a, long double b) { return a > b; }
|
||||
int __gtsf2(float a, float b);
|
||||
int __gtdf2(double a, double b);
|
||||
int __gttf2(long double a, long double b) { return a > b; }
|
||||
float __powisf2(float a, int b);
|
||||
double __powidf2(double a, int b);
|
||||
long double __powitf2(long double a, int b);
|
||||
long double __powixf2(long double a, int b);
|
||||
// complex float __mulsc3(float a, float b, float c, float d);
|
||||
// complex double __muldc3(double a, double b, double c, double d);
|
||||
// complex long double __multc3(long double a, long double b, long double c, long double d);
|
||||
// complex long double __mulxc3(long double a, long double b, long double c, long double d);
|
||||
// complex float __divsc3(float a, float b, float c, float d);
|
||||
// complex double __divdc3(double a, double b, double c, double d);
|
||||
// complex long double __divtc3(long double a, long double b, long double c, long double d);
|
||||
// complex long double __divxc3(long double a, long double b, long double c, long double d);
|
||||
|
||||
int __aeabi_dcmple(long double a, long double b)
|
||||
{
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
long long __aeabi_d2lz(double a)
|
||||
{
|
||||
return (long long)a;
|
||||
}
|
||||
|
||||
int __aeabi_dcmplt(long double a, long double b)
|
||||
{
|
||||
return a < b;
|
||||
}
|
||||
|
||||
typedef union
|
||||
{
|
||||
double d;
|
||||
struct
|
||||
{
|
||||
__UINT64_TYPE__ mantissa : 52;
|
||||
__UINT64_TYPE__ exponent : 11;
|
||||
__UINT64_TYPE__ sign : 1;
|
||||
} parts;
|
||||
} aeabi_double_t;
|
||||
|
||||
aeabi_double_t __aeabi_ddiv(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
aeabi_double_t result;
|
||||
result.d = a.d / b.d;
|
||||
return result;
|
||||
}
|
||||
|
||||
aeabi_double_t __aeabi_dmul(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
aeabi_double_t result;
|
||||
result.d = a.d * b.d;
|
||||
return result;
|
||||
}
|
||||
|
||||
aeabi_double_t __aeabi_dadd(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
aeabi_double_t result;
|
||||
result.d = a.d + b.d;
|
||||
return result;
|
||||
}
|
||||
|
||||
int __aeabi_dcmpgt(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
return a.d > b.d;
|
||||
}
|
||||
|
||||
int __aeabi_dcmpge(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
return a.d >= b.d;
|
||||
}
|
||||
|
||||
aeabi_double_t __aeabi_dsub(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
aeabi_double_t result;
|
||||
result.d = a.d - b.d;
|
||||
return result;
|
||||
}
|
||||
|
||||
aeabi_double_t __aeabi_i2d(int a)
|
||||
{
|
||||
aeabi_double_t result;
|
||||
result.d = (double)a;
|
||||
return result;
|
||||
}
|
||||
|
||||
aeabi_double_t __aeabi_l2d(long long a)
|
||||
{
|
||||
aeabi_double_t result;
|
||||
result.d = (double)a;
|
||||
return result;
|
||||
}
|
||||
|
||||
int __aeabi_dcmpeq(aeabi_double_t a, aeabi_double_t b)
|
||||
{
|
||||
return a.d == b.d;
|
||||
}
|
||||
|
||||
int __aeabi_d2iz(aeabi_double_t a)
|
||||
{
|
||||
return (int)a.d;
|
||||
}
|
||||
|
||||
struct ldivmod_result
|
||||
{
|
||||
long quot;
|
||||
long rem;
|
||||
};
|
||||
|
||||
struct ldivmod_result __aeabi_ldivmod(long numerator, long denominator)
|
||||
{
|
||||
struct ldivmod_result result;
|
||||
result.quot = numerator / denominator;
|
||||
result.rem = numerator % denominator;
|
||||
return result;
|
||||
}
|
||||
|
||||
signed __aeabi_idiv(signed numerator, signed denominator)
|
||||
{
|
||||
return numerator / denominator;
|
||||
}
|
||||
|
||||
signed __aeabi_idivmod(signed numerator, signed denominator)
|
||||
{
|
||||
signed quotient = numerator / denominator;
|
||||
signed remainder = numerator % denominator;
|
||||
return (quotient << 16) | remainder;
|
||||
}
|
||||
|
||||
unsigned __aeabi_uidiv(unsigned numerator, unsigned denominator)
|
||||
{
|
||||
return numerator / denominator;
|
||||
}
|
||||
|
||||
unsigned __aeabi_uidivmod(unsigned numerator, unsigned denominator)
|
||||
{
|
||||
unsigned quotient = numerator / denominator;
|
||||
unsigned remainder = numerator % denominator;
|
||||
return (quotient << 16) | remainder;
|
||||
}
|
||||
|
||||
__UINT64_TYPE__ __udivmoddi4(__UINT64_TYPE__ numerator, __UINT64_TYPE__ denominator, __UINT64_TYPE__ *remainder)
|
||||
{
|
||||
__UINT64_TYPE__ quotient = 0;
|
||||
__UINT64_TYPE__ bit = 1;
|
||||
|
||||
if (denominator == 0)
|
||||
{
|
||||
*remainder = numerator;
|
||||
return ~0ULL;
|
||||
}
|
||||
|
||||
while (denominator < numerator && (denominator & (1ULL << 63)) == 0)
|
||||
{
|
||||
denominator <<= 1;
|
||||
bit <<= 1;
|
||||
}
|
||||
|
||||
while (bit)
|
||||
{
|
||||
if (numerator >= denominator)
|
||||
{
|
||||
numerator -= denominator;
|
||||
quotient |= bit;
|
||||
}
|
||||
denominator >>= 1;
|
||||
bit >>= 1;
|
||||
}
|
||||
|
||||
if (remainder)
|
||||
*remainder = numerator;
|
||||
|
||||
return quotient;
|
||||
}
|
||||
|
||||
struct udivmod_result
|
||||
{
|
||||
__UINT64_TYPE__ quot;
|
||||
__UINT64_TYPE__ rem;
|
||||
};
|
||||
|
||||
struct udivmod_result __aeabi_uldivmod(__UINT64_TYPE__ numerator, __UINT64_TYPE__ denominator)
|
||||
{
|
||||
struct udivmod_result result;
|
||||
result.quot = __udivmoddi4(numerator, denominator, &result.rem);
|
||||
return result;
|
||||
}
|
@ -22,9 +22,11 @@
|
||||
|
||||
export int ioctl(int fd, unsigned long op, ...)
|
||||
{
|
||||
void *arg;
|
||||
va_list args;
|
||||
va_start(args, op);
|
||||
int ret = call_ioctl(fd, op, args);
|
||||
arg = va_arg(args, void *);
|
||||
va_end(args);
|
||||
int ret = call_ioctl(fd, op, arg);
|
||||
return __check_errno(ret, -1);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ default:
|
||||
$(error Please specify a target)
|
||||
|
||||
all: do_tools do_limine __clone_qemu __clone_all_no_qemu do_binutils do_gcc do_qemu
|
||||
ci: do_tools do_limine __clone_all_no_qemu do_binutils do_gcc
|
||||
|
||||
clean:
|
||||
rm -f rep ep
|
||||
@ -147,8 +148,8 @@ __do_binutils:
|
||||
--disable-tls \
|
||||
--disable-pie \
|
||||
&& \
|
||||
make --quiet all -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
$(MAKE) --quiet all -j$(shell nproc) && \
|
||||
$(MAKE) --quiet install
|
||||
|
||||
__do_gcc:
|
||||
mkdir -p $(GCC_CLONE_PATH)/__build
|
||||
@ -166,10 +167,10 @@ __do_gcc:
|
||||
--disable-tls \
|
||||
--disable-pie \
|
||||
&& \
|
||||
make --quiet all-gcc -j$(shell nproc) && \
|
||||
make --quiet all-target-libgcc -j$(shell nproc) && \
|
||||
make --quiet install-gcc -j$(shell nproc) && \
|
||||
make --quiet install-target-libgcc -j$(shell nproc)
|
||||
$(MAKE) --quiet all-gcc -j$(shell nproc) && \
|
||||
$(MAKE) --quiet all-target-libgcc -j$(shell nproc) && \
|
||||
$(MAKE) --quiet install-gcc -j$(shell nproc) && \
|
||||
$(MAKE) --quiet install-target-libgcc -j$(shell nproc)
|
||||
|
||||
do_binutils:
|
||||
$(MAKE) __do_binutils BUILD_TARGET="x86_64-fennix"
|
||||
@ -196,5 +197,5 @@ do_qemu:
|
||||
--disable-vnc \
|
||||
--disable-opengl \
|
||||
&& \
|
||||
make --quiet -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
$(MAKE) --quiet -j$(shell nproc) && \
|
||||
$(MAKE) --quiet install
|
||||
|
Loading…
x
Reference in New Issue
Block a user