Skip to content

Commit 6542c16

Browse files
authored
Merge pull request #1436 from hioa-cs/dev
Merge dev
2 parents 093c011 + 064d768 commit 6542c16

168 files changed

Lines changed: 6636 additions & 1553 deletions

File tree

Some content is hidden

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

CMakeLists.txt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ option(single_threaded "Compile without SMP support" ON)
5252
# create random hex string as stack protector canary
5353
string(RANDOM LENGTH 16 ALPHABET 0123456789ABCDEF STACK_PROTECTOR_VALUE)
5454

55-
set(CAPABS "${CAPABS} -mno-red-zone -fstack-protector-strong -D_STACK_GUARD_VALUE_=0x${STACK_PROTECTOR_VALUE}")
55+
set(CAPABS "${CAPABS} -fstack-protector-strong -D_STACK_GUARD_VALUE_=0x${STACK_PROTECTOR_VALUE}")
5656

5757
# Various global defines
5858
# * NO_DEBUG disables output from the debug macro
@@ -110,6 +110,21 @@ endif(silent)
110110
# Append optimization level
111111
set(CAPABS "${CAPABS} ${OPTIMIZE}")
112112

113+
# object format needs to be set BEFORE enabling ASM
114+
# see: https://cmake.org/Bug/bug_relationship_graph.php?bug_id=13166
115+
if ("${ARCH}" STREQUAL "i686")
116+
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf")
117+
set(OBJCOPY_TARGET "elf32-i386")
118+
set(CAPABS "${CAPABS} -m32")
119+
else()
120+
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf64")
121+
set(OBJCOPY_TARGET "elf64-x86-64")
122+
set(CAPABS "${CAPABS} -m64")
123+
endif()
124+
125+
enable_language(ASM_NASM)
126+
127+
# initialize C and C++ compiler flags
113128
if (CMAKE_COMPILER_IS_GNUCC)
114129
# gcc/g++ settings
115130
set(CMAKE_CXX_FLAGS " -MMD ${CAPABS} ${WARNS} -Wno-frame-address -nostdlib -fno-omit-frame-pointer -c -D_LIBCPP_HAS_NO_THREADS=1 -DOS_VERSION=\\\"${OS_VERSION}\\\"")
@@ -187,6 +202,17 @@ if(libmana)
187202
add_subdirectory(lib/mana)
188203
endif(libmana)
189204

205+
option(libuplink "Build and install uplink" ON)
206+
if(libuplink)
207+
set(libliveupdate ON) # dependent
208+
add_subdirectory(lib/uplink)
209+
endif(libuplink)
210+
211+
option(libliveupdate "Build and install LiveUpdate" ON)
212+
if(libliveupdate)
213+
add_subdirectory(lib/LiveUpdate)
214+
endif(libliveupdate)
215+
190216
#
191217
# Installation
192218
#

api/arch.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ extern void __arch_poweroff();
2929
extern void __arch_reboot();
3030
extern void __arch_enable_legacy_irq(uint8_t);
3131
extern void __arch_disable_legacy_irq(uint8_t);
32+
33+
extern void __arch_install_irq(uint8_t, void(*)());
34+
extern void __arch_subscribe_irq(uint8_t);
35+
extern void __arch_unsubscribe_irq(uint8_t);
36+
3237
inline void __arch_hw_barrier() noexcept;
3338
inline void __sw_barrier() noexcept;
3439
inline uint64_t __arch_cpu_cycles() noexcept;

api/autoconf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// -*-C++-*-
2+
#pragma once
3+
#ifndef API_AUTOCONF_HEADER
4+
#define API_AUTOCONF_HEADER
5+
6+
#include "util/autoconf.hpp"
7+
8+
#endif

api/config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// -*-C++-*-
2+
#pragma once
3+
#ifndef API_CONFIG_HEADER
4+
#define API_CONFIG_HEADER
5+
6+
#include "util/config.hpp"
7+
8+
#endif

api/hw/cmos.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace hw
4545
static const reg_t r_day = 0x7;
4646
static const reg_t r_month = 0x8;
4747
static const reg_t r_year = 0x9;
48-
static const reg_t r_cent = 0x48;
48+
//static const reg_t r_cent = 0x48;
4949

5050
// RTC Alarm registers
5151
static const reg_t r_alarm_sec = 0x1;
@@ -153,8 +153,7 @@ namespace hw
153153
* (For initialization. Recommended practice by CG I.24)
154154
**/
155155
struct Fields {
156-
uint8_t century = 0;
157-
uint8_t year = 0;
156+
int year = 0;
158157
uint8_t month = 0;
159158
uint8_t day_of_month = 0;
160159
uint8_t day_of_week = 0;
@@ -163,8 +162,7 @@ namespace hw
163162
uint8_t second = 0;
164163
};
165164

166-
uint8_t century() { return f.century; }
167-
uint16_t year() { return (f.century + 20) * 100 + f.year; }
165+
uint16_t year() { return f.year; }
168166
uint8_t month() { return f.month; }
169167
uint8_t day_of_month() { return f.day_of_month; }
170168
uint8_t day_of_week() { return f.day_of_week; }

api/kernel/events.hpp

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// This file is a part of the IncludeOS unikernel - www.includeos.org
2+
//
3+
// Copyright 2015 Oslo and Akershus University College of Applied Sciences
4+
// and Alfred Bratterud
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
#ifndef KERNEL_EVENTS_HPP
19+
#define KERNEL_EVENTS_HPP
20+
21+
#include <delegate>
22+
#include <util/fixed_bitmap.hpp>
23+
#include <smp>
24+
25+
#define IRQ_BASE 32
26+
27+
class alignas(SMP_ALIGN) Events {
28+
public:
29+
typedef void (*intr_func) ();
30+
using event_callback = delegate<void()>;
31+
32+
static const size_t NUM_EVENTS = 128;
33+
34+
uint8_t subscribe(event_callback);
35+
void subscribe(uint8_t evt, event_callback);
36+
void unsubscribe(uint8_t evt);
37+
38+
// register event for deferred processing
39+
void trigger_event(uint8_t evt);
40+
41+
/**
42+
* Get per-cpu instance
43+
*/
44+
static Events& get();
45+
static Events& get(int cpu);
46+
47+
/** process all pending events */
48+
void process_events();
49+
50+
/** array of received events */
51+
auto& get_received_array() const noexcept
52+
{ return received_array; }
53+
54+
/** array of handled events */
55+
auto& get_handled_array() const noexcept
56+
{ return handled_array; }
57+
58+
void init_local();
59+
Events() = default;
60+
61+
private:
62+
Events(Events&) = delete;
63+
Events(Events&&) = delete;
64+
Events& operator=(Events&&) = delete;
65+
Events& operator=(Events&) = delete;
66+
67+
event_callback callbacks[NUM_EVENTS];
68+
std::array<uint64_t, NUM_EVENTS> received_array;
69+
std::array<uint64_t*,NUM_EVENTS> handled_array;
70+
71+
Fixed_bitmap<NUM_EVENTS> event_subs;
72+
Fixed_bitmap<NUM_EVENTS> event_pend;
73+
Fixed_bitmap<NUM_EVENTS> event_todo;
74+
};
75+
76+
#endif //< KERNEL_EVENTS_HPP

api/kernel/irq_manager.hpp

Lines changed: 0 additions & 158 deletions
This file was deleted.

api/kernel/os.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,6 @@ class OS {
137137
* Add handler for standard output.
138138
*/
139139
static void add_stdout(print_func func);
140-
/**
141-
* Add stdout handler that simply calls OS::default_stdout
142-
**/
143-
static void add_default_stdout() {
144-
add_stdout(OS::default_stdout);
145-
}
146140

147141
/**
148142
* The default output method preferred by each platform

api/kernel/syscalls.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <sys/types.h>
2323

2424
extern "C" {
25-
int kill(pid_t pid, int sig);
2625
void panic(const char* why) __attribute__((noreturn));
2726
void default_exit() __attribute__((noreturn));
2827

0 commit comments

Comments
 (0)