Skip to content

Commit 2bfe5d1

Browse files
committed
Merge branch 'dev' of github.com:hioa-cs/IncludeOS into dev
2 parents 0620f43 + 0245cec commit 2bfe5d1

73 files changed

Lines changed: 876 additions & 11153 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/kernel/os.hpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <string>
2727
#include <sstream>
2828
#include <vector>
29+
#include <boot/multiboot.h>
2930

3031
/**
3132
* The entrypoint for OS services
@@ -36,15 +37,16 @@ class OS {
3637
public:
3738
using print_func = delegate<void(const char*, size_t)>;
3839
using Plugin = delegate<void()>;
40+
using Span_mods = gsl::span<multiboot_module_t>;
3941

4042
/**
41-
* Returns the version of the OS from when
43+
* Returns the version of the OS from when
4244
* the service was built.
4345
**/
4446
static const std::string& version() noexcept
4547
{ return version_field; }
4648

47-
/**
49+
/**
4850
* Returns the commandline arguments provided,
4951
* if any, to the VM passed on by multiboot or
5052
* other mechanisms. The first argument is always
@@ -113,7 +115,7 @@ class OS {
113115
* The on_panic handler will be called directly after a panic,
114116
* or any condition which will deliberately cause the OS to become
115117
* unresponsive. After the handler is called, the OS goes to sleep.
116-
* This handler can thus be used to, for example, automatically
118+
* This handler can thus be used to, for example, automatically
117119
* have the OS restart on any crash.
118120
**/
119121
typedef void (*on_panic_func) ();
@@ -204,6 +206,22 @@ class OS {
204206
/** Start the OS. @todo Should be `init()` - and not accessible from ABI */
205207
static void start(uint32_t boot_magic, uint32_t boot_addr);
206208

209+
/** Get "kernel modules", provided by multiboot */
210+
static Span_mods modules() {
211+
212+
if (bootinfo_ and bootinfo_->flags & MULTIBOOT_INFO_MODS) {
213+
214+
Expects(bootinfo_->mods_count < std::numeric_limits<int>::max());
215+
216+
return Span_mods{
217+
reinterpret_cast<multiboot_module_t*>(bootinfo_->mods_addr),
218+
static_cast<int>(bootinfo_->mods_count) };
219+
220+
}
221+
222+
return nullptr;
223+
}
224+
207225
private:
208226

209227
/** Process multiboot info. Called by 'start' if multibooted **/
@@ -216,15 +234,6 @@ class OS {
216234
static bool is_softreset_magic(uint32_t value);
217235
static void resume_softreset(intptr_t boot_addr);
218236

219-
static constexpr int PAGE_SHIFT = 12;
220-
221-
static bool power_;
222-
static bool boot_sequence_passed_;
223-
224-
static MHz cpu_mhz_;
225-
226-
static std::string version_field;
227-
228237
struct Plugin_struct {
229238
Plugin_struct(Plugin f, const char* n)
230239
: func_{f}, name_{n}
@@ -234,13 +243,19 @@ class OS {
234243
const char* name_;
235244
};
236245

246+
static constexpr int PAGE_SHIFT = 12;
247+
static bool power_;
248+
static bool boot_sequence_passed_;
249+
static MHz cpu_mhz_;
250+
static std::string version_field;
237251
static std::vector<Plugin_struct> plugins_;
238-
239252
static uintptr_t low_memory_size_;
240253
static uintptr_t high_memory_size_;
241254
static uintptr_t memory_end_;
242255
static uintptr_t heap_max_;
243256
static const uintptr_t elf_binary_size_;
257+
static multiboot_info_t* bootinfo_;
258+
static std::string cmdline;
244259

245260
// Prohibit copy and move operations
246261
OS(OS&) = delete;

api/net/tcp/tcp.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,21 @@ namespace net {
537537
*/
538538
void transmit(tcp::Packet_ptr);
539539

540+
/**
541+
* @brief Creates an outgoing TCP packet.
542+
*
543+
* @return A tcp packet ptr
544+
*/
545+
tcp::Packet_ptr create_outgoing_packet();
546+
547+
/**
548+
* @brief Sends a TCP reset based on the values of the incoming packet.
549+
* Used when packet are addressed to closed ports or already dead connections.
550+
*
551+
* @param[in] incoming The incoming tcp packet "to reset".
552+
*/
553+
void send_reset(const tcp::Packet& incoming);
554+
540555
/**
541556
* @brief Generate a unique initial sequence number (ISS).
542557
*

api/posix/ctype.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18+
// Trick to prevent libc++ from using old newlib locale stubs
19+
#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
20+
21+
1822
#ifndef SYS_CTYPE_H
1923
#define SYS_CTYPE_H
2024

@@ -40,5 +44,4 @@ extern "C" {
4044

4145
#endif //SYS_CTYPE_H
4246

43-
4447
#include_next <ctype.h>

api/posix/features.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
#define _POSIX_TIMERS 1
2828
#define _POSIX_MONOTONIC_CLOCK 1
2929

30+
// Enable newlib multibyte support
31+
#define _MB_CAPABLE 1
32+
33+
34+
3035
// Required to pass CMake tests for libc++
3136
#define __GLIBC_PREREQ__(min, maj) 1
3237
#define __GLIBC_PREREQ(min, maj) 1
File renamed without changes.

cmake/cross_compiled_libraries.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ else(BUNDLE_LOC)
1717
include(ExternalProject)
1818
ExternalProject_Add(PrecompiledLibraries
1919
PREFIX precompiled
20-
URL https://github.com/hioa-cs/IncludeOS/releases/download/v0.9.0/IncludeOS_install_v0-9-0.tar.gz
21-
URL_HASH SHA1=8f7dfa92d38814c0c4f3e83adacfbd741a617622
20+
URL https://github.com/hioa-cs/IncludeOS/releases/download/v0.10.1-bundle/IncludeOS_dependencies_v0-10-1-bundle.tar.gz
21+
URL_HASH SHA1=8b298ea394b304c03f59d4a2fa3db711ae7d5161
2222
CONFIGURE_COMMAND ""
2323
BUILD_COMMAND ""
2424
UPDATE_COMMAND ""
@@ -32,8 +32,12 @@ set(PRECOMPILED_DIR ${CMAKE_CURRENT_BINARY_DIR}/precompiled/src/PrecompiledLibra
3232
set(LIBCXX_INCLUDE_DIR ${PRECOMPILED_DIR}libcxx/include/)
3333
set(LIBCXX_LIB_DIR ${PRECOMPILED_DIR}/libcxx/)
3434
add_library(libcxx STATIC IMPORTED)
35+
add_library(libcxxabi STATIC IMPORTED)
36+
3537
add_dependencies(libcxx PrecompiledLibraries)
38+
add_dependencies(libcxxabi PrecompiledLibraries)
3639
set_target_properties(libcxx PROPERTIES IMPORTED_LOCATION ${LIBCXX_LIB_DIR}/libc++.a)
40+
set_target_properties(libcxxabi PROPERTIES IMPORTED_LOCATION ${LIBCXX_LIB_DIR}/libc++abi.a)
3741

3842
set(NEWLIB_INCLUDE_DIR ${PRECOMPILED_DIR}/newlib/include/)
3943
set(NEWLIB_LIB_DIR ${PRECOMPILED_DIR}/newlib/)
@@ -62,4 +66,4 @@ install(DIRECTORY ${NEWLIB_INCLUDE_DIR} DESTINATION includeos/include/newlib)
6266

6367
install(FILES ${CRTEND} ${CRTBEGIN} DESTINATION includeos/lib)
6468

65-
install(FILES ${NEWLIB_LIB_DIR}/libc.a ${NEWLIB_LIB_DIR}/libg.a ${NEWLIB_LIB_DIR}/libm.a ${LIBGCC_LIB_DIR}/libgcc.a ${LIBCXX_LIB_DIR}/libc++.a DESTINATION includeos/lib)
69+
install(FILES ${NEWLIB_LIB_DIR}/libc.a ${NEWLIB_LIB_DIR}/libg.a ${NEWLIB_LIB_DIR}/libm.a ${LIBGCC_LIB_DIR}/libgcc.a ${LIBCXX_LIB_DIR}/libc++.a ${LIBCXX_LIB_DIR}/libc++abi.a DESTINATION includeos/lib)

etc/build_binutils.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
1+
#! /bin/bash
2+
. $INCLUDEOS_SRC/etc/set_traps.sh
3+
4+
# Download, configure and build binutils
5+
16
pushd $BUILD_DIR
27

8+
# Downloading
39
if [ ! -f binutils-$binutils_version.tar.gz ]; then
410
echo -e "\n\n >>> Getting binutils into `pwd` \n"
511
wget -c --trust-server-name ftp://ftp.gnu.org/gnu/binutils/binutils-$binutils_version.tar.gz
612
fi
713

8-
14+
# Extracting
915
if [ ! -d binutils-$binutils_version ]; then
1016
echo -e "\n\n >>> Extracting binutils \n"
1117
tar -xf binutils-$binutils_version.tar.gz
18+
rm -rf build_binutils # If a new version has been downloaded it will be built
1219
else
1320
echo -e "\n\n >>> SKIP: Extracting binutils \n"
1421
fi
1522

23+
# Configuring
1624
if [ ! -d build_binutils ]; then
1725
echo -e "\n\n >>> Configuring binutils \n"
1826
mkdir -p build_binutils
1927
cd build_binutils
20-
../binutils-$binutils_version/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-werror
28+
../binutils-$binutils_version/configure \
29+
--target=$TARGET \
30+
--prefix="$TEMP_INSTALL_DIR" \
31+
--disable-nls \
32+
--disable-werror
2133

34+
# Compiling
2235
echo -e "\n\n >>> Building binutils \n"
2336
make $num_jobs
2437

38+
# Installing
2539
echo -e "\n\n >>> Installing binutils \n"
2640
make install
2741

@@ -30,3 +44,5 @@ else
3044
fi
3145

3246
popd
47+
48+
trap - EXIT
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# Bash utils
1+
#!/bin/bash
22
. $INCLUDEOS_SRC/etc/set_traps.sh
33

4-
mkdir -p $BUILD_DIR
5-
cd $BUILD_DIR
4+
# Download, configure, compile and install gcc
65

7-
GCC_LOC=ftp://ftp.nluug.nl/mirror/languages/gcc/releases/
6+
pushd $BUILD_DIR
87

8+
# Download
99
if [ ! -f gcc-$gcc_version.tar.gz ]; then
1010
echo -e "\n\n >>> Getting GCC \n"
11+
GCC_LOC=ftp://ftp.nluug.nl/mirror/languages/gcc/releases/
1112
wget -c --trust-server-name $GCC_LOC/gcc-$gcc_version/gcc-$gcc_version.tar.gz
1213
fi
1314

1415
# UNPACK GCC
1516
if [ ! -d gcc-$gcc_version ]; then
1617
echo -e "\n\n >>> Unpacking GCC source \n"
17-
cd $BUILD_DIR
1818
tar -xf gcc-$gcc_version.tar.gz
1919

2020
# GET GCC PREREQS
@@ -26,18 +26,23 @@ else
2626
echo -e "\n\n >>> SKIP: Unpacking GCC + getting prerequisites Seems to be there \n"
2727
fi
2828

29-
cd $BUILD_DIR
30-
31-
3229
mkdir -p build_gcc
33-
cd build_gcc
30+
pushd build_gcc
3431

32+
# Configure
3533
echo -e "\n\n >>> Configuring GCC \n"
36-
../gcc-$gcc_version/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
37-
34+
../gcc-$gcc_version/configure \
35+
--target=$TARGET \
36+
--prefix="$TEMP_INSTALL_DIR" \
37+
--disable-nls \
38+
--enable-languages=c,c++ \
39+
--without-headers
40+
41+
# Compile
3842
echo -e "\n\n >>> Building GCC \n"
3943
make all-gcc $num_jobs
4044

45+
# Install
4146
echo -e "\n\n >>> Installing GCC (Might require sudo) \n"
4247
make install-gcc
4348

@@ -47,5 +52,6 @@ make all-target-libgcc $num_jobs
4752
echo -e "\n\n >>> Installing libgcc (Might require sudo) \n"
4853
make install-target-libgcc
4954

50-
55+
popd # build_gcc
56+
popd # BUILD_DIR
5157
trap - EXIT

0 commit comments

Comments
 (0)