Compare commits

...

109 Commits
libc ... master

Author SHA1 Message Date
Ehmry - c6f3dfc3ec Add some ANSI C procedures to base-common
This is for the convenience of language runtimes.
2020-02-15 16:02:30 +01:00
Ehmry - 11ff9a1dc5 Add base-hw Tup rules 2020-02-13 12:13:16 +01:00
Ehmry - e0b84beafa Tup: LLVM adjustments 2020-02-13 12:13:16 +01:00
Ehmry - da0c9da996 Minor code adjustments for LLVM 2020-02-11 13:47:26 +01:00
Ehmry - fa5b9a9002 Tup: create ld.lib.so libraries when in a Nix build 2020-01-29 21:35:18 +01:00
Ehmry - 71e1a286e5 Nix: update flake 2020-01-29 18:45:57 +01:00
Ehmry - 196c340aa9 Tup: build more of gems 2020-01-29 16:26:29 +01:00
Ehmry - 200d82b4f5 core: simplify unprefixed LOG service
The special "platform" label is now "unlabeled".
2020-01-29 12:29:36 +01:00
Ehmry - 5d4e72c874 core: add platform logging service
If the root child requests a LOG service with the label "platform" then
return a LOG session that logs messages directly to kernel. This is to
allow a remote test controller to recognize messages produced by an
privileged local test harness.
2020-01-22 17:26:28 +01:00
Norman Feske 7c4568fb5a core: avoid use of C array as buffer in Log_root 2020-01-22 17:10:03 +01:00
Ehmry - b20ca5f254 Revert "Core: exit with child exit value"
Not actually useful, and causes a null deference on NOVA.
2020-01-22 17:10:03 +01:00
Ehmry - 4287419392 Add Nix flake for dev-shell 2020-01-21 13:36:05 +01:00
Ehmry - 42f93ce3da Move Nix expressions to genodepkgs 2020-01-17 17:17:34 +01:00
Ehmry - 59caa85840 Tup: mv ld-lova.lib.so from out/bin to out/lib 2020-01-17 17:17:21 +01:00
Ehmry - f902a21213 Remove NOVA submodule 2020-01-17 17:17:21 +01:00
Ehmry - ee7773567a Nix apps moved to genodepkgs 2020-01-17 17:17:21 +01:00
Ehmry - a1e84f0485 Convert README to Markdown 2020-01-17 13:54:46 +01:00
Ehmry - 9e1e1186dc Synchronize NOVA revision with genodelabs/staging
Also make the "makeFlags" attr compatible with dev-shell.
2020-01-16 13:09:56 +01:00
Ehmry - 292bd3f579 Nix: Add nova-image app 2020-01-15 16:42:10 +01:00
Ehmry - 18c0e21996 Remove version information from builds
This causes spurious rebuilds.
2020-01-15 16:42:10 +01:00
Ehmry - e45088704c Restore base tests 2020-01-15 16:42:10 +01:00
Ehmry - 8c8606b375 Skip strip in nova-iso, explicit mkisofs 2020-01-14 15:12:53 +01:00
Ehmry - c812fdf629 Add component exit to tests
This makes it possible to detect successful test runs in a general way.
2020-01-14 11:43:38 +01:00
Ehmry - 6463f84741 Nix flake: use Github url for Nixpkgs 2020-01-14 11:43:38 +01:00
Ehmry - b8e25c82da Nix: source code filtering 2020-01-14 11:43:26 +01:00
Ehmry - 955e95272c Tup: fix base-nova build 2020-01-14 11:33:00 +01:00
Ehmry - 4235b5ab9b Nix app for building NOVA ISOs 2020-01-14 11:33:00 +01:00
Ehmry - 97e01182ca Nix: package NOVA kernel
This package moved here from Genodepkgs.
2020-01-14 11:31:23 +01:00
Ehmry - 90c4d291b4 Nix flake: build packages at Hydra 2020-01-08 14:50:49 +01:00
Ehmry - d8074773d1 Add missing os test Tupfiles 2020-01-08 09:55:01 +01:00
Ehmry - 3fb87d9ea0 base-linux: use pkg-config for libraries from base repo
Tup output groups must not be used across the repositories, they will come
up empty in Nix builds, and libraries will not be fully linked.
2020-01-07 18:19:02 +01:00
Ehmry - 969180525f Use patched binary toolchain from Genode Labs
- Fetch and patch GCC distribution
 - Pass Tup config as a file
 - Fold out and dev outputs
 - Remove shellHook code for compatibility with dev-shell
 - Tweak Tup Nix conditionals
 - Add Tupfile.ini
 - Remove custom setup-hook
2020-01-05 20:32:08 +01:00
Ehmry - bab7a572fe Refactor flake to expose x86_64-linux-x86_64-genode as x86_64-linux 2019-12-26 15:33:09 +05:30
Ehmry - 32f8b603cb Use cross-compile pairs in Flake 2019-12-02 16:30:36 +01:00
Ehmry - 94266a7bb0 Add hydraJobs 2019-11-29 15:50:13 +01:00
Ehmry - 24deef9495 Use #!/usr/bin/env ... shebangs 2019-11-28 15:07:24 +01:00
Ehmry - 54776f36eb VFS/pipe: add Tupfile 2019-11-28 14:04:14 +01:00
Ehmry - 3dc909bb24 nic_stress: do not bind reference to stack allocated parameter 2019-11-28 13:56:20 +01:00
Ehmry - d650a7b0e0 VFS/terminal: variable-sized object may not be initialized 2019-11-28 13:51:21 +01:00
Ehmry - 63c4974587 vfs server: fix File_system namespace warnings 2019-11-28 13:49:20 +01:00
Ehmry - 0797619d29 FetchGit Nixpkgs from nix-shell 2019-11-28 13:38:29 +01:00
Ehmry - 3d68a520cb Tag release 19.11
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEsIWqvdxEKaxX80hspyRgNBfs1rcFAl3fpmAACgkQpyRgNBfs
 1rcezQ//ZoYChufO6m2CByuPUbITql12b6oyOjmvcw16NW+Nsf2EodwMeCk/9yyM
 kWIxqOtXp1yFPGNf8ebEkTu5YXYMkHrUds4V6nQ4nQnyk7VnQmR3XTnqP8Sr27Hp
 fHi7Dddjxufexeyb6bwis04mK4PeFWXk/D6H4nh6ZeaR30g/GQ+Wt4N64a+HcQ1g
 kLMKuLlooOoq0L9q8IVLAtQoKNR1LP6x0FKGH8B6elwns8rXna2fRSlCB+W7qLwl
 K/pQadaIkwQNj8TEXuQxdGOR1GIrTbUz9ExS6U1yPXjqK06CunDZqsn+Cv5G7p+5
 ybMaViXwDGilZjhNLTjAbPhqhoOVu+yDB5gwzKiYt6/gTKP8N+VUpXKhGpzu/0ya
 wEt2b/43vmPm1NsBQQFU6vmjyW0W0iOl+a1tetv/qFo4mzQNesbVlu6t91b0EAjp
 C0JzZj9UHj/QkKgLIPkWMVWyz+VtODUeFhMLV6+86wzFmqSNhbaL0K/1LvX3AHZR
 5M/sjMRdtRL9U7Xv/LTn/Sgisk5wT2wfI9dpkAZALZjm22751mSTv9XhdLC/+XpA
 0F7cfSg36DphYsyPmSQ9+Q79rpU+bvuuTbqAsLdYcflMaW4bsIOd4j5Lk3adIPbN
 EE0uu+CD1GbqpKy+vLr+2EIlYpVNRTQKLklmkmhb+ZBuvUo00cU=
 =4dhl
 -----END PGP SIGNATURE-----

Merge tag '19.11'

Tag release 19.11
2019-11-28 13:21:13 +01:00
Ehmry - dd07e99ef6 Nix flake 2019-11-28 13:17:35 +01:00
Ehmry - af9b91e94c Make out and dev output paths more explicit 2019-11-20 20:25:16 +01:00
Ehmry - c6c7870a29 Fix bad include path in genode-base.pc
Add the top-level of include to the search path, not include/base.
2019-11-14 08:56:19 +01:00
Ehmry - 0b427b65aa Tup: build vfs_import 2019-11-10 13:41:49 +01:00
Ehmry - c2a543ed20 test/log: exit when complete 2019-11-10 13:40:40 +01:00
Ehmry - 1dc25293b8 Startup library header path must be overriden
The startup library might fail at runtime if local headers are included
rather than headers from somewhere else.
2019-10-28 15:25:18 +01:00
Ehmry - 3bf1cc09eb Move startup library to a Tup group 2019-10-28 11:32:29 +01:00
Ehmry - fa0c527732 Revert changes to closing of remote VFS handles 2019-10-28 11:32:29 +01:00
Ehmry - 29613c217b Tup: increase default optimization level to -O2 2019-10-28 11:32:29 +01:00
Ehmry - be04cfe899 Remove spec_includes replacements from pkg-config 2019-10-28 11:32:29 +01:00
Ehmry - f037044ec5 Move Tup rules local to this repo to "repos"
Make the top-level Tuprules.tup generic enough to be shared with other projects.
2019-10-28 11:32:29 +01:00
Ehmry - ecd0252b40 Publish core-nova.o in dev output 2019-10-28 11:32:29 +01:00
Ehmry - 4921168eda test/vfs_stress: annotate switch label fall-throughs
This test was written for speed, not correctness.

Fixes #3516
2019-10-28 11:32:29 +01:00
Ehmry - af52274972 Tup: add x86 drivers from os repo 2019-10-28 11:32:29 +01:00
Ehmry - f931ce2e19 Clang: address of packed member 2019-10-28 11:32:29 +01:00
Ehmry - ac8fb6702a Clang: do not use angle brackets for local includes 2019-10-28 11:32:29 +01:00
Ehmry - c67d81dc99 Tup: rename INCLUDES to CPPFLAGS 2019-10-28 11:32:29 +01:00
Ehmry - 3c8117e555 Clang: uninitialized 2019-10-28 11:32:29 +01:00
Ehmry - a7a0d3fe63 Refactor Tup, flatten output directories
Make no attempt to replicate the depot layout.
2019-10-28 11:32:29 +01:00
Ehmry - d348e96b84 base-common: copy all sparse ELF segments, including read-only 2019-10-28 11:32:29 +01:00
Ehmry - 5e87eee9b8 Genode::Capability_space: bypass static constructor where possible 2019-10-04 00:52:03 +02:00
Ehmry - 6e9f9ce3a8 Core includes untangling
Express convoluted include walks directly in code, do not hide them
in build scripts.
2019-10-04 00:52:02 +02:00
Ehmry - a83ffd4821 Multiple inheritance considered harmful 2019-10-04 00:52:02 +02:00
Ehmry - d07ff84f5c Tup: remove gems 2019-10-04 00:52:02 +02:00
Ehmry - 790b82a88d Tup: reduce output path variables 2019-10-04 00:52:02 +02:00
Ehmry - 65d7eff10f Tup: strip down configuration options
Autodetect x86, remove conditional NOVA builds.
2019-10-04 00:52:02 +02:00
Ehmry - 228bb4f189 Tup: Remove rules for generating Dhall manifest 2019-10-04 00:52:02 +02:00
Ehmry - d0865d365c Tup: do not take local includes from pkg-config 2019-10-04 00:52:02 +02:00
Ehmry - 2d7dff54ec Tup Reorder includes 2019-10-04 00:52:02 +02:00
Ehmry - 5587f0992b Tup: build static libraries into the dev output 2019-10-04 00:52:02 +02:00
Ehmry - 7d7659635c Suffix PKG_CONFIG_PATH with Nix inputs 2019-10-04 00:52:02 +02:00
Ehmry - 5682ad8e2b Add base tests 2019-10-04 00:52:02 +02:00
Ehmry - 7d384bc3e6 Adjust for Nix environment
Use a LIBUNWIND and LIBUNWIND_BAREMETAL, adjust shell.nix to use
"base" from the  new split repository builds.
2019-10-04 00:52:02 +02:00
Ehmry - 5a8686eaf9 Compatibility with LLVM libunwind 2019-10-04 00:52:02 +02:00
Ehmry - 4e94dd4265 Remove dead code 2019-10-04 00:52:02 +02:00
Ehmry - a7f4384b12 Clang: undeclared identifier __UINT64_C 2019-10-04 00:52:02 +02:00
Ehmry - 02365c171e Clang: no reference members to stack parameters 2019-10-04 00:47:17 +02:00
Ehmry - 075ab46d39 Clang: do not use angle brackets for local includes 2019-10-04 00:47:17 +02:00
Ehmry - d52f74c7c2 Clang: remove user of register keyword 2019-10-03 22:07:28 +02:00
Ehmry - 44f2c86a91 Clang: implement memset local to C++ runtime
Using Genode::memset with Clang results in recursion.
2019-10-03 22:06:34 +02:00
Ehmry - f42e7f1ff4 Clang: unused lamba capture 2019-10-03 22:06:34 +02:00
Ehmry - b50d28c3e4 Clang: align after template expansion
Cannot align template structs. Also, cannot cast void* to addr_t in
constexpr function.
2019-10-03 22:06:34 +02:00
Ehmry - d557624469 Clang: need a GCC diagnostic push for every pop 2019-10-03 22:06:34 +02:00
Ehmry - 221320af47 Clang: ignore mismatched struct/class tags 2019-10-03 22:06:34 +02:00
Ehmry - 2d60fc9f65 Clang: do not link with libgcc.a 2019-10-03 21:57:57 +02:00
Ehmry - c39507e591 Clang: tautological-undefined-compare 2019-10-03 21:57:57 +02:00
Ehmry - 77873c7808 Clang: address-of-packed-member 2019-10-03 21:57:57 +02:00
Ehmry - 855a9375ac Clang: tautological-constant-out-of-range-compare 2019-10-03 21:57:57 +02:00
Ehmry - f6553d2872 Clang: pragma GCC compatibility 2019-10-03 21:57:57 +02:00
Ehmry - 54480c1c3d GCC: Ignore Clang pragmas 2019-10-03 21:57:57 +02:00
Ehmry - 2509d95d98 Clang: uninitialized 2019-10-03 21:57:57 +02:00
Ehmry - e3c285ac0c Clang: maybe_unused 2019-10-03 21:57:57 +02:00
Ehmry - ca98ac2a0f Clang: no null references 2019-10-03 21:57:57 +02:00
Ehmry - a3241becf0 Clang: fix type overflow 2019-10-03 21:57:57 +02:00
Ehmry - 8979b7ffbb Clang: more C++ support includes 2019-10-03 21:57:57 +02:00
Ehmry - b7c63e38f7 Clang compatible syntax 2019-10-03 21:57:57 +02:00
Ehmry - 28eb528148 Clang: add [[maybe_unused]] to Lock::Guards 2019-10-03 21:57:57 +02:00
Ehmry - 24f4608ce7 Clang: avoid casting nullptr to reference 2019-10-03 21:57:57 +02:00
Ehmry - 852651b3f2 Move chunk types out of File_system namespace 2019-10-03 21:57:57 +02:00
Ehmry - 69ca5b133b Clang: disambiguate namespaces 2019-10-03 21:57:57 +02:00
Ehmry - e46099e224 Clang: disable some RPC tracing
Clang cannot handle this much template salad.
2019-10-03 21:57:57 +02:00
Ehmry - c770a8b9ec Clang: remove unused 2019-10-03 21:57:57 +02:00
Ehmry - 2dc6ea2042 Clang: do not redeclare __SIZE_TYPE__ 2019-10-03 21:25:37 +02:00
Ehmry - 30700e179a Clang: reconcile struct and class declarations 2019-10-03 21:25:37 +02:00
Ehmry - 829b629a0c Clang: ignore -Wuninitialized 2019-10-03 21:25:36 +02:00
Ehmry - 59ab4ef6bc Tupify
Implement a graph-based build system.
2019-10-03 21:25:36 +02:00
Ehmry - 4952b37e4c Core: exit with child exit value
Effective for base-linux only.
2019-10-03 21:25:36 +02:00
608 changed files with 3958 additions and 904 deletions

13
.gitignore vendored
View File

@ -2,10 +2,21 @@
*.orig
*.swp
*.rej
result
result-*
/build
/contrib
/depot
/public
/repos/world
/.tup
/build-*
/configs
##### TUP GITIGNORE #####
##### Lines below automatically generated by Tup.
##### Do not edit.
.tup
/.gitignore
/dev
/out

0
.gitmodules vendored Normal file
View File

View File

@ -1,16 +1,29 @@
**FORK AHEAD**
=================================
Genode Operating System Framework
=================================
This a fork of the Genode OS reference implementation with a replacement
build system that is humane and interoperable.
Changes against [Genode Labs](https://genode-labs.com/) master may be
reviewed with the following commands:
```sh
git remote add genodelabs https://github.com/genodelabs/genode.git
git fetch genodelabs
git diff genodelabs/master
```
---
# Genode Operating System Framework
This is the source tree of the reference implementation of the Genode OS
architecture. For a general overview about the architecture, please refer to
the project's official website:
:Official project website for the Genode OS Framework:
### Official project website for the Genode OS Framework
https://genode.org/documentation/general-overview
[https://genode.org/documentation/general-overview]
The current implementation can be compiled for 8 different kernels: Linux,
L4ka::Pistachio, L4/Fiasco, OKL4, NOVA, Fiasco.OC, seL4, and a custom
@ -33,15 +46,14 @@ the kernel that fits best with the requirements at hand for the particular
usage scenario.
Documentation
#############
## Documentation
The primary documentation is the book "Genode Foundations", which is available
on the front page of Genode website:
:Download the book "Genode Foundations":
### Download the book "Genode Foundations"
[https://genode.org]
https://genode.org
The book describes Genode in a holistic and comprehensive way. It equips you
with a thorough understanding of the architecture, assists developers with the
@ -53,79 +65,75 @@ The project has a quarterly release cycle. Each version is accompanied with
detailed release documentation, which is available at the documentation
section of the project website:
:Release documentation:
### Release documentation
[https://genode.org/documentation/release-notes/]
https://genode.org/documentation/release-notes/
Directory overview
##################
## Directory overview
The source tree is composed of the following subdirectories:
:'doc':
### 'doc'
This directory contains general documentation. Please consider the following
document for a quick guide to get started with the framework:
! doc/getting_started.txt
[doc/getting_started.txt](doc/getting_started.txt)
If you are curious about the ready-to-use components that come with the
framework, please review the components overview:
! doc/components.txt
[doc/components.txt](doc/components.txt)
:'repos':
### 'repos':
This directory contains the so-called source-code repositories of Genode.
Please refer to the README file in the 'repos' directory to learn more
about the roles of the individual repositories.
:'tool':
### 'tool'
Source-code management tools and scripts. Please refer to the README file
contained in the directory.
:'depot' and 'public':
### 'depot' and 'public'
Local depot and public archive of Genode packages. Please refer to
! doc/depot.txt
[doc/depot.txt](doc/depot.txt)
for more details.
Additional community-maintained components
##########################################
## Additional community-maintained components
The components found within the main source tree are complemented by a growing
library of additional software, which can be seamlessly integrated into Genode
system scenarios.
:Genode-world repository:
### Genode-world repository
[https://github.com/genodelabs/genode-world]
https://github.com/genodelabs/genode-world
Contact
#######
## Contact
The best way to get in touch with Genode developers and users is the project's
mailing list. Please feel welcome to join in!
:Genode Mailing Lists:
### Genode Mailing Lists
[https://genode.org/community/mailing-lists]
https://genode.org/community/mailing-lists
Commercial support
##################
## Commercial support
The driving force behind the Genode OS Framework is the German company Genode
Labs. The company offers commercial licensing, trainings, support, and
contracted development work:
:Genode Labs website:
### Genode Labs website
[https://www.genode-labs.com]
https://www.genode-labs.com

0
Tupfile.ini Normal file
View File

46
Tuprules.gcc Normal file
View File

@ -0,0 +1,46 @@
TOOLCHAIN_CONFIGURED=$(TOOLCHAIN_CONFIGURED)X
ifeq (@(TUP_ARCH),i386)
CC_MARCH = -march=i686 -m32
LD_MARCH = -melf_i386
AS_MARCH = -march=i686 --32
endif
ifeq (@(TUP_ARCH),x86_64)
CC_MARCH = -m64 -mcmodel=large
LD_MARCH = -melf_x86_64
endif
ifeq (@(TUP_ARCH),arm_v8)
CC_MARCH = -march=armv8-a
endif
ifdef CXXFLAGS
CXXFLAGS = @(CXXFLAGS)
endif
CXXFLAGS += -Wno-error=implicit-fallthrough
CXXFLAGS += -Wno-error=unknown-pragmas
CXXFLAGS += -Wextra
CXXFLAGS += -Weffc++
CXXFLAGS += -Werror
CXXFLAGS += -Wsuggest-override
CXXFLAGS += -Wno-unknown-pragmas
LIBGCC = `$(CXX) $(CC_MARCH) -print-libgcc-file-name`
!ir = | $(DEV_DIR)/<pkg-config> |> clang $(OLEVEL) $(CXXFLAGS) $(CXXFLAGS_%e) $(CXXFLAGS_%f) `$(PKG_CONFIG) --cflags $(LIBS)` $(CPPFLAGS) -S -emit-llvm %f |> %B.ll
!asm = |> ^ CC %b^ @(CC_WRAPPER) $(CC) $(OLEVEL) $(CFLAGS) $(CFLAGS_%e) $(CFLAGS_%f) -D__ASSEMBLY__ $(CPPFLAGS) -c %f -o %o |> %B.o
!cc = | $(DEV_DIR)/<pkg-config> |> ^o CC %f^ @(CC_WRAPPER) $(CC) $(OLEVEL) $(CFLAGS) $(CFLAGS_%e) $(CFLAGS_%f) $(CPPFLAGS) `$(PKG_CONFIG) --cflags $(LIBS) $(LIBS_CFLAGS)` -c -fPIC %f -o %o |> %B.o
!cxx = | $(DEV_DIR)/<pkg-config> |> ^o CXX %b^ @(CC_WRAPPER) $(CXX) $(OLEVEL) $(CXXFLAGS) $(CXXFLAGS_%e) $(CXXFLAGS_%f) $(CPPFLAGS) `$(PKG_CONFIG) --cflags $(LIBS)` -c -fPIC %f -o %o |> %B.o
!ld = | $(DEV_DIR)/<lib> $(DEV_DIR)/<pkg-config> |> ^o LD %o^ $(LD) -o %o $(LDFLAGS) `$(PKG_CONFIG) --libs $(LIBS)` %f |>
!incbin = |> ^ incbin %f^ \
export SYM=_binary_`echo %b | sed 's/\./_/g'`; \
echo ".global ${SYM}_start, ${SYM}_end; .data; .align 4; ${SYM}_start:; .incbin \"%f\"; ${SYM}_end:" \
| x86_64-unknown-genode-as $(AS_MARCH) -o %o - \
|> binary_%b.o

40
Tuprules.llvm Normal file
View File

@ -0,0 +1,40 @@
TOOLCHAIN_CONFIGURED=$(TOOLCHAIN_CONFIGURED)X
ifeq (@(TUP_ARCH),i386)
CC_MARCH = -march=i686 -m32
LD_MARCH = -melf_i386
AS_MARCH = -march=i686 --32
endif
ifeq (@(TUP_ARCH),x86_64)
CC_MARCH = -m64 -mcmodel=large
LD_MARCH = -melf_x86_64
endif
ifeq (@(TUP_ARCH),arm_v8)
CC_MARCH = -march=armv8-a
endif
ifdef CXXFLAGS
CXXFLAGS = @(CXXFLAGS)
endif
CXXFLAGS += -Wno-undefined-bool-conversion -Wno-unknown-attributes -Wsystem-headers -Werror -Wno-uninitialized -Wno-mismatched-tags
LIBGCC = `$(CC) $(CC_MARCH) -print-libgcc-file-name`
!ir = | $(DEV_DIR)/<pkg-config> |> clang $(OLEVEL) $(CXXFLAGS) $(CXXFLAGS_%e) $(CXXFLAGS_%f) `$(PKG_CONFIG) --cflags $(LIBS)` $(CPPFLAGS) -S -emit-llvm %f |> %B.ll
!asm = |> ^ CC %b^ @(CC_WRAPPER) $(CC) $(OLEVEL) $(CFLAGS) $(CFLAGS_%e) $(CFLAGS_%f) -D__ASSEMBLY__ $(CPPFLAGS) -c %f -o %o |> %B.o
!cc = | $(DEV_DIR)/<pkg-config> |> ^o CC %f^ @(CC_WRAPPER) $(CC) $(OLEVEL) $(CFLAGS) $(CFLAGS_%e) $(CFLAGS_%f) $(CPPFLAGS) `$(PKG_CONFIG) --cflags $(LIBS) $(LIBS_CFLAGS)` -c -fPIC %f -o %o |> %B.o
!cxx = | $(DEV_DIR)/<pkg-config> |> ^o CXX %b^ @(CC_WRAPPER) $(CXX) $(OLEVEL) $(CXXFLAGS) $(CXXFLAGS_%e) $(CXXFLAGS_%f) $(CPPFLAGS) `$(PKG_CONFIG) --cflags $(LIBS)` -c -fPIC %f -o %o |> %B.o
!ld = | $(DEV_DIR)/<lib> $(DEV_DIR)/<pkg-config> |> ^o LD %o^ $(LD) $(LDFLAGS) `$(PKG_CONFIG) --libs $(LIBS)` --whole-archive --start-group %f --no-whole-archive --end-group -o %o |>
!incbin = |> ^ incbin %f^ \
export SYM=_binary_`echo %b | sed 's/\./_/g'`; \
echo ".global ${SYM}_start, ${SYM}_end; .data; .align 4; ${SYM}_start:; .incbin \"%f\"; ${SYM}_end:" \
| llvm-mc -filetype=obj - > %o \
|> binary_%b.o

103
Tuprules.tup Normal file
View File

@ -0,0 +1,103 @@
.gitignore
AR = @(AR)
AS = @(AS)
CC = @(CC)
CXX = @(CXX)
LD= @(LD)
OBJCOPY = @(OBJCOPY)
STRIP = @(STRIP)
OUT_DIR=$(TUP_CWD)/out
DEV_DIR = $(TUP_CWD)/dev
DEV_LIB_DIR = $(DEV_DIR)/lib
ifdef IS_GCC
include Tuprules.gcc
endif
ifdef IS_LLVM
include Tuprules.llvm
endif
ifeq ($(TOOLCHAIN_CONFIGURED),)
error no toolchain configuration is active
endif
ifneq ($(TOOLCHAIN_CONFIGURED),X)
error "multiple toolchain configurations are active "
endif
ifeq (@(TUP_ARCH),i386)
X86 = y
endif
ifeq (@(TUP_ARCH),x86_64)
X86 = y
endif
GENODE_DIR = $(TUP_CWD)
!prg = | $(DEV_DIR)/<lib> $(DEV_DIR)/<pkg-config> \
|> ^o LD %o^ $(LD) -o %o $(LD_MARCH) $(LDFLAGS) -L$(DEV_LIB_DIR) %f `$(PKG_CONFIG) --libs $(LIBS) genode-prg` $(LIBGCC) |> %d
!lib = | $(DEV_DIR)/<lib> $(DEV_DIR)/<pkg-config> |> ^o LD %o^ $(LD) $(LD_MARCH) %f $(LDFLAGS) `$(PKG_CONFIG) --libs genode-lib $(LIBS)` -L$(DEV_LIB_DIR) -o %o |> %d.lib.so
!collect_bin = |> ^ COLLECT %b^ \
$(STRIP) -o %o %f \
|> $(OUT_DIR)/bin/%b $(OUT_DIR)/<bin>
!collect_shared = |> ^ COLLECT %b^ \
cp %f %o \
|> $(OUT_DIR)/lib/%b $(OUT_DIR)/<lib>
!collect_static = |> ^ COLLECT %b^ \
cp %f %o \
|> $(DEV_LIB_DIR)/%b \
$(DEV_DIR)/<lib> \
PKG_CONFIG_DIR = $(DEV_DIR)/lib/pkgconfig
ifdef NIX_OUTPUTS_DEV
export PKG_CONFIG_PATH
PKG_CONFIG = PKG_CONFIG_PATH=$(PKG_CONFIG_DIR):$PKG_CONFIG_PATH @(PKGCONFIG)
else
PKG_CONFIG = PKG_CONFIG_PATH=$(PKG_CONFIG_DIR) @(PKGCONFIG)
endif
CFLAGS += -g
CXXFLAGS += -g
ifdef OLEVEL
OLEVEL = @(OLEVEL)
else
OLEVEL = -O2
endif
!strip = |> $(STRIP) -o %o %f |>
!ln = |> ln -s %f %o |>
!ar = |> $(AR) -rcs %o %f |> %d.a
GIT_VERSION = `git describe || echo @(VERSION)`
SED_PKGCONFIG_FLAGS += -e "s|@VERSION@|$(GIT_VERSION)|"
!sed_pkgconfig_file = |> ^o SED %B^ \
sed $(SED_PKGCONFIG_FLAGS) $(SED_FLAGS) < %f > %o; \
$(PKG_CONFIG) --validate %o; \
|> $(PKG_CONFIG_DIR)/%B $(DEV_DIR)/<pkg-config>
!sed_pkgconfig_flags = |> ^o SED %d.pc^ \
sed $(SED_PKGCONFIG_FLAGS) $(SED_FLAGS) > %o; \
$(PKG_CONFIG) --validate %o; \
|> $(PKG_CONFIG_DIR)/%d.pc $(DEV_DIR)/<pkg-config>
!emit_lib_pkg_config = |> ^ emit %d.a pkg-config^ \
echo Name: %d >> %o; \
echo Description: Genode %d library >> %o; \
echo Version: $(GIT_VERSION) >> %o; \
echo Libs: -l:%d.a >> %o; \
$(PKG_CONFIG) --validate %o; \
|> $(PKG_CONFIG_DIR)/%d.pc $(DEV_DIR)/<pkg-config>

0
configs/.gitignore vendored Normal file
View File

56
flake.lock Normal file
View File

@ -0,0 +1,56 @@
{
"inputs": {
"genodepkgs": {
"inputs": {
"dhall-haskell": {
"inputs": {
"nixpkgs": {
"inputs": {},
"narHash": "sha256-wJg4DA700SoQbEz61448sR6BgxRa1R92K3vvCV1g+HY=",
"originalUrl": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148",
"url": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148"
},
"nixpkgsStaticLinux": {
"inputs": {},
"narHash": "sha256-famU3pJZ4vkElV9qc71HmyRVSvcrAhfMZ0UJKpmmKP8=",
"originalUrl": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working",
"url": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working&rev=925aac04f4ca58aceb83beef18cb7dae0715421b"
}
},
"narHash": "sha256-KJl9ZLcMcEsLSPcwcWoc0Ac74/6HKC9LkVMeLwhyhlg=",
"originalUrl": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake",
"url": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake&rev=aea28adf3d10ff1982aa4ddd176d1476251b932f"
},
"genode-depot": {
"inputs": {
"nixpkgs": {
"inputs": {},
"narHash": "sha256-NB+H7zK3BB//zM127FqgbG4iAfY+nS/IOyO+uGWA5Ho=",
"originalUrl": "nixpkgs",
"url": "github:edolstra/nixpkgs/7845bf5f4b3013df1cf036e9c9c3a55a30331db9"
}
},
"narHash": "sha256-7eL2MfGgeEaIwJXPc4LQ7pBa4JeGicm9th7onjKgzsE=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode-depot.git",
"url": "git+https://gitea.c3d2.de/ehmry/genode-depot.git?ref=master&rev=8c2aafed45b4075e37f1cd93de0ebf93f38c83c3"
},
"nixpkgs": {
"inputs": {},
"narHash": "sha256-EqxCk6ORqq4fkewWttpvks0VycBec9X9spAZ+Pq/CEI=",
"originalUrl": "github:ehmry/nixpkgs",
"url": "github:ehmry/nixpkgs/cf50f3b8bdc28832249afab6bca68acad832e011"
}
},
"narHash": "sha256-78eloDNkEjWAckNLbfNait0zb6QBG4QxltX6FyV1vAk=",
"originalUrl": "git+https://git.sr.ht/~ehmry/genodepkgs",
"url": "git+https://git.sr.ht/~ehmry/genodepkgs?ref=master&rev=dad28cc17b17542ada59ba2005fbf1af5d5f8209"
},
"nixpkgs": {
"inputs": {},
"narHash": "sha256-NB+H7zK3BB//zM127FqgbG4iAfY+nS/IOyO+uGWA5Ho=",
"originalUrl": "nixpkgs",
"url": "github:edolstra/nixpkgs/7845bf5f4b3013df1cf036e9c9c3a55a30331db9"
}
},
"version": 3
}

14
flake.nix Normal file
View File

@ -0,0 +1,14 @@
{
description = "Genode development flake";
edition = 201909;
inputs.genodepkgs.uri = "git+https://git.sr.ht/~ehmry/genodepkgs";
outputs = { self, nixpkgs, genodepkgs }: {
devShell.x86_64-linux =
genodepkgs.packages.x86_64-linux-x86_64-genode.genode.base;
};
}

50
repos/Tuprules.tup Normal file
View File

@ -0,0 +1,50 @@
# Tup rules that are local to this Git repo and
# should not be shared with other projects.
&LD_SCRIPT_SO = base/src/ld/genode_rel.ld
ifeq (@(TUP_ARCH),x86_64)
ASM_SYM_DEPENDENCY = movq \1@GOTPCREL(%rip), %rax
else
ASM_SYM_DEPENDENCY = .long \1
endif
!abi_stub = |> ^ STUB %o^\
sed \
-e "s/^\(\w\+\) D \(\w\+\)\$/.data; .global \1; .type \1,%%object; .size \1,\2; \1:/" \
-e "s/^\(\w\+\) V/.data; .weak \1; .type \1,%%object; \1:/" \
-e "s/^\(\w\+\) T/.text; .global \1; .type \1,%%function; \1:/" \
-e "s/^\(\w\+\) R \(\w\+\)\$/.section .rodata; .global \1; .type \1,%%object; .size \1,\2; \1:/" \
-e "s/^\(\w\+\) W/.text; .weak \1; .type \1,%%function; \1:/" \
-e "s/^\(\w\+\) B \(\w\+\)\$/.bss; .global \1; .type \1,%%object; .size \1,\2; \1:/" \
-e "s/^\(\w\+\) U/.text; .global \1; $(ASM_SYM_DEPENDENCY)/" \
%f > stub.s; \
$(CC) $(CC_MARCH) -x assembler -c stub.s; \
$(LD) -o %o \
-shared \
-T &(LD_SCRIPT_SO) \
stub.o; \
rm -v stub.o stub.s; \
|> $(DEV_LIB_DIR)/%B.lib.so $(DEV_DIR)/<lib>
BASE_DIR = $(GENODE_DIR)/repos/base
&BASE_DIR = base
ifeq (@(TUP_ARCH),i386)
CPPFLAGS += -I$(BASE_DIR)/include/spec/x86_32
CPPFLAGS += -I$(BASE_DIR)/include/spec/x86
CPPFLAGS += -I$(BASE_DIR)/include/spec/32bit
endif
ifeq (@(TUP_ARCH),x86_64)
CPPFLAGS += -I$(BASE_DIR)/include/spec/x86_64
CPPFLAGS += -I$(BASE_DIR)/include/spec/x86
CPPFLAGS += -I$(BASE_DIR)/include/spec/64bit
endif
ifeq (@(TUP_ARCH),arm64)
CPPFLAGS += -I$(BASE_DIR)/include/spec/arm_64
CPPFLAGS += -I$(BASE_DIR)/include/spec/64bit
endif
CPPFLAGS += -I$(BASE_DIR)/include

View File

@ -0,0 +1,8 @@
ifeq (@(TUP_ARCH),x86_64)
CPPFLAGS += -I$(TUP_CWD)/include/spec/x86_64
endif
CPPFLAGS += -I$(TUP_CWD)/include
include &(BASE_DIR)/Tuprules.tup
REP_DIR = $(TUP_CWD)

View File

@ -0,0 +1,2 @@
CPPFLAGS += -I$(TUP_CWD)/include
CPPFLAGS += -I$(BASE_DIR)/src/include

View File

@ -0,0 +1,71 @@
ifeq (@(TUP_ARCH),x86_64)
CPPFLAGS += -I$(TUP_CWD)/spec/x86_64
NR_OF_CPUS = 32
CPPFLAGS += -DNR_OF_CPUS=$(NR_OF_CPUS)
LDFLAGS += --defsym NR_OF_CPUS=$(NR_OF_CPUS)
endif
GEN_CORE_DIR = $(BASE_DIR)/src/core
# add include paths
CPPFLAGS += -I$(BASE_DIR)/../base-hw/src/core
CPPFLAGS += -I$(GEN_CORE_DIR)/include
CPPFLAGS += -I$(BASE_DIR)/../base-hw/src/include
CPPFLAGS += -I$(BASE_DIR)/src/include
# add C++ sources
SRC_CC += $(GEN_CORE_DIR)/core_log.cc
SRC_CC += $(GEN_CORE_DIR)/core_mem_alloc.cc
SRC_CC += $(GEN_CORE_DIR)/core_rpc_cap_alloc.cc
SRC_CC += $(GEN_CORE_DIR)/cpu_session_component.cc
SRC_CC += $(GEN_CORE_DIR)/cpu_thread_component.cc
SRC_CC += $(GEN_CORE_DIR)/dataspace_component.cc
SRC_CC += $(GEN_CORE_DIR)/default_log.cc
SRC_CC += $(GEN_CORE_DIR)/dump_alloc.cc
SRC_CC += $(GEN_CORE_DIR)/heartbeat.cc
SRC_CC += $(GEN_CORE_DIR)/io_mem_session_component.cc
SRC_CC += $(GEN_CORE_DIR)/main.cc
SRC_CC += $(GEN_CORE_DIR)/pd_session_component.cc
SRC_CC += $(GEN_CORE_DIR)/pd_session_support.cc
SRC_CC += $(GEN_CORE_DIR)/platform_rom_modules.cc
SRC_CC += $(GEN_CORE_DIR)/ram_dataspace_factory.cc
SRC_CC += $(GEN_CORE_DIR)/region_map_component.cc
SRC_CC += $(GEN_CORE_DIR)/rom_session_component.cc
SRC_CC += $(GEN_CORE_DIR)/signal_receiver.cc
SRC_CC += $(GEN_CORE_DIR)/signal_transmitter_noinit.cc
SRC_CC += $(GEN_CORE_DIR)/stack_area.cc
SRC_CC += $(GEN_CORE_DIR)/trace_session_component.cc
SRC_CC += $(GEN_CORE_DIR)/version.cc
CXXFLAGS_$(GEN_CORE_DIR)/version.cc += -DGENODE_VERSION=\"`git describe`\"
SRC_CC += $(TUP_CWD)/capability.cc
SRC_CC += $(TUP_CWD)/core_log_out.cc
SRC_CC += $(TUP_CWD)/core_region_map.cc
SRC_CC += $(TUP_CWD)/cpu_session_support.cc
SRC_CC += $(TUP_CWD)/env.cc
SRC_CC += $(TUP_CWD)/io_mem_session_support.cc
SRC_CC += $(TUP_CWD)/irq_session_component.cc
SRC_CC += $(TUP_CWD)/kernel_log.cc
SRC_CC += $(TUP_CWD)/native_pd_component.cc
SRC_CC += $(TUP_CWD)/native_utcb.cc
SRC_CC += $(TUP_CWD)/pager.cc
SRC_CC += $(TUP_CWD)/platform.cc
SRC_CC += $(TUP_CWD)/platform_pd.cc
SRC_CC += $(TUP_CWD)/platform_thread.cc
SRC_CC += $(TUP_CWD)/ram_dataspace_support.cc
SRC_CC += $(TUP_CWD)/region_map_support.cc
SRC_CC += $(TUP_CWD)/stack_area_addr.cc
SRC_CC += $(TUP_CWD)/thread_start.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/cpu.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/cpu_scheduler.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/double_list.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/init.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/ipc_node.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/irq.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/kernel.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/object.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/signal_receiver.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/thread.cc
SRC_CC_KERNEL += $(TUP_CWD)/kernel/timer.cc

View File

@ -17,7 +17,7 @@
#include <base/internal/raw_write_string.h>
#include <core_log.h>
#include <kernel/log.h>
#include "kernel/log.h"
void Genode::Core_log::out(char const c) { Kernel::log(c); }

View File

@ -17,7 +17,7 @@
/* core includes */
#include <platform.h>
#include <core_region_map.h>
#include <map_local.h>
#include "map_local.h"
#include <util.h>
#include <base/heap.h>

View File

@ -16,7 +16,7 @@
/* core includes */
#include <cpu_session_component.h>
#include <kernel/configuration.h>
#include "kernel/configuration.h"
using namespace Genode;

View File

@ -13,10 +13,10 @@
*/
/* base-hw includes */
#include <kernel/core_interface.h>
#include "kernel/core_interface.h"
/* core includes */
#include <kernel/irq.h>
#include "kernel/irq.h"
#include <irq_root.h>
#include <core_env.h>

View File

@ -13,11 +13,11 @@
*/
/* core includes */
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include <kernel/thread.h>
#include <kernel/irq.h>
#include <kernel/pd.h>
#include "cpu.h"
#include "kernel.h"
#include "thread.h"
#include "irq.h"
#include "pd.h"
#include <board.h>
#include <hw/assert.h>
#include <hw/boot_info.h>

View File

@ -19,10 +19,10 @@
/* core includes */
#include <board.h>
#include <kernel/cpu_context.h>
#include <kernel/irq.h>
#include <kernel/inter_processor_work.h>
#include <kernel/thread.h>
#include "cpu_context.h"
#include "irq.h"
#include "inter_processor_work.h"
#include "thread.h"
namespace Kernel
{
@ -69,6 +69,7 @@ namespace Kernel
* publicly provide via a 'typedef Genode::Cpu::Arch_regs Arch_regs'.
* Then, the 'Genode::Cpu' could be inherited privately.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout

View File

@ -16,8 +16,8 @@
#define _CORE__KERNEL__CPU_CONTEXT_H_
/* core includes */
#include <kernel/cpu_scheduler.h>
#include <kernel/timer.h>
#include "cpu_scheduler.h"
#include "timer.h"
namespace Kernel
{

View File

@ -11,7 +11,7 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <kernel/cpu.h>
#include "cpu.h"
using namespace Kernel;

View File

@ -13,7 +13,7 @@
#include <base/log.h>
#include <hw/assert.h>
#include <kernel/cpu_scheduler.h>
#include "cpu_scheduler.h"
using namespace Kernel;

View File

@ -17,8 +17,8 @@
/* core includes */
#include <util.h>
#include <util/misc_math.h>
#include <kernel/configuration.h>
#include <kernel/double_list.h>
#include "configuration.h"
#include "double_list.h"
namespace Kernel
{

View File

@ -11,7 +11,7 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <kernel/cpu.h>
#include "cpu.h"
void Kernel::Cpu::Ipi::occurred() { }

View File

@ -12,7 +12,7 @@
*/
/* core includes */
#include <kernel/double_list.h>
#include "double_list.h"
using namespace Kernel;

View File

@ -13,10 +13,10 @@
*/
/* core includes */
#include <kernel/pd.h>
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include <kernel/lock.h>
#include "pd.h"
#include "cpu.h"
#include "kernel.h"
#include "lock.h"
#include <platform_pd.h>
#include <board.h>
#include <platform_thread.h>

View File

@ -20,10 +20,10 @@
/* core includes */
#include <platform_pd.h>
#include <kernel/ipc_node.h>
#include <kernel/pd.h>
#include <kernel/kernel.h>
#include <kernel/thread.h>
#include "ipc_node.h"
#include "pd.h"
#include "kernel.h"
#include "thread.h"
using namespace Kernel;

View File

@ -51,7 +51,7 @@ class Kernel::Ipc_node : private Ipc_node_queue::Element
private:
friend class Core_thread;
friend struct Core_thread;
friend class Genode::Fifo<Ipc_node>;
State _state = INACTIVE;

View File

@ -12,9 +12,9 @@
*/
/* core includes */
#include <kernel/kernel.h>
#include <kernel/cpu.h>
#include <kernel/irq.h>
#include "kernel.h"
#include "cpu.h"
#include "irq.h"
void Kernel::Irq::disable() const {

View File

@ -23,7 +23,7 @@
#include <base/internal/unmanaged_singleton.h>
/* core includes */
#include <kernel/signal_receiver.h>
#include "signal_receiver.h"
namespace Kernel
{
@ -50,7 +50,7 @@ namespace Genode
class Kernel::Irq : Genode::Avl_node<Irq>
{
friend class Genode::Avl_tree<Irq>;
friend class Genode::Avl_node<Irq>;
friend struct Genode::Avl_node<Irq>;
public:

View File

@ -13,9 +13,9 @@
*/
/* core includes */
#include <kernel/cpu.h>
#include <kernel/lock.h>
#include <kernel/kernel.h>
#include "cpu.h"
#include "lock.h"
#include "kernel.h"
extern "C" void kernel()

View File

@ -15,9 +15,9 @@
#include <cpu/atomic.h>
#include <cpu/memory_barrier.h>
#include <kernel/cpu.h>
#include <kernel/lock.h>
#include <kernel/kernel.h>
#include "cpu.h"
#include "lock.h"
#include "kernel.h"
Kernel::Lock & Kernel::data_lock()
{

View File

@ -1,6 +1,6 @@
#include <kernel/object.h>
#include <kernel/pd.h>
#include <kernel/kernel.h>
#include "object.h"
#include "pd.h"
#include "kernel.h"
#include <util/construct_at.h>
@ -13,7 +13,7 @@ using namespace Kernel;
Object::~Object()
{
for (Object_identity * oi = first(); oi; oi = first())
for (Object_identity * oi = list.first(); oi; oi = list.first())
oi->invalidate();
}
@ -24,18 +24,18 @@ Object::~Object()
void Object_identity::invalidate()
{
for (Object_identity_reference * oir = first(); oir; oir = first())
for (Object_identity_reference * oir = list.first(); oir; oir = list.first())
oir->invalidate();
if (_object) {
_object->remove(this);
_object->list.remove(this);
_object = nullptr;
}
}
Object_identity::Object_identity(Object & object)
: _object(&object) { _object->insert(this); }
: _object(&object) { _object->list.insert(this); }
Object_identity::~Object_identity() { invalidate(); }
@ -50,7 +50,7 @@ Object_identity_reference::find(Pd &pd)
{
if (!_identity) return nullptr;
for (Object_identity_reference * oir = _identity->first();
for (Object_identity_reference * oir = _identity->list.first();
oir; oir = oir->next())
if (&pd == &(oir->_pd)) return oir;
return nullptr;
@ -79,7 +79,7 @@ Object_identity_reference * Object_identity_reference::factory(void * dst,
void Object_identity_reference::invalidate() {
if (_identity) _identity->remove(this);
if (_identity) _identity->list.remove(this);
_identity = nullptr;
}
@ -88,7 +88,7 @@ Object_identity_reference::Object_identity_reference(Object_identity *oi,
Pd &pd)
: _capid(pd.capid_alloc().alloc()), _identity(oi), _pd(pd), _in_utcbs(0)
{
if (_identity) _identity->insert(this);
if (_identity) _identity->list.insert(this);
_pd.cap_tree().insert(this);
}

View File

@ -23,7 +23,7 @@
/* core includes */
#include <kernel/core_interface.h>
#include <kernel/interface.h>
#include <kernel/kernel.h>
#include "kernel.h"
namespace Kernel
{
@ -32,7 +32,7 @@ namespace Kernel
/**
* Base class of all Kernel objects
*/
class Object;
struct Object;
/**
* An object identity helps to distinguish different capability owners
@ -73,18 +73,16 @@ namespace Kernel
}
struct Kernel::Object : private Object_identity_list
struct Kernel::Object
{
using Object_identity_list::remove;
using Object_identity_list::insert;
Object_identity_list list { };
virtual ~Object();
};
class Kernel::Object_identity
: public Object_identity_list::Element,
public Kernel::Object_identity_reference_list
: public Object_identity_list::Element
{
private:
@ -98,6 +96,8 @@ class Kernel::Object_identity
public:
Kernel::Object_identity_reference_list list { };
Object_identity(Object & object);
~Object_identity();

View File

@ -12,7 +12,7 @@
*/
/* core includes */
#include <kernel/signal_receiver.h>
#include "signal_receiver.h"
using namespace Kernel;

View File

@ -23,11 +23,11 @@
/* core includes */
#include <hw/assert.h>
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include <kernel/thread.h>
#include <kernel/irq.h>
#include <kernel/log.h>
#include "cpu.h"
#include "kernel.h"
#include "thread.h"
#include "irq.h"
#include "log.h"
#include <map_local.h>
#include <platform_pd.h>

View File

@ -29,7 +29,7 @@ namespace Kernel
{
struct Thread_fault;
class Thread;
class Core_thread;
struct Core_thread;
}

View File

@ -12,9 +12,9 @@
*/
/* Core includes */
#include <kernel/cpu.h>
#include <kernel/timer.h>
#include <kernel/configuration.h>
#include "cpu.h"
#include "timer.h"
#include "configuration.h"
#include <hw/assert.h>
using namespace Kernel;

View File

@ -16,7 +16,7 @@
/* base-hw includes */
#include <kernel/types.h>
#include <kernel/irq.h>
#include "irq.h"
/* Genode includes */
#include <util/list.h>

View File

@ -17,10 +17,10 @@
namespace Genode { class Vm_state; }
/* core includes */
#include <kernel/cpu_context.h>
#include <kernel/kernel.h>
#include <kernel/pd.h>
#include <kernel/signal_receiver.h>
#include "cpu_context.h"
#include "kernel.h"
#include "pd.h"
#include "signal_receiver.h"
#include <board.h>

View File

@ -12,7 +12,7 @@
*/
/* core includes */
#include <kernel/thread.h>
#include "thread.h"
void Kernel::Thread::_call_new_vm() { user_arg_0(-1); }
void Kernel::Thread::_call_delete_vm() { user_arg_0(-1); }

View File

@ -12,8 +12,8 @@
*/
/* core includes */
#include <kernel/thread.h>
#include <kernel/vm.h>
#include "thread.h"
#include "vm.h"
void Kernel::Thread::_call_new_vm()
{

View File

@ -17,7 +17,7 @@
#include <board.h>
#include <platform.h>
#include <kernel/log.h>
#include "kernel/log.h"
void Kernel::log(char const c)

View File

@ -12,7 +12,7 @@
*/
#include <pd_session_component.h>
#include <native_pd_component.h>
#include "native_pd_component.h"
using namespace Genode;

View File

@ -22,7 +22,7 @@
/* base-hw includes */
#include <kernel/interface.h>
#include <kernel/object.h>
#include "kernel/object.h"
namespace Genode {
/**

View File

@ -0,0 +1,37 @@
ifeq (@(TUP_ARCH),x86_64)
include_rules
GEN_CORE_DIR = $(BASE_DIR)/src/core
# add C++ sources
SRC_CC += $(REP_DIR)/src/lib/hw/spec/64bit/memory_map.cc
SRC_CC += ../kernel/cpu_mp.cc
SRC_CC += ../kernel/lock.cc
SRC_CC += ../kernel/vm_thread_off.cc
SRC_CC += $(GEN_CORE_DIR)/spec/x86/io_port_session_component.cc
SRC_CC += $(GEN_CORE_DIR)/spec/x86/io_port_session_support.cc
SRC_CC += $(GEN_CORE_DIR)/spec/x86/platform_services.cc
SRC_CC += ../spec/x86_64/bios_data_area.cc
SRC_CC += ../spec/x86_64/cpu.cc
SRC_CC += ../spec/x86_64/pic.cc
SRC_CC += ../spec/x86_64/pit.cc
SRC_CC += ../spec/x86_64/platform_support.cc
SRC_CC += ../spec/x86_64/platform_support_common.cc
: foreach $(SRC_S) |> !asm |> {obj}
: foreach $(SRC_CC) |> !cxx |> {obj}
: foreach $(SRC_CC_KERNEL) |> !cxx |> ../kernel/%B.o {obj}
: {obj} | \
$(DEV_DIR)/<lib> \
$(DEV_DIR)/<pkg-config> \
$(BASE_DIR)/<base-libs> \
$(REP_DIR)/<base-common> \
$(REP_DIR)/<core-obj> \
|> $(LD) $(LDFLAGS) -u _start -r \
--whole-archive --start-group %f %<core-obj> %<base-libs> %<base-common> $(PKG_LIBS) --no-whole-archive --end-group -o %o \
|> core.a $(REP_DIR)/<core> {core}
: {core} |> cp %f %o |> $(OUT_DIR)/lib/core-hw-pc.a
endif

View File

@ -19,14 +19,14 @@
#include <boot_modules.h>
#include <core_log.h>
#include <hw/memory_region.h>
#include <map_local.h>
#include "map_local.h"
#include <platform.h>
#include <platform_pd.h>
#include <hw/page_flags.h>
#include <hw/util.h>
#include <kernel/kernel.h>
#include "kernel/kernel.h"
#include <translation_table.h>
#include <kernel/cpu.h>
#include "kernel/cpu.h"
/* base-internal includes */
#include <base/internal/crt0.h>

View File

@ -88,7 +88,7 @@ Hw::Address_space::Address_space(Page_table & tt,
Hw::Address_space::Address_space(Platform_pd & pd)
: _tt(*construct_at<Page_table>(_table_alloc(), *((Page_table*)Hw::Mm::core_page_tables().base))),
_tt_phys((addr_t)_cma().phys_addr(&_tt)),
_tt_array(new (_cma()) Array([this] (void * virt) {
_tt_array(new (_cma()) Array([] (void * virt) {
return (addr_t)_cma().phys_addr(virt);})),
_tt_alloc(_tt_array->alloc()),
_kobj(true, *(Page_table*)translation_table_phys(), pd) { }

View File

@ -17,15 +17,15 @@
#include <platform_pd.h>
#include <core_env.h>
#include <rm_session_component.h>
#include <map_local.h>
#include "map_local.h"
/* base-internal includes */
#include <base/internal/native_utcb.h>
#include <base/internal/capability_space.h>
/* kernel includes */
#include <kernel/pd.h>
#include <kernel/kernel.h>
#include "kernel/pd.h"
#include "kernel/kernel.h"
using namespace Genode;

View File

@ -18,7 +18,7 @@
/* core includes */
#include <ram_dataspace_factory.h>
#include <platform.h>
#include <map_local.h>
#include "map_local.h"
using namespace Genode;

View File

@ -24,8 +24,8 @@
namespace Genode {
class Signal_context_component;
class Signal_source_component;
struct Signal_context_component;
struct Signal_source_component;
typedef Object_pool<Signal_context_component> Signal_context_pool;
typedef Object_pool<Signal_source_component> Signal_source_pool;
@ -50,7 +50,7 @@ struct Genode::Signal_source_component : private Kernel_object<Kernel::Signal_re
public Signal_source_pool::Entry
{
friend class Object_pool<Signal_source_component>;
friend class Signal_context_component;
friend struct Signal_context_component;
using Signal_source_pool::Entry::cap;

View File

@ -0,0 +1,23 @@
/*
* \brief CPU driver for core
* \author Norman Feske
* \author Martin stein
* \date 2012-08-30
*/
/*
* Copyright (C) 2012-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__ARM_V6__CPU_H_
#define _CORE__SPEC__ARM_V6__CPU_H_
/* core includes */
#include <spec/arm/cpu_support.h>
namespace Genode { using Cpu = Arm_cpu; }
#endif /* _CORE__SPEC__ARM_V6__CPU_H_ */

View File

@ -0,0 +1,94 @@
/*
* \brief CPU driver for core
* \author Stefan Kalkowski
* \date 2019-05-10
*/
/*
* Copyright (C) 2019 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__ARM_V8__CPU_H_
#define _CORE__SPEC__ARM_V8__CPU_H_
/* Genode includes */
#include <util/register.h>
#include <cpu/cpu_state.h>
#include <base/internal/align_at.h>
#include <hw/spec/arm_64/cpu.h>
namespace Kernel { struct Thread_fault; }
namespace Genode {
struct Cpu;
using sizet_arithm_t = __uint128_t;
using uint128_t = __uint128_t;
}
struct Genode::Cpu : Hw::Arm_64_cpu
{
enum Exception_entry {
SYNC_LEVEL_EL1 = 0x000,
IRQ_LEVEL_EL1 = 0x080,
FIQ_LEVEL_EL1 = 0x100,
SERR_LEVEL_EL1 = 0x180,
SYNC_LEVEL_EL1_EXC_MODE = 0x200,
IRQ_LEVEL_EL1_EXC_MODE = 0x280,
FIQ_LEVEL_EL1_EXC_MODE = 0x300,
SERR_LEVEL_EL1_EXC_MODE = 0x380,
SYNC_LEVEL_EL0 = 0x400,
IRQ_LEVEL_EL0 = 0x480,
FIQ_LEVEL_EL0 = 0x500,
SERR_LEVEL_EL0 = 0x580,
AARCH32_SYNC_LEVEL_EL0 = 0x600,
AARCH32_IRQ_LEVEL_EL0 = 0x680,
AARCH32_FIQ_LEVEL_EL0 = 0x700,
AARCH32_SERR_LEVEL_EL0 = 0x780,
RESET = 0x800
};
struct alignas(16) Fpu_state
{
Genode::uint128_t q[32];
Genode::uint32_t fpsr;
};
struct alignas(8) Context : Cpu_state
{
Genode::uint64_t pstate { };
Genode::uint64_t exception_type { RESET };
Fpu_state fpu_state { };
Context(bool privileged);
};
struct Mmu_context
{
Ttbr::access_t ttbr;
Mmu_context(addr_t page_table_base);
~Mmu_context();
Genode::uint16_t id() {
return Ttbr::Asid::get(ttbr); }
};
void switch_to(Context&, Mmu_context &);
static void mmu_fault(Context &, Kernel::Thread_fault &);
/**
* Return kernel name of the executing CPU
*/
static unsigned executing_id() { return 0; }
static void clean_data_cache_by_virt_region(addr_t, size_t);
static void clean_invalidate_data_cache_by_virt_region(addr_t, size_t);
static void invalidate_instr_cache_by_virt_region(addr_t, size_t);
};
#endif /* _CORE__SPEC__ARM_V8__CPU_H_ */

View File

@ -0,0 +1,124 @@
/*
* \brief CPU driver for core
* \author Martin stein
* \author Stefan Kalkowski
* \date 2011-11-03
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__CORTEX_A15__CPU_H_
#define _CORE__SPEC__CORTEX_A15__CPU_H_
/* core includes */
#include <spec/arm_v7/cpu_support.h>
namespace Genode { class Cpu; }
class Genode::Cpu : public Arm_v7_cpu
{
public:
/*********************************
** Virtualization extensions **
*********************************/
/**
* Hypervisor system trap register
*/
struct Hstr : Register<32>
{
/* System coprocessor primary register access trap */
template <unsigned R>
struct T : Bitfield<R, 1> {};
static access_t init()
{
/*
* allow cache (7), TLB (8) maintenance, and performance
* monitor (9), process/thread ID register (13) and timer (14)
* access.
*/
access_t v = 0;
T<0>::set(v, 1);
T<1>::set(v, 1);
T<2>::set(v, 1);
T<3>::set(v, 1);
T<5>::set(v, 1);
T<6>::set(v, 1);
T<10>::set(v, 1);
T<11>::set(v, 1);
T<12>::set(v, 1);
T<15>::set(v, 1);
return v;
};
};
/**
* Hypervisor control register
*/
struct Hcr : Register<32>
{
struct Vm : Bitfield<0, 1> {}; /* VT MMU enabled */
struct Fmo : Bitfield<3, 1> {}; /* FIQ cannot been masked */
struct Imo : Bitfield<4, 1> {}; /* IRQ cannot been masked */
struct Amo : Bitfield<5, 1> {}; /* A bit cannot been masked */
struct Twi : Bitfield<13, 1> {}; /* trap on WFI instruction */
struct Twe : Bitfield<14, 1> {}; /* trap on WFE instruction */
struct Tidcp : Bitfield<20, 1> {}; /* trap lockdown */
struct Tac : Bitfield<21, 1> {}; /* trap ACTLR accesses */
struct Tvm : Bitfield<26, 1> {}; /* trap virtual memory ctrls */
static access_t init()
{
access_t v = 0;
Vm::set(v, 1);
Fmo::set(v, 1);
Imo::set(v, 1);
Amo::set(v, 1);
Twi::set(v, 1);
Twe::set(v, 1);
Tidcp::set(v, 1);
Tac::set(v, 1);
Tvm::set(v, 1);
return v;
};
};
/**
* An usermode execution state
*/
struct Mmu_context
{
Ttbr_64bit::access_t ttbr0;
Mmu_context(addr_t const table);
~Mmu_context();
Genode::uint8_t id() const { return Ttbr_64bit::Asid::get(ttbr0); }
};
static void mmu_fault_status(Fsr::access_t fsr,
Kernel::Thread_fault & fault);
/**
* Return kernel name of the executing CPU
*/
static unsigned executing_id() { return Mpidr::Aff_0::get(Mpidr::read()); }
void switch_to(Context &, Mmu_context & mmu_context)
{
if (mmu_context.id() && (Ttbr0_64bit::read() != mmu_context.ttbr0))
Ttbr0_64bit::write(mmu_context.ttbr0);
}
};
#endif /* _CORE__SPEC__CORTEX_A15__CPU_H_ */

View File

@ -0,0 +1,35 @@
/*
* \brief ARM Cortex A8 CPU driver for core
* \author Martin stein
* \author Stefan Kalkowski
* \date 2011-11-03
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__CORTEX_A8__CPU_H_
#define _CORE__SPEC__CORTEX_A8__CPU_H_
/* core includes */
#include <spec/arm_v7/cpu_support.h>
namespace Genode { struct Cpu; }
struct Genode::Cpu : Arm_v7_cpu
{
/**
* Post processing after a translation was added to a translation table
*
* \param addr virtual address of the translation
* \param size size of the translation
*/
static void translation_added(addr_t const addr, size_t const size);
};
#endif /* _CORE__SPEC__CORTEX_A8__CPU_H_ */

View File

@ -0,0 +1,40 @@
/*
* \brief CPU driver for core
* \author Martin stein
* \author Stefan Kalkowski
* \date 2011-11-03
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__CORTEX_A9__CPU_H_
#define _CORE__SPEC__CORTEX_A9__CPU_H_
/* core includes */
#include <spec/arm_v7/cpu_support.h>
#include <board.h>
namespace Genode { struct Cpu; }
struct Genode::Cpu : Arm_v7_cpu
{
/**
* Clean and invalidate data-cache for virtual region
* 'base' - 'base + size'
*/
void clean_invalidate_data_cache_by_virt_region(addr_t base,
size_t const size)
{
Arm_cpu::clean_invalidate_data_cache_by_virt_region(base, size);
Board::l2_cache().clean_invalidate();
}
static unsigned executing_id() { return Mpidr::Aff_0::get(Mpidr::read()); }
};
#endif /* _CORE__SPEC__CORTEX_A9__CPU_H_ */

View File

@ -0,0 +1,86 @@
/*
* \brief CPU driver for core
* \author Sebastian Sumpf
* \date 2015-06-02
*/
/*
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__RISCV__CPU_H_
#define _CORE__SPEC__RISCV__CPU_H_
/* Genode includes */
#include <base/stdint.h>
#include <cpu/cpu_state.h>
#include <util/register.h>
#include <base/internal/align_at.h>
#include <kernel/interface.h>
#include <hw/spec/riscv/cpu.h>
namespace Kernel { struct Thread_fault; }
namespace Genode
{
/**
* CPU driver for core
*/
class Cpu;
typedef __uint128_t sizet_arithm_t;
}
namespace Kernel { class Pd; }
class Genode::Cpu : public Hw::Riscv_cpu
{
public:
struct alignas(8) Context : Cpu_state
{
Context(bool);
};
struct Mmu_context
{
Sptbr::access_t sptbr = 0;
Mmu_context(addr_t page_table_base);
~Mmu_context();
};
/**
* From the manual
*
* The behavior of SFENCE.VM depends on the current value of the sasid
* register. If sasid is nonzero, SFENCE.VM takes effect only for address
* translations in the current address space. If sasid is zero, SFENCE.VM
* affects address translations for all address spaces. In this case, it
* also affects global mappings, which are described in Section 4.5.1.
*
* Right no we will flush anything
*/
static void sfence()
{
/*
* Note: In core the address space id must be zero
*/
asm volatile ("sfence.vm\n");
}
static void invalidate_tlb_by_pid(unsigned const /* pid */) { sfence(); }
void switch_to(Mmu_context & context);
static void mmu_fault(Context & c, Kernel::Thread_fault & f);
static unsigned executing_id() { return 0; }
};
#endif /* _CORE__SPEC__RISCV__CPU_H_ */

View File

@ -0,0 +1,6 @@
ifeq (@(TUP_ARCH),x86_64)
include_rules
: foreach *.s |> !asm |> | $(REP_DIR)/<core-obj>
endif

View File

@ -15,8 +15,8 @@
#define _CORE__SPEC__X86_64__BOARD_H_
#include <hw/spec/x86_64/pc_board.h>
#include <spec/x86_64/pic.h>
#include <spec/x86_64/pit.h>
#include "pic.h"
#include "pit.h"
namespace Board {
using namespace Hw::Pc_board;

View File

@ -13,8 +13,8 @@
/* core includes */
#include <cpu.h>
#include <kernel/thread.h>
#include <kernel/pd.h>
#include "../../kernel/thread.h"
#include "../../kernel/pd.h"
extern int __idt;
extern int __idt_end;

View File

@ -0,0 +1,135 @@
/*
* \brief x86_64 CPU driver for core
* \author Adrian-Ken Rueegsegger
* \author Martin stein
* \author Reto Buerki
* \author Stefan Kalkowski
* \date 2015-02-06
*/
/*
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__X86_64__CPU_H_
#define _CORE__SPEC__X86_64__CPU_H_
/* Genode includes */
#include <util/register.h>
#include <kernel/interface_support.h>
#include <cpu/cpu_state.h>
#include "../../../include/hw/spec/x86_64/cpu_registers.h"
/* base includes */
#include <base/internal/align_at.h>
#include <base/internal/unmanaged_singleton.h>
/* core includes */
#include <fpu.h>
namespace Kernel { struct Thread_fault; }
namespace Genode {
class Cpu;
using sizet_arithm_t = __uint128_t;
}
class Genode::Cpu : public Hw::X86_64_cpu
{
protected:
public:
/**
* Task State Segment (TSS)
*
* See Intel SDM Vol. 3A, section 7.7
*/
struct alignas(8) Tss
{
uint32_t reserved0;
uint64_t rsp[3]; /* pl0-3 stack pointer */
uint64_t reserved1;
uint64_t ist[7]; /* irq stack pointer */
uint64_t reserved2;
static void init();
} __attribute__((packed)) tss { };
/**
* Interrupt Descriptor Table (IDT)
*
* See Intel SDM Vol. 3A, section 6.10
*/
struct Idt { static void init(); };
/**
* Global Descriptor Table (GDT)
* See Intel SDM Vol. 3A, section 3.5.1
*/
struct alignas(8) Gdt
{
uint64_t null_desc = 0;
uint64_t sys_cs_64bit_desc = 0x20980000000000;
uint64_t sys_ds_64bit_desc = 0x20930000000000;
uint64_t usr_cs_64bit_desc = 0x20f80000000000;
uint64_t usr_ds_64bit_desc = 0x20f30000000000;
uint64_t tss_desc[2];
void init(addr_t tss_addr);
} __attribute__((packed)) gdt { };
/**
* Extend basic CPU state by members relevant for 'base-hw' only
*/
struct Kernel_stack { unsigned long kernel_stack { }; };
/* exception_vector.s depends on the position of the Kernel_stack */
struct alignas(16) Context : Cpu_state, Kernel_stack, Fpu_context
{
enum Eflags {
EFLAGS_IF_SET = 1 << 9,
EFLAGS_IOPL_3 = 3 << 12,
};
Context(bool privileged);
} __attribute__((packed));
struct Mmu_context
{
addr_t cr3;
Mmu_context(addr_t page_table_base);
};
/**
* Return kernel name of the executing CPU
*/
static unsigned executing_id();
/**
* Switch to new context
*
* \param context next CPU context
*/
void switch_to(Context & context, Mmu_context &mmu_context);
static void mmu_fault(Context & regs, Kernel::Thread_fault & fault);
/**
* Invalidate the whole TLB
*/
static void invalidate_tlb() {
Genode::Cpu::Cr3::write(Genode::Cpu::Cr3::read()); }
};
#endif /* _CORE__SPEC__X86_64__CPU_H_ */

View File

@ -0,0 +1,6 @@
ifeq (@(TUP_ARCH),x86_64)
include_rules
: foreach *.cc |> !cxx |> | $(REP_DIR)/<core-obj>
endif

View File

@ -13,8 +13,8 @@
*/
/* core includes */
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include "../../../kernel/cpu.h"
#include "../../../kernel/kernel.h"
void Kernel::Cpu::_arch_init()
{

View File

@ -11,8 +11,8 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <kernel/cpu.h>
#include <kernel/pd.h>
#include "../../../kernel/cpu.h"
#include "../../../kernel/pd.h"
bool Kernel::Pd::invalidate_tlb(Cpu & cpu, addr_t, size_t)

View File

@ -14,9 +14,9 @@
*/
/* core includes */
#include <kernel/cpu.h>
#include <kernel/thread.h>
#include <kernel/pd.h>
#include "../../../kernel/cpu.h"
#include "../../../kernel/thread.h"
#include "../../../kernel/pd.h"
void Kernel::Thread::Tlb_invalidation::execute()
{

View File

@ -14,8 +14,8 @@
*/
/* core includes */
#include <kernel/cpu.h>
#include <kernel/thread.h>
#include "../../../kernel/cpu.h"
#include "../../../kernel/thread.h"
using namespace Kernel;

View File

@ -19,7 +19,7 @@
#include <drivers/timer/util.h>
/* core includes */
#include <kernel/timer.h>
#include "../../kernel/timer.h"
#include <platform.h>
using namespace Genode;

View File

@ -23,7 +23,7 @@
#include <port_io.h>
#include <board.h>
namespace Board { class Timer; }
namespace Board { struct Timer; }
/**
* LAPIC-based timer driver for core

View File

@ -13,7 +13,7 @@
#include <bios_data_area.h>
#include <platform.h>
#include <kernel/cpu.h>
#include "../../kernel/cpu.h"
#include <map_local.h>
using namespace Genode;

View File

@ -22,8 +22,8 @@
#include <base/internal/native_utcb.h>
/* core includes */
#include <map_local.h>
#include <kernel/kernel.h>
#include "map_local.h"
#include "kernel/kernel.h"
#include <platform.h>
#include <platform_thread.h>

View File

@ -28,8 +28,8 @@
#include <kernel/interface.h>
namespace Genode {
struct Native_utcb;
class Native_utcb;
/**
* The main thread's UTCB, used during bootstrap of the main thread before it

View File

@ -57,13 +57,6 @@ namespace Hw
template <typename ENTRY, unsigned PAGE_SIZE_LOG2, unsigned SIZE_LOG2>
class Page_directory;
using Level_3_translation_table =
Page_directory<Level_4_translation_table,
SIZE_LOG2_2MB, SIZE_LOG2_1GB>;
using Level_2_translation_table =
Page_directory<Level_3_translation_table,
SIZE_LOG2_1GB, SIZE_LOG2_512GB>;
/**
* IA-32e common descriptor.
*
@ -489,7 +482,24 @@ class Hw::Page_directory
*/
void remove_translation(addr_t vo, size_t size, Allocator & alloc) {
_range_op(vo, 0, size, Remove_func(alloc)); }
} __attribute__((aligned(1 << ALIGNM_LOG2)));
};
namespace Hw {
struct Level_3_translation_table :
Page_directory<
Level_4_translation_table,
SIZE_LOG2_2MB, SIZE_LOG2_1GB>
{ } __attribute__((aligned(1 << ALIGNM_LOG2)));
struct Level_2_translation_table :
Page_directory<
Level_3_translation_table,
SIZE_LOG2_1GB, SIZE_LOG2_512GB>
{ } __attribute__((aligned(1 << ALIGNM_LOG2)));
}
class Hw::Pml4_table

View File

@ -56,7 +56,7 @@ namespace Hw
* \param p pointer
* \param alignm_log2 log2 of the required alignment
*/
constexpr bool aligned(void * const p, addr_t alignm_log2) {
inline bool aligned(void * const p, addr_t alignm_log2) {
return (addr_t)p == trunc((addr_t)p, alignm_log2); }
/**

View File

@ -25,10 +25,11 @@
#include <base/internal/unmanaged_singleton.h>
/* core-local includes */
#include <kernel/signal_receiver.h>
#include <hw/mapping.h>
#include <object.h>
#include <rpc_cap_factory.h>
#include "rpc_cap_factory.h"
#include "../core/kernel/signal_receiver.h"
#include "../core/kernel/object.h"
#include "../core/kernel/thread.h"
namespace Genode
{

View File

@ -24,9 +24,9 @@
/* base-hw includes */
#include <hw/boot_info.h>
#include <hw/memory_region.h>
#include <kernel/configuration.h>
#include <kernel/core_interface.h>
#include <kernel/pd.h>
#include "../core/kernel/configuration.h"
#include "../core/kernel/core_interface.h"
#include "../core/kernel/pd.h"
/* core includes */
#include <platform_generic.h>
@ -37,7 +37,7 @@
#include <board.h>
namespace Genode {
class Address_space;
struct Address_space;
class Platform;
};

View File

@ -17,13 +17,13 @@
/* Core includes */
#include <translation_table.h>
#include <platform.h>
#include <address_space.h>
#include <hw/page_table_allocator.h>
#include <object.h>
#include <kernel/configuration.h>
#include <kernel/object.h>
#include <kernel/pd.h>
#include "platform.h"
#include "../core/object.h"
#include "../core/kernel/configuration.h"
#include "../core/kernel/object.h"
#include "../core/kernel/pd.h"
namespace Hw
{
@ -50,7 +50,7 @@ namespace Genode
/**
* Platform specific part of Core's protection domain
*/
class Core_platform_pd;
struct Core_platform_pd;
using Hw::Page_flags;
}

View File

@ -25,16 +25,16 @@
/* core includes */
#include <address_space.h>
#include <object.h>
#include "../core/object.h"
/* kernel includes */
#include <kernel/core_interface.h>
#include <kernel/thread.h>
#include "../core/kernel/core_interface.h"
#include "../core/kernel/thread.h"
namespace Genode {
class Pager_object;
class Thread_state;
struct Thread_state;
class Rm_client;
class Platform_thread;
class Platform_pd;

View File

@ -23,8 +23,8 @@
#include <base/log.h>
/* core-local includes */
#include <object.h>
#include <kernel/thread.h>
#include "../core/object.h"
#include "../core/kernel/thread.h"
/* base-internal includes */
#include <base/internal/capability_space.h>

View File

@ -0,0 +1,46 @@
include_rules
BASE_COMMON_DIR = $(BASE_DIR)/src/lib/base-common
include $(BASE_COMMON_DIR)/Tupfile.inc
SRC_CC += $(BASE_COMMON_DIR)/ansi_c.cc
SRC_CC += $(BASE_COMMON_DIR)/allocator_avl.cc
SRC_CC += $(BASE_COMMON_DIR)/avl_tree.cc
SRC_CC += $(BASE_COMMON_DIR)/child.cc
SRC_CC += $(BASE_COMMON_DIR)/child_process.cc
SRC_CC += $(BASE_COMMON_DIR)/component.cc
SRC_CC += $(BASE_COMMON_DIR)/console.cc
SRC_CC += $(BASE_COMMON_DIR)/elf_binary.cc
SRC_CC += $(BASE_COMMON_DIR)/entrypoint.cc
SRC_CC += $(BASE_COMMON_DIR)/env_session_id_space.cc
SRC_CC += $(BASE_COMMON_DIR)/heap.cc
SRC_CC += $(BASE_COMMON_DIR)/lock.cc
SRC_CC += $(BASE_COMMON_DIR)/log.cc
SRC_CC += $(BASE_COMMON_DIR)/output.cc
SRC_CC += $(BASE_COMMON_DIR)/raw_output.cc
SRC_CC += $(BASE_COMMON_DIR)/region_map_client.cc
SRC_CC += $(BASE_COMMON_DIR)/registry.cc
SRC_CC += $(BASE_COMMON_DIR)/rm_session_client.cc
SRC_CC += $(BASE_COMMON_DIR)/root_proxy.cc
SRC_CC += $(BASE_COMMON_DIR)/rpc_dispatch_loop.cc
SRC_CC += $(BASE_COMMON_DIR)/rpc_entrypoint.cc
SRC_CC += $(BASE_COMMON_DIR)/session_state.cc
SRC_CC += $(BASE_COMMON_DIR)/signal_common.cc
SRC_CC += $(BASE_COMMON_DIR)/slab.cc
SRC_CC += $(BASE_COMMON_DIR)/sleep.cc
SRC_CC += $(BASE_COMMON_DIR)/sliced_heap.cc
SRC_CC += $(BASE_COMMON_DIR)/stack_allocator.cc
SRC_CC += $(BASE_COMMON_DIR)/stack_protector.cc
SRC_CC += $(BASE_COMMON_DIR)/thread.cc
SRC_CC += $(BASE_COMMON_DIR)/thread_myself.cc
SRC_CC += $(BASE_COMMON_DIR)/trace.cc
SRC_CC += $(BASE_COMMON_DIR)/vm_session.cc
SRC_CC += ipc.cc
SRC_CC += signal_transmitter.cc
SRC_CC += thread_bootstrap.cc
: foreach $(SRC_CC) |> !cxx |> {obj}
: foreach $(SRC_S) |> !asm |> {obj}
: {obj} |> !ar |> base-hw-common.lib.a | $(REP_DIR)/<base-hw-common>

View File

@ -0,0 +1,22 @@
include_rules
BASE_LIB_DIR = $(BASE_DIR)/src/lib/base
SRC_CC += $(BASE_LIB_DIR)/default_log.cc
SRC_CC += $(BASE_LIB_DIR)/env_reinit.cc
SRC_CC += $(BASE_LIB_DIR)/heartbeat.cc
SRC_CC += $(BASE_LIB_DIR)/main_thread_cap.cc
SRC_CC += $(BASE_LIB_DIR)/rpc_cap_alloc.cc
SRC_CC += $(BASE_LIB_DIR)/stack_area.cc
SRC_CC += $(BASE_LIB_DIR)/stack_area_addr.cc
SRC_CC += cache.cc
SRC_CC += capability.cc
SRC_CC += env_deprecated.cc
SRC_CC += native_utcb.cc
SRC_CC += raw_write_string.cc
SRC_CC += signal_receiver.cc
SRC_CC += thread_start.cc
: foreach $(SRC_CC) |> !cxx |> {base-obj}
: {base-obj} |> !ar |> base-hw.lib.a | $(REP_DIR)/<base-hw>

View File

@ -0,0 +1,46 @@
include_rules
include $(BASE_DIR)/src/lib/ldso/Tuprules.tup
: foreach $(LDSO_DIR)/*.cc |> !cxx |> {obj}
: foreach $(LDSO_SPEC_DIR)/*.s |> !asm |> {obj}
LDFLAGS += -shared --eh-frame-hdr
: $(BASE_DIR)/lib/symbols/ld \
|> \
echo -e '{\n\tglobal:' >> %o; \
sed -n "s/^\(\w\+\) .*/\t\t\1;/p" %f >> %o; \
echo -e "\tlocal: *;\n};" >> %o; \
|> symbol.map
LDFLAGS += -Bsymbolic-functions --version-script=symbol.map
ifeq (@(TUP_ARCH),i386)
LDFLAGS += -T$(LDSO_DIR)/linux-32.ld
else
LDFLAGS += -T$(LDSO_DIR)/linker.ld
LDFLAGS += --entry=_start
endif
LDFLAGS += -z max-page-size=0x1000
LDFLAGS += -T$(BASE_DIR)/src/ld/genode_rel.ld
PKG_LIBS = -L$(DEV_DIR)/lib `$(PKG_CONFIG) --libs alarm cxx ldso-startup timeout`
OUTPUT = ld-hw.lib.so
ifdef NIX_OUTPUTS_DEV
OUTPUT = ld.lib.so
endif
: {obj} | \
$(DEV_DIR)/<lib> \
$(DEV_DIR)/<pkg-config> \
$(REP_DIR)/<base-common> \
$(REP_DIR)/<base-hw> \
$(REP_DIR)/<startup> \
symbol.map \
|> $(LD) -o %o $(LD_MARCH) $(LDFLAGS) --whole-archive --start-group $(PKG_LIBS) %<base-common> %<base-hw> %<startup> %f --end-group --no-whole-archive $(LIBGCC) \
|> $(OUTPUT) $(REP_DIR)/<ld> {lib}
: foreach {lib} |> !collect_shared |>

View File

@ -0,0 +1,2 @@
include_rules
include &(BASE_DIR)/src/lib/startup/Tupfile.inc

View File

@ -0,0 +1,21 @@
include_rules
ifeq (@(TUP_ARCH),arm)
SRC_CC += ../base-common/arm/kernel/*.cc
endif
ifeq (@(TUP_ARCH),aarch64)
SRC_CC += ../base-common/arm_64/kernel/*.cc
endif
ifeq (@(TUP_ARCH),riscv)
SRC_CC += ../base-common/riscv/kernel/*.cc
endif
ifeq (@(TUP_ARCH),x86_64)
SRC_CC += ../base-common/x86_64/kernel/*.cc
endif
: foreach $(SRC_CC) |> !cxx |> {obj}
: {obj} |> !ar |> syscall-hw.lib.a | $(REP_DIR)/<syscall-hw>

View File

@ -0,0 +1,12 @@
LIBS += genode-base
include_rules
BASE_TIMER_DIR = $(BASE_DIR)/src/timer
CPPFLAGS += -I$(BASE_TIMER_DIR)/include
CPPFLAGS += -I.
#TODO: ^ FAIL
: foreach *.cc $(BASE_TIMER_DIR)/*.cc |> !cxx |> %B.hw.o {obj}
: {obj} | $(REP_DIR)/<syscall-hw> |> !prg %<syscall-hw> |> hw_timer_drv {bin}
: {bin} |> !collect_bin |>

View File

@ -0,0 +1,2 @@
include &(BASE_DIR)/Tuprules.tup
REP_DIR = $(TUP_CWD)

View File

@ -0,0 +1,7 @@
ifndef LINUX_HEADERS
error CONFIG_LINUX_HEADERS not defined
endif
CPPFLAGS += -I$(TUP_CWD)/include
CPPFLAGS += -I$(BASE_DIR)/src/include
CPPFLAGS += -I@(LINUX_HEADERS)/include

View File

@ -0,0 +1,59 @@
include_rules
GEN_CORE_DIR = $(BASE_DIR)/src/core
CPPFLAGS += -D_GNU_SOURCE
CPPFLAGS += \
-I$(REP_DIR)/src/core/include \
-I$(GEN_CORE_DIR)/include \
SRC_CC += *.cc
SRC_CC += \
$(GEN_CORE_DIR)/capability_space.cc \
$(GEN_CORE_DIR)/core_log.cc \
$(GEN_CORE_DIR)/core_rpc_cap_alloc.cc \
$(GEN_CORE_DIR)/cpu_session_component.cc \
$(GEN_CORE_DIR)/cpu_session_support.cc \
$(GEN_CORE_DIR)/cpu_thread_component.cc \
$(GEN_CORE_DIR)/default_log.cc \
$(GEN_CORE_DIR)/heartbeat.cc \
$(GEN_CORE_DIR)/main.cc \
$(GEN_CORE_DIR)/pd_session_component.cc \
$(GEN_CORE_DIR)/pd_session_support.cc \
$(GEN_CORE_DIR)/platform_services.cc \
$(GEN_CORE_DIR)/ram_dataspace_factory.cc \
$(GEN_CORE_DIR)/rpc_cap_factory_l4.cc \
$(GEN_CORE_DIR)/signal_receiver.cc \
$(GEN_CORE_DIR)/signal_source_component.cc \
$(GEN_CORE_DIR)/signal_transmitter_proxy.cc \
$(GEN_CORE_DIR)/trace_session_component.cc \
$(GEN_CORE_DIR)/version.cc \
CXXFLAGS_$(GEN_CORE_DIR)/version.cc += -DGENODE_VERSION=\"`git describe`\"
: foreach $(SRC_CC) |> !cxx |> {obj}
LDFLAGS += -gc-sections
LDFLAGS += -z max-page-size=0x1000
LDFLAGS += -nostdlib
LDFLAGS += -Ttext=0x01000000
LDFLAGS += -T$(BASE_DIR)/src/ld/genode.ld
LDFLAGS += -T$(REP_DIR)/src/ld/stack_area.ld
ifdef IS_LLVM
PKG_LIBS = -L$(DEV_DIR)/lib `$(PKG_CONFIG) --libs cxx-baremetal`
else
PKG_LIBS = -L$(DEV_DIR)/lib `$(PKG_CONFIG) --libs cxx`
endif
: {obj} | \
$(DEV_DIR)/<lib> \
$(DEV_DIR)/<pkg-config> \
$(REP_DIR)/<base-common> \
$(REP_DIR)/<startup> \
$(REP_DIR)/<syscall> \
|> $(LD) -o %o $(LD_MARCH) $(LDFLAGS) --start-group %f %<base-common> %<startup> %<syscall> $(PKG_LIBS) -end-group $(LIBGCC) \
|> core-linux $(REP_DIR)/<core> {bin}
: {bin} |> !collect_bin |>

Some files were not shown because too many files have changed in this diff Show More