Compare commits

..

5 Commits

Author SHA1 Message Date
Ehmry - 7c83f3da91 WiP! Update flake.nix for big adjustment to Nixpkgs and CC wrapper 2020-01-01 14:13:23 +01:00
Ehmry - cb2bc510bf Pass toolchain paths to Tup directly as configuration 2020-01-01 14:12:28 +01:00
Ehmry - c6968d30ad WiP! Adjust Tupfiles to build with both LLVM and GCC 2020-01-01 14:11:31 +01:00
Ehmry - feccc31bed WiP Move toolchain settings to conditional includes 2019-12-31 09:39:32 +01:00
Ehmry - 0ea06cc2a1 WiP! Use binary patched 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
2019-12-31 09:14:17 +01:00
122 changed files with 631 additions and 1161 deletions

7
.gitignore vendored
View File

@ -13,10 +13,3 @@ result-*
/.tup
/build-*
/configs
##### TUP GITIGNORE #####
##### Lines below automatically generated by Tup.
##### Do not edit.
.tup
/.gitignore
/dev
/out

3
.gitmodules vendored
View File

@ -0,0 +1,3 @@
[submodule "repos/base-nova/src/NOVA"]
path = repos/base-nova/src/NOVA
url = git://depot.h4ck.me/srv/git/NOVA

View File

@ -1,29 +1,16 @@
**FORK AHEAD**
This a fork of the Genode OS reference implementation with a replacement
build system that is humane and interoperable.
=================================
Genode Operating System Framework
=================================
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
https://genode.org/documentation/general-overview
:Official project website for the Genode OS Framework:
[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
@ -46,14 +33,15 @@ 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
@ -65,75 +53,79 @@ 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]

View File

View File

@ -6,18 +6,17 @@ 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
include tup-genode/gcc.tup
endif
ifdef IS_LLVM
include Tuprules.llvm
include tup-genode/llvm.tup
endif
ifeq ($(TOOLCHAIN_CONFIGURED),)
@ -39,12 +38,19 @@ 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
|> ^o LD %o^ \
$(LD) $(LD_MARCH) $(LDFLAGS) \
%f \
-L$(DEV_LIB_DIR) \
`$(PKG_CONFIG) --libs $(LIBS) genode-prg` \
$(LIBGCC) \
-o %o \
|> %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 \
$STRIP -o %o %f \
|> $(OUT_DIR)/bin/%b $(OUT_DIR)/<bin>
!collect_shared = |> ^ COLLECT %b^ \
@ -56,14 +62,9 @@ GENODE_DIR = $(TUP_CWD)
|> $(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_DIR = $(DEV_DIR)/lib/pkgconfig
PKG_CONFIG = PKG_CONFIG_PATH=$(PKG_CONFIG_DIR) @(PKGCONFIG)
endif
CFLAGS += -g
CXXFLAGS += -g
@ -74,11 +75,13 @@ else
OLEVEL = -O2
endif
!strip = |> $(STRIP) -o %o %f |>
export STRIP
!strip = |> $STRIP -o %o %f |>
!ln = |> ln -s %f %o |>
!ar = |> $(AR) -rcs %o %f |> %d.a
export AR
!ar = |> $AR -rcs %o %f |> %d.a
GIT_VERSION = `git describe || echo @(VERSION)`

246
default.nix Normal file
View File

@ -0,0 +1,246 @@
let
pinnedNixpkgs = import (builtins.fetchGit {
url = "https://gitea.c3d2.de/ehmry/nixpkgs.git";
ref = "genode";
});
in { localSystem ? "x86_64-linux", crossSystem ? "x86_64-genode"
, nixpkgs ? pinnedNixpkgs, self ? { } }:
let
nixpkgs' = if builtins.isAttrs nixpkgs then
nixpkgs
else
nixpkgs { inherit localSystem crossSystem; };
inherit (nixpkgs') buildPackages llvmPackages;
sourceForgeToolchain = nixpkgs'.buildPackages.callPackage ./toolchain.nix { };
stdenvLlvm = let inherit (nixpkgs') stdenv;
in assert stdenv.cc.isClang; stdenv;
stdenvGcc = let
stdenv =
nixpkgs'.stdenvAdapters.overrideCC nixpkgs'.stdenv sourceForgeToolchain;
in assert stdenv.cc.isGNU; stdenv;
src = self.outPath or (builtins.fetchGit ./.);
version = self.lastModified or "unstable";
inherit (stdenvLlvm) lib targetPlatform;
specs = with targetPlatform;
[ ]
++ lib.optional is32bit "32bit"
++ lib.optional is64bit "64bit"
++ lib.optional isAarch32 "arm"
++ lib.optional isAarch64 "arm_64"
++ lib.optional isRiscV "riscv"
++ lib.optional isx86 "x86"
++ lib.optional isx86_32 "x86_32"
++ lib.optional isx86_64 "x86_64";
toTupConfig = stdenv: attrs:
let
tupArch = with stdenv.targetPlatform;
if isAarch32 then
"arm"
else
if isAarch64 then
"arm64"
else
if isx86_32 then
"i386"
else
if isx86_64 then
"x86_64"
else
abort "unhandled targetPlatform";
attrs' = with stdenv; { TUP_ARCH = tupArch; } // attrs;
in nixpkgs'.writeTextFile {
name = "tup.config";
text = with builtins;
let
op = config: name: ''
${config}CONFIG_${name}=${getAttr name attrs}
'';
in foldl' op "" (attrNames attrs);
};
tupConfigGcc = let
f = stdenv:
let prefix = bin: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}${bin}";
in {
AR = prefix "ar";
CC = prefix "gcc";
CXX = prefix "g++";
LD = prefix "ld";
NM = prefix "nm";
OBJCOPY = prefix "objcopy";
OBJDUMP = prefix "objdump";
RANLIB = prefix "ranlib";
READELF = prefix "readelf";
STRIP = prefix "strip";
PKGCONFIG = "${nixpkgs'.buildPackages.pkgconfig}/bin/pkg-config";
IS_GCC = "";
LINUX_HEADERS = buildPackages.glibc.dev;
VERSION = version;
};
in toTupConfig stdenvGcc (f stdenvGcc);
tupConfigLlvm = let
f = stdenv:
let prefix = bin: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}${bin}";
in {
AR = prefix "ar";
CC = prefix "cc";
CXX = prefix "c++";
LD = prefix "ld";
NM = prefix "nm";
OBJCOPY = prefix "objcopy";
OBJDUMP = prefix "objdump";
RANLIB = prefix "ranlib";
READELF = prefix "readelf";
STRIP = prefix "strip";
PKGCONFIG = "${nixpkgs'.buildPackages.pkgconfig}/bin/pkg-config";
IS_LLVM = "";
LIBCXXABI = llvmPackages.libcxxabi;
LIBCXX = llvmPackages.libcxx;
LIBUNWIND_BAREMETAL =
llvmPackages.libunwind.override { isBaremetal = true; };
LIBUNWIND = llvmPackages.libunwind;
LINUX_HEADERS = buildPackages.glibc.dev;
VERSION = version;
};
in toTupConfig stdenvLlvm (f stdenvLlvm);
buildRepo = { stdenv, repo, repoInputs }:
let
in stdenv.mkDerivation {
pname = "genode-" + repo;
inherit src repo specs version;
setupHook = ./setup-hooks.sh;
nativeBuildInputs = repoInputs;
# This is wrong, why does pkg-config not collect buildInputs?
propagatedNativeBuildInputs = repoInputs;
depsBuildBuild = with buildPackages; [ llvm pkgconfig tup ];
tupConfig = if stdenv.cc.isGNU then
tupConfigGcc
else if stdenv.cc.isClang then
tupConfigLlvm
else
throw "no Tup config for this stdenv";
configurePhase = ''
# Configure Tup
set -v
install -m666 $tupConfig tup.config
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config
echo CONFIG_NIX_OUTPUTS_DEV=$out >> tup.config
# Disable other repos
for R in repos/*; do
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete
done
# Scan repository and generate script
tup init
tup generate buildPhase.sh
# Redirect artifacts to Nix store
mkdir -p $out/lib $out/include
ln -s $out out
ln -s $out dev
'';
buildPhase = ''
test -d repos/$repo/src/ld && cp -rv repos/$repo/src/ld $out/
pushd .
set -v
source buildPhase.sh
set +v
popd
'';
installPhase = ''
# Populate the "dev" headers
if [ -d "repos/$repo/include" ]; then
for DIR in repos/$repo/include; do
for SPEC in $specs; do
if [ -d $DIR/spec/$SPEC ]; then
cp -r $DIR/spec/$SPEC/* $out/include
rm -r $DIR/spec/$SPEC
fi
done
rm -rf $DIR/spec
cp -r $DIR $out/
done
fi
touch $out/.genode
for pc in $out/lib/pkgconfig/*.pc; do
sed -e "s|^Libs: |Libs: -L$out/lib |" -i $pc
done
'';
meta = with stdenv.lib; {
description =
"The Genode operation system framework (${repo} repository).";
homepage = "https://genode.org/";
license = licenses.agpl3;
maintainers = [ maintainers.ehmry ];
};
};
buildRepo' = { ... } @ args: buildRepo ({ stdenv = stdenvGcc; } // args);
in rec {
base = buildRepo' {
repo = "base";
repoInputs = [ ];
};
base-linux = buildRepo' {
repo = "base-linux";
repoInputs = [ base ];
};
base-nova = buildRepo' {
repo = "base-nova";
repoInputs = [ base ];
};
os = buildRepo' {
repo = "os";
repoInputs = [ base ];
};
gems = buildRepo' {
repo = "gems";
repoInputs = [ os ];
};
inherit stdenvGcc stdenvLlvm tupConfigGcc tupConfigLlvm;
}

View File

@ -1,55 +1,10 @@
{
"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"
"narHash": "sha256-ddVEifoNDi/5YVOEnoJRjRiIM4vfa5m46+t0Wf7beQo=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode-devel",
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode-devel&rev=ffad0e9b6604e2670de1d756d102f91d5b951359"
}
},
"version": 3

View File

@ -1,14 +1,58 @@
{
description = "Genode development flake";
edition = 201909;
inputs.genodepkgs.uri = "git+https://git.sr.ht/~ehmry/genodepkgs";
description = "Genode system flake";
outputs = { self, nixpkgs, genodepkgs }: {
inputs.nixpkgs.uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode-devel";
devShell.x86_64-linux =
genodepkgs.packages.x86_64-linux-x86_64-genode.genode.base;
outputs = { self, nixpkgs }:
let
mkOutput = { system, localSystem, crossSystem }: rec {
packages = import ./default.nix {
inherit localSystem crossSystem self;
nixpkgs = builtins.getAttr system nixpkgs.legacyPackages;
};
defaultPackage = packages.base-linux;
devShell = packages.base;
};
localSystems = [ "x86_64-linux" ];
crossSystems = [ "x86_64-genode" ];
forAllCrossSystems = f:
with builtins;
let
f' = localSystem: crossSystem:
let system = localSystem + "-" + crossSystem;
in {
name = system;
value = f { inherit system localSystem crossSystem; };
};
list = nixpkgs.lib.lists.crossLists f' [ localSystems crossSystems ];
attrSet = listToAttrs list;
in attrSet;
finalize = outputs:
with builtins;
let
outputs' = outputs // {
x86_64-linux = getAttr "x86_64-linux-x86_64-genode" outputs;
};
systems = attrNames outputs';
outputAttrs = attrNames (head (attrValues outputs'));
list = map (attr: {
name = attr;
value = listToAttrs (map (system: {
name = system;
value = getAttr attr (getAttr system outputs');
}) systems);
}) outputAttrs;
in listToAttrs list;
final = finalize (forAllCrossSystems mkOutput);
in final;
};
}

View File

@ -18,18 +18,20 @@ endif
-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; \
%f \
| $(CC) -x assembler -c - -o tmp.o; \
$(LD) -o %o \
-shared \
-T &(LD_SCRIPT_SO) \
stub.o; \
rm -v stub.o stub.s; \
tmp.o; \
rm tmp.o; \
|> $(DEV_LIB_DIR)/%B.lib.so $(DEV_DIR)/<lib>
BASE_DIR = $(GENODE_DIR)/repos/base
&BASE_DIR = base
ifndef NIX_OUTPUTS_DEV
ifeq (@(TUP_ARCH),i386)
CPPFLAGS += -I$(BASE_DIR)/include/spec/x86_32
CPPFLAGS += -I$(BASE_DIR)/include/spec/x86
@ -48,3 +50,5 @@ CPPFLAGS += -I$(BASE_DIR)/include/spec/64bit
endif
CPPFLAGS += -I$(BASE_DIR)/include
endif

View File

@ -167,7 +167,7 @@ namespace Genode {
size_t max_caps() const override { return Capability_space::max_caps(); }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
};
}

View File

@ -483,7 +483,7 @@ Platform::Platform() :
** Generic platform interface **
********************************/
void Platform::wait_for_exit()
void Platform::wait_for_exit(int const &)
{
/*
* On Fiasco, Core never exits. So let us sleep forever.

View File

@ -183,7 +183,7 @@ namespace Genode {
Cap_id_allocator &cap_id_alloc() { return _cap_id_alloc; }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
};
}

View File

@ -582,7 +582,7 @@ Platform::Platform() :
** Generic platform interface **
********************************/
void Platform::wait_for_exit()
void Platform::wait_for_exit(int const &)
{
/*
* On Fiasco, Core never exits. So let us sleep forever.

View File

@ -1,8 +0,0 @@
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

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

View File

@ -1,71 +0,0 @@
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

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

View File

@ -50,7 +50,7 @@ namespace Genode
class Kernel::Irq : Genode::Avl_node<Irq>
{
friend class Genode::Avl_tree<Irq>;
friend struct Genode::Avl_node<Irq>;
friend class Genode::Avl_node<Irq>;
public:

View File

@ -32,7 +32,7 @@ namespace Kernel
/**
* Base class of all Kernel objects
*/
struct Object;
class Object;
/**
* An object identity helps to distinguish different capability owners

View File

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

View File

@ -1,37 +0,0 @@
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

@ -24,8 +24,8 @@
namespace Genode {
struct Signal_context_component;
struct Signal_source_component;
class Signal_context_component;
class 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 struct Signal_context_component;
friend class Signal_context_component;
using Signal_source_pool::Entry::cap;

View File

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

View File

@ -1,6 +0,0 @@
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

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

View File

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

View File

@ -37,7 +37,7 @@
#include <board.h>
namespace Genode {
struct Address_space;
class Address_space;
class Platform;
};
@ -128,7 +128,7 @@ class Genode::Platform : public Genode::Platform_generic
size_t vm_size() const override { return Hw::Mm::user().size; }
Rom_fs &rom_fs() override { return _rom_fs; }
void wait_for_exit() override {
void wait_for_exit(int const &) override {
while (1) { Kernel::stop_thread(); } };
bool supports_direct_unmap() const override { return true; }

View File

@ -50,7 +50,7 @@ namespace Genode
/**
* Platform specific part of Core's protection domain
*/
struct Core_platform_pd;
class Core_platform_pd;
using Hw::Page_flags;
}

View File

@ -34,7 +34,7 @@
namespace Genode {
class Pager_object;
struct Thread_state;
class Thread_state;
class Rm_client;
class Platform_thread;
class Platform_pd;

View File

@ -1,46 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,46 +0,0 @@
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

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

View File

@ -1,21 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -41,11 +41,7 @@ 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
LDFLAGS += -L$(DEV_LIB_DIR) `$(PKG_CONFIG) --libs cxx-baremetal`
: {obj} | \
$(DEV_DIR)/<lib> \
@ -53,7 +49,7 @@ endif
$(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) \
|> !ld %<base-common> %<startup> %<syscall> \
|> core-linux $(REP_DIR)/<core> {bin}
: {bin} |> !collect_bin |>

View File

@ -129,7 +129,9 @@ namespace Genode {
*/
size_t max_caps() const override { return 10000; }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
void child_exit() override;
};
}

View File

@ -113,7 +113,7 @@ Platform::Platform()
}
void Platform::wait_for_exit()
void Platform::wait_for_exit(int const &exit_value)
{
for (;;) {
@ -145,9 +145,11 @@ void Platform::wait_for_exit()
Platform_thread::submit_exception(pid);
}
}
lx_exit_group(0);
lx_exit_group(exit_value);
}
void Platform::child_exit() { sigint_handler(0); }
/*****************************
** Support for IPC library **

View File

@ -1,8 +1,6 @@
include_rules
GENERIC_DIR = $(BASE_DIR)/src/lib/base-common
include $(GENERIC_DIR)/Tupfile.inc
GENERIC_SRC_CC += \
$(GENERIC_DIR)/ansi_c.cc \
$(GENERIC_DIR)/allocator_avl.cc \
$(GENERIC_DIR)/avl_tree.cc \
$(GENERIC_DIR)/capability.cc \
@ -32,7 +30,8 @@ GENERIC_SRC_CC += \
$(GENERIC_DIR)/thread_myself.cc \
$(GENERIC_DIR)/trace.cc \
#CXXFLAGS += -mllvm -opt-bisect-limit=1
: foreach $(GENERIC_SRC_CC) |> !cxx |> {obj}
: foreach *.cc |> !cxx |> {obj}
: foreach $(SRC_S) |> !asm |> {obj}
: {obj} |> !ar |> base-linux-common.lib.a | $(REP_DIR)/<base-common>
: {obj} |> !ar |> | $(REP_DIR)/<base-common>

View File

@ -1,6 +1,17 @@
include_rules
include $(BASE_DIR)/src/lib/ldso/Tuprules.tup
ifeq (@(TUP_ARCH),x86_64)
CPPFLAGS += -I$(BASE_DIR)/src/lib/ldso/spec/x86_64
endif
LDSO_DIR = $(BASE_DIR)/src/lib/ldso
ifeq (@(TUP_ARCH),x86_64)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/x86_64
endif
CPPFLAGS += -I$(LDSO_SPEC_DIR)
CPPFLAGS = -I$(LDSO_DIR)/include $(CPPFLAGS)
: foreach $(LDSO_DIR)/*.cc |> !cxx |> {obj}
: foreach $(LDSO_SPEC_DIR)/*.s |> !asm |> {obj}
@ -21,22 +32,22 @@ LDFLAGS += -T$(REP_DIR)/src/ld/stack_area.ld
LDFLAGS += -T$(BASE_DIR)/src/ld/genode_rel.ld
LDFLAGS += --entry=_start_initial_stack
BASE_LIBS += $(REP_DIR)/src/lib/base/base-linux.lib.a
BASE_LIBS += \
$(REP_DIR)/src/lib/base/base-linux.lib.a \
PKG_LIBS = -L$(DEV_DIR)/lib `$(PKG_CONFIG) --libs alarm cxx ldso-startup timeout`
BASE_PKGS += alarm cxx ldso-startup startup timeout
OUTPUT = ld-linux.lib.so
ifdef NIX_OUTPUTS_DEV
OUTPUT = ld.lib.so
endif
LDFLAGS += -L$(DEV_LIB_DIR) `$(PKG_CONFIG) --static --libs $(BASE_PKGS)`
: $(BASE_LIBS) {obj} | \
symbol.map \
$(DEV_DIR)/<lib> \
$(DEV_DIR)/<pkg-config> \
$(REP_DIR)/<base-common> \
$(REP_DIR)/<startup> \
$(REP_DIR)/<syscall> \
|> $(LD) -o %o $(LD_MARCH) $(LDFLAGS) --whole-archive --start-group %<base-common> %<startup> %<syscall> %f $(PKG_LIBS) --end-group --no-whole-archive $(LIBGCC); printf "\x02" | dd of=%o bs=1 seek=16 count=1 conv=notrunc; |> $(OUTPUT) $(REP_DIR)/<ld> {bin}
|> \
$(LD) $(LDFLAGS) %<base-common> %<syscall> %f -o %o; \
printf "\x02" | dd of=%o bs=1 seek=16 count=1 conv=notrunc; \
|> ld-linux.lib.so $(REP_DIR)/<ld> {bin}
: {bin} |> !collect_bin |>

View File

@ -19,4 +19,4 @@ ifeq ($(SPEC_DIR),)
endif
: foreach $(SPEC_DIR)/*.S |> !asm |> {obj}
: {obj} |> !ar |> syscall-linux.lib.a | $(REP_DIR)/<syscall>
: {obj} |> !ar |> | $(REP_DIR)/<syscall>

@ -0,0 +1 @@
Subproject commit fbb002d4d6e2b6eddae4d1f0990fe71307e8c7ca

View File

@ -45,15 +45,15 @@ CXXFLAGS_$(GEN_CORE_DIR)/version.cc += -DGENODE_VERSION=\"`git describe`\"
: foreach $(SRC_CC) |> !cxx |> {obj}
PKG_LIBS = -L$(DEV_DIR)/lib `$(PKG_CONFIG) --libs cxx`
LDFLAGS += -L$(DEV_LIB_DIR) `$(PKG_CONFIG) --libs cxx-baremetal`
: {obj} | \
$(DEV_DIR)/<lib> \
$(DEV_DIR)/<pkg-config> \
$(BASE_DIR)/<base-libs> \
$(REP_DIR)/<base-common> \
$(REP_DIR)/<startup> \
$(REP_DIR)/<base-common> \
|> $(LD) $(LDFLAGS) -u _start -r \
--whole-archive --start-group %f %<base-libs> %<base-common> %<startup> $(PKG_LIBS) --no-whole-archive --end-group -o %o \
%<base-libs> %<base-common> %<startup> %f -o %o \
|> core.o $(REP_DIR)/<core> {core}
: {core} |> cp %f %o |> $(OUT_DIR)/lib/core-nova.o

View File

@ -82,7 +82,7 @@ namespace Genode {
size_t vm_size() const override { return _vm_size; }
Rom_fs &rom_fs() override { return _rom_fs; }
size_t max_caps() const override { return _max_caps; }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
bool supports_direct_unmap() const override { return true; }

View File

@ -990,5 +990,5 @@ bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, unsigned size)
** Generic platform interface **
********************************/
void Platform::wait_for_exit() { sleep_forever(); }
void Platform::wait_for_exit(int const &) { sleep_forever(); }

View File

@ -1,10 +1,8 @@
include_rules
GENERIC_DIR = $(BASE_DIR)/src/lib/base-common
include $(GENERIC_DIR)/Tupfile.inc
GENERIC_SRC_CC += \
$(GENERIC_DIR)/ansi_c.cc \
$(GENERIC_DIR)/allocator_avl.cc \
$(GENERIC_DIR)/avl_tree.cc \
$(GENERIC_DIR)/child.cc \
@ -35,7 +33,5 @@ GENERIC_SRC_CC += \
$(GENERIC_DIR)/trace.cc \
$(GENERIC_DIR)/vm_session.cc \
: foreach $(GENERIC_SRC_CC) |> !cxx |> %B.o {obj}
: foreach $(SRC_S) |> !asm |> {obj}
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !ar |> base-nova-common.lib.a | $(REP_DIR)/<base-common>
: foreach $(GENERIC_SRC_CC) |> !cxx |> %B.base.o $(REP_DIR)/<base-common> {obj}
: foreach *.cc |> !cxx |> %B.nova.o $(REP_DIR)/<base-common> {obj}

View File

@ -16,4 +16,4 @@ SRC_CC += \
: foreach $(SRC_CC) |> !cxx |> {base-obj}
: {base-obj} |> !ar |> base-nova.lib.a | $(REP_DIR)/<base-nova>
: {base-obj} |> !ar |> base-nova.lib.a

View File

@ -1,6 +1,13 @@
include_rules
include $(BASE_DIR)/src/lib/ldso/Tuprules.tup
LDSO_DIR = $(BASE_DIR)/src/lib/ldso
ifeq (@(TUP_ARCH),x86_64)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/x86_64
endif
CPPFLAGS += -I$(LDSO_SPEC_DIR)
CPPFLAGS += -I$(LDSO_DIR)/include
: foreach $(LDSO_DIR)/*.cc |> !cxx |> {obj}
: foreach $(LDSO_SPEC_DIR)/*.s |> !asm |> {obj}
@ -16,7 +23,7 @@ LDFLAGS += -shared --eh-frame-hdr
LDFLAGS += -Bsymbolic-functions --version-script=symbol.map
ifeq (@(TUP_ARCH),i386)
ifeq (@(TUP_ARCH),x86_32)
LDFLAGS += -T$(LDSO_DIR)/linux-32.ld
else
LDFLAGS += -T$(LDSO_DIR)/linker.ld
@ -26,21 +33,25 @@ 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`
BASE_LIBS += $(REP_DIR)/src/lib/base/base-nova.lib.a
OUTPUT = ld-nova.lib.so
ifdef NIX_OUTPUTS_DEV
OUTPUT = ld.lib.so
endif
LDFLAGS += -L$(DEV_LIB_DIR) `$(PKG_CONFIG) --static --libs $(BASE_PKGS)`
: {obj} | \
$(DEV_DIR)/<lib> \
$(DEV_DIR)/<pkg-config> \
$(REP_DIR)/<base-common> \
$(REP_DIR)/<base-nova> \
$(REP_DIR)/<startup> \
symbol.map \
|> $(LD) -o %o $(LD_MARCH) $(LDFLAGS) --whole-archive --start-group $(PKG_LIBS) %<base-common> %<base-nova> %<startup> %f --end-group --no-whole-archive $(LIBGCC) \
|> $(OUTPUT) $(REP_DIR)/<ld> {lib}
|> \
$(LD) -o %o \
$(LD_MARCH) $(LDFLAGS) \
--whole-archive --start-group \
%<base-common> \
%<startup> \
%f \
--end-group --no-whole-archive \
$(LIBGCC) \
|> ld-nova.lib.so $(REP_DIR)/<ld> {bin}
: foreach {lib} |> !collect_shared |>
: {bin} |> !collect_bin |>

View File

@ -139,7 +139,7 @@ namespace Genode {
Rom_fs &rom_fs() override { return _rom_fs; }
size_t max_caps() const override { return Capability_space::max_caps(); }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
bool supports_direct_unmap() const override { return true; }

View File

@ -215,7 +215,7 @@ Platform::Platform()
** Generic platform interface **
********************************/
void Platform::wait_for_exit()
void Platform::wait_for_exit(int const &)
{
/*
* On OKL4, core never exits. So let us sleep forever.

View File

@ -153,7 +153,7 @@ namespace Genode {
Rom_fs &rom_fs() override { return _rom_fs; }
size_t max_caps() const override { return Capability_space::max_caps(); }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
Affinity::Space affinity_space() const override
{

View File

@ -640,7 +640,7 @@ Platform::Platform()
** Generic platform interface **
********************************/
void Platform::wait_for_exit()
void Platform::wait_for_exit(int const &)
{
/*
* On Pistachio, core never exits. So let us sleep forever.

View File

@ -274,7 +274,7 @@ class Genode::Platform : public Platform_generic
Cap_sel asid_pool() const { return _asid_pool_sel; }
void wait_for_exit() override;
void wait_for_exit(int const &) override;
/**
* Determine size of a core local mapping required for a

View File

@ -661,7 +661,7 @@ void Platform::reset_sel(unsigned sel)
}
void Platform::wait_for_exit()
void Platform::wait_for_exit(int const &)
{
sleep_forever();
}

View File

@ -24,4 +24,5 @@ GCC_INCLUDE = -I`$(CC) -print-file-name=include`
-c %f -o %o \
|> %B.o
!ld = |> ^ MERGE %o^ $(LD) -o %o $(LDFLAGS) %f |>
!ld = |> ^ MERGE %o^ $(LD) \
$(LDFLAGS) --whole-archive --start-group %f --end-group --no-whole-archive -o %o |>

View File

@ -23,7 +23,7 @@
#include <base/capability.h>
/* only needed for base-hw */
namespace Kernel { class Signal_receiver; }
namespace Kernel { struct Signal_receiver; }
namespace Genode {
@ -97,7 +97,7 @@ class Genode::Signal
*/
Signal(Data data);
friend class Kernel::Signal_receiver;
friend struct Kernel::Signal_receiver;
friend class Signal_receiver;
friend class Signal_context;

View File

@ -649,14 +649,9 @@ dl_unwind_find_exidx T
genode_argc D 4
genode_argv D 8
genode_envp B 8
longjmp W
lx_environ B 8
memcmp W
memcpy W
memmove W
memset W
setjmp W
stdout_reconnect T
strcmp W
strlen W
wait_for_continue T

View File

@ -30,7 +30,12 @@ namespace Genode {
*/
Log_session_component *_create_session(const char *args) override
{
return new (md_alloc()) Log_session_component(label_from_args(args));
char label_buf[Log_session_component::LABEL_LEN];
Arg label_arg = Arg_string::find_arg(args, "label");
label_arg.string(label_buf, sizeof(label_buf), "");
return new (md_alloc()) Log_session_component(label_buf);
}
public:

View File

@ -17,32 +17,27 @@
#include <util/string.h>
#include <base/log.h>
#include <base/rpc_server.h>
#include <base/session_label.h>
#include <log_session/log_session.h>
namespace Genode {
class Log_session_component : public Rpc_object<Log_session>
{
public:
enum { LABEL_LEN = 128 };
private:
Session_label const _label;
static Session_label _expand_label(Session_label const &label)
{
if (label == "init -> unlabeled")
return "";
else
return Session_label("[", label, "] ");
}
char _label[LABEL_LEN];
public:
/**
* Constructor
*/
Log_session_component(Session_label const &label)
: _label(_expand_label(label)) { }
Log_session_component(const char *label) {
strncpy(_label, label, sizeof(_label)); }
/*****************
@ -59,18 +54,21 @@ namespace Genode {
char const *string = string_buf.string();
size_t len = strlen(string);
char buf[string_buf.MAX_SIZE];
unsigned from_i = 0;
for (unsigned i = 0; i < len; i++) {
if (string[i] == '\n') {
log(_label, Cstring(string + from_i, i - from_i));
memcpy(buf, string + from_i, i - from_i);
buf[i - from_i] = 0;
log("[", Cstring(_label), "] ", Cstring(buf));
from_i = i + 1;
}
}
/* if last character of string was not a line break, add one */
if (from_i < len)
log(_label, Cstring(string + from_i));
log("[", Cstring(_label), "] ", Cstring(string + from_i));
return len;
}

View File

@ -29,16 +29,14 @@ namespace Genode {
}
class Genode::Native_cpu_component
struct Genode::Native_cpu_component
{
public:
Native_cpu_component(Cpu_session_component &, char const *) { }
Native_cpu_component(Cpu_session_component &, char const *) { }
Capability<Cpu_session::Native_cpu> cap()
{
return Capability<Cpu_session::Native_cpu>();
}
Capability<Cpu_session::Native_cpu> cap()
{
return Capability<Cpu_session::Native_cpu>();
}
};
#endif /* _CORE__INCLUDE__NATIVE_CPU_COMPONENT_H_ */

View File

@ -77,7 +77,12 @@ namespace Genode {
/**
* Wait for exit condition
*/
virtual void wait_for_exit() = 0;
virtual void wait_for_exit(int const &exit_value) = 0;
/**
* Handle exit of child
*/
virtual void child_exit() { };
/**
* Return true if platform supports direct unmap (no mapping db)

View File

@ -119,6 +119,8 @@ class Core_child : public Child_policy
Child _child;
int &_exit_value;
public:
/**
@ -128,14 +130,16 @@ class Core_child : public Child_policy
Pd_session &core_pd, Capability<Pd_session> core_pd_cap,
Cpu_session &core_cpu, Capability<Cpu_session> core_cpu_cap,
Cap_quota cap_quota, Ram_quota ram_quota,
Rpc_entrypoint &ep)
Rpc_entrypoint &ep,
int &exit_value)
:
_services(services),
_core_pd_cap (core_pd_cap), _core_pd (core_pd),
_core_cpu_cap(core_cpu_cap), _core_cpu(core_cpu),
_cap_quota(Child::effective_quota(cap_quota)),
_ram_quota(Child::effective_quota(ram_quota)),
_child(local_rm, ep, *this)
_child(local_rm, ep, *this),
_exit_value(exit_value)
{ }
@ -174,6 +178,13 @@ class Core_child : public Child_policy
_core_cpu.transfer_quota(cap, Cpu_session::quota_lim_upscale(100, 100));
}
void exit(int exit_value) override
{
_exit_value = exit_value;
Child_policy::exit(exit_value);
platform().child_exit();
}
Pd_session &ref_pd() override { return _core_pd; }
Pd_session_capability ref_pd_cap() const override { return _core_pd_cap; }
@ -221,6 +232,8 @@ namespace Genode {
int main()
{
static int exit_value { 0 };
/**
* Disable tracing within core because it is currently not fully implemented.
*/
@ -309,10 +322,10 @@ int main()
static Reconstructible<Core_child>
init(services, local_rm, core_pd, core_pd_cap, core_cpu, core_cpu_cap,
init_cap_quota, init_ram_quota, ep);
init_cap_quota, init_ram_quota, ep, exit_value);
platform().wait_for_exit();
platform().wait_for_exit(exit_value);
init.destruct();
return 0;
return exit_value;
}

View File

@ -1,5 +1,5 @@
include_rules
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !ar |> | $(BASE_DIR)/<alarm> {bin}
: {obj} |> !ar |> {bin}
: foreach {bin} |> !collect_static |>
: |> !emit_lib_pkg_config |>

View File

@ -1,15 +0,0 @@
ifeq (@(TUP_ARCH),arm)
SRC_S += $(BASE_DIR)/src/lib/base-common/arm/*.S
endif
ifeq (@(TUP_ARCH),arm64)
SRC_S += $(BASE_DIR)/src/lib/base-common/arm_64/*.S
endif
ifeq (@(TUP_ARCH),i386)
SRC_S += $(BASE_DIR)/src/lib/base-common/x86_32/*.S
endif
ifeq (@(TUP_ARCH),x86_64)
SRC_S += $(BASE_DIR)/src/lib/base-common/x86_64/*.S
endif

View File

@ -1,28 +0,0 @@
/*
* \brief Implementation of basic C utilities
* \author Emery Hemingway
* \date 2020-01-14
*/
/*
* Copyright (C) 2020 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.
*/
#include <util/string.h>
using namespace Genode;
extern "C" __attribute__((weak))
int memcmp(const void *p0, const void *p1, size_t size)
{
return Genode::memcmp(p0, p1, size);
}
extern "C" __attribute__((weak))
size_t strlen(const char *s)
{
return Genode::strlen(s);
}

View File

@ -1,120 +0,0 @@
/* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* needed parts from <machine/asm.h> */
#define __FBSDID(x)
#define ENTRY(x) .text; .align 0; .globl x; .type x,#function; x:;
#define WEAK_ALIAS(x,y)
#define RET mov pc, lr
#define _JB_MAGIC__SETJMP 0x4278f500
#define __SOFTFP__ 1
#define _STANDALONE
/* end of <machine/asm.h> */
__FBSDID("$FreeBSD: release/8.2.0/lib/libc/arm/gen/setjmp.S 193145 2009-05-31 02:03:40Z marcel $");
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the stack.
* The previous signal state is NOT restored.
*
* Note: r0 is the return value
* r1-r3 are scratch registers in functions
*/
ENTRY(setjmp)
ldr r1, .Lsetjmp_magic
str r1, [r0], #4
#ifdef __SOFTFP__
add r0, r0, #52
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /* __SOFTFP__ */
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
RET
.Lsetjmp_magic:
.word _JB_MAGIC__SETJMP
WEAK_ALIAS(__longjmp, longjmp)
ENTRY(longjmp)
ldr r2, .Lsetjmp_magic
ldr r3, [r0], #4
teq r2, r3
bne botch
#ifdef __SOFTFP__
add r0, r0, #52
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore fpsr */
ldr r4, [r0], #0x0004
wfs r4
#endif /* __SOFTFP__ */
/* Restore integer registers */
ldmia r0, {r4-r14}
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
beq botch
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
RET
/* validation failed, die die die. */
botch:
#if !defined(_STANDALONE)
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */
#else
b .
#endif

View File

@ -1,108 +0,0 @@
/*-
* Copyright (c) 2014 Andrew Turner
* Copyright (c) 2014 The FreeBSD Foundation
* All rights reserved.
*
* Portions of this software were developed by Andrew Turner
* under sponsorship from the FreeBSD Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* needed parts from <machine/asm.h> */
#define __FBSDID(x)
#define ENTRY(sym) .text; .globl sym; .align 2; .type sym,#function; sym:
#define END(sym) .size sym, . - sym
/* end of <machine/asm.h> */
__FBSDID("$FreeBSD: releng/12.0/lib/libc/aarch64/gen/setjmp.S 313146 2017-02-03 11:51:06Z andrew $");
/* needed parts from <machine/setjmp.h> */
#define _JB_SIGMASK 22
#define _JB_MAGIC__SETJMP 0xfb5d25837d7ff700
/* end of <machine/asm.h> */
ENTRY(setjmp)
/* Store the magic value and stack pointer */
ldr x8, .Lmagic
mov x9, sp
stp x8, x9, [x0], #16
/* Store the general purpose registers and lr */
stp x19, x20, [x0], #16
stp x21, x22, [x0], #16
stp x23, x24, [x0], #16
stp x25, x26, [x0], #16
stp x27, x28, [x0], #16
stp x29, lr, [x0], #16
#ifndef _STANDALONE
/* Store the vfp registers */
stp d8, d9, [x0], #16
stp d10, d11, [x0], #16
stp d12, d13, [x0], #16
stp d14, d15, [x0]
#endif
/* Return value */
mov x0, #0
ret
.align 3
.Lmagic:
.quad _JB_MAGIC__SETJMP
END(setjmp)
ENTRY(longjmp)
/* Check the magic value */
ldr x8, [x0], #8
ldr x9, .Lmagic
cmp x8, x9
b.ne botch
/* Restore the stack pointer */
ldr x8, [x0], #8
mov sp, x8
/* Restore the general purpose registers and lr */
ldp x19, x20, [x0], #16
ldp x21, x22, [x0], #16
ldp x23, x24, [x0], #16
ldp x25, x26, [x0], #16
ldp x27, x28, [x0], #16
ldp x29, lr, [x0], #16
#ifndef _STANDALONE
/* Restore the vfp registers */
ldp d8, d9, [x0], #16
ldp d10, d11, [x0], #16
ldp d12, d13, [x0], #16
ldp d14, d15, [x0]
#endif
/* Load the return value */
mov x0, x1
ret
botch:
b botch
END(longjmp)

View File

@ -1,79 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)setjmp.s 5.1 (Berkeley) 4/23/90"
#endif /* LIBC_SCCS and not lint */
//#include <machine/asm.h>
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the environment 'a'.
* The previous signal state is NOT restored.
*/
.text; .p2align 2,0x90
.globl setjmp; .type setjmp,@function; setjmp:
movl 4(%esp),%eax
movl 0(%esp),%edx
movl %edx, 0(%eax) /* rta */
movl %ebx, 4(%eax)
movl %esp, 8(%eax)
movl %ebp,12(%eax)
movl %esi,16(%eax)
movl %edi,20(%eax)
fnstcw 24(%eax)
xorl %eax,%eax
ret
.size setjmp, . - setjmp
.text; .p2align 2,0x90
.globl longjmp; .type longjmp,@function; longjmp:
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
movl 4(%edx),%ebx
movl 8(%edx),%esp
movl 12(%edx),%ebp
movl 16(%edx),%esi
movl 20(%edx),%edi
fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
1: movl %ecx,0(%esp)
ret
.size longjmp, . - longjmp

View File

@ -1,93 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)setjmp.s 5.1 (Berkeley) 4/23/90"
#endif /* LIBC_SCCS and not lint */
//#include <machine/asm.h>
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the environment 'a'.
* The previous signal state is NOT restored.
*/
.text; .p2align 4,0x90
.globl setjmp; .type setjmp,@function; setjmp:
movq %rdi,%rax
movq 0(%rsp),%rdx /* retval */
movq %rdx, 0(%rax) /* 0; retval */
movq %rbx, 8(%rax) /* 1; rbx */
movq %rsp,16(%rax) /* 2; rsp */
movq %rbp,24(%rax) /* 3; rbp */
movq %r12,32(%rax) /* 4; r12 */
movq %r13,40(%rax) /* 5; r13 */
movq %r14,48(%rax) /* 6; r14 */
movq %r15,56(%rax) /* 7; r15 */
fnstcw 64(%rax) /* 8; fpu cw */
stmxcsr 68(%rax) /* and mxcsr */
xorq %rax,%rax
ret
.size setjmp, . - setjmp
.text; .p2align 4,0x90
.globl longjmp; .type longjmp,@function; longjmp:
movq %rdi,%rdx
/* Restore the mxcsr, but leave exception flags intact. */
stmxcsr -4(%rsp)
movl 68(%rdx),%eax
andl $0xffffffc0,%eax
movl -4(%rsp),%edi
andl $0x3f,%edi
xorl %eax,%edi
movl %edi,-4(%rsp)
ldmxcsr -4(%rsp)
movq %rsi,%rax /* retval */
movq 0(%rdx),%rcx
movq 8(%rdx),%rbx
movq 16(%rdx),%rsp
movq 24(%rdx),%rbp
movq 32(%rdx),%r12
movq 40(%rdx),%r13
movq 48(%rdx),%r14
movq 56(%rdx),%r15
fldcw 64(%rdx)
testq %rax,%rax
jnz 1f
incq %rax
1: movq %rcx,0(%rsp)
ret
.size longjmp, . - longjmp

View File

@ -52,15 +52,16 @@ LOCAL_SYMBOLS = \
#
# Symbols we wrap (see unwind.c)
#
EH_SYMBOLS += _Unwind_Complete
EH_SYMBOLS += _Unwind_DeleteException
EH_SYMBOLS += _Unwind_Resume
EH_SYMBOLS = \
_Unwind_Complete \
_Unwind_DeleteException \
#
# Additional functions for ARM
#
EH_SYMBOLS += __aeabi_unwind_cpp_pr0
EH_SYMBOLS += __aeabi_unwind_cpp_pr1
EH_SYMBOLS += \
__aeabi_unwind_cpp_pr0 \
__aeabi_unwind_cpp_pr1 \
ifdef IS_LLVM
@ -87,11 +88,13 @@ LLVM_LIBS += @(LIBCXXABI)/lib/libc++abi.a
endif
CPPFLAGS += -I`$(CC) -print-file-name=include`
: foreach *.cc |> !cxx |> {obj}
REDEF_SYMBOLS = `echo $(EH_SYMBOLS) | awk -v RS=' ' '{ print "--redefine-sym "$1"=_cxx_"$1 }'`
: foreach *.c |> !cc |>
: foreach *.c |> !cc |> {obj}
ifdef IS_LLVM
@ -101,11 +104,11 @@ ifdef IS_LLVM
: {obj} |> \
$(LD) $(LD_MARCH) $(KEEP_SYMBOLS) -r %f $(LLVM_LIBS) @(LIBUNWIND_BAREMETAL)/lib/libunwind.a -o %o |> supc++-baremetal.tmp
: supc++.tmp |> @(OBJCOPY) $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) %f %o |> supc++.o
: supc++-baremetal.tmp |> @(OBJCOPY) $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) %f %o |> supc++-baremetal.o
: supc++.tmp |> $(OBJCOPY) $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) %f %o |> supc++.o
: supc++-baremetal.tmp |> $OBJCOPY $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) %f %o |> supc++-baremetal.o
: supc++.o unwind.o |> !ar |> cxx.a {bin}
: supc++-baremetal.o unwind.o |> !ar |> cxx-baremetal.a {bin}
: supc++.o |> !ar |> cxx.a {bin}
: supc++-baremetal.o |> !ar |> cxx-baremetal.a {bin}
: foreach {bin} |> !collect_static |>
: |> !emit_lib_pkg_config |>
@ -114,13 +117,14 @@ endif
ifdef IS_GCC
LIBCXX_GCC += `$(CXX) $(CC_MARCH) -print-file-name=libsupc++.a`
LIBCXX_GCC += `$(CXX) $(CC_MARCH) -print-file-name=libgcc_eh.a`
#LIBCXX_GCC += `$(CXX) $(CC_MARCH) -print-file-name=libgcc_eh.a || true`
: {obj} |> $(LD) $(LD_MARCH) $(KEEP_SYMBOLS) -r %f $(LIBCXX_GCC) -o %o |> supc++.tmp
: {obj} |> \
$(LD) $(LD_MARCH) $(KEEP_SYMBOLS) -r %f $(LIBCXX_GCC) -o %o |> supc++.tmp
: supc++.tmp |> @(OBJCOPY) $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) %f %o |> supc++.o
: supc++.tmp |> $OBJCOPY $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) %f %o |> supc++.o
: supc++.o unwind.o |> !ar |> | $(BASE_DIR)/<cxx> {bin}
: supc++.o |> !ar |> cxx.a {bin}
: foreach {bin} |> !collect_static |>
: |> !emit_lib_pkg_config |>

View File

@ -1,21 +1,3 @@
include_rules
SED_EXPR += -e "s/^\(\w\+\) D \(\w\+\)\$/.data; .global \1; .type \1,%object; .size \1,\2; \1: .skip 1/"
SED_EXPR += -e "s/^\(\w\+\) V/.data; .weak \1; .type \1,%object; \1: .skip 1/"
SED_EXPR += -e "s/^\(\w\+\) T/.text; .global \1; .type \1,%function; \1:/"
SED_EXPR += -e "s/^\(\w\+\) R \(\w\+\)\$/.section .rodata; .global \1; .type \1,%object; .size \1,\2; \1:/"
SED_EXPR += -e "s/^\(\w\+\) W/.text; .weak \1; .type \1,%function; \1:/"
SED_EXPR += -e "s/^\(\w\+\) B \(\w\+\)\$/.bss; .global \1; .type \1,%object; .size \1,\2; \1:/"
SED_EXPR += -e "s/^\(\w\+\) U/.text; .global \1; movq \1@GOTPCREL(%rip), %rax/"
: |> sed $(SED_EXPR) < $(REP_DIR)/lib/symbols/%d > %o |> %d.symbols.s {asm}
: foreach {asm} |> !cc |> %d.symbols.o {obj}
LDFLAGS += -shared --eh-frame-hdr
LDFLAGS += -z max-page-size=0x1000
LDFLAGS += -T$(BASE_DIR)/src/lib/ldso/linker.ld
LDFLAGS += -T$(BASE_DIR)/src/ld/genode_rel.ld
: {obj} |> !ld |> $(DEV_LIB_DIR)/%d.lib.so $(DEV_DIR)/<lib>
: $(REP_DIR)/lib/symbols/ld |> !abi_stub |>
: foreach *.pc.in |> !sed_pkgconfig_file |>

View File

@ -2,6 +2,6 @@ LIBS += base
include_rules
: foreach startup.cc |> !cxx |> %B.o {obj}
: {obj} |> !ar |> | $(BASE_DIR)/<ldso-startup> {bin}
: {obj} | |> !ar |> {bin}
: foreach {bin} |> !collect_static |>
: |> !emit_lib_pkg_config |>

View File

@ -1,26 +0,0 @@
LDSO_DIR = $(BASE_DIR)/src/lib/ldso
ifeq (@(TUP_ARCH),i386)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/x86_64
CPPFLAGS = -I$(LDSO_SPEC_DIR) -I$(LDSO_DIR)/include $(CPPFLAGS)
endif
ifeq (@(TUP_ARCH),x86_64)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/x86_64
CPPFLAGS = -I$(LDSO_SPEC_DIR) -I$(LDSO_DIR)/include $(CPPFLAGS)
endif
ifeq (@(TUP_ARCH),arm)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/arm
CPPFLAGS = -I$(LDSO_SPEC_DIR) -I$(LDSO_DIR)/include $(CPPFLAGS)
endif
ifeq (@(TUP_ARCH),arm64)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/arm_64
CPPFLAGS = -I$(LDSO_SPEC_DIR) -I$(LDSO_DIR)/include $(CPPFLAGS)
endif
ifeq (@(TUP_ARCH),riscv)
LDSO_SPEC_DIR = $(LDSO_DIR)/spec/riscv
CPPFLAGS = -I$(LDSO_SPEC_DIR) -I$(LDSO_DIR)/include $(CPPFLAGS)
endif

View File

@ -19,7 +19,6 @@
#include <util/string.h>
#include <base/thread.h>
#include <base/heap.h>
#include <base/sleep.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
@ -776,11 +775,3 @@ void Component::construct(Genode::Env &env)
/* start binary */
binary_ptr->call_entry_point(env);
}
extern "C" int main(int, char **, char **)
{
Genode::error("LD: dummy \"main\" procedure invoked!");
Genode::sleep_forever();
return ~0;
}

View File

@ -14,6 +14,6 @@ else
endif
: foreach $(SRC_CC) |> !cxx |> {obj}
: {obj} |> !ar |> | $(BASE_DIR)/<timeout> {bin}
: {obj} |> !ar |> {bin}
: foreach {bin} |> !collect_static |>
: |> !emit_lib_pkg_config |>

View File

@ -83,7 +83,7 @@ struct Main
void call_const_method(Compound const &compound) {
compound.member->reference.const_method(); }
Main(Env &env)
Main(Env &)
{
log("--- Reconstructible utility test ---");
{
@ -132,7 +132,6 @@ struct Main
log("got exception, as expected"); }
log("--- Reconstructible utility test finished ---");
env.parent().exit(0);
}
};

View File

@ -41,13 +41,12 @@ struct Main
Adder adder { };
Synced_interface<Adder, Pseudo_lock> synced_adder { lock, &adder };
Main(Env &env)
Main(Env &)
{
log("--- Synced interface test ---");
int const res = synced_adder()->add(13, 14);
log("result is ", res);
log("--- Synced interface test finished ---");
env.parent().exit(0);
}
};

View File

@ -1,9 +1,5 @@
REP_DIR = $(TUP_CWD)
CPPFLAGS += -I$(REP_DIR)/include
LIBS += genode-os
ifndef NIX_OUTPUTS_DEV
include ../os/Tuprules.tup
endif

View File

@ -12,7 +12,7 @@
*/
#ifndef _INCLUDE__NANO3D__SQRT_H_
#define _INCLUDE__NANO3D__SQRT_H_
#define _INCLUDE__NANO3D__SQRT_H__
namespace Nano3d {
@ -38,4 +38,4 @@ namespace Nano3d {
}
}
#endif /* _INCLUDE__NANO3D__SQRT_H_ */
#endif /* _INCLUDE__NANO3D__SQRT_H__ */

View File

@ -1,4 +0,0 @@
include_rules
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,8 +0,0 @@
include_rules
CPPFLAGS += -I. -I$(REP_DIR)/../demo/include
SRC_BIN += $(REP_DIR)/../demo/src/app/scout/data/droidsansb10.tff
SRC_BIN += closer.rgba maximize.rgba minimize.rgba windowed.rgba
: foreach *.cc |> !cxx |> {obj}
: foreach $(SRC_BIN) |> !incbin |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
CPPFLAGS += -I.
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,4 +0,0 @@
include_rules
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,4 +0,0 @@
include_rules
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
LIBS += vfs
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,8 +0,0 @@
include_rules
ifneq ($(X86),)
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>
endif

View File

@ -1,5 +0,0 @@
include_rules
LIBS += vfs
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
LIBS += vfs
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
CPPFLAGS += -I.
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
CPPFLAGS += -I. -I../depot_deploy
: foreach *.cc view/*.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
CPPFLAGS += -I.
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1 +1 @@
LIBS += ldso-startup
LIBS += genode-lib ldso-startup

View File

@ -1,5 +0,0 @@
include_rules
LIBS += blit
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -1,5 +0,0 @@
include_rules
CPPFLAGS += -I.
: foreach *.cc |> !cxx |> {obj}
: {obj} |> !prg |> {bin}
: {bin} |> !collect_bin |>

View File

@ -77,7 +77,6 @@ struct Main
test.construct(env, false, 1, "without timeouts"); test.destruct();
test.construct(env, true, 2, "with timeouts"); test.destruct();
log("--- Timed semaphore test finished ---");
env.parent().exit(0);
}
};

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