Skip to content

Commit 7eebb15

Browse files
committed
Merge dev
2 parents 0290def + 4e0946f commit 7eebb15

38 files changed

Lines changed: 2785 additions & 42 deletions

CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/net/dhcp/options.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ struct domain_name_servers : public type<DOMAIN_NAME_SERVERS>, public addr_optio
215215
*/
216216
struct domain_name : public type<DOMAIN_NAME>, public base
217217
{
218-
constexpr domain_name(const std::string& dname) noexcept
218+
domain_name(const std::string& dname) noexcept
219219
: base{type::CODE, static_cast<uint8_t>(dname.size())}
220220
{
221221
std::memcpy(&val[0], dname.data(), dname.size());
@@ -296,7 +296,7 @@ struct server_identifier : public type<DHCP_SERVER_IDENTIFIER>, public addr_opti
296296
*/
297297
struct param_req_list : public type<DHCP_PARAMETER_REQUEST_LIST>, public base
298298
{
299-
constexpr param_req_list(const std::vector<Code>& codes) noexcept
299+
param_req_list(const std::vector<Code>& codes) noexcept
300300
: base{DHCP_PARAMETER_REQUEST_LIST, static_cast<uint8_t>(codes.size())}
301301
{
302302
Expects(codes.size() < 50); // or something
@@ -309,7 +309,7 @@ struct param_req_list : public type<DHCP_PARAMETER_REQUEST_LIST>, public base
309309
*/
310310
struct message : public type<DHCP_MESSAGE>, public base
311311
{
312-
constexpr message(const std::string& msg) noexcept
312+
message(const std::string& msg) noexcept
313313
: base{CODE, static_cast<uint8_t>(msg.size())}
314314
{
315315
Expects(not msg.empty() and msg.size() <= 128); // or something

api/net/inet.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ namespace net {
138138
return pckt;
139139
}
140140

141-
Filter_chain(const char* chain_name, std::initializer_list<Packetfilter> filters) :
142-
chain{filters},
143-
name{chain_name} {}
141+
Filter_chain(const char* chain_name, std::initializer_list<Packetfilter> filters)
142+
: chain(filters), name{chain_name}
143+
{}
144144
};
145145

146146
/**

api/net/tcp/connection.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inline Connection& Connection::on_connect(ConnectCallback cb) {
1010

1111
inline Connection& Connection::on_read(size_t recv_bufsz, ReadCallback cb)
1212
{
13-
read_request = std::make_unique<ReadRequest>(recv_bufsz, this->cb.RCV.NXT, cb);
13+
read_request = std::make_unique<ReadRequest>(recv_bufsz, seq_t(this->cb.RCV.NXT), cb);
1414
return *this;
1515
}
1616

api/util/statman.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Stat {
100100
Stat& operator=(const Stat& other) = delete;
101101
Stat& operator=(Stat&& other) = delete;
102102

103-
} __attribute__((packed)); //< class Stat
103+
}; //< class Stat
104104

105105

106106
class Statman {

cmake/post.service.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@ set(CMAKE_CXX_COMPILER_TARGET ${TRIPLE})
1515
set(CMAKE_C_COMPILER_TARGET ${TRIPLE})
1616
message(STATUS "Target triple ${TRIPLE}")
1717

18+
# defines $CAPABS depending on installation
19+
include(${CMAKE_CURRENT_LIST_DIR}/settings.cmake)
20+
1821
# Arch-specific defines & options
1922
if ("${ARCH}" STREQUAL "x86_64")
2023
set(ARCH_INTERNAL "ARCH_X64")
2124
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf64")
2225
set(OBJCOPY_TARGET "elf64-x86-64")
26+
set(CAPABS "${CAPABS} -m64")
2327
else()
2428
set(ARCH_INTERNAL "ARCH_X86")
2529
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf")
2630
set(OBJCOPY_TARGET "elf32-i386")
31+
set(CAPABS "${CAPABS} -m32")
2732
endif()
2833
enable_language(ASM_NASM)
2934

30-
# defines $CAPABS depending on installation
31-
include(${CMAKE_CURRENT_LIST_DIR}/settings.cmake)
32-
3335
# Various global defines
3436
# * OS_TERMINATE_ON_CONTRACT_VIOLATION provides classic assert-like output from Expects / Ensures
3537
# * _GNU_SOURCE enables POSIX-extensions in newlib, such as strnlen. ("everything newlib has", ref. cdefs.h)
@@ -46,8 +48,8 @@ if (debug)
4648
endif()
4749

4850
if (CMAKE_COMPILER_IS_GNUCC)
49-
set(CMAKE_CXX_FLAGS "-m32 -MMD ${CAPABS} ${WARNS} -nostdlib -fno-omit-frame-pointer -c -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1")
50-
set(CMAKE_C_FLAGS "-m32 -MMD ${CAPABS} ${WARNS} -nostdlib -fno-omit-frame-pointer -c")
51+
set(CMAKE_CXX_FLAGS "-MMD ${CAPABS} ${WARNS} -nostdlib -fno-omit-frame-pointer -c -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1")
52+
set(CMAKE_C_FLAGS "-MMD ${CAPABS} ${WARNS} -nostdlib -fno-omit-frame-pointer -c")
5153
else()
5254
# these kinda work with llvm
5355
set(CMAKE_CXX_FLAGS "-MMD ${CAPABS} ${OPTIMIZE} ${WARNS} -nostdlib -nostdlibinc -fno-omit-frame-pointer -c -std=c++14 -D_LIBCPP_HAS_NO_THREADS=1")

diskimagebuild/fat_internal.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ static const uint8_t LAST_LONG_ENTRY = 0x40;
3737
struct cl_dir
3838
{
3939
uint8_t shortname[11];
40-
uint8_t attrib;
40+
uint8_t attrib = 0;
4141
uint8_t pad1[8];
42-
uint16_t cluster_hi;
43-
uint32_t modified;
44-
uint16_t cluster_lo;
45-
uint32_t filesize;
42+
uint16_t cluster_hi = 0;
43+
uint32_t modified = 0;
44+
uint16_t cluster_lo = 0;
45+
uint32_t filesize = 0;
4646

4747
} __attribute__((packed));
4848

diskimagebuild/writer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ void create_preamble(
127127
cl_dir ent;
128128
ent.attrib = ATTR_DIRECTORY;
129129
ent.filesize = 0;
130+
ent.modified = 0;
130131
// . current directory
131132
memcpy((char*) ent.shortname, ". ", SHORTNAME_LEN);
132133
ent.cluster_hi = fsys.to_cluster_hi(self);
@@ -152,6 +153,7 @@ cl_dir create_entry(const std::string& name, uint8_t attr, uint32_t size)
152153
ent.cluster_hi = 0; /// SET THIS
153154
ent.cluster_lo = 0; /// SET THIS
154155
ent.filesize = size;
156+
ent.modified = 0;
155157
return ent;
156158
}
157159

@@ -163,6 +165,7 @@ void fill_unused(std::vector<cl_dir>& ents, int num)
163165
ent.cluster_hi = 0;
164166
ent.cluster_lo = 0;
165167
ent.filesize = 0;
168+
ent.modified = 0;
166169
while (num-- > 0) ents.push_back(ent);
167170
}
168171
void mod16_test(std::vector<cl_dir>& ents, int& mod16, int long_entries)
@@ -229,7 +232,11 @@ long Dir::write(FileSys& fsys, FILE* file, long pos, long parent)
229232
{
230233
cl_dir last;
231234
last.shortname[0] = 0x0; // last entry
232-
last.attrib = 0;
235+
last.cluster_hi = 0;
236+
last.cluster_lo = 0;
237+
last.attrib = 0;
238+
last.modified = 0;
239+
last.filesize = 0;
233240
ents.push_back(last);
234241
}
235242

examples/demo_service/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ set(SOURCES
3636

3737
if ("$ENV{PLATFORM}" STREQUAL "x86_solo5")
3838
set(DRIVERS
39-
solo5net # Virtio networking
40-
# virtioblock # Virtio block device
41-
# ... Others from src/drivers
39+
solo5net
4240
)
4341
else()
4442
set(DRIVERS
45-
silent_start # Less output during boot
4643
virtionet # Virtio networking
4744
# virtioblock # Virtio block device
4845
# ... Others from src/drivers

lib/LiveUpdate/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 2.8.9)
2+
3+
add_definitions(-DARCH_${ARCH})
4+
add_definitions(-DARCH="${ARCH}")
5+
6+
include_directories(${INCLUDEOS_ROOT}/api/posix)
7+
include_directories(${LIBCXX_INCLUDE_DIR})
8+
include_directories(${NEWLIB_INCLUDE_DIR})
9+
include_directories(${INCLUDEOS_ROOT}/src/include)
10+
include_directories(${INCLUDEOS_ROOT}/api)
11+
include_directories(${INCLUDEOS_ROOT}/mod/GSL/)
12+
13+
add_custom_command(
14+
OUTPUT hotswap64.bin
15+
COMMAND ${CMAKE_ASM_NASM_COMPILER} -f bin -o hotswap64.bin ${CMAKE_CURRENT_SOURCE_DIR}/hotswap64.asm
16+
DEPENDS hotswap64.asm
17+
)
18+
add_custom_target(hotswap64 DEPENDS hotswap64.bin)
19+
20+
# LiveUpdate static library
21+
add_library(liveupdate STATIC
22+
storage.cpp update.cpp resume.cpp rollback.cpp hotswap.cpp
23+
serialize_tcp.cpp hotswap64_blob.asm
24+
)
25+
add_dependencies(liveupdate hotswap64)
26+
install(TARGETS liveupdate DESTINATION includeos/${ARCH}/lib)
27+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/liveupdate.hpp DESTINATION includeos/include RENAME liveupdate)

0 commit comments

Comments
 (0)