Skip to content

Commit c09e684

Browse files
Merge branch 'dev' of github.com:hioa-cs/IncludeOS into dev
2 parents 088cd33 + 63bb70c commit c09e684

10 files changed

Lines changed: 60 additions & 35 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ before_script:
1717
- mkdir darwin && cd darwin
1818

1919
script:
20-
- cmake .. -DTRAVIS=ON
20+
- cmake .. -DTRAVIS=ON -DEXTRA_TESTS=ON
2121
- make VERBOSE=1 && ./unittests --pass

examples/demo_service/service.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ http::Response handle_request(const http::Request& req)
8282
void Service::start(const std::string&)
8383
{
8484
// DHCP on interface 0
85+
printf("*** Waiting up to 10 sec. for DHCP... ***\n");
8586
auto& inet = net::Inet4::ifconfig(5.0, [](bool timeout) {
8687
if (timeout) {
88+
printf("*** Falling back to static network config ***\n");
8789
// static IP in case DHCP fails
8890
net::Inet4::stack().network_config(
8991
{ 10,0,0,42 }, // IP

install.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ while getopts "h?yqb:" opt; do
3333
;;
3434
q) quiet=1
3535
;;
36-
b) BUNDLE_LOC=$OPTARG
36+
b) BUNDLE_LOC=$OPTARG
3737
if [ -f $BUNDLE_LOC ]; then
3838
export BUNDLE_LOC=$BUNDLE_LOC
3939
else
@@ -105,7 +105,7 @@ if ! command -v sudo > /dev/null 2>&1; then
105105
exit 1
106106
fi
107107

108-
# Install build requirements (compiler, etc)
108+
# Install build requirements (compiler, etc)
109109
if [ "Darwin" = "$SYSTEM" ]; then
110110
if ! ./etc/install_osx.sh; then
111111
printf "%s\n" ">>> Sorry <<<"\
@@ -118,7 +118,7 @@ else
118118
dependency_level=all
119119
else
120120
dependency_level=build
121-
fi
121+
fi
122122
echo ">>> Dependencies required:"
123123
if ! ./etc/install_build_requirements.sh -s $SYSTEM -r $RELEASE -c -d $dependency_level; then
124124
missing_dependencies=1
@@ -132,7 +132,7 @@ fi
132132
# Check if script has write permission to PREFIX location
133133
start_dir=$INCLUDEOS_PREFIX
134134
while [ "$start_dir" != "/" ]
135-
do
135+
do
136136
if [ -d $start_dir ]; then # If dir exists
137137
if [ ! -w $start_dir ]; then # If dir is not writable
138138
printf "\n\n>>> IncludeOS can't be installed with the current options\n"
@@ -164,7 +164,7 @@ printf " %-25s %-25s %s\n"\
164164

165165
# Give user option to evaluate install options
166166
if tty -s && [ $install_yes -eq 0 ]; then
167-
read -p "Is this correct [Y/n]?" answer
167+
read -p "Is this correct [Y/n]? " answer
168168
answer=${answer:-"Y"} # Default value
169169
case $answer in
170170
[yY] | [yY][Ee][Ss] )
@@ -190,7 +190,7 @@ function clean {
190190
if [ -f /tmp/cmake_output.txt ]; then
191191
rm /tmp/cmake_output.txt
192192
fi
193-
}
193+
}
194194
trap clean EXIT
195195

196196
printf "\n\n>>> Running install_from_bundle.sh (expect up to 3 minutes)\n"
@@ -223,7 +223,7 @@ fi
223223
# INSTALL FINISHED:
224224
############################################################
225225

226-
printf "\n\n>>> IncludeOS installation Done!\n"
226+
printf "\n\n>>> IncludeOS installation Done!\n"
227227
printf " %s\n" "To use IncludeOS set env variables for cmake to know your compiler, e.g.:"\
228228
' export CC="clang-3.8"'\
229229
' export CXX="clang++-3.8"'\

src/arch/x86/start.asm

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern kernel_start
2020
global _start
2121
global __xsave_enabled
2222
global __avx_enabled
23+
global __ecx_was
2324

2425
%define MB_MAGIC 0x1BADB002
2526
%define MB_FLAGS 0x3 ;; ALIGN + MEMINFO
@@ -49,7 +50,6 @@ __xsave_enabled:
4950
__avx_enabled:
5051
dw 0x0
5152

52-
ALIGN32
5353
section .text
5454
;; Multiboot places boot paramters on eax and ebx.
5555
_start:
@@ -77,8 +77,10 @@ rock_bottom:
7777

7878
;; enable SSE before we enter C/C++ land
7979
call enable_sse
80+
;; try to enable XSAVE before checking AVX
81+
call enable_xsave
8082
;; enable AVX if xsave and avx supported on CPU
81-
;call enable_avx
83+
call enable_avx
8284

8385
;; Place multiboot parameters on stack
8486
push ebx
@@ -99,11 +101,24 @@ enable_sse:
99101
ret
100102

101103
enable_xsave:
104+
push eax
105+
push ebx
106+
; check for XSAVE support
107+
mov eax, 1
108+
xor ecx, ecx
109+
cpuid
110+
; bit 26 ecx
111+
and ecx, 0x04000000
112+
cmp ecx, 0x04000000
113+
jne xsave_not_supported
102114
; enable XSAVE
103115
mov eax, cr4
104116
or eax, 0x40000
105117
mov cr4, eax
106118
mov WORD [__xsave_enabled], 0x1
119+
xsave_not_supported:
120+
pop ebx
121+
pop eax
107122
ret
108123

109124
enable_avx:
@@ -117,8 +132,6 @@ enable_avx:
117132
and ecx, 0x18000000
118133
cmp ecx, 0x18000000
119134
jne avx_not_supported
120-
;; enable XSAVE
121-
call enable_xsave
122135
;; enable AVX support
123136
xor ecx, ecx
124137
xgetbv

src/drivers/virtionet.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ VirtioNet::VirtioNet(hw::PCI_Device& d)
156156
}
157157
else
158158
{
159-
assert(0 && "Legacy IRQs not supported");
159+
auto irq = Virtio::get_legacy_irq();
160+
IRQ_manager::get().subscribe(irq, {this, &VirtioNet::legacy_handler});
160161
}
161162

162163
#ifndef NO_DEFERRED_KICK
@@ -243,6 +244,12 @@ void VirtioNet::msix_xmit_handler()
243244
}
244245
}
245246

247+
void VirtioNet::legacy_handler()
248+
{
249+
msix_recv_handler();
250+
msix_xmit_handler();
251+
}
252+
246253
void VirtioNet::add_receive_buffer(uint8_t* pkt)
247254
{
248255
// offset pointer to virtionet header

src/drivers/virtionet.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ class VirtioNet : Virtio, public net::Link_layer<net::Ethernet> {
220220
void msix_xmit_handler();
221221
void msix_conf_handler();
222222

223+
/** Legacy IRQ handler */
224+
void legacy_handler();
225+
223226
/** Allocate and queue buffer from bufstore_ in RX queue. */
224227
void add_receive_buffer(uint8_t*);
225228

test/fs/unit/memdisk_test.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020

2121
CASE("memdisk properties")
2222
{
23-
auto disk = fs::new_shared_memdisk();
24-
EXPECT(disk->empty() == true);
25-
EXPECT(disk->device_id() == 0);
26-
EXPECT(disk->fs_ready() == false);
27-
EXPECT(disk->name() == "memdisk0");
28-
EXPECT(disk->dev().size() == 0ull);
29-
EXPECT(disk->dev().device_type() == "Block device");
30-
EXPECT(disk->dev().driver_name() == "MemDisk");
23+
fs::Disk& disk = fs::memdisk();
24+
EXPECT(disk.empty() == true);
25+
EXPECT(disk.device_id() == 0);
26+
EXPECT(disk.fs_ready() == false);
27+
EXPECT(disk.name() == "memdisk0");
28+
EXPECT(disk.dev().size() == 0ull);
29+
EXPECT(disk.dev().device_type() == "Block device");
30+
EXPECT(disk.dev().driver_name() == "MemDisk");
3131
bool enumerated_partitions {false};
32-
32+
3333
fs::Disk::on_parts_func part_fn = [&enumerated_partitions, &lest_env]
3434
(fs::error_t err, std::vector<fs::Disk::Partition>& partitions)
3535
{
@@ -39,6 +39,6 @@ CASE("memdisk properties")
3939
}
4040
};
4141

42-
disk->partitions(part_fn);
42+
disk.partitions(part_fn);
4343
EXPECT(enumerated_partitions == true);
4444
}

test/posix/integration/conf/service.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ extern "C" void test_sysconf();
2929
extern "C" void test_pathconf();
3030
extern "C" void test_pwd();
3131

32-
fs::Disk_ptr& memdisk() {
33-
static auto disk = fs::new_shared_memdisk();
32+
fs::Disk& memdisk() {
33+
fs::Disk& disk = fs::memdisk();
3434

35-
if (not disk->fs_ready()) {
36-
disk->init_fs([](fs::error_t err, auto&) {
35+
if (not disk.fs_ready()) {
36+
disk.init_fs([](fs::error_t err, auto&) {
3737
if (err) {
3838
printf("ERROR MOUNTING DISK\n");
3939
printf("%s\n", err.reason().c_str());
@@ -58,7 +58,7 @@ int main(int, char **) {
5858
test_sysconf();
5959

6060
// mount a disk with contents for testing
61-
auto root = memdisk()->fs().stat("/");
61+
auto root = memdisk().fs().stat("/");
6262
fs::mount("/etc", root, "test fs");
6363
test_pathconf();
6464

test/posix/integration/stat/ftw_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void ftw_tests()
9898
printf("Total size: %ld\n", total_size);
9999
}
100100

101-
int display_info(const char *fpath, const struct stat *sb, int flag, struct FTW *ftwbuf)
101+
int display_info(const char *fpath, const struct stat *sb, int flag, struct FTW *)
102102
{
103103
printf("%ld\t%s (%d)\n", sb->st_size, fpath, flag);
104104
#ifdef EXTRAVERBOSE

test/posix/integration/stat/test_stat_ftw.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
int ftw_tests();
2525
int stat_tests();
2626

27-
fs::Disk_ptr& memdisk() {
28-
static auto disk = fs::new_shared_memdisk();
27+
fs::Disk& memdisk() {
28+
fs::Disk& disk = fs::memdisk();
2929

30-
if (not disk->fs_ready()) {
31-
printf("%s\n", disk->name().c_str());
32-
disk->init_fs([](fs::error_t err, auto&) {
30+
if (not disk.fs_ready()) {
31+
printf("%s\n", disk.name().c_str());
32+
disk.init_fs([](fs::error_t err, auto&) {
3333
if (err) {
3434
printf("ERROR MOUNTING DISK\n");
3535
exit(127);
@@ -44,7 +44,7 @@ int main()
4444
INFO("POSIX stat", "Running tests for POSIX stat");
4545

4646
// mount a disk with contents for testing
47-
auto root = memdisk()->fs().stat("/");
47+
auto root = memdisk().fs().stat("/");
4848
fs::mount("/mnt/disk", root, "test root");
4949

5050
fs::print_tree();

0 commit comments

Comments
 (0)