├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── CMakeLists.txt ├── CONTRIBUTE.md ├── LICENSE ├── NOTICE ├── README.md ├── api ├── arch.hpp ├── arch │ ├── aarch64.hpp │ ├── i686.hpp │ ├── x86 │ │ ├── cpu.hpp │ │ ├── gdt.hpp │ │ ├── paging.hpp │ │ └── paging_utils.hpp │ └── x86_64.hpp ├── async ├── autoconf ├── boot │ └── multiboot.h ├── config ├── debug ├── delegate ├── detail │ └── os.hpp ├── expects ├── features.hpp ├── fiber ├── fs │ ├── common.hpp │ ├── dirent.hpp │ ├── disk.hpp │ ├── fat.hpp │ ├── fat_internal.hpp │ ├── fd_compatible.hpp │ ├── filesystem.hpp │ ├── mbr.hpp │ ├── memdisk.hpp │ ├── partition.hpp │ ├── path.hpp │ └── vfs.hpp ├── fuzz │ ├── fuzzy_helpers.hpp │ ├── fuzzy_http.hpp │ ├── fuzzy_packet.hpp │ ├── fuzzy_stack.hpp │ ├── fuzzy_stream.hpp │ └── macfuzzy.hpp ├── hal │ ├── detail │ │ └── machine.hpp │ ├── machine.hpp │ └── machine_memory.hpp ├── http ├── https ├── hw │ ├── async_device.hpp │ ├── block_device.hpp │ ├── cpu.hpp │ ├── device.hpp │ ├── ioport.hpp │ ├── mac_addr.hpp │ ├── msi.hpp │ ├── nic.hpp │ ├── pci.hpp │ ├── pci_device.hpp │ ├── pci_manager.hpp │ ├── ps2.hpp │ ├── serial.hpp │ ├── usernet.hpp │ ├── vga_gfx.hpp │ └── writable_blkdev.hpp ├── ide ├── info ├── isotime ├── kernel │ ├── auxvec.h │ ├── botan_rng.hpp │ ├── context.hpp │ ├── cpuid.hpp │ ├── crash_context.hpp │ ├── diag.hpp │ ├── elf.hpp │ ├── events.hpp │ ├── fiber.hpp │ ├── memmap.hpp │ ├── memory.hpp │ ├── rng.hpp │ ├── rtc.hpp │ ├── service.hpp │ ├── solo5_manager.hpp │ ├── terminal.hpp │ ├── timers.hpp │ └── vga.hpp ├── kprint ├── likely ├── membitmap ├── memdisk ├── memstream ├── net │ ├── addr.hpp │ ├── botan │ │ ├── credman.hpp │ │ └── tls_server.hpp │ ├── buffer_store.hpp │ ├── checksum.hpp │ ├── configure.hpp │ ├── conntrack.hpp │ ├── dhcp │ │ ├── dh4client.hpp │ │ ├── dhcp4.hpp │ │ ├── dhcpd.hpp │ │ ├── message.hpp │ │ ├── options.hpp │ │ └── record.hpp │ ├── dns │ │ ├── client.hpp │ │ ├── dns.hpp │ │ ├── query.hpp │ │ ├── record.hpp │ │ └── response.hpp │ ├── error.hpp │ ├── ethernet │ │ ├── ethernet.hpp │ │ ├── ethernet_8021q.hpp │ │ ├── ethertype.hpp │ │ └── header.hpp │ ├── http │ │ ├── basic_client.hpp │ │ ├── client.hpp │ │ ├── client_connection.hpp │ │ ├── common.hpp │ │ ├── connection.hpp │ │ ├── cookie.hpp │ │ ├── error.hpp │ │ ├── header.hpp │ │ ├── header_fields.hpp │ │ ├── message.hpp │ │ ├── methods.hpp │ │ ├── mime_types.hpp │ │ ├── parse.hpp │ │ ├── request.hpp │ │ ├── response.hpp │ │ ├── response_writer.hpp │ │ ├── server.hpp │ │ ├── server_connection.hpp │ │ ├── status_code_constants.hpp │ │ ├── status_codes.hpp │ │ ├── time.hpp │ │ └── version.hpp │ ├── https │ │ ├── botan_server.hpp │ │ ├── openssl_server.hpp │ │ └── s2n_server.hpp │ ├── iana.hpp │ ├── inet │ ├── inet.hpp │ ├── inet4 │ ├── inet_common.hpp │ ├── interfaces │ ├── interfaces.hpp │ ├── ip4 │ │ ├── addr.hpp │ │ ├── arp.hpp │ │ ├── cidr.hpp │ │ ├── header.hpp │ │ ├── icmp4.hpp │ │ ├── icmp4_common.hpp │ │ ├── icmp_error.hpp │ │ ├── ip4.hpp │ │ ├── packet_arp.hpp │ │ ├── packet_icmp4.hpp │ │ └── packet_ip4.hpp │ ├── ip6 │ │ ├── addr.hpp │ │ ├── addr_list.hpp │ │ ├── detail │ │ │ └── stateful_addr.hpp │ │ ├── dhcp6.hpp │ │ ├── extension_header.hpp │ │ ├── header.hpp │ │ ├── icmp6.hpp │ │ ├── icmp6_common.hpp │ │ ├── icmp6_error.hpp │ │ ├── ip6.hpp │ │ ├── mld.hpp │ │ ├── mld │ │ │ └── message.hpp │ │ ├── ndp.hpp │ │ ├── ndp │ │ │ ├── host_params.hpp │ │ │ ├── message.hpp │ │ │ ├── options.hpp │ │ │ ├── router_entry.hpp │ │ │ └── router_params.hpp │ │ ├── packet_icmp6.hpp │ │ ├── packet_ip6.hpp │ │ ├── packet_mld.hpp │ │ ├── packet_ndp.hpp │ │ ├── slaac.hpp │ │ ├── stateful_addr.hpp │ │ ├── tcp6.hpp │ │ └── udp6.hpp │ ├── link_layer.hpp │ ├── nat │ │ ├── napt.hpp │ │ └── nat.hpp │ ├── netfilter.hpp │ ├── openssl │ │ ├── init.hpp │ │ └── tls_stream.hpp │ ├── packet.hpp │ ├── port_util.hpp │ ├── router │ ├── router.hpp │ ├── s2n │ │ └── stream.hpp │ ├── socket.hpp │ ├── stream.hpp │ ├── stream_buffer.hpp │ ├── tcp │ │ ├── common.hpp │ │ ├── connection.hpp │ │ ├── connection.inc │ │ ├── connection_states.hpp │ │ ├── headers.hpp │ │ ├── listener.hpp │ │ ├── options.hpp │ │ ├── packet.hpp │ │ ├── packet4_view.hpp │ │ ├── packet6_view.hpp │ │ ├── packet_view.hpp │ │ ├── read_buffer.hpp │ │ ├── read_request.hpp │ │ ├── rttm.hpp │ │ ├── sack.hpp │ │ ├── stream.hpp │ │ ├── tcp.hpp │ │ ├── tcp_conntrack.hpp │ │ ├── tcp_errors.hpp │ │ └── write_queue.hpp │ ├── udp │ │ ├── common.hpp │ │ ├── header.hpp │ │ ├── packet4_view.hpp │ │ ├── packet6_view.hpp │ │ ├── packet_udp.hpp │ │ ├── packet_view.hpp │ │ ├── socket.hpp │ │ └── udp.hpp │ ├── util.hpp │ ├── vif.hpp │ ├── vlan │ ├── vlan_manager.hpp │ └── ws │ │ ├── connector.hpp │ │ ├── header.hpp │ │ └── websocket.hpp ├── os ├── os.hpp ├── plugins │ └── unik.hpp ├── pmr ├── posix │ ├── fd.hpp │ ├── fd_map.hpp │ ├── file_fd.hpp │ ├── rng_fd.hpp │ ├── sockfd.hpp │ ├── stddef.h │ ├── syslog_print_socket.hpp │ ├── syslog_udp_socket.hpp │ ├── tcp_fd.hpp │ ├── udp_fd.hpp │ ├── unix_fd.hpp │ └── unix_fd_impl.hpp ├── profile ├── ringbuffer ├── rtc ├── serial ├── service ├── signal ├── smp ├── smp_utils ├── statman ├── syslogd ├── system_log ├── tar ├── terminal ├── timers ├── uri ├── util │ ├── alloc_buddy.hpp │ ├── alloc_lstack.hpp │ ├── alloc_pmr.hpp │ ├── allocator.hpp │ ├── async.hpp │ ├── autoconf.hpp │ ├── base64.hpp │ ├── bitops.hpp │ ├── config.hpp │ ├── crc32.hpp │ ├── crc64.hpp │ ├── delegate.hpp │ ├── detail │ │ ├── alloc_pmr.hpp │ │ └── string_view │ ├── elf_binary.hpp │ ├── elf_binary.inc │ ├── fixed_bitmap.hpp │ ├── fixed_list_alloc.hpp │ ├── fixed_queue.hpp │ ├── fixed_storage.hpp │ ├── fixed_vector.hpp │ ├── isotime.hpp │ ├── logger.hpp │ ├── membitmap.hpp │ ├── memstream.h │ ├── path_to_regex.hpp │ ├── percent_encoding.hpp │ ├── ringbuffer.hpp │ ├── sha1.hpp │ ├── signal.hpp │ ├── statman.hpp │ ├── syslog_facility.hpp │ ├── syslogd.hpp │ ├── tar.hpp │ ├── timer.hpp │ ├── typename.hpp │ ├── units.hpp │ └── uri.hpp ├── vga └── virtio │ └── virtio.hpp ├── chainloader.nix ├── cmake ├── compiler_options.txt ├── cpu_feat.cmake ├── elf-toolchain.cmake ├── includeos-config.cmake.in ├── includeos.cmake ├── library.cmake ├── linux.service.cmake ├── os.cmake └── vanilla.cmake ├── code-of-conduct.md ├── default.nix ├── deps ├── botan │ ├── WIP.md │ └── default.nix ├── http-parser │ └── default.nix ├── lest │ └── default.nix ├── libfdt │ └── CMakeLists.txt ├── musl-unpatched │ └── default.nix ├── musl │ ├── default.nix │ └── patches │ │ ├── endian.patch │ │ ├── includeos_syscalls.h │ │ ├── musl.patch │ │ ├── musl_full.patch │ │ └── syscall.h ├── s2n │ └── default.nix └── uzlib │ ├── Makefile.ios │ └── default.nix ├── etc ├── debug │ └── service.gdb ├── linux │ ├── lxp-callgraph │ ├── lxp-debug │ ├── lxp-gprof │ ├── lxp-pgo │ └── lxp-run ├── logo.png └── set_traps.sh ├── example.nix ├── example ├── CMakeLists.txt └── src │ └── main.cpp ├── lib └── LiveUpdate │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ ├── liveupdate │ ├── liveupdate.hpp │ └── storage.hpp │ ├── layout.txt │ └── src │ ├── elfscan.cpp │ ├── hotswap.cpp │ ├── hotswap64.asm │ ├── hotswap64_blob.asm │ ├── os.cpp │ ├── partition.cpp │ ├── resume.cpp │ ├── rollback.cpp │ ├── serialize_s2n.cpp │ ├── serialize_tcp.cpp │ ├── serialize_tcp.hpp │ ├── storage.cpp │ └── update.cpp ├── overlay.nix ├── pinned.nix ├── shell.nix ├── src ├── CMakeLists.txt ├── arch │ ├── CMakeLists.txt │ ├── aarch64 │ │ ├── CMakeLists.txt │ │ ├── arch_start.asm │ │ ├── cpu.cpp │ │ ├── cpu.h │ │ ├── exceptions.asm │ │ ├── linker.ld │ │ ├── macros.h │ │ ├── paging.cpp │ │ ├── syscall_entry.cpp │ │ ├── timer.cpp │ │ └── timer.h │ ├── i686 │ │ ├── CMakeLists.txt │ │ ├── apic_asm.asm │ │ ├── arch_start.asm │ │ ├── exceptions.asm │ │ ├── fiber.asm │ │ ├── gdt_asm.asm │ │ ├── interrupts.asm │ │ ├── linker.ld │ │ ├── paging.cpp │ │ └── profile_intr.asm │ └── x86_64 │ │ ├── CMakeLists.txt │ │ ├── __syscall_entry.asm │ │ ├── apic_asm.asm │ │ ├── apic_longmode.asm │ │ ├── arch_start.asm │ │ ├── arch_start_broken1.asm │ │ ├── exceptions.asm │ │ ├── fiber_asm.asm │ │ ├── init_paging.cpp │ │ ├── interrupts.asm │ │ ├── ist.cpp │ │ ├── linker.ld │ │ ├── paging.cpp │ │ ├── profile_intr.asm │ │ ├── syscall_entry.cpp │ │ └── tss.hpp ├── chainload │ ├── CMakeLists.txt │ ├── hotswap.cpp │ ├── layout.txt │ └── service.cpp ├── crt │ ├── CMakeLists.txt │ ├── c_abi.c │ ├── crti.asm │ ├── crtn.asm │ ├── ctype_b_loc.c │ ├── ctype_tolower_loc.c │ ├── cxx_abi.cpp │ ├── pthread.c │ └── quick_exit.cpp ├── drivers │ ├── CMakeLists.txt │ ├── disk_logger.cpp │ ├── e1000.cpp │ ├── e1000.hpp │ ├── e1000_defs.hpp │ ├── heap_debugging.cpp │ ├── ide.cpp │ ├── ide.hpp │ ├── ip4_reassembly.cpp │ ├── solo5blk.cpp │ ├── solo5blk.hpp │ ├── solo5net.cpp │ ├── solo5net.hpp │ ├── stdout │ │ ├── bootlog.cpp │ │ ├── default_stdout.cpp │ │ ├── timestamps.cpp │ │ └── vgaout.cpp │ ├── vga_emergency.cpp │ ├── virtioblk.cpp │ ├── virtioblk.hpp │ ├── virtiocon.cpp │ ├── virtiocon.hpp │ ├── virtionet.cpp │ ├── virtionet.hpp │ ├── vmxnet3.cpp │ ├── vmxnet3.hpp │ └── vmxnet3_queues.hpp ├── fs │ ├── CMakeLists.txt │ ├── dirent.cpp │ ├── disk.cpp │ ├── fat.cpp │ ├── fat_async.cpp │ ├── fat_sync.cpp │ ├── filesystem.cpp │ ├── mbr.cpp │ ├── memdisk.cpp │ └── path.cpp ├── hal │ ├── CMakeLists.txt │ └── machine.cpp ├── hw │ ├── CMakeLists.txt │ ├── msi.cpp │ ├── nic.cpp │ ├── pci_device.cpp │ ├── pci_manager.cpp │ ├── pci_msi.cpp │ ├── ps2.cpp │ ├── serial.cpp │ ├── usernet.cpp │ └── vga_gfx.cpp ├── include │ └── kernel.hpp ├── kernel │ ├── CMakeLists.txt │ ├── block.cpp │ ├── context.cpp │ ├── context_asm.asm │ ├── cpuid.cpp │ ├── elf.cpp │ ├── events.cpp │ ├── fiber.cpp │ ├── heap.cpp │ ├── kernel.cpp │ ├── liveupdate.cpp │ ├── memmap.cpp │ ├── multiboot.cpp │ ├── os.cpp │ ├── profile.cpp │ ├── rng.cpp │ ├── rtc.cpp │ ├── scoped_profiler.cpp │ ├── service_stub.cpp │ ├── syscalls.cpp │ ├── system_log.cpp │ ├── terminal.cpp │ ├── timers.cpp │ ├── tls.cpp │ └── vga.cpp ├── memdisk │ ├── empty.asm │ ├── memdisk.asm │ └── memdisk.py ├── musl │ ├── CMakeLists.txt │ ├── _lseek.cpp │ ├── access.cpp │ ├── brk.cpp │ ├── chmod.cpp │ ├── chown.cpp │ ├── clock_gettime.cpp │ ├── close.cpp │ ├── common.hpp │ ├── creat.cpp │ ├── cwd.cpp │ ├── dup3.cpp │ ├── execve.cpp │ ├── exit.cpp │ ├── faccessat.cpp │ ├── faccessat2.cpp │ ├── fchdir.cpp │ ├── fchmod.cpp │ ├── fchmodat.cpp │ ├── fchmodat2.cpp │ ├── fchown.cpp │ ├── fcntl.cpp │ ├── fstat.cpp │ ├── fstatat.cpp │ ├── fsync.cpp │ ├── ftruncate.cpp │ ├── futex.cpp │ ├── getdents.cpp │ ├── geteuid.cpp │ ├── getgid.cpp │ ├── getpid.cpp │ ├── getrandom.cpp │ ├── getrlimit.cpp │ ├── getrusage.cpp │ ├── gettid.cpp │ ├── gettimeofday.cpp │ ├── getuid.cpp │ ├── ioctl.cpp │ ├── kill.cpp │ ├── lseek.cpp │ ├── madvise.cpp │ ├── mincore.cpp │ ├── mkdir.cpp │ ├── mkdirat.cpp │ ├── mknod.cpp │ ├── mknodat.cpp │ ├── mlock.cpp │ ├── mmap.cpp │ ├── mprotect.cpp │ ├── mremap.cpp │ ├── msync.cpp │ ├── munmap.cpp │ ├── nanosleep.cpp │ ├── open.cpp │ ├── openat.cpp │ ├── pipe.cpp │ ├── poll.cpp │ ├── prlimit64.cpp │ ├── read.cpp │ ├── readlink.cpp │ ├── readv.cpp │ ├── rename.cpp │ ├── rmdir.cpp │ ├── rt_sigaction.cpp │ ├── sched_getaffinity.cpp │ ├── sched_setaffinity.cpp │ ├── sched_setscheduler.cpp │ ├── sched_yield.cpp │ ├── select.cpp │ ├── set_robust_list.cpp │ ├── set_tid_address.cpp │ ├── setgid.cpp │ ├── setpgid.cpp │ ├── setrlimit.cpp │ ├── setsid.cpp │ ├── setuid.cpp │ ├── sigaltstack.cpp │ ├── sigmask.cpp │ ├── socketcall.cpp │ ├── stat.cpp │ ├── statx.cpp │ ├── stub.hpp │ ├── sync.cpp │ ├── syscall_n.cpp │ ├── sysinfo.cpp │ ├── umask.cpp │ ├── uname.cpp │ ├── unlink.cpp │ ├── utimensat.cpp │ ├── wait4.cpp │ ├── write.cpp │ └── writev.cpp ├── net │ ├── CMakeLists.txt │ ├── addr.cpp │ ├── buffer_store.cpp │ ├── checksum.cpp │ ├── configure.cpp │ ├── conntrack.cpp │ ├── dhcp │ │ ├── dh4client.cpp │ │ └── dhcpd.cpp │ ├── dns │ │ ├── client.cpp │ │ ├── dns.cpp │ │ ├── query.cpp │ │ ├── record.cpp │ │ └── response.cpp │ ├── ethernet │ │ ├── ethernet.cpp │ │ └── ethernet_8021q.cpp │ ├── http │ │ ├── basic_client.cpp │ │ ├── client.cpp │ │ ├── client_connection.cpp │ │ ├── cookie.cpp │ │ ├── header.cpp │ │ ├── header_fields.cpp │ │ ├── message.cpp │ │ ├── mime_types.cpp │ │ ├── request.cpp │ │ ├── response.cpp │ │ ├── response_writer.cpp │ │ ├── server.cpp │ │ ├── server_connection.cpp │ │ ├── status_codes.cpp │ │ ├── time.cpp │ │ └── version.cpp │ ├── https │ │ ├── botan_server.cpp │ │ ├── openssl_server.cpp │ │ └── s2n_server.cpp │ ├── inet.cpp │ ├── interfaces.cpp │ ├── ip4 │ │ ├── arp.cpp │ │ ├── icmp4.cpp │ │ ├── ip4.cpp │ │ └── reassembly.cpp │ ├── ip6 │ │ ├── addr.cpp │ │ ├── addr_list.cpp │ │ ├── extension_header.cpp │ │ ├── icmp6.cpp │ │ ├── ip6.cpp │ │ ├── mld.cpp │ │ ├── ndp.cpp │ │ ├── packet_mld.cpp │ │ ├── packet_ndp.cpp │ │ ├── slaac.cpp │ │ └── udp6.cpp │ ├── nat │ │ ├── napt.cpp │ │ └── nat.cpp │ ├── openssl │ │ ├── client.cpp │ │ ├── init.cpp │ │ ├── server.cpp │ │ └── tls_stream.cpp │ ├── packet_debug.cpp │ ├── tcp │ │ ├── connection.cpp │ │ ├── connection_states.cpp │ │ ├── listener.cpp │ │ ├── read_buffer.cpp │ │ ├── read_request.cpp │ │ ├── rttm.cpp │ │ ├── stream.cpp │ │ ├── tcp.cpp │ │ ├── tcp_conntrack.cpp │ │ └── write_queue.cpp │ ├── udp │ │ ├── socket.cpp │ │ └── udp.cpp │ ├── vlan_manager.cpp │ └── ws │ │ └── websocket.cpp ├── platform │ ├── CMakeLists.txt │ ├── aarch64_vm │ │ ├── CMakeLists.txt │ │ ├── exception_handling.cpp │ │ ├── exception_handling.hpp │ │ ├── gic.cpp │ │ ├── gic.h │ │ ├── gic_regs.h │ │ ├── init_libc.cpp │ │ ├── init_libc.hpp │ │ ├── kernel_start.cpp │ │ ├── os.cpp │ │ ├── platform.cpp │ │ ├── platform.hpp │ │ ├── sanity_checks.cpp │ │ ├── serial1.cpp │ │ ├── start.asm │ │ ├── start_aarch64.asm │ │ └── stop.asm │ ├── kvm │ │ ├── bsd_pvclock.hpp │ │ ├── kvmclock.cpp │ │ ├── kvmclock.hpp │ │ └── pv_eoi.cpp │ ├── x86_nano │ │ ├── CMakeLists.txt │ │ ├── kernel_start.cpp │ │ └── platform.cpp │ ├── x86_pc │ │ ├── CMakeLists.txt │ │ ├── acpi.cpp │ │ ├── acpi.hpp │ │ ├── apic.cpp │ │ ├── apic.hpp │ │ ├── apic_boot.asm │ │ ├── apic_iface.hpp │ │ ├── apic_regs.hpp │ │ ├── apic_revenant.cpp │ │ ├── apic_revenant.hpp │ │ ├── apic_timer.cpp │ │ ├── apic_timer.hpp │ │ ├── boot │ │ │ ├── CMakeLists.txt │ │ │ ├── bootloader.asm │ │ │ └── disk_read_lba.asm │ │ ├── clocks.cpp │ │ ├── clocks.hpp │ │ ├── cmos.cpp │ │ ├── cmos.hpp │ │ ├── cmos_clock.cpp │ │ ├── cmos_clock.hpp │ │ ├── cpu_freq_sampling.cpp │ │ ├── cpu_freq_sampling.hpp │ │ ├── gdt.cpp │ │ ├── idt.cpp │ │ ├── idt.hpp │ │ ├── init_libc.cpp │ │ ├── init_libc.hpp │ │ ├── ioapic.cpp │ │ ├── ioapic.hpp │ │ ├── kernel_start.cpp │ │ ├── os.cpp │ │ ├── pic.cpp │ │ ├── pic.hpp │ │ ├── pit.cpp │ │ ├── pit.hpp │ │ ├── platform.cpp │ │ ├── platform.hpp │ │ ├── rand.cpp │ │ ├── sanity_checks.cpp │ │ ├── serial1.cpp │ │ ├── smbios.cpp │ │ ├── smbios.hpp │ │ ├── smp.cpp │ │ ├── smp.hpp │ │ ├── softreset.cpp │ │ ├── start.asm │ │ ├── x2apic.hpp │ │ └── xapic.hpp │ └── x86_solo5 │ │ ├── CMakeLists.txt │ │ ├── kernel_start.cpp │ │ ├── os.cpp │ │ ├── platform.cpp │ │ ├── sanity_checks.cpp │ │ ├── serial1.cpp │ │ ├── solo5_manager.cpp │ │ └── start.asm ├── plugins │ ├── CMakeLists.txt │ ├── autoconf.cpp │ ├── example.cpp │ ├── field_medic │ │ ├── diag.cpp │ │ ├── fieldmedic.cpp │ │ └── fieldmedic.hpp │ ├── madness │ │ ├── doge.hpp │ │ ├── madness.cpp │ │ └── madness.hpp │ ├── nacl.cpp │ ├── syslog.cpp │ ├── syslogd.cpp │ ├── system_log.cpp │ ├── terminal.cpp │ ├── unik.cpp │ └── vfs.cpp ├── posix │ ├── CMakeLists.txt │ ├── fd.cpp │ ├── file_fd.cpp │ ├── memalign.cpp │ ├── pthread.cpp │ ├── secure_getenv.cpp │ ├── stdlib.cpp │ ├── sys │ │ ├── socket.cpp │ │ └── stat.cpp │ ├── tcp_fd.cpp │ ├── udp_fd.cpp │ ├── unistd.cpp │ └── unix_fd.cpp ├── service_name.cpp ├── util │ ├── CMakeLists.txt │ ├── async.cpp │ ├── autoconf.cpp │ ├── config.cpp │ ├── crc32.cpp │ ├── logger.cpp │ ├── memstream.c │ ├── path_to_regex.cpp │ ├── percent_encoding.cpp │ ├── pmr_default.cpp │ ├── sha1.cpp │ ├── statman.cpp │ ├── statman_liu.cpp │ ├── syslog_facility.cpp │ ├── syslogd.cpp │ ├── tar.cpp │ └── uri.cpp ├── version.cpp └── virtio │ ├── CMakeLists.txt │ ├── virtio.cpp │ └── virtio_queue.cpp ├── test.sh ├── test ├── .gitignore ├── CMakeLists.txt ├── README.md ├── fs │ ├── integration │ │ ├── fat16 │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── banana.ascii │ │ │ ├── disk │ │ │ │ └── banana.txt │ │ │ ├── fat16.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── fat32 │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── banana.ascii │ │ │ ├── banana.txt │ │ │ ├── fat32.cpp │ │ │ ├── fat32_disk.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── ide │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── banana.ascii │ │ │ ├── banana.txt │ │ │ ├── fat32_disk.sh │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── ide_write │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── banana.ascii │ │ │ ├── banana.txt │ │ │ ├── fat32_disk.sh │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── memdisk │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── bigdisk.cpp │ │ │ ├── bigdisk.sh │ │ │ ├── nosector.cpp │ │ │ ├── sector0.disk │ │ │ ├── sector2.disk │ │ │ ├── test.py │ │ │ ├── twosector.cpp │ │ │ └── vm.json │ │ ├── vfs │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── create_disk.sh │ │ │ ├── memdisk │ │ │ │ ├── README.md │ │ │ │ └── users │ │ │ │ │ ├── alfred │ │ │ │ │ ├── etc │ │ │ │ │ │ ├── ip4 │ │ │ │ │ │ │ └── config.txt │ │ │ │ │ │ └── ip6 │ │ │ │ │ │ │ └── config.txt │ │ │ │ │ └── private │ │ │ │ │ │ ├── secret_plan_step1.txt │ │ │ │ │ │ └── secret_plan_step2.txt │ │ │ │ │ └── ingve │ │ │ │ │ └── etc │ │ │ │ │ └── ip4 │ │ │ │ │ └── config.txt │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ ├── virtio1 │ │ │ │ ├── pictures │ │ │ │ │ └── profile.txt │ │ │ │ └── txt │ │ │ │ │ └── quote.txt │ │ │ ├── virtio2 │ │ │ │ ├── pictures │ │ │ │ │ └── profile.txt │ │ │ │ └── txt │ │ │ │ │ └── quote.txt │ │ │ └── vm.json │ │ └── virtio_block │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── cleanup.sh │ │ │ ├── image.sh │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ ├── test.txt │ │ │ └── vm.json │ └── unit │ │ ├── memdisk_test.cpp │ │ ├── path_test.cpp │ │ ├── unit_fat.cpp │ │ ├── unit_fs.cpp │ │ └── vfs_test.cpp ├── hw │ ├── integration │ │ ├── serial │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── run.sh │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── vga │ │ │ ├── Makefile │ │ │ ├── debug.sh │ │ │ ├── run.sh │ │ │ ├── service.gdb │ │ │ ├── test.sh │ │ │ ├── vbox.sh │ │ │ └── vga.cpp │ │ └── virtio_queue │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── run.sh │ │ │ ├── service.cpp │ │ │ └── test.sh │ └── unit │ │ ├── cpu_test.cpp │ │ ├── mac_addr_test.cpp │ │ ├── usernet.cpp │ │ └── virtio_queue.cpp ├── integration │ └── README.md ├── kernel │ ├── integration │ │ ├── LiveUpdate │ │ │ ├── CMakeLists.txt │ │ │ ├── liu.hpp │ │ │ ├── manual.sh │ │ │ ├── server.hpp │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ ├── test_boot.cpp │ │ │ └── vm.json │ │ ├── block │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── context │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── exception │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── fiber │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── fiber_smp.cpp │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── grub │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── grub.cfg │ │ │ ├── grubiso.sh │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── kprint │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── memmap │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ ├── vm1.json │ │ │ └── vm2.json │ │ ├── modules │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── osinit │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── paging │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── plugin_init │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── plugin1.cpp │ │ │ ├── plugin2.cpp │ │ │ ├── plugin3.cpp │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── rng │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── smp │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── spinlocks │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── stacktrace │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── term │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── timers │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ ├── timers.cpp │ │ │ └── vm.json │ │ └── tls │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ └── unit │ │ ├── arch.cpp │ │ ├── block.cpp │ │ ├── cpuid.cpp │ │ ├── memmap_test.cpp │ │ ├── os_test.cpp │ │ ├── paging.inc │ │ ├── rng.cpp │ │ ├── service_stub_test.cpp │ │ ├── spinlocks.cpp │ │ ├── test_hal.cpp │ │ ├── test_memory.cpp │ │ ├── unit_events.cpp │ │ ├── unit_liveupdate.cpp │ │ ├── unit_timers.cpp │ │ └── x86_paging.cpp ├── lest_util │ ├── common.cxx │ ├── lestmain.cxx │ ├── malloc.h │ ├── mock_fs.cpp │ ├── mock_fs.hpp │ ├── nic_mock.hpp │ ├── os_mock.cpp │ ├── packet_factory.hpp │ ├── posix_strace.hpp │ ├── random.cpp │ └── stdlib.h ├── lib │ └── unit │ │ └── mana │ │ └── cookie_jar_test.cpp ├── memdisk.fat ├── misc │ ├── binary_check │ │ └── test.sh │ ├── build_services │ │ └── test.sh │ ├── run_unit_tests │ │ └── test.sh │ ├── solo5-hvt │ │ ├── build.sh │ │ ├── manual.sh │ │ └── test.sh │ └── solo5-spt │ │ └── test.sh ├── mod │ └── integration │ │ └── gsl │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── service.cpp │ │ └── test.py ├── net │ ├── integration │ │ ├── bufstore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── configure │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── config.json │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── dhclient │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── dhcpd │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── dhcpd_dhclient_linux │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── dns │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── gateway │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── nacl.txt │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── http │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── run.sh │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── icmp │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── icmp6 │ │ │ ├── CMakeLists.txt │ │ │ ├── linux │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── run.sh │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── microLB │ │ │ ├── CMakeLists.txt │ │ │ ├── config.json │ │ │ ├── drive │ │ │ │ ├── test.key │ │ │ │ └── test.pem │ │ │ ├── server.js │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── nat │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── router │ │ │ ├── CMakeLists.txt │ │ │ ├── diagram.md │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── router6 │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── diagram.md │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── slaac │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── tcp │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── debug.py │ │ │ ├── linux │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── run.sh │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── udp │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── vlan │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── config.json │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ └── websocket │ │ │ ├── CMakeLists.txt │ │ │ ├── service.cpp │ │ │ ├── setup.sh │ │ │ ├── test.py │ │ │ └── vm.json │ └── unit │ │ ├── addr_test.cpp │ │ ├── bufstore.cpp │ │ ├── checksum.cpp │ │ ├── cidr.cpp │ │ ├── conntrack_test.cpp │ │ ├── cookie_test.cpp │ │ ├── dhcp.cpp │ │ ├── dhcp_message_test.cpp │ │ ├── error.cpp │ │ ├── http_header_test.cpp │ │ ├── http_method_test.cpp │ │ ├── http_mime_types_test.cpp │ │ ├── http_request_test.cpp │ │ ├── http_response_test.cpp │ │ ├── http_status_codes_test.cpp │ │ ├── http_time_test.cpp │ │ ├── http_version_test.cpp │ │ ├── interfaces_test.cpp │ │ ├── ip4.cpp │ │ ├── ip4_addr.cpp │ │ ├── ip4_packet_test.cpp │ │ ├── ip6.cpp │ │ ├── ip6_addr.cpp │ │ ├── ip6_addr_list_test.cpp │ │ ├── ip6_packet_test.cpp │ │ ├── napt_test.cpp │ │ ├── nat_test.cpp │ │ ├── packets.cpp │ │ ├── path_mtu_discovery.cpp │ │ ├── port_util_test.cpp │ │ ├── router_test.cpp │ │ ├── socket.cpp │ │ ├── stateful_addr_test.cpp │ │ ├── tcp_benchmark.cpp │ │ ├── tcp_packet_test.cpp │ │ ├── tcp_read_buffer_test.cpp │ │ ├── tcp_read_request_test.cpp │ │ ├── tcp_sack_test.cpp │ │ ├── tcp_write_queue.cpp │ │ └── websocket.cpp ├── performance │ ├── .keep │ ├── integration │ │ └── .keep │ └── unit │ │ └── .keep ├── plugin │ └── integration │ │ └── unik │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── service.cpp │ │ ├── test.py │ │ └── vm.json ├── posix │ ├── integration │ │ ├── conf │ │ │ ├── CMakeLists.txt │ │ │ ├── config.json │ │ │ ├── disk │ │ │ │ └── files │ │ │ │ │ └── passwd │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ ├── test_pathconf.c │ │ │ ├── test_pwd.c │ │ │ ├── test_sysconf.c │ │ │ └── vm.json │ │ ├── file_fd │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── config.json │ │ │ ├── disk │ │ │ │ ├── file1 │ │ │ │ ├── file2 │ │ │ │ ├── file3 │ │ │ │ ├── folder1 │ │ │ │ │ ├── file1 │ │ │ │ │ ├── file2 │ │ │ │ │ ├── foldera │ │ │ │ │ │ └── file1 │ │ │ │ │ ├── folderb │ │ │ │ │ │ └── file1 │ │ │ │ │ └── folderc │ │ │ │ │ │ └── file1 │ │ │ │ ├── folder2 │ │ │ │ │ └── file1 │ │ │ │ └── folder3 │ │ │ │ │ ├── file1 │ │ │ │ │ └── file2 │ │ │ ├── run.sh │ │ │ ├── test.py │ │ │ ├── test_file_fd.cpp │ │ │ └── vm.json │ │ ├── main │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── main_no_params.cpp │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── pthread │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── stat │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── config.json │ │ │ ├── disk │ │ │ │ ├── file1 │ │ │ │ ├── file2 │ │ │ │ ├── file3 │ │ │ │ ├── folder1 │ │ │ │ │ ├── file1 │ │ │ │ │ ├── file2 │ │ │ │ │ ├── foldera │ │ │ │ │ │ └── file1 │ │ │ │ │ ├── folderb │ │ │ │ │ │ └── file1 │ │ │ │ │ └── folderc │ │ │ │ │ │ └── file1 │ │ │ │ ├── folder2 │ │ │ │ │ └── file1 │ │ │ │ └── folder3 │ │ │ │ │ ├── file1 │ │ │ │ │ └── file2 │ │ │ ├── ftw_tests.cpp │ │ │ ├── run.sh │ │ │ ├── stat_tests.cpp │ │ │ ├── test.py │ │ │ ├── test_stat_ftw.cpp │ │ │ └── vm.json │ │ ├── syslog_default │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── syslog_plugin │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── config.json │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── tcp │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── udp │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ └── utsname │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ └── unit │ │ ├── fd_map_test.cpp │ │ ├── inet_test.cpp │ │ └── unit_fd.cpp ├── stl │ ├── integration │ │ ├── coroutines │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ ├── crt │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ └── test.py │ │ ├── exceptions │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ ├── test.py │ │ │ └── vm.json │ │ └── stl │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── service.cpp │ │ │ └── test.py │ └── unit │ │ └── .keep ├── stress │ ├── CMakeLists.txt │ ├── README.md │ ├── service.cpp │ ├── test.py │ └── vm.json ├── userspace │ ├── fuzz │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── apply_payloads.sh │ │ ├── continous_fuzz.sh │ │ ├── fuzzy_helpers.hpp │ │ ├── fuzzy_http.hpp │ │ ├── fuzzy_packet.cpp │ │ ├── fuzzy_packet.hpp │ │ ├── fuzzy_stack.cpp │ │ ├── fuzzy_stack.hpp │ │ ├── fuzzy_stream.hpp │ │ ├── fuzzy_webserver.cpp │ │ ├── http.cpp │ │ ├── macfuzzy.hpp │ │ ├── service.cpp │ │ └── test.sh │ ├── liveupdate │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── service.cpp │ │ └── test.sh │ ├── microlb │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── client.py │ │ ├── memdisk.fat │ │ ├── run_cgroup.sh │ │ ├── run_test.sh │ │ ├── server.js │ │ └── service.cpp │ ├── router │ │ ├── CMakeLists.txt │ │ ├── nacl.cpp │ │ └── service.cpp │ ├── s2n │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── memdisk.fat │ │ ├── serial.cpp │ │ ├── serial.hpp │ │ ├── service.cpp │ │ └── test.sh │ ├── tcp │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── pgo.sh │ │ ├── service.cpp │ │ └── test.sh │ └── websockets │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── memdisk.fat │ │ └── service.cpp └── util │ ├── integration │ ├── tar │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── service.cpp │ │ ├── tar_example │ │ │ ├── first_file.txt │ │ │ ├── l1_f1 │ │ │ │ ├── l2 │ │ │ │ │ ├── README.md │ │ │ │ │ └── service.cpp │ │ │ │ └── service.cpp │ │ │ ├── l1_f2 │ │ │ │ └── virtio.hpp │ │ │ └── second_file.md │ │ ├── test.py │ │ └── vm.json │ └── tar_gz │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── service.cpp │ │ ├── tar_example │ │ ├── first_file.txt │ │ ├── l1_f1 │ │ │ ├── l2 │ │ │ │ ├── README.md │ │ │ │ └── service.cpp │ │ │ └── service.cpp │ │ ├── l1_f2 │ │ │ └── virtio.hpp │ │ └── second_file.md │ │ ├── test.py │ │ └── vm.json │ └── unit │ ├── base64.cpp │ ├── bitops.cpp │ ├── buddy_alloc_test.cpp │ ├── config.cpp │ ├── corrupt-tar-gz.sh │ ├── crc32.cpp │ ├── delegate.cpp │ ├── fixed_list_alloc_test.cpp │ ├── fixed_queue.cpp │ ├── fixed_vector.cpp │ ├── isotime.cpp │ ├── logger_test.cpp │ ├── lstack │ ├── test_lstack.hpp │ ├── test_lstack_common.cpp │ ├── test_lstack_merging.cpp │ ├── test_lstack_nodes.cpp │ └── test_lstack_nomerge.cpp │ ├── membitmap.cpp │ ├── path_to_regex_no_options.cpp │ ├── path_to_regex_options.cpp │ ├── path_to_regex_parse.cpp │ ├── percent_encoding_test.cpp │ ├── pmr_alloc_test.cpp │ ├── ringbuffer.cpp │ ├── sha1.cpp │ ├── statman.cpp │ ├── syslog_facility_test.cpp │ ├── syslogd_test.cpp │ ├── tar_test.cpp │ └── uri_test.cpp ├── test_solo5_hvt.sh ├── test_solo5_spt.sh ├── unittests.nix ├── userspace ├── CMakeLists.txt ├── README.md ├── includeos │ └── CMakeLists.txt └── src │ ├── CMakeLists.txt │ ├── arch.cpp │ ├── config.cpp │ ├── drivers │ ├── memdisk.cpp │ ├── tap_driver.cpp │ └── tap_driver.hpp │ ├── epoll_evloop.hpp │ ├── linux_evloop.cpp │ ├── main.cpp │ ├── os.cpp │ ├── plugins │ └── CMakeLists.txt │ └── profile.cpp ├── vmbuild.nix └── vmbuild ├── .gitignore ├── CMakeLists.txt ├── elf_syms.cpp └── vmbuild.cpp /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | draw_white_space = all 11 | trim_trailing_white_space_on_save = true 12 | 13 | [Makefile] 14 | indent_style = tab 15 | 16 | [Makelib] 17 | indent_style = tab 18 | 19 | [*.py] 20 | indent_size = 4 21 | 22 | [boot] 23 | indent_size = 4 24 | 25 | [*.asm] 26 | indent_size = 4 27 | -------------------------------------------------------------------------------- /CONTRIBUTE.md: -------------------------------------------------------------------------------- 1 | # Contributing to IncludeOS 2 | 3 | You're very welcome to [clone, edit and send pull-request](https://help.github.com/articles/using-pull-requests). 4 | 5 | **Please read the contribution guidelines: [Contributing to IncludeOS](http://includeos.readthedocs.io/en/latest/Contributing-to-IncludeOS.html)** 6 | 7 | ## Thank you! 8 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | IncludeOS - A Resource Efficient Unikernel for Cloud Services 2 | 3 | Copyright 2015 Oslo and Akershus University College of Applied Sciences 4 | and Alfred Bratterud 5 | 6 | This product includes software developed at 7 | IncludeOS (http://www.includeos.org/). 8 | 9 | -------------------------------------------------------------------------------- /api/async: -------------------------------------------------------------------------------- 1 | // -*-C++-*- 2 | #pragma once 3 | #ifndef API_ASYNC_HEADER 4 | #define API_ASYNC_HEADER 5 | 6 | #include "util/async.hpp" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /api/autoconf: -------------------------------------------------------------------------------- 1 | // -*-C++-*- 2 | #pragma once 3 | #ifndef API_AUTOCONF_HEADER 4 | #define API_AUTOCONF_HEADER 5 | 6 | #include "util/autoconf.hpp" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /api/config: -------------------------------------------------------------------------------- 1 | // -*-C++-*- 2 | #pragma once 3 | #ifndef API_CONFIG_HEADER 4 | #define API_CONFIG_HEADER 5 | 6 | #include "util/config.hpp" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /api/detail/os.hpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | inline uint64_t os::cycles_since_boot() noexcept 7 | { 8 | return os::Arch::cpu_cycles(); 9 | } 10 | inline uint64_t os::nanos_since_boot() noexcept 11 | { 12 | return (cycles_since_boot() * 1e6) / os::cpu_freq().count(); 13 | } 14 | -------------------------------------------------------------------------------- /api/fuzz/fuzzy_packet.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "fuzzy_helpers.hpp" 5 | 6 | namespace fuzzy 7 | { 8 | extern uint8_t* 9 | add_eth_layer(uint8_t* data, FuzzyIterator& fuzzer, net::Ethertype type); 10 | extern uint8_t* 11 | add_ip4_layer(uint8_t* data, FuzzyIterator& fuzzer, 12 | const net::ip4::Addr src_addr, 13 | const net::ip4::Addr dst_addr, 14 | const uint8_t protocol = 0); 15 | extern uint8_t* 16 | add_udp4_layer(uint8_t* data, FuzzyIterator& fuzzer, 17 | const uint16_t dport); 18 | extern uint8_t* 19 | add_tcp4_layer(uint8_t* data, FuzzyIterator& fuzzer, 20 | const uint16_t dport); 21 | } -------------------------------------------------------------------------------- /api/fuzz/fuzzy_stack.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace fuzzy 7 | { 8 | using AsyncDevice = hw::Async_device; 9 | using AsyncDevice_ptr = std::unique_ptr; 10 | 11 | enum layer_t { 12 | ETH, 13 | IP4, 14 | TCP, 15 | TCP_CONNECTION, 16 | UDP, 17 | DNS, 18 | HTTP, 19 | WEBSOCKET 20 | }; 21 | 22 | struct stack_config { 23 | layer_t layer = IP4; 24 | uint16_t ip_port = 0; 25 | }; 26 | 27 | extern void 28 | insert_into_stack(AsyncDevice_ptr&, stack_config config, 29 | const uint8_t* data, const size_t size); 30 | } 31 | -------------------------------------------------------------------------------- /api/fuzz/macfuzzy.hpp: -------------------------------------------------------------------------------- 1 | // __ __ ___ _ _ 2 | // | \/ | __ _ __ | __| _ _ ___ ___ | || | 3 | // | |\/| | / _` | / _| | _| | +| | |_ / |_ / \_, | 4 | // |_|__|_| \__,_| \__|_ _|_|_ \_,_| _/__| _/__| _|__/ 5 | // _|"""""|_|"""""|_|"""""|_| """ |_|"""""|_|"""""|_|"""""|_| """"| 6 | // "`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-' 7 | #pragma once 8 | #include "fuzzy_helpers.hpp" 9 | #include "fuzzy_stack.hpp" 10 | #include "fuzzy_packet.hpp" 11 | //#include "fuzzy_stream.hpp" 12 | -------------------------------------------------------------------------------- /api/ide: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "fs/disk.hpp" 3 | #include "hw/ide.hpp" 4 | -------------------------------------------------------------------------------- /api/kernel/diag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef KERNEL_DIAG_HOOKS_HPP 2 | #define KERNEL_DIAG_HOOKS_HPP 3 | #define RUN_DIAG_HOOKS true 4 | 5 | constexpr bool run_diag_hooks = RUN_DIAG_HOOKS; 6 | 7 | namespace kernel::diag { 8 | void post_bss() noexcept; 9 | void post_machine_init() noexcept; 10 | void post_init_libc() noexcept; 11 | void post_service() noexcept; 12 | 13 | void default_post_init_libc() noexcept; 14 | 15 | template 16 | void hook() { 17 | if constexpr (run_diag_hooks) { 18 | Func(); 19 | } 20 | } 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /api/likely: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // remove me when c++20 3 | #pragma once 4 | #ifndef INCLUDEOS_BRANCH_PRED_HEADER 5 | #define INCLUDEOS_BRANCH_PRED_HEADER 6 | 7 | #define LIKELY(x) __builtin_expect(!!(x), 1) 8 | #define UNLIKELY(x) __builtin_expect(!!(x), 0) 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /api/net/http/parse.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/api/net/http/parse.hpp -------------------------------------------------------------------------------- /api/net/inet: -------------------------------------------------------------------------------- 1 | //-*- C++ -*- 2 | #pragma once 3 | #ifndef NET_INET_HEADER 4 | #define NET_INET_HEADER 5 | 6 | #include "inet.hpp" 7 | 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /api/net/inet4: -------------------------------------------------------------------------------- 1 | //-*- C++ -*- 2 | #pragma once 3 | #warning net/inet4 has changed to net/inet, please #include that instead! 4 | #include "inet.hpp" 5 | -------------------------------------------------------------------------------- /api/net/openssl/init.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace openssl 6 | { 7 | extern void setup_rng(); 8 | extern void verify_rng(); 9 | extern void init(); 10 | 11 | extern SSL_CTX* create_server(const std::string& cert, const std::string& key); 12 | 13 | extern SSL_CTX* create_client(fs::List, bool verify_peer = false); 14 | // enable peer certificate verification 15 | extern void client_verify_peer(SSL_CTX*); 16 | } 17 | -------------------------------------------------------------------------------- /api/pmr: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if __has_include() 4 | #include 5 | #include 6 | #else 7 | #include 8 | #include 9 | namespace std { 10 | namespace pmr = std::experimental::pmr; 11 | } 12 | #endif 13 | 14 | namespace os::mem { 15 | using buffer = std::pmr::vector; 16 | using buf_ptr = std::shared_ptr; 17 | } 18 | -------------------------------------------------------------------------------- /api/posix/stddef.h: -------------------------------------------------------------------------------- 1 | #define _DYNAMIC 2 | 3 | 4 | #define _GCC_MAX_ALIGN_T 5 | #include_next 6 | -------------------------------------------------------------------------------- /cmake/cpu_feat.cmake: -------------------------------------------------------------------------------- 1 | set(CAPABS "-mavx2 -maes -mfpmath=sse") 2 | message(STATUS "Using native CPU features. CAPABS = ${CAPABS}") 3 | -------------------------------------------------------------------------------- /cmake/includeos-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Config file to be picked up by find_package() 2 | @PACKAGE_INIT@ 3 | set(ARCH "x86_64") 4 | set(INCLUDEOS_PACKAGE @CMAKE_INSTALL_PREFIX@) 5 | set(CMAKE_MODULE_PATH @CMAKE_INSTALL_PREFIX@/cmake) 6 | -------------------------------------------------------------------------------- /cmake/vanilla.cmake: -------------------------------------------------------------------------------- 1 | IF(${ARCH} STREQUAL "x86_64" OR ${ARCH} STREQUAL "i686") 2 | set(CAPABS "-msse3 -mfpmath=sse") 3 | message(STATUS "Using vanilla CPU features: SSE3. CAPABS = ${CAPABS}") 4 | ENDIF() 5 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { withCcache ? false, # Enable ccache. Requires correct permissions, see overlay.nix. 2 | smp ? false, # Enable multcore support (SMP) 3 | nixpkgs ? ./pinned.nix, 4 | overlays ? [ 5 | (import ./overlay.nix { inherit withCcache; inherit smp; } ) 6 | ], 7 | pkgs ? import nixpkgs { config = {}; inherit overlays; } 8 | }: 9 | 10 | let 11 | inherit (pkgs) pkgsIncludeOS; 12 | in 13 | assert (pkgsIncludeOS.stdenv.buildPlatform.isLinux == false) -> 14 | throw "Currently only Linux builds are supported"; 15 | assert (pkgsIncludeOS.stdenv.hostPlatform.isMusl == false) -> 16 | throw "Stdenv should be based on Musl"; 17 | 18 | pkgsIncludeOS.includeos 19 | -------------------------------------------------------------------------------- /deps/botan/WIP.md: -------------------------------------------------------------------------------- 1 | # WIP build 2 | The current conanfile builds botan 3.4, which is the latest at the time of writing. 3 | __This is not yet tested with IncludeOS__. The last version known to work with IncludeOS is botan 2.8, which had explicit support. The approach now is to see if we can avoid requiring special support and use a linux build. -------------------------------------------------------------------------------- /deps/botan/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs 3 | }: 4 | let 5 | cpuFlag = if pkgs.stdenv.system == "i686-linux" then "x86_32" else "x86_64"; 6 | in 7 | pkgs.botan2.overrideAttrs (oldAttrs: { 8 | 9 | postInstall = (oldAttrs.postInstall or "") + '' 10 | ln -sr "$out/include/botan-2/botan" "$out/include" 11 | ''; 12 | 13 | configurePhase = '' 14 | runHook preConfigure 15 | python3 configure.py --prefix=$out --with-bzip2 --with-zlib --build-targets=static --cpu=${cpuFlag} --os=linux 16 | runHook postConfigure 17 | ''; 18 | 19 | buildPhase = '' 20 | runHook preBuild 21 | 22 | make -j $NIX_BUILD_CORES 23 | 24 | runHook postBuild 25 | ''; 26 | }) 27 | -------------------------------------------------------------------------------- /deps/lest/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | stdenv 4 | }: 5 | stdenv.mkDerivation rec { 6 | pname = "lest"; 7 | version = "1.35.2"; 8 | 9 | meta = { 10 | description = "A tiny C++11 test framework – lest errors escape testing."; 11 | homepage = "https://github.com/martinmoene/lest"; 12 | license = pkgs.lib.licenses.boost; 13 | }; 14 | 15 | src = fetchGit { 16 | url = "https://github.com/martinmoene/lest.git"; 17 | rev = "1eda2f7c33941617fc368ce764b5fbeffccb59bc"; 18 | }; 19 | 20 | cmakeBuildType = "Debug"; 21 | 22 | postBuild = '' 23 | mkdir -p "$out/include" 24 | cp -r include "$out/" 25 | ''; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /deps/libfdt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(libfdt) 4 | 5 | set(SRC_S 6 | dtc/libfdt/fdt.c 7 | dtc/libfdt/fdt_ro.c 8 | dtc/libfdt/fdt_wip.c 9 | dtc/libfdt/fdt_sw.c 10 | dtc/libfdt/fdt_rw.c 11 | dtc/libfdt/fdt_strerror.c 12 | dtc/libfdt/fdt_empty_tree.c 13 | dtc/libfdt/fdt_addresses.c 14 | dtc/libfdt/fdt_overlay.c 15 | ) 16 | 17 | set(HEADERS 18 | dtc/libfdt/fdt.h 19 | dtc/libfdt/libfdt.h 20 | dtc/libfdt/libfdt_env.h 21 | ) 22 | 23 | include_directories(dtc/libfdt) 24 | 25 | add_library(fdt STATIC ${SRC_S}) 26 | 27 | INSTALL(TARGETS fdt DESTINATION "lib") 28 | 29 | INSTALL(FILES ${HEADERS} DESTINATION "include") 30 | -------------------------------------------------------------------------------- /deps/musl/patches/endian.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/endian.h b/include/endian.h 2 | index 1bd4445..88c3347 100644 3 | --- a/include/endian.h 4 | +++ b/include/endian.h 5 | @@ -29,12 +29,12 @@ static __inline uint16_t __bswap16(uint16_t __x) 6 | 7 | static __inline uint32_t __bswap32(uint32_t __x) 8 | { 9 | - return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; 10 | + return __x>>24 | (__x>>8&0xff00) | (__x<<8&0xff0000) | __x<<24; 11 | } 12 | 13 | static __inline uint64_t __bswap64(uint64_t __x) 14 | { 15 | - return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32); 16 | + return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32); 17 | } 18 | 19 | #if __BYTE_ORDER == __LITTLE_ENDIAN 20 | -------------------------------------------------------------------------------- /etc/debug/service.gdb: -------------------------------------------------------------------------------- 1 | set architecture i386:x86-64 2 | 3 | break OS::start 4 | break Service::start 5 | break main 6 | 7 | set step-mode on 8 | set non-stop off 9 | target remote localhost:1234 10 | 11 | # To use the GDB_ENTRY macro, uncomment: 12 | set $eax=1 13 | -------------------------------------------------------------------------------- /etc/linux/lxp-callgraph: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | echo -e "\n>>> Installing dependencies" 5 | sudo pip install setuptools wheel 6 | pip -q install gprof2dot 7 | sudo apt install -y graphviz 8 | 9 | BINARY="`cat build/binary.txt`" 10 | echo -e "\n>>> Generating callgraph.svg from $BINARY" 11 | gprof build/$BINARY | gprof2dot | dot -Tsvg -o callgraph.svg 12 | firefox callgraph.svg 13 | -------------------------------------------------------------------------------- /etc/linux/lxp-debug: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | echo -e "\n>>> Running service with debugging" 3 | DBG="ON" 4 | source lxp-run 5 | -------------------------------------------------------------------------------- /etc/linux/lxp-gprof: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | echo -e "\n>>> Running service with profiling" 3 | source lxp-run gprof 4 | -------------------------------------------------------------------------------- /etc/linux/lxp-pgo: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | echo -e "\n>>> Running service with profile-guided optimizations" 4 | source lxp-run -DPGO_ENABLE=ON -DPGO_GENERATE=ON 5 | # TODO: figure out if we are using clang or gcc as this is only for clang 6 | #llvm-profdata merge -output build/default.profdata build/default.profraw 7 | source lxp-run -DPGO_ENABLE=ON -DPGO_GENERATE=OFF 8 | -------------------------------------------------------------------------------- /etc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/etc/logo.png -------------------------------------------------------------------------------- /etc/set_traps.sh: -------------------------------------------------------------------------------- 1 | set -e # Exit immediately on error (we're trapping the exit signal) 2 | trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG 3 | trap 'echo -e "\nINSTALL FAILED ON COMMAND: $previous_command\n"' EXIT 4 | 5 | 6 | # NOTE: script should end with 7 | # trap - EXIT 8 | -------------------------------------------------------------------------------- /example.nix: -------------------------------------------------------------------------------- 1 | { withCcache ? false, 2 | 3 | doCheck ? true, # boot unikernel after building it 4 | includeos ? import ./default.nix { inherit withCcache; }, 5 | }: 6 | 7 | includeos.stdenv.mkDerivation rec { 8 | pname = "includeos_example"; 9 | src = includeos.pkgs.lib.cleanSource ./example; 10 | dontStrip = true; 11 | inherit doCheck; 12 | 13 | nativeBuildInputs = [ 14 | includeos.pkgs.buildPackages.nasm 15 | includeos.pkgs.buildPackages.cmake 16 | ]; 17 | 18 | buildInputs = [ 19 | includeos 20 | includeos.chainloader 21 | ]; 22 | 23 | nativeCheckInputs = [ 24 | includeos.vmrunner 25 | includeos.pkgs.qemu 26 | ]; 27 | 28 | checkPhase = '' 29 | boot *.elf.bin 30 | ''; 31 | 32 | version = "dev"; 33 | } 34 | -------------------------------------------------------------------------------- /example/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Service::start(const std::string& args){ 5 | printf("Args = %s\n", args.c_str()); 6 | printf("Try giving the service less memory, eg. 10MB in vm.json\n"); 7 | printf("Service done. Shutting down...\n"); 8 | os::shutdown(); 9 | } 10 | -------------------------------------------------------------------------------- /lib/LiveUpdate/README.md: -------------------------------------------------------------------------------- 1 | # LiveUpdate 2 | 3 | # Put Liveupdate in conan editable mode 4 | 5 | **NOTE: Make sure you are in the IncludeOS src directory** 6 | 1. Remove the version variable from the `conanfile.py`. 7 | ``` 8 | awk '!/version = conan_tools/' lib/LiveUpdate/conanfile.py > temp && mv temp lib/LiveUpdate/conanfile.py 9 | ``` 10 | 1. Add editable package with correct layout 11 | ``` 12 | conan editable add lib/LiveUpdate liveupdate/9.9.9@includeos/latest --layout lib/LiveUpdate/layout.txt 13 | ``` 14 | 1. Run Conan install 15 | ``` 16 | conan install -if lib/LiveUpdate/build lib/LiveUpdate 17 | ``` 18 | 1. Run Conan build 19 | ``` 20 | conan build -sf . -bf lib/LiveUpdate/build lib/LiveUpdate 21 | ``` 22 | -------------------------------------------------------------------------------- /lib/LiveUpdate/layout.txt: -------------------------------------------------------------------------------- 1 | [includedirs] 2 | include 3 | 4 | [libdirs] 5 | build/lib 6 | -------------------------------------------------------------------------------- /pinned.nix: -------------------------------------------------------------------------------- 1 | import ( 2 | builtins.fetchTarball { 3 | url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.05.tar.gz"; 4 | sha256 = "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx"; 5 | } 6 | ) 7 | -------------------------------------------------------------------------------- /src/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(${ARCH}) 2 | -------------------------------------------------------------------------------- /src/arch/aarch64/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Branch according to exception level 3 | */ 4 | .macro execution_level_switch, var, el3, el2, el1 5 | mrs \var, CurrentEL 6 | cmp \var, 0xc 7 | b.eq \el3 8 | cmp \var, 0x8 9 | b.eq \el2 10 | cmp \var, 0x4 11 | b.eq \el1 12 | .endm 13 | -------------------------------------------------------------------------------- /src/arch/aarch64/syscall_entry.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "cpu.h" 4 | 5 | 6 | extern "C" 7 | long syscall_SYS_set_thread_area(struct user_desc *u_info) 8 | { 9 | set_tpidr(u_info); 10 | /* 11 | if (UNLIKELY(!u_info)) return -EINVAL; 12 | #ifdef __x86_64__ 13 | x86::CPU::set_fs(u_info); 14 | #else 15 | x86::CPU::set_gs(u_info); 16 | #endif*/ 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /src/arch/i686/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf32") 2 | 3 | ### i686 arch specific ### 4 | set(ARCH_OBJECTS 5 | gdt_asm.asm 6 | profile_intr.asm 7 | apic_asm.asm 8 | arch_start.asm 9 | exceptions.asm 10 | interrupts.asm 11 | fiber.asm 12 | paging.cpp 13 | ) 14 | 15 | add_library(arch STATIC ${ARCH_OBJECTS}) 16 | 17 | set_target_properties(arch PROPERTIES LINKER_LANGUAGE CXX) 18 | install(TARGETS arch DESTINATION lib) 19 | install(FILES linker.ld DESTINATION .) 20 | configure_file(linker.ld ${CMAKE_BINARY_DIR}) 21 | -------------------------------------------------------------------------------- /src/arch/x86_64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) 2 | 3 | ### x86_64 arch specific ### 4 | set(ARCH_OBJECTS 5 | apic_asm.asm 6 | apic_longmode.asm 7 | arch_start.asm 8 | exceptions.asm 9 | interrupts.asm 10 | fiber_asm.asm 11 | __syscall_entry.asm 12 | syscall_entry.cpp 13 | ist.cpp 14 | paging.cpp 15 | init_paging.cpp 16 | ) 17 | 18 | add_library(arch STATIC ${ARCH_OBJECTS}) 19 | set_target_properties(arch PROPERTIES LINKER_LANGUAGE CXX) 20 | configure_file(linker.ld ${CMAKE_BINARY_DIR}) 21 | install(TARGETS arch DESTINATION lib) 22 | install(FILES linker.ld DESTINATION .) 23 | -------------------------------------------------------------------------------- /src/chainload/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | # IncludeOS install location 4 | project(chainloader C CXX) 5 | 6 | find_package(IncludeOS REQUIRED) 7 | 8 | set(ARCH i686) 9 | set(PLATFORM nano) 10 | set(ELF_SYMBOLS true) 11 | 12 | include(os) 13 | 14 | option(default_stdout "" ON) 15 | set(SOURCES 16 | service.cpp hotswap.cpp 17 | ) 18 | set(BINARY_NAME chainloader) 19 | 20 | os_add_executable(chainloader "IncludeOS chainloader" ${SOURCES}) 21 | os_install(TARGETS chainloader DESTINATION bin) 22 | os_install(TARGETS chainloader.elf.bin.copy DESTINATION bin) 23 | os_install(TARGETS _elf_symbols.bin DESTINATION bin) 24 | -------------------------------------------------------------------------------- /src/chainload/layout.txt: -------------------------------------------------------------------------------- 1 | [includedirs] 2 | include 3 | 4 | [libdirs] 5 | build/lib 6 | [bindirs] 7 | build 8 | -------------------------------------------------------------------------------- /src/crt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SRCS 2 | c_abi.c 3 | ctype_b_loc.c 4 | ctype_tolower_loc.c 5 | quick_exit.cpp 6 | cxx_abi.cpp 7 | ) 8 | add_library(crt OBJECT ${SRCS}) 9 | 10 | # disable sanitizers on c_abi and cxx_abi, etc. 11 | set_source_files_properties(c_abi.c PROPERTIES COMPILE_FLAGS "-fno-sanitize=all") 12 | set_source_files_properties(cxx_abi.cpp PROPERTIES COMPILE_FLAGS "-fno-sanitize=all") 13 | -------------------------------------------------------------------------------- /src/crt/crti.asm: -------------------------------------------------------------------------------- 1 | global _init 2 | global _fini 3 | 4 | section .init 5 | _init: 6 | push ebp 7 | mov DWORD ebp, esp 8 | 9 | 10 | section .fini 11 | _fini: 12 | push ebp 13 | mov DWORD ebp, esp 14 | -------------------------------------------------------------------------------- /src/crt/crtn.asm: -------------------------------------------------------------------------------- 1 | section .init 2 | 3 | pop ebp 4 | ret 5 | 6 | section .fini 7 | 8 | pop ebp 9 | ret 10 | -------------------------------------------------------------------------------- /src/drivers/ip4_reassembly.cpp: -------------------------------------------------------------------------------- 1 | /* to be removed eventually */ 2 | -------------------------------------------------------------------------------- /src/fs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 |  2 | SET(SRCS 3 | disk.cpp 4 | filesystem.cpp 5 | dirent.cpp 6 | mbr.cpp 7 | path.cpp 8 | fat.cpp 9 | fat_async.cpp 10 | fat_sync.cpp 11 | memdisk.cpp 12 | ) 13 | 14 | add_library(fs OBJECT ${SRCS}) 15 | -------------------------------------------------------------------------------- /src/hal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | machine.cpp 3 | ) 4 | 5 | 6 | add_library(hal OBJECT ${SRCS}) 7 | -------------------------------------------------------------------------------- /src/hw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | pci_device.cpp 3 | pci_manager.cpp 4 | nic.cpp 5 | ps2.cpp 6 | serial.cpp 7 | vga_gfx.cpp 8 | msi.cpp 9 | pci_msi.cpp 10 | usernet.cpp 11 | ) 12 | 13 | 14 | add_library(hw OBJECT ${SRCS}) 15 | -------------------------------------------------------------------------------- /src/kernel/rtc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | RTC::timestamp_t RTC::booted_at; 4 | 5 | void RTC::init() 6 | { 7 | // set boot timestamp 8 | booted_at = now(); 9 | } 10 | -------------------------------------------------------------------------------- /src/memdisk/empty.asm: -------------------------------------------------------------------------------- 1 | USE32 2 | section .diskdata 3 | 4 | -------------------------------------------------------------------------------- /src/memdisk/memdisk.asm: -------------------------------------------------------------------------------- 1 | USE32 2 | ALIGN 4096 3 | section .diskdata 4 | incbin "testdisk" 5 | -------------------------------------------------------------------------------- /src/musl/_lseek.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | 3 | static long sys__lseek() 4 | { 5 | return -ENOSYS; 6 | } 7 | 8 | extern "C" 9 | long syscall_SYS__lseek() { 10 | return stubtrace(sys__lseek, "_lseek"); 11 | } 12 | -------------------------------------------------------------------------------- /src/musl/chmod.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_chmod(const char* /*path*/, mode_t /*mode*/) { 5 | // currently makes no sense, especially since we're read-only 6 | return -EROFS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_chmod(const char *path, mode_t mode) { 11 | return strace(sys_chmod, "chmod", path, mode); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/chown.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_chown(const char* /*path*/, uid_t /*owner*/, gid_t /*group*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_chown(const char *path, uid_t owner, gid_t group) 11 | { 12 | return strace(sys_chown, "chown", path, owner, group); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/close.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_close(int fd) 5 | { 6 | if(auto* fildes = FD_map::_get(fd); fildes) 7 | { 8 | long res = fildes->close(); 9 | FD_map::close(fd); 10 | return res; 11 | } 12 | return -EBADF; 13 | } 14 | 15 | extern "C" 16 | long syscall_SYS_close(int fd) { 17 | return strace(sys_close, "close", fd); 18 | } 19 | -------------------------------------------------------------------------------- /src/musl/creat.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | #include 3 | 4 | static long sys_creat(const char* /*pathname*/, mode_t /*mode*/) { 5 | // currently makes no sense, especially since we're read-only 6 | return -EROFS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_creat(const char *pathname, mode_t mode) { 11 | return stubtrace(sys_creat, "creat", pathname, mode); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/dup3.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_dup(int /*oldfd*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | static long sys_dup2(int /*oldfd*/, int /*newfd*/) 10 | { 11 | return -ENOSYS; 12 | } 13 | static long sys_dup3(int /*oldfd*/, int /*newfd*/, int /*flags*/) 14 | { 15 | return -ENOSYS; 16 | } 17 | 18 | extern "C" 19 | long syscall_SYS_dup(int oldfd) { 20 | return strace(sys_dup, "dup", oldfd); 21 | } 22 | 23 | extern "C" 24 | long syscall_SYS_dup2(int oldfd, int newfd) { 25 | return strace(sys_dup2, "dup2", oldfd, newfd); 26 | } 27 | 28 | extern "C" 29 | long syscall_SYS_dup3(int oldfd, int newfd, int flags) { 30 | return strace(sys_dup3, "dup3", oldfd, newfd, flags); 31 | } 32 | -------------------------------------------------------------------------------- /src/musl/execve.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_execve(const char*, char *const[], char *const[]) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_execve(const char *filename, char *const argv[], 12 | char *const envp[]) 13 | { 14 | return strace(sys_execve, "execve", filename, argv, envp); 15 | } 16 | -------------------------------------------------------------------------------- /src/musl/exit.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | __attribute__((noreturn)) 7 | static long sys_exit(int status) 8 | { 9 | const std::string msg = "Service exited with status " + std::to_string(status) + "\n"; 10 | os::print(msg.data(), msg.size()); 11 | __arch_poweroff(); 12 | __builtin_unreachable(); 13 | } 14 | 15 | extern "C" 16 | void syscall_SYS_exit(int status) { 17 | strace(sys_exit, "exit", status); 18 | } 19 | -------------------------------------------------------------------------------- /src/musl/faccessat.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_faccessat(int /*fd*/, const char* /*path*/, mode_t, int /*flag*/) 6 | { 7 | // TODO Same as access(), but path is relative to fd 8 | return -EROFS; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_faccessat(int fd, const char *path, mode_t mode, int flag) { 13 | return strace(sys_faccessat, "faccessat", fd, path, mode, flag); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/faccessat2.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_faccessat2(int /*fd*/, const char* /*path*/, mode_t, int /*flag*/) 6 | { 7 | // TODO Same as access(), but path is relative to fd 8 | return -EROFS; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_faccessat2(int fd, const char *path, mode_t mode, int flag) { 13 | return strace(sys_faccessat2, "faccessat2", fd, path, mode, flag); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/fchdir.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_fchdir(int /*fd*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_fchdir(int fd) 11 | { 12 | return strace(sys_fchdir, "fchown", fd); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/fchmod.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_fchmod(int /*fd*/, mode_t /*mode*/) { 5 | // currently makes no sense, especially since we're read-only 6 | return -EROFS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_fchmod(int fildes, mode_t mode) { 11 | return strace(sys_fchmod, "fchmod", fildes, mode); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/fchmodat.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_fchmodat(int /*fd*/, const char* /*path*/, mode_t, int /*flag*/) 6 | { 7 | // currently makes no sense, especially since we're read-only 8 | return -EROFS; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_fchmodat(int fd, const char *path, mode_t mode, int flag) { 13 | return strace(sys_fchmodat, "fchmodat", fd, path, mode, flag); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/fchmodat2.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_fchmodat2(int /*fd*/, const char* /*path*/, mode_t, int /*flag*/) 6 | { 7 | // currently makes no sense, especially since we're read-only 8 | return -EROFS; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_fchmodat2(int fd, const char *path, mode_t mode, int flag) { 13 | return strace(sys_fchmodat2, "fchmodat2", fd, path, mode, flag); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/fchown.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_fchown(int /*fd*/, uid_t /*owner*/, gid_t /*group*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_fchown(int fd, uid_t owner, gid_t group) 11 | { 12 | return strace(sys_fchown, "fchown", fd, owner, group); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/fcntl.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_fcntl(int fd, int cmd, va_list va) 5 | { 6 | if(auto* fildes = FD_map::_get(fd); fildes) 7 | return fildes->fcntl(cmd, va); 8 | 9 | return -EBADF; 10 | } 11 | 12 | extern "C" 13 | long syscall_SYS_fcntl(int fd, int cmd, ... /* arg */ ) 14 | { 15 | va_list va; 16 | va_start(va, cmd); 17 | auto ret = strace(sys_fcntl, "fcntl", fd, cmd, va); 18 | va_end(va); 19 | return ret; 20 | } 21 | -------------------------------------------------------------------------------- /src/musl/fstat.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | #include 5 | 6 | static long sys_fstat(int fd, struct stat* stat_buf) 7 | { 8 | if (UNLIKELY(stat_buf == nullptr)) 9 | return -EINVAL; 10 | 11 | if(auto* fildes = FD_map::_get(fd); fildes) 12 | return fildes->fstat(stat_buf); 13 | 14 | return -EBADF; 15 | } 16 | 17 | extern "C" 18 | long syscall_SYS_fstat(int fd, struct stat* stat_buf) { 19 | return strace(sys_fstat, "fstat", fd, stat_buf); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/musl/fsync.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_fsync(int /*fd*/) 5 | { 6 | return -EROFS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_fsync(int fd) 11 | { 12 | return strace(sys_fsync, "fsync", fd); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/ftruncate.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_ftruncate(int /*fd*/, off_t /*length*/) 6 | { 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_ftruncate(int fd, off_t length) 12 | { 13 | return strace(sys_ftruncate, "ftruncate", fd, length); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/getdents.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_getdents(unsigned int fd, struct dirent *dirp, unsigned int count) 6 | { 7 | if(auto* fildes = FD_map::_get(fd); fildes) 8 | return fildes->getdents(dirp, count); 9 | 10 | return -EBADF; 11 | } 12 | 13 | extern "C" 14 | long syscall_SYS_getdents(unsigned int fd, struct dirent *dirp, unsigned int count) { 15 | return strace(sys_getdents, "getdents", fd, dirp, count); 16 | } 17 | -------------------------------------------------------------------------------- /src/musl/geteuid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_geteuid() 6 | { 7 | return 0; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_geteuid() 12 | { 13 | return strace(sys_geteuid, "geteuid"); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/getgid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_getgid() 5 | { 6 | return 0; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_getgid() 11 | { 12 | return strace(sys_getgid, "getgid"); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/getpid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | int sys_getpid() { 4 | return 1; 5 | } 6 | 7 | extern "C" 8 | long syscall_SYS_getpid() { 9 | return strace(sys_getpid, "getpid"); 10 | } 11 | -------------------------------------------------------------------------------- /src/musl/getrandom.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | // TODO Flags are ignored. 5 | static long sys_getrandom(void* buf, size_t len, unsigned int flags) 6 | { 7 | rng_absorb(buf, len); 8 | return len; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_getrandom(void *buf, size_t len, unsigned int flags) { 13 | return strace(sys_getrandom, "getrandom", buf, len, flags); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/getrlimit.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | #include 4 | 5 | static int sys_getrlimit(int /*resource*/, struct rlimit*) { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_getrlimit(int resource, struct rlimit *rlim) { 11 | return strace(sys_getrlimit, "getrlimit", resource, rlim); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/getrusage.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | #include 4 | 5 | static int sys_getrusage(int /*resource*/, struct rusage*) { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_getrusage(int resource, struct rusage *usage) { 11 | return strace(sys_getrusage, "getrusage", resource, usage); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/gettid.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | 3 | static long sys_gettid() { 4 | // TODO: threading partially implemented. Needs cleaning up. 5 | // We used to warn: 6 | // "gettid not implemented for threaded IncludeOS" 7 | // But we want to enable -Werror 8 | return 1; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_gettid() { 13 | return stubtrace(sys_gettid, "gettid"); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/gettimeofday.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_gettimeofday(struct timeval *tv, struct timezone *tz) 5 | { 6 | timespec t = __arch_wall_clock(); 7 | tv->tv_sec = t.tv_sec; 8 | tv->tv_usec = t.tv_nsec * 1000; 9 | if (tz != nullptr) { 10 | tz->tz_minuteswest = 0; 11 | tz->tz_dsttime = 0; /* DST_NONE */ 12 | } 13 | return 0; 14 | } 15 | 16 | extern "C" 17 | long syscall_SYS_gettimeofday(struct timeval *tv, struct timezone *tz) { 18 | return strace(sys_gettimeofday, "gettimeofday", tv, tz); 19 | } 20 | -------------------------------------------------------------------------------- /src/musl/getuid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static long sys_getuid() { 4 | return 0; 5 | } 6 | 7 | extern "C" 8 | long syscall_SYS_getuid() { 9 | return strace(sys_getuid, "getuid"); 10 | } 11 | -------------------------------------------------------------------------------- /src/musl/kill.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | int sys_kill(pid_t /*pid*/, int /*sig*/) { 5 | os::panic("KILL called"); 6 | } 7 | 8 | int sys_tkill(int /*tid*/, int /*sig*/) { 9 | os::panic("TKILL called"); 10 | } 11 | 12 | int sys_tgkill(int /*tgid*/, int /*tid*/, int /*sig*/) { 13 | os::panic("TGKILL called"); 14 | } 15 | 16 | extern "C" 17 | long syscall_SYS_kill(pid_t pid, int sig) { 18 | return strace(sys_kill, "kill", pid, sig); 19 | } 20 | 21 | extern "C" 22 | long syscall_SYS_tkill(int tid, int sig) { 23 | return strace(sys_tkill, "tkill", tid, sig); 24 | } 25 | 26 | extern "C" 27 | long syscall_SYS_tgkill(int tgid, int tid, int sig) 28 | { 29 | return strace(sys_tgkill, "tgkill", tgid, tid, sig); 30 | } 31 | -------------------------------------------------------------------------------- /src/musl/mincore.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static long sys_mincore([[maybe_unused]]void *addr, 4 | [[maybe_unused]]size_t length, 5 | [[maybe_unused]]unsigned char *vec) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_mincore(void *addr, size_t length, unsigned char *vec) 12 | { 13 | return strace(sys_mincore, "mincore", addr, length, vec); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/mkdir.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_mkdir(const char* /*path*/, mode_t /*mode*/) { 5 | // currently makes no sense, especially since we're read-only 6 | return -EROFS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_mkdir(const char *path, mode_t mode) { 11 | return strace(sys_mkdir, "mkdir", path, mode); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/mkdirat.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_mkdirat(int /*fd*/, const char* /*path*/, mode_t /*mode*/) { 6 | // currently makes no sense, especially since we're read-only 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_mkdirat(int fd, const char *path, mode_t mode) { 12 | return strace(sys_mkdirat, "mkdirat", fd, path, mode); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/mknod.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_mknod(const char* /*pathname*/, mode_t /*mode*/, dev_t /*dev*/) 5 | { 6 | // currently makes no sense, especially since we're read-only 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_mknod(const char *pathname, mode_t mode, dev_t dev) { 12 | return strace(sys_mknod, "mknod", pathname, mode, dev); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/mknodat.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_mknodat(int /*dirfd*/, const char* /*path*/, mode_t, dev_t) 5 | { 6 | // currently makes no sense, especially since we're read-only 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev) { 12 | return strace(sys_mknodat, "mknodat", dirfd, pathname, mode, dev); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/mlock.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_mlock(const void* /* addr */, size_t /* len */) 5 | { 6 | return -ENOSYS; 7 | } 8 | static long sys_munlock(const void* /* addr */, size_t /* len */) 9 | { 10 | return -ENOSYS; 11 | } 12 | 13 | extern "C" 14 | long syscall_SYS_mlock(const void* addr, size_t len) 15 | { 16 | return strace(sys_mlock, "mlock", addr, len); 17 | } 18 | extern "C" 19 | long syscall_SYS_munlock(const void *addr, size_t len) 20 | { 21 | return strace(sys_munlock, "munlock", addr, len); 22 | } 23 | -------------------------------------------------------------------------------- /src/musl/mprotect.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_mprotect(void* /*addr*/, size_t /*len*/, int /*prot*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_mprotect(void *addr, size_t len, int prot) 11 | { 12 | return strace(sys_mprotect, "mprotect", addr, len, prot); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/mremap.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static long sys_mremap(void */*old_address*/, size_t /*old_size*/, 4 | size_t /*new_size*/, int /*flags*/, void */*new_address*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_mremap(void *old_address, size_t old_size, 11 | size_t new_size, int flags, void *new_address) 12 | { 13 | return strace(sys_mremap, "mremap", old_address, old_size, new_size, flags, new_address); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/msync.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static long sys_msync(void */*addr*/, size_t /*length*/, int /*flags*/) 4 | { 5 | return -ENOSYS; 6 | } 7 | 8 | extern "C" 9 | long syscall_SYS_msync(void *addr, size_t length, int flags) 10 | { 11 | return strace(sys_msync, "msync", addr, length, flags); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/munmap.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | extern "C" void kfree(void* addr, size_t length); 4 | 5 | static long sys_munmap(void *addr, size_t length) 6 | { 7 | if(UNLIKELY(length == 0)) 8 | return -EINVAL; 9 | 10 | kfree(addr, length); 11 | return 0; 12 | } 13 | 14 | extern "C" 15 | long syscall_SYS_munmap(void *addr, size_t length) 16 | { 17 | return strace(sys_munmap, "munmap", addr, length); 18 | } 19 | -------------------------------------------------------------------------------- /src/musl/openat.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_openat(int /*dirfd*/, const char* /*path*/, int /*flags*/, mode_t) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_openat(int dirfd, const char *pathname, int flags, mode_t mode) { 12 | return strace(sys_openat, "openat", dirfd, pathname, flags, mode); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/pipe.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static long sys_pipe([[maybe_unused]]int pipefd[2]) 4 | { 5 | return -ENOSYS; 6 | } 7 | 8 | static long sys_pipe2([[maybe_unused]]int pipefd[2], [[maybe_unused]]int flags) 9 | { 10 | return -ENOSYS; 11 | } 12 | 13 | extern "C" { 14 | long syscall_SYS_pipe(int pipefd[2]) { 15 | return strace(sys_pipe, "pipe", pipefd); 16 | } 17 | 18 | long syscall_SYS_pipe2(int pipefd[2], int flags) { 19 | return strace(sys_pipe2, "pipe2", pipefd, flags); 20 | } 21 | } // extern "C" 22 | -------------------------------------------------------------------------------- /src/musl/prlimit64.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_prlimit64(pid_t /*pid*/, int /*resource*/, 5 | const struct rlimit */*new_limit*/, 6 | struct rlimit */*old_limit*/) 7 | { 8 | return -ENOSYS; 9 | } 10 | 11 | extern "C" 12 | long syscall_SYS_prlimit64(pid_t pid, int resource, 13 | const struct rlimit *new_limit, 14 | struct rlimit *old_limit) 15 | { 16 | return strace(sys_prlimit64, "prlimit64", pid, resource, new_limit, old_limit); 17 | } 18 | -------------------------------------------------------------------------------- /src/musl/read.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_read(int fd, void* buf, size_t len) 5 | { 6 | if(UNLIKELY(buf == nullptr)) 7 | return -EFAULT; 8 | 9 | if(auto* fildes = FD_map::_get(fd); fildes) 10 | return fildes->read(buf, len); 11 | 12 | return -EBADF; 13 | } 14 | 15 | extern "C" 16 | long syscall_SYS_read(int fd, void *buf, size_t nbyte) { 17 | return strace(sys_read, "read", fd, buf, nbyte); 18 | } 19 | -------------------------------------------------------------------------------- /src/musl/readlink.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_readlink(const char* /*path*/, char* /*buf*/, size_t /*bufsiz*/) 6 | { 7 | return -EIO; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_readlink(const char *path, char *buf, size_t bufsiz) 12 | { 13 | return strace(sys_readlink, "readlink", path, buf, bufsiz); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/readv.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | #include 4 | 5 | static ssize_t sys_readv(int fd, const struct iovec* iov, int iovcnt) 6 | { 7 | if(auto* fildes = FD_map::_get(fd); fildes) 8 | return fildes->readv(iov, iovcnt); 9 | 10 | return -EBADF; 11 | } 12 | 13 | extern "C" 14 | ssize_t syscall_SYS_readv(int fd, const struct iovec *iov, int iovcnt) 15 | { 16 | return strace(sys_readv, "readv", fd, iov, iovcnt); 17 | } 18 | -------------------------------------------------------------------------------- /src/musl/rename.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_rename(const char* /*oldpath*/, const char* /*newpath*/) 5 | { 6 | // currently makes no sense, especially since we're read-only 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_rename(const char* oldpath, const char* newpath) 12 | { 13 | return strace(sys_rename, "rename", oldpath, newpath); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/rmdir.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_rmdir(const char* /*pathname*/) 5 | { 6 | /* technically path needs to be verified first */ 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_rmdir(const char *pathname) 12 | { 13 | return strace(sys_rmdir, "rmdir", pathname); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/rt_sigaction.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static int sys_sigaction(int signum, 4 | const struct sigaction* act, 5 | const struct sigaction* oldact) 6 | { 7 | (void) signum; 8 | (void) act; 9 | (void) oldact; 10 | return -ENOSYS; 11 | } 12 | 13 | extern "C" 14 | int syscall_SYS_rt_sigaction(int signum, 15 | const struct sigaction* act, 16 | const struct sigaction* oldact) 17 | { 18 | return strace(sys_sigaction, "rt_sigaction", signum, act, oldact); 19 | } 20 | -------------------------------------------------------------------------------- /src/musl/sched_getaffinity.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_sched_getaffinity(pid_t /*pid*/, size_t /*cpusetsize*/, 5 | cpu_set_t */*mask*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_sched_getaffinity(pid_t pid, size_t cpusetsize, 12 | cpu_set_t *mask) 13 | { 14 | return strace(sys_sched_getaffinity, "sched_getaffinity", pid, cpusetsize, mask); 15 | } 16 | -------------------------------------------------------------------------------- /src/musl/sched_setaffinity.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_sched_setaffinity(pid_t /*pid*/, size_t /*cpusetsize*/, 5 | cpu_set_t */*mask*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_sched_setaffinity(pid_t pid, size_t cpusetsize, 12 | cpu_set_t *mask) 13 | { 14 | return strace(sys_sched_setaffinity, "sched_setaffinity", pid, cpusetsize, mask); 15 | } 16 | -------------------------------------------------------------------------------- /src/musl/sched_setscheduler.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_sched_setscheduler(pid_t /*pid*/, int /*policy*/, const struct sched_param* /*param*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_sched_setscheduler(pid_t pid, int policy, 11 | const struct sched_param *param) 12 | { 13 | return strace(sys_sched_setscheduler, "sched_setscheduler", pid, policy, param); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/sched_yield.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | 3 | static long sys_sched_yield() 4 | { 5 | return 0; 6 | } 7 | 8 | extern "C" 9 | long syscall_SYS_sched_yield() { 10 | return stubtrace(sys_sched_yield, "sched_yield"); 11 | } 12 | -------------------------------------------------------------------------------- /src/musl/select.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | long sys_select(int /*nfds*/, 5 | fd_set* /*readfds*/, 6 | fd_set* /*writefds*/, 7 | fd_set* /*exceptfds*/, 8 | struct timeval* /*timeout*/) 9 | { 10 | return -ENOSYS; 11 | } 12 | 13 | extern "C" 14 | long syscall_SYS_select(int nfds, 15 | fd_set* readfds, 16 | fd_set* writefds, 17 | fd_set* exceptfds, 18 | struct timeval* timeout) 19 | { 20 | return strace(sys_select, "select", nfds, readfds, writefds, exceptfds, timeout); 21 | } 22 | -------------------------------------------------------------------------------- /src/musl/set_robust_list.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | static long sys_set_robust_list(struct robust_list_head */*head*/, size_t /*len*/) 4 | { 5 | return -ENOSYS; 6 | } 7 | 8 | extern "C" 9 | long syscall_SYS_set_robust_list(struct robust_list_head *head, size_t len) { 10 | return strace(sys_set_robust_list, "set_robust_list", head, len); 11 | } 12 | -------------------------------------------------------------------------------- /src/musl/set_tid_address.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | 3 | static struct { 4 | int tid = 1; 5 | int* set_child_tid = nullptr; 6 | int* clear_child_tid = nullptr; 7 | } __main_thread__; 8 | 9 | static long sys_set_tid_address(int* tidptr) { 10 | __main_thread__.clear_child_tid = tidptr; 11 | return __main_thread__.tid; 12 | } 13 | 14 | extern "C" 15 | long syscall_SYS_set_tid_address(int* tidptr) { 16 | return stubtrace(sys_set_tid_address, "set_tid_address", tidptr); 17 | } 18 | -------------------------------------------------------------------------------- /src/musl/setgid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | long sys_setgid(gid_t /*gid*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_setgid(gid_t gid) 12 | { 13 | return strace(sys_setgid, "setgid", gid); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/setpgid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | long sys_setpgid(pid_t /*pid*/, gid_t /*gid*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_setpgid(pid_t pid, gid_t gid) 12 | { 13 | return strace(sys_setpgid, "setpgid", pid, gid); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/setrlimit.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | long sys_setrlimit(int /*resource*/, const struct rlimit* /*rlim*/) 4 | { 5 | return -ENOSYS; 6 | } 7 | 8 | extern "C" 9 | long syscall_SYS_setrlimit(int resource, 10 | const struct rlimit* rlim) 11 | { 12 | return strace(sys_setrlimit, "setrlimit", resource, rlim); 13 | } 14 | -------------------------------------------------------------------------------- /src/musl/setsid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | long sys_setsid() 6 | { 7 | return 0; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_setsid() 12 | { 13 | return strace(sys_setsid, "setsid"); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/setuid.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | long sys_setuid(uid_t /*uid*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_setuid(uid_t uid) 12 | { 13 | return strace(sys_setuid, "setuid", uid); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/sigaltstack.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_sigaltstack(const stack_t * /*ss*/, stack_t * /*old_ss*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_sigaltstack(const stack_t *_Nullable ss, 11 | stack_t *_Nullable old_ss) 12 | { 13 | return strace(sys_sigaltstack, "sigaltstack", ss, old_ss); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/statx.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | long sys_statx(int /*dirfd*/, const char* /*pathname*/, int /*flags*/, 5 | unsigned int /*mask*/, struct statx* /*statxbuf*/) 6 | { 7 | return -ENOSYS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_statx(int dirfd, const char *pathname, int flags, 12 | unsigned int mask, struct statx *statxbuf) { 13 | return strace(sys_statx, "statx", dirfd, pathname, flags, mask, statxbuf); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/musl/sync.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | 3 | static long sys_sync() { 4 | return 0; 5 | } 6 | 7 | static long sys_syncfs() { 8 | return 0; 9 | } 10 | 11 | extern "C" { 12 | long syscall_SYS_sync() { 13 | return stubtrace(sys_sync, "sync"); 14 | } 15 | 16 | long syscall_SYS_syncfs() { 17 | return stubtrace(sys_syncfs, "syncfs"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/musl/syscall_n.cpp: -------------------------------------------------------------------------------- 1 | #include "stub.hpp" 2 | 3 | long syscall(long /*number*/) 4 | { 5 | return -ENOSYS; 6 | } 7 | 8 | extern "C" 9 | long syscall_n(long i) { 10 | return stubtrace(syscall, "syscall", i); 11 | } 12 | -------------------------------------------------------------------------------- /src/musl/sysinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_sysinfo(struct sysinfo */*info*/) 5 | { 6 | return -ENOSYS; 7 | } 8 | 9 | extern "C" 10 | long syscall_SYS_sysinfo(struct sysinfo *info) { 11 | return strace(sys_sysinfo, "sysinfo", info); 12 | } 13 | -------------------------------------------------------------------------------- /src/musl/umask.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | mode_t THE_MASK = 002; 5 | 6 | static mode_t sys_umask(mode_t cmask) { 7 | mode_t prev_mask = THE_MASK; 8 | 9 | if(THE_MASK != cmask) 10 | THE_MASK = cmask; 11 | 12 | return prev_mask; 13 | } 14 | 15 | extern "C" 16 | mode_t syscall_SYS_umask(mode_t cmask) { 17 | return strace(sys_umask, "umask", cmask); 18 | } 19 | -------------------------------------------------------------------------------- /src/musl/uname.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long sys_uname(struct utsname *buf) { 6 | if(UNLIKELY(buf == nullptr)) 7 | return -EFAULT; 8 | 9 | strcpy(buf->sysname, "IncludeOS"); 10 | 11 | strcpy(buf->nodename, "IncludeOS-node"); 12 | 13 | strcpy(buf->release, os::version()); 14 | 15 | strcpy(buf->version, os::version()); 16 | 17 | strcpy(buf->machine, os::arch()); 18 | 19 | return 0; 20 | } 21 | 22 | extern "C" 23 | long syscall_SYS_uname(struct utsname *buf) { 24 | return strace(sys_uname, "uname", buf); 25 | } 26 | -------------------------------------------------------------------------------- /src/musl/unlink.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_unlink(const char* /*pathname*/) 5 | { 6 | /* technically path needs to be verified first */ 7 | return -EROFS; 8 | } 9 | 10 | extern "C" 11 | long syscall_SYS_unlink(const char *pathname) 12 | { 13 | return strace(sys_unlink, "rmdir", pathname); 14 | } 15 | -------------------------------------------------------------------------------- /src/musl/wait4.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | #include 4 | 5 | static long 6 | sys_wait4(pid_t /*pid*/, int* /*wstatus*/, int /*options*/, 7 | struct rusage* /*rusage*/) 8 | { 9 | return 0; 10 | } 11 | 12 | extern "C" 13 | long syscall_SYS_wait4(pid_t pid, int *wstatus, int options, 14 | struct rusage *rusage) 15 | { 16 | return strace(sys_wait4, "wait4", pid, wstatus, options, rusage); 17 | } 18 | -------------------------------------------------------------------------------- /src/musl/write.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "common.hpp" 3 | #include 4 | 5 | // The actual syscall 6 | static long sys_write(int fd, char* str, size_t len) { 7 | 8 | if (fd == 1 or fd == 2) 9 | { 10 | os::print(str, len); 11 | return len; 12 | } 13 | 14 | if(auto* fildes = FD_map::_get(fd); fildes) 15 | return fildes->write(str, len); 16 | 17 | return -EBADF; 18 | } 19 | 20 | // The syscall wrapper, using strace if enabled 21 | extern "C" 22 | long syscall_SYS_write(int fd, char* str, size_t len) { 23 | //return strace(sys_write, "write", fd, str, len); 24 | return sys_write(fd, str, len); 25 | } 26 | -------------------------------------------------------------------------------- /src/musl/writev.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | #include 3 | 4 | static long sys_writev(int fd, const struct iovec *iov, int iovcnt) 5 | { 6 | if (fd == 1 || fd == 2) 7 | { 8 | long res = 0; 9 | for(int i = 0; i < iovcnt; i++) 10 | { 11 | auto* text = (const char*)iov[i].iov_base; 12 | auto len = iov[i].iov_len; 13 | os::print(text, len); 14 | res += len; 15 | } 16 | return res; 17 | } 18 | return 0; 19 | } 20 | 21 | extern "C" 22 | long syscall_SYS_writev(int fd, const struct iovec *iov, int iovcnt){ 23 | //return strace(sys_writev, "writev", fd, iov, iovcnt); 24 | return sys_writev(fd, iov, iovcnt); 25 | } 26 | -------------------------------------------------------------------------------- /src/net/ip6/packet_mld.cpp: -------------------------------------------------------------------------------- 1 | //#define MLD_DEBUG 1 2 | #ifdef MLD_DEBUG 3 | #define PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) 4 | #else 5 | #define PRINT(fmt, ...) /* fmt */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace net::mld 13 | { 14 | MldPacket2::MldPacket2(icmp6::Packet& icmp6) : icmp6_(icmp6) {} 15 | 16 | MldPacket2::Query& MldPacket2::query() 17 | { 18 | return *reinterpret_cast(&(icmp6_.header().payload[0])); 19 | } 20 | 21 | MldPacket2::Report& MldPacket2::report() 22 | { 23 | return *reinterpret_cast(&(icmp6_.header().payload[0])); 24 | } 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /src/net/tcp/stream.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace net::tcp 5 | { 6 | /*#include // remove me, sack debugging 7 | std::ostream& operator<< (std::ostream& out, const net::tcp::sack::Entries& ent) { 8 | for (auto el : ent) { 9 | out << el << "\n"; 10 | } 11 | return out; 12 | }*/ 13 | 14 | int Stream::get_cpuid() const noexcept { 15 | return m_tcp->host().get_cpuid(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/platform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(${PLATFORM} STREQUAL "solo5-hvt") 2 | message(STATUS "platform x86_solo5") 3 | add_subdirectory(x86_solo5) 4 | elseif(${PLATFORM} STREQUAL "solo5-spt") 5 | message(FATAL_ERROR "SPT not implemented yet") 6 | elseif (${PLATFORM} STREQUAL "nano") 7 | if (${ARCH} STREQUAL "aarch64") 8 | add_subdirectory(aarch64_vm) 9 | else() 10 | add_subdirectory(x86_nano) 11 | endif() 12 | else() 13 | if (${ARCH} STREQUAL "aarch64") 14 | add_subdirectory(aarch64_vm) 15 | else() 16 | message(STATUS "platform x86_pc") 17 | add_subdirectory(x86_pc) 18 | endif() 19 | endif() 20 | -------------------------------------------------------------------------------- /src/platform/aarch64_vm/exception_handling.hpp: -------------------------------------------------------------------------------- 1 | #ifndef EXCEPTION_HANDLING_H 2 | #define EXCEPTION_HANDLING_H 3 | typedef void (*irq_handler_t)(); 4 | void register_handler(uint16_t irq, irq_handler_t handler); 5 | void unregiser_handler(uint16_t irq); 6 | 7 | #endif //EXCEPTION_HANDLING_H 8 | -------------------------------------------------------------------------------- /src/platform/aarch64_vm/init_libc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace aarch64 5 | { 6 | extern void init_libc(uintptr_t dtb); 7 | } 8 | 9 | extern "C" { 10 | void kernel_sanity_checks(); 11 | uintptr_t __syscall_entry(); 12 | } 13 | 14 | #define LL_ASSERT(X) if (!(X)) { kprint("Early assertion failed: " #X "\n"); asm("hlt 0xf000"); } 15 | -------------------------------------------------------------------------------- /src/platform/aarch64_vm/platform.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLATFORM_H 2 | #define PLATFORM_H 3 | 4 | void __platform_init(uint64_t addr); 5 | 6 | 7 | 8 | #endif /* end of include guard: 9 | */ 10 | -------------------------------------------------------------------------------- /src/platform/aarch64_vm/stop.asm: -------------------------------------------------------------------------------- 1 | .global vm_exit 2 | vm_exit: 3 | /* 0x20026 == ADP_Stopped_ApplicationExit */ 4 | mov x1, #0x26 5 | movk x1, #2, lsl #16 6 | str x1, [sp,#0] 7 | 8 | /* Exit status code. Host QEMU process exits with that status. */ 9 | mov x0, #0 10 | str x0, [sp,#8] 11 | 12 | /* x1 contains the address of parameter block. 13 | * Any memory address could be used. */ 14 | mov x1, sp 15 | 16 | /* SYS_EXIT */ 17 | mov w0, #0x18 18 | 19 | /* Do the semihosting call on A64. */ 20 | hlt 0xf000 21 | -------------------------------------------------------------------------------- /src/platform/kvm/kvmclock.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | struct KVM_clock 7 | { 8 | static void init(); 9 | static uint64_t system_time(); 10 | static timespec wall_clock(); 11 | static util::KHz get_tsc_khz(); 12 | static void deactivate(); 13 | }; 14 | -------------------------------------------------------------------------------- /src/platform/x86_nano/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(LIBNAME ${ARCH}_nano) 2 | set(PLATFORM_OBJECTS 3 | ../x86_pc/start.asm 4 | ../x86_pc/serial1.cpp 5 | ../x86_pc/idt.cpp 6 | platform.cpp 7 | kernel_start.cpp 8 | ) 9 | 10 | add_library(${LIBNAME} STATIC ${PLATFORM_OBJECTS}) 11 | set_target_properties(${LIBNAME} PROPERTIES LINKER_LANGUAGE CXX) 12 | set_target_properties(${LIBNAME} 13 | PROPERTIES 14 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/platform 15 | ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/platform 16 | ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/platform 17 | ) 18 | 19 | 20 | install(TARGETS ${LIBNAME} DESTINATION platform) 21 | -------------------------------------------------------------------------------- /src/platform/x86_pc/boot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_custom_command( 3 | OUTPUT bootloader 4 | COMMAND ${CMAKE_ASM_NASM_COMPILER} -f bin -I${CMAKE_CURRENT_SOURCE_DIR}/../ -o bootloader ${CMAKE_CURRENT_SOURCE_DIR}/bootloader.asm 5 | DEPENDS bootloader.asm disk_read_lba.asm 6 | ) 7 | 8 | add_custom_target(run ALL DEPENDS bootloader) 9 | 10 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bootloader DESTINATION boot) 11 | -------------------------------------------------------------------------------- /src/platform/x86_pc/init_libc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace x86 5 | { 6 | extern void init_libc(uint32_t magic, uint32_t address); 7 | } 8 | 9 | extern "C" { 10 | void kernel_sanity_checks(); 11 | uintptr_t __syscall_entry(); 12 | } 13 | 14 | #define LL_ASSERT(X) if (!(X)) { kprint("Early assertion failed: " #X "\n"); asm("cli;hlt"); } 15 | -------------------------------------------------------------------------------- /src/platform/x86_solo5/serial1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include 7 | 8 | void __init_serial1() {} 9 | 10 | void __serial_print1(const char* cstr) 11 | { 12 | solo5_console_write(cstr, strlen(cstr)); 13 | } 14 | void __serial_print(const char* str, size_t len) 15 | { 16 | solo5_console_write(str, len); 17 | } 18 | 19 | void kprint(const char* c){ 20 | __serial_print1(c); 21 | } 22 | 23 | void kprintf(const char* format, ...) 24 | { 25 | char buf[8192]; 26 | va_list aptr; 27 | va_start(aptr, format); 28 | vsnprintf(buf, sizeof(buf), format, aptr); 29 | __serial_print1(buf); 30 | va_end(aptr); 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/plugins/system_log.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/src/plugins/system_log.cpp -------------------------------------------------------------------------------- /src/posix/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SRCS 2 | fd.cpp 3 | 4 | ) 5 | if (NOT CMAKE_TESTING_ENABLED) 6 | list(APPEND SRCS 7 | file_fd.cpp 8 | tcp_fd.cpp 9 | udp_fd.cpp 10 | unix_fd.cpp 11 | ) 12 | endif() 13 | add_library(posix OBJECT ${SRCS}) 14 | -------------------------------------------------------------------------------- /src/posix/secure_getenv.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" 4 | char* secure_getenv(const char* name) 5 | { 6 | return getenv(name); 7 | } -------------------------------------------------------------------------------- /src/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | async.cpp 3 | statman.cpp 4 | logger.cpp 5 | sha1.cpp 6 | syslog_facility.cpp 7 | syslogd.cpp 8 | percent_encoding.cpp 9 | path_to_regex.cpp 10 | crc32.cpp 11 | ) 12 | 13 | #if (NOT CMAKE_TESTING_ENABLED) 14 | 15 | if (NOT ${PLATFORM} STREQUAL "nano") 16 | include_directories(${CMAKE_SOURCE_DIR}/lib/LiveUpdate/include) 17 | list(APPEND SRCS 18 | memstream.c 19 | tar.cpp 20 | uri.cpp #rapidjson 21 | autoconf.cpp 22 | config.cpp 23 | statman_liu.cpp 24 | ) 25 | endif() 26 | 27 | 28 | 29 | add_library(util OBJECT ${SRCS}) 30 | -------------------------------------------------------------------------------- /src/util/pmr_default.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | std::pmr::memory_resource* std::pmr::get_default_resource() noexcept { 5 | static os::mem::Default_pmr* default_pmr; 6 | if (default_pmr == nullptr) 7 | default_pmr = new os::mem::Default_pmr{}; 8 | return default_pmr; 9 | } 10 | -------------------------------------------------------------------------------- /src/virtio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | virtio_queue.cpp 3 | ) 4 | if (NOT CMAKE_TESTING_ENABLED) 5 | list(APPEND SRCS 6 | virtio.cpp 7 | ) 8 | endif() 9 | add_library(virtio OBJECT ${SRCS}) 10 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | *.gcov 2 | *.gcda 3 | *.gcno 4 | unittests 5 | -------------------------------------------------------------------------------- /test/fs/integration/fat16/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | os_add_executable(fs_fat16 "FAT16 filesystem test" fat16.cpp) 8 | os_add_stdout(fs_fat16 default_stdout) 9 | 10 | os_diskbuilder(fs_fat16 disk) 11 | 12 | configure_file(banana.ascii ${CMAKE_CURRENT_BINARY_DIR}) 13 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 14 | configure_file(vm.json ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/fs/integration/fat16/README.md: -------------------------------------------------------------------------------- 1 | # FAT16 Test Service 2 | 3 | Test the functionalty of the FAT16 filesystem with the use of memdisk. 4 | 5 | The test verifies the following things: 6 | 7 | 1. The disk size. 8 | 2. Auto mounting/recognition of filesystem. 9 | 3. Disk structure. 10 | 4. Disk content with the help of `banana.txt` and `banana.ascii`. 11 | 5. Filesystem API (read) and subclasses as `Dirent`. 12 | 6. Random access sync read. 13 | 14 | `fat16_disk.sh` is used to create a 8 MB FAT16 disk `my.disk` with `banana.txt` as content, which will be included as a memdisk into the service. 15 | 16 | -------------------------------------------------------------------------------- /test/fs/integration/fat16/banana.ascii: -------------------------------------------------------------------------------- 1 | const std::string internal_banana= 2 | R"( ____ ___ 3 | | _ \ ___ _ _.' _ `. 4 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 5 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 6 | | `.[_) ) _ | \| | (_) | | | | |.',..| 7 | ':. `. /| | | | | _ | |\ | | |.' :;::' 8 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 9 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 10 | ';:' `::;::;' '' ., . 11 | `: .,. `' .::... . .::;::;' 12 | `..:;::;:.. ::;::;:;:;, :;::;' 13 | "-:;::;:;: ':;::;:'' ;.-' 14 | ""`---...________...---'"" 15 | )"; 16 | -------------------------------------------------------------------------------- /test/fs/integration/fat16/disk/banana.txt: -------------------------------------------------------------------------------- 1 | ____ ___ 2 | | _ \ ___ _ _.' _ `. 3 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 4 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 5 | | `.[_) ) _ | \| | (_) | | | | |.',..| 6 | ':. `. /| | | | | _ | |\ | | |.' :;::' 7 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 8 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 9 | ';:' `::;::;' '' ., . 10 | `: .,. `' .::... . .::;::;' 11 | `..:;::;:.. ::;::;:;:;, :;::;' 12 | "-:;::;:;: ':;::;:'' ;.-' 13 | ""`---...________...---'"" 14 | -------------------------------------------------------------------------------- /test/fs/integration/fat16/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import os 5 | from subprocess import call 6 | from vmrunner import vmrunner 7 | 8 | # Get an auto-created VM from the vmrunner 9 | vm = vmrunner.vms[0] 10 | 11 | # Boot the VM 12 | if len(sys.argv) > 1: 13 | vm.boot(30,image_name='fs_fat16.elf.bin') 14 | else: 15 | vm.boot(30,image_name='fs_fat16.elf.bin') 16 | -------------------------------------------------------------------------------- /test/fs/integration/fat16/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "service.img" } 2 | -------------------------------------------------------------------------------- /test/fs/integration/fat32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5 2 | )set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | os_add_executable(fs_fat32 "FAT32 filesystem test" fat32.cpp) 8 | os_add_stdout(fs_fat32 default_stdout) 9 | 10 | if ("$ENV{PLATFORM}" STREQUAL "x86_solo5") 11 | os_add_drivers(fs_fat32 solo5blk) 12 | else() 13 | os_add_drivers(fs_fat32 virtioblk) 14 | endif() 15 | 16 | #do this code in cmake instead ? 17 | configure_file(fat32_disk.sh ${CMAKE_CURRENT_BINARY_DIR}) 18 | configure_file(banana.txt ${CMAKE_CURRENT_BINARY_DIR}) 19 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 20 | configure_file(vm.json ${CMAKE_CURRENT_BINARY_DIR}) 21 | -------------------------------------------------------------------------------- /test/fs/integration/fat32/README.md: -------------------------------------------------------------------------------- 1 | # FAT32 Test Service 2 | 3 | Test the functionalty of the FAT32 filesystem with the use of VirioBlk disk. 4 | 5 | The test verifies the following things: 6 | 7 | 1. The disk size. 8 | 2. Auto mounting/recognition of filesystem. 9 | 3. Disk structure. 10 | 4. Disk content with the help of `banana.txt` and `banana.ascii`. 11 | 5. Filesystem API (read) and subclasses as `Dirent`. 12 | 6. Remounting of filesystem. 13 | 7. Asynchronous operations (also nested like stat into read). 14 | 15 | `fat32_disk.sh` is used to create a 4 GB FAT32 disk `my.disk` with `banana.txt` as content, which will be included by qemu as a separate drive. 16 | 17 | -------------------------------------------------------------------------------- /test/fs/integration/fat32/banana.ascii: -------------------------------------------------------------------------------- 1 | const std::string internal_banana= 2 | R"( ____ ___ 3 | | _ \ ___ _ _.' _ `. 4 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 5 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 6 | | `.[_) ) _ | \| | (_) | | | | |.',..| 7 | ':. `. /| | | | | _ | |\ | | |.' :;::' 8 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 9 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 10 | ';:' `::;::;' '' ., . 11 | `: .,. `' .::... . .::;::;' 12 | `..:;::;:.. ::;::;:;:;, :;::;' 13 | "-:;::;:;: ':;::;:'' ;.-' 14 | ""`---...________...---'"" 15 | )"; 16 | -------------------------------------------------------------------------------- /test/fs/integration/fat32/banana.txt: -------------------------------------------------------------------------------- 1 | ____ ___ 2 | | _ \ ___ _ _.' _ `. 3 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 4 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 5 | | `.[_) ) _ | \| | (_) | | | | |.',..| 6 | ':. `. /| | | | | _ | |\ | | |.' :;::' 7 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 8 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 9 | ';:' `::;::;' '' ., . 10 | `: .,. `' .::... . .::;::;' 11 | `..:;::;:.. ::;::;:;:;, :;::;' 12 | "-:;::;:;: ':;::;:'' ;.-' 13 | ""`---...________...---'"" 14 | -------------------------------------------------------------------------------- /test/fs/integration/fat32/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "drives" : [{ 3 | "file" : "my.disk", 4 | "type" : "virtio", 5 | "format" : "raw", 6 | "media" : "disk" 7 | }], 8 | "intrusive" : "True" 9 | } 10 | -------------------------------------------------------------------------------- /test/fs/integration/ide/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(fs_ide "IDE driver test" ${SOURCES}) 12 | os_add_stdout(fs_ide default_stdout) 13 | 14 | os_add_drivers(fs_ide ide_readonly) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/fs/integration/ide/README.md: -------------------------------------------------------------------------------- 1 | # FAT32 Test Service 2 | 3 | Test the functionalty of the FAT32 filesystem with the use of VirioBlk disk. 4 | 5 | The test verifies the following things: 6 | 7 | 1. The disk size. 8 | 2. Auto mounting/recognition of filesystem. 9 | 3. Disk structure. 10 | 4. Disk content with the help of `banana.txt` and `banana.ascii`. 11 | 5. Filesystem API (read) and subclasses as `Dirent`. 12 | 6. Remounting of filesystem. 13 | 7. Asynchronous operations (also nested like stat into read). 14 | 15 | `fat32_disk.sh` is used to create a 4 GB FAT32 disk `my.disk` with `banana.txt` as content, which will be included by qemu as a separate drive. 16 | 17 | -------------------------------------------------------------------------------- /test/fs/integration/ide/banana.ascii: -------------------------------------------------------------------------------- 1 | const std::string internal_banana= 2 | R"( ____ ___ 3 | | _ \ ___ _ _.' _ `. 4 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 5 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 6 | | `.[_) ) _ | \| | (_) | | | | |.',..| 7 | ':. `. /| | | | | _ | |\ | | |.' :;::' 8 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 9 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 10 | ';:' `::;::;' '' ., . 11 | `: .,. `' .::... . .::;::;' 12 | `..:;::;:.. ::;::;:;:;, :;::;' 13 | "-:;::;:;: ':;::;:'' ;.-' 14 | ""`---...________...---'"" 15 | )"; 16 | -------------------------------------------------------------------------------- /test/fs/integration/ide/banana.txt: -------------------------------------------------------------------------------- 1 | ____ ___ 2 | | _ \ ___ _ _.' _ `. 3 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 4 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 5 | | `.[_) ) _ | \| | (_) | | | | |.',..| 6 | ':. `. /| | | | | _ | |\ | | |.' :;::' 7 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 8 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 9 | ';:' `::;::;' '' ., . 10 | `: .,. `' .::... . .::;::;' 11 | `..:;::;:.. ::;::;:;:;, :;::;' 12 | "-:;::;:;: ':;::;:'' ;.-' 13 | ""`---...________...---'"" 14 | -------------------------------------------------------------------------------- /test/fs/integration/ide/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "drives" : [{ 3 | "file" : "../my.disk", 4 | "type" : "ide", 5 | "format" : "raw", 6 | "media" : "disk" 7 | }], 8 | "intrusive" : "True" 9 | } 10 | -------------------------------------------------------------------------------- /test/fs/integration/ide_write/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(fs_ide_write "VFS filesystem test" ${SOURCES}) 12 | os_add_stdout(fs_ide_write default_stdout) 13 | os_add_drivers(fs_ide_write ide_writeonly) 14 | 15 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 16 | -------------------------------------------------------------------------------- /test/fs/integration/ide_write/README.md: -------------------------------------------------------------------------------- 1 | # FAT32 Test Service 2 | 3 | Test the functionalty of the FAT32 filesystem with the use of VirioBlk disk. 4 | 5 | The test verifies the following things: 6 | 7 | 1. The disk size. 8 | 2. Auto mounting/recognition of filesystem. 9 | 3. Disk structure. 10 | 4. Disk content with the help of `banana.txt` and `banana.ascii`. 11 | 5. Filesystem API (read) and subclasses as `Dirent`. 12 | 6. Remounting of filesystem. 13 | 7. Asynchronous operations (also nested like stat into read). 14 | 15 | `fat32_disk.sh` is used to create a 4 GB FAT32 disk `my.disk` with `banana.txt` as content, which will be included by qemu as a separate drive. 16 | 17 | -------------------------------------------------------------------------------- /test/fs/integration/ide_write/banana.ascii: -------------------------------------------------------------------------------- 1 | const std::string internal_banana= 2 | R"( ____ ___ 3 | | _ \ ___ _ _.' _ `. 4 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 5 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 6 | | `.[_) ) _ | \| | (_) | | | | |.',..| 7 | ':. `. /| | | | | _ | |\ | | |.' :;::' 8 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 9 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 10 | ';:' `::;::;' '' ., . 11 | `: .,. `' .::... . .::;::;' 12 | `..:;::;:.. ::;::;:;:;, :;::;' 13 | "-:;::;:;: ':;::;:'' ;.-' 14 | ""`---...________...---'"" 15 | )"; 16 | -------------------------------------------------------------------------------- /test/fs/integration/ide_write/banana.txt: -------------------------------------------------------------------------------- 1 | ____ ___ 2 | | _ \ ___ _ _.' _ `. 3 | _ | [_) )' _ `._ _ ___ ! \ | | (_) | _ 4 | |:;.| _ <| (_) | \ | |' _ `| \| | _ | .:;| 5 | | `.[_) ) _ | \| | (_) | | | | |.',..| 6 | ':. `. /| | | | | _ | |\ | | |.' :;::' 7 | !::, `-!_| | | |\ | | | | | \ !_!.' ':;! 8 | !::; ":;:!.!.\_!_!_!.!-'-':;:'' '''! 9 | ';:' `::;::;' '' ., . 10 | `: .,. `' .::... . .::;::;' 11 | `..:;::;:.. ::;::;:;:;, :;::;' 12 | "-:;::;:;: ':;::;:'' ;.-' 13 | ""`---...________...---'"" 14 | -------------------------------------------------------------------------------- /test/fs/integration/ide_write/fat32_disk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### FAT32 TEST DISK ### 4 | 5 | DISK=my.disk 6 | MOUNTDIR=tmpdisk 7 | 8 | # If no arg supplied, setup disk 9 | if [ $# -eq 0 ] 10 | then 11 | 12 | # Remove disk if exists 13 | rm -f $DISK 14 | # Preallocate space to file 15 | truncate -s 1M $DISK 16 | # Create FAT32 filesystem on "my.disk" 17 | mkfs.fat $DISK 18 | 19 | # If "clean" is supplied, clean up 20 | elif [ $1 = "clean" ] 21 | then 22 | echo "> Cleaning up TEST DISK: $DISK" 23 | rm -f $DISK 24 | fi 25 | -------------------------------------------------------------------------------- /test/fs/integration/ide_write/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "drives" : [{ 3 | "file" : "../my.disk", 4 | "type" : "ide", 5 | "format" : "raw", 6 | "media" : "disk" 7 | }], 8 | "intrusive" : "True" 9 | } 10 | -------------------------------------------------------------------------------- /test/fs/integration/memdisk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(memdisk) 5 | include(os) 6 | 7 | set(SOURCES 8 | twosector.cpp 9 | ) 10 | 11 | os_add_executable(fs_memdisk "Memdisk filesystem test" ${SOURCES}) 12 | os_add_stdout(fs_memdisk default_stdout) 13 | 14 | os_add_memdisk(fs_memdisk ${CMAKE_CURRENT_SOURCE_DIR}/sector2.disk) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/fs/integration/memdisk/README.md: -------------------------------------------------------------------------------- 1 | # MemDisk Test Service 2 | 3 | Test to see that MemDisk is working correctly - also verifying the disk interface. 4 | 5 | This test composed of 3 separate services: 6 | 7 | 1. Test a memdisk with 0 sectors (`sector0.disk`) 8 | - Verifies that the disk is empty. 9 | 2. Test a memdisk with 2 sectors (`sector2.disk`) 10 | - Verifies that the disk is 2 sectors. 11 | - Verifies reading and comparing binary data. 12 | 3. Test a big memdisk of 256 000 sectors (created by `bigdisk.sh`) 13 | - Verifies that a big disk is correctly included. 14 | - Verifies MBR (Master Boot Record) signature. 15 | -------------------------------------------------------------------------------- /test/fs/integration/memdisk/bigdisk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### BIG DISK CREATION ### 4 | DISK=big.disk 5 | MOUNTDIR=tmpdisk 6 | 7 | rm -f $DISK 8 | echo "> Creating big disk" 9 | fallocate -l 131072000 $DISK # 256000 sectors 10 | mkfs.fat $DISK 11 | # mkdir -p $MOUNTDIR 12 | # sudo mount $DISK $MOUNTDIR 13 | # sudo cp banana.txt $MOUNTDIR 14 | # sync # Mui Importante 15 | # sudo umount $MOUNTDIR 16 | # rmdir $MOUNTDIR 17 | -------------------------------------------------------------------------------- /test/fs/integration/memdisk/sector0.disk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/fs/integration/memdisk/sector0.disk -------------------------------------------------------------------------------- /test/fs/integration/memdisk/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from subprocess import call 8 | 9 | from vmrunner import vmrunner 10 | vm = vmrunner.vms[0] 11 | 12 | #boot the vm 13 | if len(sys.argv) > 1: 14 | vm.boot(20,image_name=str(sys.argv[1])) 15 | else: 16 | vm.boot(20,image_name='fs_memdisk.elf.bin') 17 | -------------------------------------------------------------------------------- /test/fs/integration/memdisk/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem": 256, 3 | "intrusive" : "True" 4 | } 5 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(vfs) 5 | include(os) 6 | 7 | os_add_executable(fs_vfs "VFS filesystem test" service.cpp) 8 | os_add_stdout(fs_vfs default_stdout) 9 | os_add_drivers(fs_vfs virtioblk) 10 | os_diskbuilder(fs_vfs memdisk) 11 | 12 | #do this code in cmake instead ? 13 | file(COPY memdisk DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 14 | file(COPY virtio1 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 15 | file(COPY virtio2 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 16 | file(COPY create_disk.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 17 | 18 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 19 | configure_file(vm.json ${CMAKE_CURRENT_BINARY_DIR}) 20 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/README.md: -------------------------------------------------------------------------------- 1 | # Test IncludeOS Virtual File System 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/create_disk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e #stop on first error 3 | ### DISK CREATION ### 4 | MOUNTDIR=tmpdisk 5 | 6 | # Set local directory to first param if provided, default to memdisk 7 | CONTENT=$1 8 | LOCALDIR=$2 9 | LOCALDIR=${LOCALDIR:-memdisk} 10 | 11 | DISK=$LOCALDIR.disk 12 | 13 | rm -f $DISK 14 | echo ">> Creating disk image from $LOCALDIR to $LOCALDIR.disk" 15 | truncate -s 1048576 $DISK # 256000 sectors 16 | sudo mkfs.fat $DISK 17 | mkdir -p $MOUNTDIR 18 | sudo mount $DISK $MOUNTDIR 19 | sudo cp -r $CONTENT/* $MOUNTDIR 20 | sudo sync # Mui Importante 21 | sudo umount $MOUNTDIR 22 | rm -rf $MOUNTDIR 23 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/memdisk/README.md: -------------------------------------------------------------------------------- 1 | #Test content for virtual file system test 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/memdisk/users/alfred/etc/ip4/config.txt: -------------------------------------------------------------------------------- 1 | 10.0.0.42 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/memdisk/users/alfred/etc/ip6/config.txt: -------------------------------------------------------------------------------- 1 | fe80::8b3:f8c7:b2ab:4934 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/memdisk/users/alfred/private/secret_plan_step1.txt: -------------------------------------------------------------------------------- 1 | Manhattan 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/memdisk/users/alfred/private/secret_plan_step2.txt: -------------------------------------------------------------------------------- 1 | Berlin 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/memdisk/users/ingve/etc/ip4/config.txt: -------------------------------------------------------------------------------- 1 | 10.0.0.43 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/virtio1/txt/quote.txt: -------------------------------------------------------------------------------- 1 | I see through the lies of the Jedi. 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/virtio2/txt/quote.txt: -------------------------------------------------------------------------------- 1 | Always pass on what you have learned. 2 | -------------------------------------------------------------------------------- /test/fs/integration/vfs/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "drives" : [ 3 | { 4 | "file" : "virtio1.disk", 5 | "type" : "virtio", 6 | "format" : "raw", 7 | "media" : "disk" 8 | }, 9 | { 10 | "file" : "virtio2.disk", 11 | "type" : "virtio", 12 | "format" : "raw", 13 | "media" : "disk" 14 | }], 15 | "intrusive": "True" 16 | } 17 | -------------------------------------------------------------------------------- /test/fs/integration/virtio_block/README.md: -------------------------------------------------------------------------------- 1 | # Test Virtio block. WIP 2 | -------------------------------------------------------------------------------- /test/fs/integration/virtio_block/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Cleaning up after test..." 3 | rm image.img 4 | echo "Done" 5 | -------------------------------------------------------------------------------- /test/fs/integration/virtio_block/image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e #stop on first error 3 | echo "Creating *huge* disk for test" 4 | truncate -s 4000000000 image.img 5 | sudo mkfs.fat image.img 6 | 7 | mkdir -p mountpoint 8 | sudo mount -o rw,sync image.img mountpoint 9 | 10 | sudo cp service.cpp mountpoint/ 11 | sudo sync 12 | sudo umount mountpoint 13 | sudo rm -rf mountpoint 14 | echo "Done" 15 | -------------------------------------------------------------------------------- /test/fs/integration/virtio_block/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import subprocess 5 | import os 6 | 7 | thread_timeout = 50 8 | 9 | subprocess.call(['./image.sh'], timeout=thread_timeout) 10 | 11 | def cleanup(): 12 | subprocess.call(['./cleanup.sh']) 13 | 14 | from vmrunner import vmrunner 15 | vm = vmrunner.vms[0] 16 | 17 | vm.on_exit(cleanup) 18 | 19 | if len(sys.argv) > 1: 20 | vm.boot(thread_timeout,image_name=str(sys.argv[1])) 21 | else: 22 | vm.boot(thread_timeout,image_name='fs_virtio_block.elf.bin') 23 | -------------------------------------------------------------------------------- /test/fs/integration/virtio_block/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "drives" : [{"file" : "image.img", 3 | "type" : "virtio", 4 | "format": "raw", 5 | "media": "disk" }], 6 | "intrusive" : "True" 7 | } 8 | -------------------------------------------------------------------------------- /test/fs/unit/unit_fs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace fs; 6 | 7 | CASE("Initialize mock FS") 8 | { 9 | fs::MemDisk memdisk {0, 0}; 10 | fs::Disk disk { memdisk }; 11 | 12 | EXPECT(disk.empty()); 13 | EXPECT(disk.device_id() >= 0); 14 | EXPECT(disk.name().size() > 1); // name0 15 | disk.init_fs( 16 | [&] (fs::error_t error, fs::File_system& fs) 17 | { 18 | EXPECT(error != fs::no_error); 19 | }); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /test/hw/integration/serial/Makefile: -------------------------------------------------------------------------------- 1 | ################################################# 2 | # IncludeOS SERVICE makefile # 3 | ################################################# 4 | 5 | # The name of your service 6 | SERVICE = test_serial 7 | SERVICE_NAME = Serial port Test Service 8 | 9 | # Your service parts 10 | FILES = service.cpp 11 | 12 | # Your disk image 13 | DISK= 14 | LOCAL_INCLUDES= 15 | 16 | # IncludeOS location 17 | ifndef INCLUDEOS_INSTALL 18 | INCLUDEOS_INSTALL=$(HOME)/IncludeOS_install 19 | endif 20 | 21 | include $(INCLUDEOS_INSTALL)/Makeseed 22 | -------------------------------------------------------------------------------- /test/hw/integration/serial/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/hw/integration/serial/README.md -------------------------------------------------------------------------------- /test/hw/integration/serial/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | source ${INCLUDEOS_HOME-$HOME/IncludeOS_install}/etc/run.sh test_serial.img 3 | -------------------------------------------------------------------------------- /test/hw/integration/serial/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | import sys 5 | import os 6 | 7 | includeos_src = os.environ.get('INCLUDEOS_SRC', 8 | os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0]) 9 | sys.path.insert(0,includeos_src) 10 | 11 | from subprocess import call 12 | 13 | from vmrunner import vmrunner 14 | 15 | # Get an auto-created VM from the vmrunner 16 | vm = vmrunner.vms[0] 17 | 18 | def test_serial_port(): 19 | print(" Test triggered") 20 | global vm 21 | vm.writeline("Here is a test\n") 22 | 23 | 24 | vm.on_output("trigger_test_serial_port", test_serial_port) 25 | 26 | # Boot the VM 27 | vm.make().boot(80) 28 | -------------------------------------------------------------------------------- /test/hw/integration/serial/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_serial.img" 3 | } 4 | -------------------------------------------------------------------------------- /test/hw/integration/vga/Makefile: -------------------------------------------------------------------------------- 1 | ################################################# 2 | # IncludeOS SERVICE makefile # 3 | ################################################# 4 | 5 | # The name of your service 6 | SERVICE = test_vga 7 | SERVICE_NAME = The VGA Test Service 8 | 9 | # Your service parts 10 | FILES=vga.cpp 11 | # Your disk image 12 | DISK= 13 | 14 | # IncludeOS location 15 | ifndef INCLUDEOS_INSTALL 16 | INCLUDEOS_INSTALL=$(HOME)/IncludeOS_install 17 | endif 18 | 19 | include $(INCLUDEOS_INSTALL)/Makeseed 20 | -------------------------------------------------------------------------------- /test/hw/integration/vga/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gdb -x service.gdb 3 | -------------------------------------------------------------------------------- /test/hw/integration/vga/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | export DEV_GRAPHICS="-vga std" 3 | source ${INCLUDEOS_HOME-$HOME/IncludeOS_install}/etc/run.sh test_vga.img 4 | -------------------------------------------------------------------------------- /test/hw/integration/vga/service.gdb: -------------------------------------------------------------------------------- 1 | file Test 2 | break Service::start 3 | target remote localhost:1234 4 | -------------------------------------------------------------------------------- /test/hw/integration/vga/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ../test_base 3 | 4 | export DEV_GRAPHICS="-vga std" 5 | make SERVICE=Test FILES=vga.cpp 6 | start Test.img "VGA: Verify that the service starts test" 7 | make SERVICE=Test FILES=vga.cpp clean 8 | -------------------------------------------------------------------------------- /test/hw/integration/vga/vbox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ../../etc/vboxrun.sh Test.img 3 | -------------------------------------------------------------------------------- /test/hw/integration/virtio_queue/README.md: -------------------------------------------------------------------------------- 1 | # Test Virtio::Queue. WIP 2 | 3 | Sucess: Outputs SUCCESS if all tests pass 4 | Fail: Panic if any test fails 5 | 6 | NOTE: This test uses the `lest` unit test framework as well for some tests. The result of those tests will also be reported. 7 | -------------------------------------------------------------------------------- /test/hw/integration/virtio_queue/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | source ${INCLUDEOS_HOME-$HOME/IncludeOS_install}/etc/run.sh test_virtio_queue.img 3 | -------------------------------------------------------------------------------- /test/hw/integration/virtio_queue/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ../test_base 3 | 4 | make 5 | start test_virtio_queue.img 6 | 7 | cd ../tcp 8 | make clean && make 9 | start test_tcp.img 10 | -------------------------------------------------------------------------------- /test/integration/README.md: -------------------------------------------------------------------------------- 1 | # IncludeOS integration test 2 | -------------------------------------------------------------------------------- /test/kernel/integration/LiveUpdate/manual.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat > /dev/tcp/10.0.0.59/666 < build/kernel_LiveUpdate 3 | -------------------------------------------------------------------------------- /test/kernel/integration/LiveUpdate/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | import socket 6 | 7 | from vmrunner import vmrunner 8 | vm = vmrunner.vms[0] 9 | 10 | 11 | def begin_test(line): 12 | f = open('./kernel_LiveUpdate','rb') 13 | 14 | s = socket.socket() 15 | s.connect(("10.0.0.59", 666)) 16 | s.send(f.read()) 17 | s.close() 18 | 19 | vm.on_output("Ready to receive binary blob", begin_test) 20 | if len(sys.argv) > 1: 21 | vm.boot(40,image_name=str(sys.argv[1])) 22 | else: 23 | vm.boot(40,image_name='kernel_LiveUpdate.elf.bin') 24 | -------------------------------------------------------------------------------- /test/kernel/integration/LiveUpdate/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "VM with interface for testing LiveUpdate", 3 | "net" : [ 4 | {"device" : "virtio"} 5 | ], 6 | "mem" : 1024 7 | } 8 | -------------------------------------------------------------------------------- /test/kernel/integration/block/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(kernel_block "Kernel blocking test" ${SOURCES}) 12 | os_add_stdout(kernel_block default_stdout) 13 | 14 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/kernel/integration/block/README.md: -------------------------------------------------------------------------------- 1 | # Test blocking calls 2 | -------------------------------------------------------------------------------- /test/kernel/integration/block/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | 6 | 7 | from subprocess import call 8 | 9 | from vmrunner import vmrunner 10 | if len(sys.argv) > 1: 11 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 12 | else: 13 | vmrunner.vms[0].boot(40,image_name='kernel_block.elf.bin') 14 | -------------------------------------------------------------------------------- /test/kernel/integration/block/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "blocking.img", 2 | "time_sensitive" : "True" 3 | } 4 | -------------------------------------------------------------------------------- /test/kernel/integration/context/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(kernel_context "Task switching test" ${SOURCES}) 12 | os_add_stdout(kernel_context default_stdout) 13 | 14 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/kernel/integration/context/README.md: -------------------------------------------------------------------------------- 1 | # Test stack switching 2 | -------------------------------------------------------------------------------- /test/kernel/integration/context/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | if len(sys.argv) > 1: 10 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 11 | else: 12 | vmrunner.vms[0].boot(20,image_name='kernel_context.elf.bin') 13 | -------------------------------------------------------------------------------- /test/kernel/integration/context/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "service.img" } 2 | -------------------------------------------------------------------------------- /test/kernel/integration/exception/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | set(ELF_SYMBOLS true) 5 | 6 | project (service) 7 | include(os) 8 | 9 | set(SOURCES 10 | service.cpp 11 | ) 12 | 13 | os_add_executable(kernel_exception "CPU exception test" ${SOURCES}) 14 | os_add_stdout(kernel_exception default_stdout) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/exception/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | import socket 6 | 7 | from vmrunner import vmrunner 8 | vm = vmrunner.vms[0] 9 | 10 | counter = 0 11 | expected = 5 12 | def is_good(line): 13 | global counter 14 | counter += 1 15 | print(" Found expected line {}/{}\n".format(counter, expected, line)) 16 | 17 | if (counter == expected): 18 | vm.exit(0, "All tests passed") 19 | 20 | vm.on_output("\\x15\\x07\\t\*\*\*\* PANIC \*\*\*\*", is_good) 21 | vm.on_output("Divide-by-zero Error", is_good) 22 | 23 | vm.on_output("__cpu_exception", is_good) 24 | vm.on_output("Service::start()", is_good) 25 | 26 | vm.boot(20,image_name='kernel_exception') 27 | -------------------------------------------------------------------------------- /test/kernel/integration/exception/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "CPU exception test", 3 | "mem" : 48 4 | } 5 | -------------------------------------------------------------------------------- /test/kernel/integration/fiber/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | if (DEFINED ENV{INCLUDEOS_THREADING}) 4 | option(threading "" ENV{INCLUDEOS_THREADING}) 5 | endif() 6 | 7 | project (service) 8 | include(os) 9 | 10 | set(SOURCES 11 | service.cpp 12 | ) 13 | if (threading) 14 | list(APPEND SOURCES fiber_smp.cpp) 15 | endif() 16 | 17 | os_add_executable(kernel_fiber "GRUB boot test" ${SOURCES}) 18 | os_add_stdout(kernel_fiber default_stdout) 19 | os_add_drivers(kernel_fiber boot_logger) 20 | 21 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 22 | -------------------------------------------------------------------------------- /test/kernel/integration/fiber/README.md: -------------------------------------------------------------------------------- 1 | # Test kprint - the earliest available kernel printing facility 2 | -------------------------------------------------------------------------------- /test/kernel/integration/fiber/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | if len(sys.argv) > 1: 10 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 11 | else: 12 | vmrunner.vms[0].boot(image_name='kernel_fiber.elf.bin') 13 | -------------------------------------------------------------------------------- /test/kernel/integration/fiber/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "service.img", 3 | "smp" : 16 4 | } 5 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/.gitignore: -------------------------------------------------------------------------------- 1 | temp_disk/ 2 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/README.md: -------------------------------------------------------------------------------- 1 | # Test booting with GRUB 2 | 3 | The test will create a disk image with a GRUB bootloader and a minimal IncludeOS service. The test only verifies that the service boots with GRUB and starts successfully. 4 | 5 | NOTE: 6 | - Requires xorriso package 7 | - Requires grub-pc package 8 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/grub.cfg: -------------------------------------------------------------------------------- 1 | set timeout=0 2 | set default=0 # Set the default menu entry 3 | 4 | menuentry "IncludeOS" { 5 | multiboot /boot/service 6 | boot 7 | } 8 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/grubiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | LOCAL_DISK="$(mktemp -d)" 5 | SERVICE=$1 6 | GRUBIMG=grub.iso 7 | 8 | echo "Building $GRUBIMG..." 9 | # create grub.iso 10 | mkdir -p "$LOCAL_DISK"/boot/grub 11 | cp "$SERVICE" "$LOCAL_DISK"/boot/service 12 | cp grub.cfg "$LOCAL_DISK"/boot/grub 13 | grub-mkrescue -o "$GRUBIMG" "$LOCAL_DISK" 14 | rm -vrf "$LOCAL_DISK" 15 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo apt-get -q install -qy grub-pc xorriso 3 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | import subprocess 7 | 8 | from vmrunner import vmrunner 9 | 10 | vm = vmrunner.vms[0]; 11 | 12 | # Create the GRUB image 13 | vm.boot(20, multiboot = False) 14 | -------------------------------------------------------------------------------- /test/kernel/integration/grub/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "grub.iso" } 2 | -------------------------------------------------------------------------------- /test/kernel/integration/kprint/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(kernel_kprint "kprint() test" ${SOURCES}) 12 | os_add_stdout(kernel_kprint default_stdout) 13 | 14 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/kernel/integration/kprint/README.md: -------------------------------------------------------------------------------- 1 | # Test kprint - the earliest available kernel printing facility 2 | -------------------------------------------------------------------------------- /test/kernel/integration/memmap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(kernel_memmap "Memmap test" ${SOURCES}) 12 | os_add_stdout(kernel_memmap default_stdout) 13 | 14 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | configure_file(vm1.json ${CMAKE_CURRENT_BINARY_DIR}) 16 | configure_file(vm2.json ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/memmap/README.md: -------------------------------------------------------------------------------- 1 | # Test of different timers 2 | 3 | -------------------------------------------------------------------------------- /test/kernel/integration/memmap/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | from builtins import str 5 | import sys 6 | import os 7 | 8 | from vmrunner import vmrunner 9 | 10 | image_name="kernel_memmap.elf.bin" 11 | 12 | def test2(): 13 | print("Booting VM 2 - lots of memory") 14 | vm = vmrunner.vm(config = "vm2.json") 15 | vm.boot(20, image_name = image_name) 16 | 17 | vm = vmrunner.vm(config = "vm1.json") 18 | vm.on_exit_success(test2) 19 | print("Booting VM 1 - default amount of memory") 20 | 21 | if len(sys.argv) > 1: 22 | vm.boot(image_name=str(sys.argv[1])) 23 | else: 24 | vm.boot(20,image_name=image_name) 25 | -------------------------------------------------------------------------------- /test/kernel/integration/memmap/vm1.json: -------------------------------------------------------------------------------- 1 | {"image" : "service.img" } 2 | -------------------------------------------------------------------------------- /test/kernel/integration/memmap/vm2.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "service.img", 3 | "mem" : 2000 4 | } 5 | -------------------------------------------------------------------------------- /test/kernel/integration/modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | set(ARCH i686) 5 | set(PLATFORM x86_nano) 6 | 7 | project (service) 8 | include(os) 9 | 10 | MESSAGE(STATUS "CMake root: " ${INCLUDEOS_PREFIX}) 11 | 12 | set(SOURCES 13 | service.cpp 14 | ) 15 | 16 | os_add_executable(kernel_modules "Kernel modules test" ${SOURCES}) 17 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/kernel/integration/modules/README.md: -------------------------------------------------------------------------------- 1 | # Test multiboot modules 2 | -------------------------------------------------------------------------------- /test/kernel/integration/modules/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import os 5 | 6 | from vmrunner import vmrunner 7 | 8 | vm = vmrunner.vms[0]; 9 | # Build, run and clean 10 | vm.boot(image_name='kernel_modules.elf.bin') 11 | -------------------------------------------------------------------------------- /test/kernel/integration/modules/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio"}], 3 | "image" : "kernel_modules.img", 4 | "modules" : [ 5 | {"path" : "kernel_modules", "args" : "loaded as module"} 6 | ], 7 | "mem" : 128 8 | } 9 | -------------------------------------------------------------------------------- /test/kernel/integration/osinit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(osinit "OS initialization test" ${SOURCES}) 12 | os_add_stdout(osinit default_stdout) 13 | os_add_drivers(osinit boot_logger) 14 | os_add_plugins(osinit field_medic) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/osinit/service.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Service::start() 5 | { 6 | kprint("Service::start entered\n"); 7 | } 8 | -------------------------------------------------------------------------------- /test/kernel/integration/osinit/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from vmrunner import vmrunner 4 | vm = vmrunner.vms[0] 5 | 6 | 7 | def done(line): 8 | if "Healthy" in line: 9 | vm.exit(0, "OS initialization test succeeded") 10 | elif "failed" in line: 11 | status = line.split(":")[1].strip() 12 | vm.exit(1, status) 13 | else: 14 | vm.exit(2, "OS initialization test failed") 15 | 16 | vm.on_output("Diagnose complete", done) 17 | 18 | 19 | vm.boot(20, image_name='osinit.elf.bin') 20 | -------------------------------------------------------------------------------- /test/kernel/integration/paging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp # ...add more here 9 | ) 10 | 11 | os_add_executable(kernel_paging "Page protection test" ${SOURCES}) 12 | os_add_stdout(kernel_paging default_stdout) 13 | os_add_drivers(kernel_paging boot_logger) 14 | os_add_plugins(kernel_paging vfs) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/paging/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "Page protection test", 3 | "mem" : 3584, 4 | "time_sensitive": "True", 5 | "smp" : 16 6 | } 7 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp plugin1.cpp plugin2.cpp plugin3.cpp 9 | ) 10 | 11 | os_add_executable(kernel_plugin_init "Plugin init test" ${SOURCES}) 12 | os_add_stdout(kernel_plugin_init default_stdout) 13 | os_add_plugins(kernel_plugin_init example) 14 | 15 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 16 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/README.md: -------------------------------------------------------------------------------- 1 | # Test pre-service plugin initialization routines 2 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/plugin1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern bool example_plugin_registered; 4 | extern bool example_plugin_run; 5 | int my_plugin_functions = 0; 6 | int f1_data = 0; 7 | 8 | __attribute__((constructor)) 9 | static void func1(){ 10 | 11 | 12 | // NOTE: since this plugin is a part of the service, its ctors 13 | // will be called after the installed plugin ctors. Therefore we can 14 | // depend on installed plugins being run / registered. 15 | 16 | CHECKSERT(example_plugin_registered, "Example plugin registered"); 17 | CHECKSERT(example_plugin_run, "Example plugin ran"); 18 | 19 | INFO("Plugin 1","initialization function 1"); 20 | f1_data = 0xf1; 21 | my_plugin_functions++; 22 | } 23 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/plugin2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern int my_plugin_functions; 4 | int f2_data = 0; 5 | 6 | __attribute__((constructor)) 7 | static void func2(){ 8 | INFO("Plugin 2","initialization function 2"); 9 | f2_data = 0xf2; 10 | my_plugin_functions++; 11 | } 12 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/plugin3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern int my_plugin_functions; 5 | int f3_data = 0; 6 | 7 | // The OS will no longer catch exceptions in plugins 8 | class myexcept : public std::exception { 9 | using std::exception::exception; 10 | const char* what() const noexcept override{ 11 | f3_data = 0xf417; 12 | return "My plugin message"; 13 | } 14 | }; 15 | 16 | __attribute__((constructor)) 17 | static void func3(){ 18 | INFO("Plugin 3","initialization function 3"); 19 | my_plugin_functions++; 20 | f3_data = 0xf3; 21 | } 22 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | 6 | from vmrunner import vmrunner 7 | if len(sys.argv) > 1: 8 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 9 | else: 10 | vmrunner.vms[0].boot(60,image_name='kernel_plugin_init.elf.bin') 11 | -------------------------------------------------------------------------------- /test/kernel/integration/plugin_init/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "service.img" } 2 | -------------------------------------------------------------------------------- /test/kernel/integration/rng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp # ...add more here 9 | ) 10 | 11 | os_add_executable(kernel_rng "R.N.Geesus test" ${SOURCES}) 12 | os_add_stdout(kernel_rng default_stdout) 13 | #os_add_drivers(service boot_logger) 14 | os_add_plugins(kernel_rng vfs) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/rng/README.md: -------------------------------------------------------------------------------- 1 | # RNG Test 2 | 3 | Tests POSIX random (`open`, `read` etc on `"/dev/urandom"`) and `std::random_device`. 4 | 5 | -------------------------------------------------------------------------------- /test/kernel/integration/rng/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | if len(sys.argv) > 1: 10 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 11 | else: 12 | vmrunner.vms[0].boot(20,image_name='kernel_rng.elf.bin') 13 | -------------------------------------------------------------------------------- /test/kernel/integration/rng/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "service.img" } 2 | -------------------------------------------------------------------------------- /test/kernel/integration/smp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (smp_test) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp # ...add more here 9 | ) 10 | 11 | os_add_executable(kernel_smp "SMP test" ${SOURCES}) 12 | os_add_stdout(kernel_smp default_stdout) 13 | os_add_drivers(kernel_smp boot_logger) 14 | #os_add_plugins(service vfs) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/smp/README.md: -------------------------------------------------------------------------------- 1 | ### SMP 2 | 3 | ``` 4 | mkdir build 5 | cd build 6 | cmake .. 7 | make 8 | ../run.sh smp_example 9 | ``` 10 | -------------------------------------------------------------------------------- /test/kernel/integration/smp/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | boot_count = 0 10 | success = False 11 | 12 | def booted(line): 13 | global boot_count 14 | boot_count += 1; 15 | if boot_count > 1: 16 | vm.exit(1, "VM rebooted unexpectedly") 17 | 18 | vm = vmrunner.vms[0] 19 | 20 | vm.on_output("#include // Literally", booted); 21 | 22 | vm.boot(20,image_name='kernel_smp.elf.bin') 23 | -------------------------------------------------------------------------------- /test/kernel/integration/smp/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "service.img", 3 | "smp" : 16 4 | } 5 | -------------------------------------------------------------------------------- /test/kernel/integration/spinlocks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | set(ELF_SYMBOLS true) 4 | 5 | project (service) 6 | include(os) 7 | 8 | set(SOURCES 9 | service.cpp 10 | ) 11 | 12 | os_add_executable(kernel_spinlocks "spinlock test" ${SOURCES}) 13 | os_add_stdout(kernel_spinlocks default_stdout) 14 | os_add_drivers(kernel_spinlocks boot_logger) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/spinlocks/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import os 5 | 6 | from vmrunner import vmrunner 7 | 8 | vm = vmrunner.vms[0]; 9 | 10 | if len(sys.argv) > 1: 11 | vm.boot(image_name=str(sys.argv[1])) 12 | else: 13 | # Build, run and clean 14 | vm.boot(image_name='kernel_spinlocks') 15 | -------------------------------------------------------------------------------- /test/kernel/integration/stacktrace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | set(ELF_SYMBOLS true) 5 | 6 | project (service) 7 | include(os) 8 | 9 | set(SOURCES 10 | service.cpp 11 | ) 12 | 13 | os_add_executable(kernel_stacktrace "Stacktrace test" ${SOURCES}) 14 | os_add_stdout(kernel_stacktrace default_stdout) 15 | os_add_drivers(kernel_stacktrace boot_logger) 16 | 17 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/kernel/integration/stacktrace/service.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Service::start() 4 | { 5 | printf("Calling os::print_backtrace()\n"); 6 | os::print_backtrace(); 7 | printf("We reached the end.\n"); 8 | } 9 | -------------------------------------------------------------------------------- /test/kernel/integration/stacktrace/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | vm = vmrunner.vms[0] 10 | 11 | counter = 0 12 | expected = 4 13 | def is_good(line): 14 | global counter, expected 15 | counter += 1 16 | print(" Found expected line {}/{}\n".format(counter, expected, line)) 17 | if (counter == expected): 18 | vm.exit(0, "All tests passed") 19 | 20 | vm.on_output("Service::start()", is_good) 21 | vm.on_output("kernel_main", is_good) 22 | vm.on_output("libc_start_main", is_good) 23 | vm.on_output("long_mode", is_good) 24 | 25 | vm.boot(20,image_name='kernel_stacktrace') 26 | -------------------------------------------------------------------------------- /test/kernel/integration/stacktrace/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "service.img", 3 | "smp" : 16 4 | } 5 | -------------------------------------------------------------------------------- /test/kernel/integration/term/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(kernel_term "Terminal test" ${SOURCES}) 12 | os_add_stdout(kernel_term default_stdout) 13 | os_add_drivers(kernel_term virtionet) 14 | #os_add_plugins(service vfs) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/term/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from __future__ import print_function 3 | from builtins import str 4 | import sys 5 | import os 6 | import socket 7 | 8 | from vmrunner import vmrunner 9 | vm = vmrunner.vms[0] 10 | 11 | 12 | def begin_test(line): 13 | s = socket.socket() 14 | s.connect(("10.0.0.63", 23)) 15 | s.send(str.encode("netstat\r\n")) 16 | result = s.recv(1024).decode() 17 | print(result) 18 | s.close() 19 | return "Banana Terminal" in result 20 | 21 | vm.on_output("Connect to terminal", begin_test) 22 | if len(sys.argv) > 1: 23 | vm.boot(image_name=str(sys.argv[1])) 24 | else: 25 | vm.boot(40,image_name='kernel_term.elf.bin') 26 | -------------------------------------------------------------------------------- /test/kernel/integration/term/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "VM with interface for testing LiveUpdate", 3 | "net" : [ 4 | {"device" : "virtio"} 5 | ], 6 | "mem" : 128 7 | } 8 | -------------------------------------------------------------------------------- /test/kernel/integration/timers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(kernel_timers "Timers Test Service" service.cpp timers.cpp) 12 | os_add_stdout(kernel_timers default_stdout) 13 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 14 | -------------------------------------------------------------------------------- /test/kernel/integration/timers/README.md: -------------------------------------------------------------------------------- 1 | # Test of different timers 2 | 3 | -------------------------------------------------------------------------------- /test/kernel/integration/timers/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | vmrunner.vms[0].boot(60, image_name="kernel_timers.elf.bin") 10 | -------------------------------------------------------------------------------- /test/kernel/integration/timers/vm.json: -------------------------------------------------------------------------------- 1 | {"image" : "test_timers.img", 2 | "time_sensitive" : "True" 3 | } 4 | -------------------------------------------------------------------------------- /test/kernel/integration/tls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | #option(threading "" ON) 4 | 5 | project (tls) 6 | include(os) 7 | 8 | set(SOURCES 9 | service.cpp # ...add more here 10 | ) 11 | 12 | os_add_executable(kernel_tls "TLS test" ${SOURCES}) 13 | os_add_stdout(kernel_tls default_stdout) 14 | os_add_drivers(kernel_tls boot_logger) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/kernel/integration/tls/README.md: -------------------------------------------------------------------------------- 1 | ### SMP 2 | 3 | ``` 4 | mkdir build 5 | cd build 6 | cmake .. 7 | make 8 | ../run.sh smp_example 9 | ``` 10 | -------------------------------------------------------------------------------- /test/kernel/integration/tls/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | 6 | from vmrunner import vmrunner 7 | if len(sys.argv) > 1: 8 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 9 | else: 10 | vmrunner.vms[0].boot(20,image_name='kernel_tls.elf.bin') 11 | -------------------------------------------------------------------------------- /test/kernel/integration/tls/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem" : 32 3 | } 4 | -------------------------------------------------------------------------------- /test/kernel/unit/arch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | CASE("Testing arch.hpp") 5 | { 6 | // TODO: some way to verify these? 7 | __arch_hw_barrier(); // __builtin_sync_synchronize() equivalent 8 | __sw_barrier(); 9 | } 10 | -------------------------------------------------------------------------------- /test/kernel/unit/block.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | extern "C" uint32_t os_get_blocking_level(); 5 | extern "C" uint32_t os_get_highest_blocking_level(); 6 | 7 | CASE("OS::block") 8 | { 9 | static bool event_happened = false; 10 | auto ev = Events::get().subscribe( 11 | [&] () { 12 | event_happened = true; 13 | EXPECT(os_get_blocking_level() == 1); 14 | EXPECT(os_get_highest_blocking_level() == 1); 15 | }); 16 | Events::get().trigger_event(ev); 17 | // block until event happens 18 | os::block(); 19 | // Done 20 | EXPECT(event_happened); 21 | EXPECT(os_get_blocking_level() == 0); 22 | EXPECT(os_get_highest_blocking_level() == 1); 23 | } 24 | -------------------------------------------------------------------------------- /test/kernel/unit/cpuid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | CASE("CPUID test") 6 | { 7 | EXPECT(!CPUID::detect_features_str().empty()); 8 | } 9 | -------------------------------------------------------------------------------- /test/lest_util/lestmain.cxx: -------------------------------------------------------------------------------- 1 | #include "common.cxx" 2 | 3 | lest::tests& specification() 4 | { 5 | static lest::tests tests; 6 | return tests; 7 | } 8 | 9 | int main( int argc, char * argv[] ) 10 | { 11 | return lest::run( specification(), argc, argv /*, std::cout */ ); 12 | } 13 | -------------------------------------------------------------------------------- /test/lest_util/malloc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifdef __MACH__ 3 | extern void* memalign(size_t alignment, size_t size); 4 | #else 5 | #include_next 6 | #endif 7 | -------------------------------------------------------------------------------- /test/lest_util/posix_strace.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define PRINT(x, ...) /** x **/ 4 | -------------------------------------------------------------------------------- /test/lest_util/random.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | // Random addresses to test for each PML 3 | namespace test { 4 | uint64_t rand64(){ 5 | static std::mt19937_64 mt_rand(time(0)); 6 | return mt_rand(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/lest_util/stdlib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #ifdef __MACH__ 4 | void* aligned_alloc(size_t alignment, size_t size); 5 | #endif 6 | 7 | #include_next 8 | -------------------------------------------------------------------------------- /test/memdisk.fat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/memdisk.fat -------------------------------------------------------------------------------- /test/misc/run_unit_tests/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | INCLUDEOS_SRC=${INCLUDEOS_SRC-$HOME/IncludeOS} 4 | ARCH=${ARCH:-x86_64} 5 | 6 | pushd $INCLUDEOS_SRC/build_$ARCH/unittests 7 | ./unittests --pass 8 | popd 9 | -------------------------------------------------------------------------------- /test/misc/solo5-hvt/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | pushd $INCLUDEOS_SRC/examples/demo_service/build_solo5-hvt 5 | make 6 | popd 7 | -------------------------------------------------------------------------------- /test/misc/solo5-hvt/manual.sh: -------------------------------------------------------------------------------- 1 | solo5-hvt --disk=dummy.disk --net=tap100 -- $INCLUDEOS_SRC/examples/demo_service/build_solo5-hvt/demo 2 | -------------------------------------------------------------------------------- /test/mod/integration/gsl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(mod_gsl "GSL test" ${SOURCES}) 12 | os_add_stdout(mod_gsl default_stdout) 13 | 14 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/mod/integration/gsl/README.md: -------------------------------------------------------------------------------- 1 | # Test basics of C++ Core Guidelines Support Library 2 | This just tests a fraction of GSL functionality, but it's here to just verify that basic GSL support is in place and working in IncludeOS. 3 | 4 | Sucess: Outputs SUCCESS if all tests pass 5 | Fail: Panic if any test fails 6 | 7 | NOTE: This test uses the `lest` unit test framework as well for some tests. The result of those tests will also be reported. 8 | -------------------------------------------------------------------------------- /test/mod/integration/gsl/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | if len(sys.argv) > 1: 9 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 10 | else: 11 | vmrunner.vms[0].cmake().boot(60) 12 | -------------------------------------------------------------------------------- /test/net/integration/bufstore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_bufstore "Bufferstore test" ${SOURCES}) 12 | 13 | os_add_stdout(net_bufstore default_stdout) 14 | 15 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 16 | -------------------------------------------------------------------------------- /test/net/integration/bufstore/README.md: -------------------------------------------------------------------------------- 1 | # Test net::BufferStore and net::Packet chaining 2 | 3 | Internal tests that verifies that packet chaining plays well with the buffer store, i.e. that you can chain lots of packets, dechain, and they all return their buffers back to the bufstore. 4 | -------------------------------------------------------------------------------- /test/net/integration/bufstore/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | if len(sys.argv) > 1: 10 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 11 | else: 12 | vmrunner.vms[0].boot(30,image_name='net_bufstore.elf.bin') 13 | -------------------------------------------------------------------------------- /test/net/integration/configure/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_config(net_configure "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(net_configure "Configure test" ${SOURCES}) 14 | 15 | os_add_plugins(net_configure autoconf) 16 | os_add_drivers(net_configure virtionet boot_logger) 17 | os_add_stdout(net_configure default_stdout) 18 | 19 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 20 | -------------------------------------------------------------------------------- /test/net/integration/configure/README.md: -------------------------------------------------------------------------------- 1 | # Configure Test 2 | 3 | Verifies that the network config in `config.json` is getting correctly parsed. 4 | -------------------------------------------------------------------------------- /test/net/integration/configure/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | #TODO move timeout to ctest.. 9 | if len(sys.argv) > 1: 10 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 11 | else: 12 | vmrunner.vms[0].boot(30,image_name='net_configure.elf.bin') 13 | -------------------------------------------------------------------------------- /test/net/integration/configure/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [ 3 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}, 4 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:3a"}, 5 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:4a"}, 6 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:5a"}, 7 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:6a"}, 8 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:7a"}, 9 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:8a"} 10 | ], 11 | "mem" : 256 12 | } 13 | -------------------------------------------------------------------------------- /test/net/integration/dhclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | os_add_executable(net_dhclient "IncludeOS DHCP test" service.cpp) 8 | 9 | os_add_plugins(net_dhclient autoconf) 10 | os_add_drivers(net_dhclient virtionet) 11 | os_add_stdout(net_dhclient default_stdout) 12 | 13 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 14 | -------------------------------------------------------------------------------- /test/net/integration/dhclient/README.md: -------------------------------------------------------------------------------- 1 | # Test DHCP functionality 2 | 3 | Note: requires a DHCP server to be present on the include0 bridge 4 | -------------------------------------------------------------------------------- /test/net/integration/dhclient/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_dhcp.img", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 4 | "time_sensitive" : "True" 5 | } 6 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | os_add_executable(net_dhcpd "IncludeOS DHCP server test" service.cpp) 8 | 9 | os_add_plugins(net_dhcpd autoconf) 10 | os_add_drivers(net_dhcpd virtionet) 11 | os_add_stdout(net_dhcpd default_stdout) 12 | 13 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 14 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd/README.md: -------------------------------------------------------------------------------- 1 | # Test DHCP server 2 | 3 | Note: 4 | Requires that $INCLUDEOS_PREFIX/includeos/scripts/create_bridge.sh has been run and that a route has been added to the created bridge (bridge43): sudo route add -net 10.0.100.0 netmask 255.255.255.0 dev bridge43 5 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo arp -d 10.0.0.10 2>&1 > /dev/null 4 | sudo arp -d 10.0.0.11 2>&1 > /dev/null 5 | sudo arp -d 10.0.0.12 2>&1 > /dev/null 6 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_dhcp_server.img", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}, 4 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2f"}, 5 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:20"}, 6 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:23"}], 7 | "mem" : 128, 8 | "time_sensitive" : "True" 9 | } 10 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd_dhclient_linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | os_add_executable(net_dhcpd_dhclient_linux "IncludeOS DHCP server test" service.cpp) 8 | 9 | os_add_plugins(net_dhcpd_dhclient_linux autoconf) 10 | os_add_drivers(net_dhcpd_dhclient_linux virtionet) 11 | os_add_stdout(net_dhcpd_dhclient_linux default_stdout) 12 | 13 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 14 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd_dhclient_linux/README.md: -------------------------------------------------------------------------------- 1 | # Test IncludeOS DHCP server with Linux dhclient 2 | 3 | Note: 4 | Works on a linux distributions that have dhclient and route. 5 | $INCLUDEOS_PREFIX/includeos/scripts/create_bridge.sh must be run prior to the test. 6 | 7 | Run test: sudo -E ./test.py 8 | -------------------------------------------------------------------------------- /test/net/integration/dhcpd_dhclient_linux/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "test_dhcp_server_dhclient.img", 3 | "net": [ 4 | { 5 | "device": "virtio", 6 | "mac": "c0:01:0a:00:00:2a" 7 | } 8 | ], 9 | "mem": 128 10 | } 11 | -------------------------------------------------------------------------------- /test/net/integration/dns/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_dns "DNS test" ${SOURCES}) 12 | 13 | os_add_drivers(net_dns virtionet e1000 vmxnet3) 14 | os_add_stdout(net_dns default_stdout) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/net/integration/dns/README.md: -------------------------------------------------------------------------------- 1 | # DNS Test 2 | -------------------------------------------------------------------------------- /test/net/integration/dns/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [ 3 | { 4 | "device" : "vmxnet3", "mac" : "c0:01:0a:00:00:2a", 5 | "backend" : "user" 6 | } 7 | ], 8 | "mem" : 128, 9 | "intrusive" : "True" 10 | } 11 | -------------------------------------------------------------------------------- /test/net/integration/gateway/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_gateway "Gateway test" ${SOURCES}) 12 | 13 | os_add_nacl(net_gateway nacl.txt) 14 | os_add_drivers(net_gateway virtionet e1000 vmxnet3) 15 | os_add_stdout(net_gateway default_stdout) 16 | 17 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/net/integration/gateway/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | #if name is passed execute that do not clean and do not rebuild.. 10 | if len(sys.argv) > 1: 11 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 12 | else: 13 | vmrunner.vms[0].boot(70,image_name='net_gateway.elf.bin') 14 | -------------------------------------------------------------------------------- /test/net/integration/gateway/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_gateway.img", 3 | "net" : [ 4 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}, 5 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2f"}, 6 | {"device" : "vmxnet3", "mac" : "c0:01:0a:00:00:20"}, 7 | {"device" : "vmxnet3", "mac" : "c0:01:0a:00:00:23"} 8 | ], 9 | "mem" : 128 10 | } 11 | -------------------------------------------------------------------------------- /test/net/integration/http/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_http "HTTP test" ${SOURCES}) 12 | os_add_drivers(net_http virtionet) 13 | os_add_stdout(net_http default_stdout) 14 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/net/integration/http/README.md: -------------------------------------------------------------------------------- 1 | # HTTP Test 2 | 3 | ## Client 4 | Test the HTTP Client on local server. 5 | 6 | Outgoing test requires correct network configuration. 7 | -------------------------------------------------------------------------------- /test/net/integration/http/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set - 3 | INCLUDEOS_PREFIX=${INCLUDEOS_PREFIX-/usr/local} 4 | sudo $INCLUDEOS_PREFIX/includeos/scripts/create_bridge.sh 5 | 6 | FILE=$1 7 | shift 8 | source $INCLUDEOS_PREFIX/includeos/scripts/run.sh $FILE ${*} 9 | -------------------------------------------------------------------------------- /test/net/integration/http/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 256 4 | } 5 | -------------------------------------------------------------------------------- /test/net/integration/icmp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_icmp "ICMP test" ${SOURCES}) 12 | 13 | os_add_drivers(net_icmp virtionet) 14 | os_add_stdout(net_icmp default_stdout) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/net/integration/icmp/README.md: -------------------------------------------------------------------------------- 1 | # ICMP integration test 2 | -------------------------------------------------------------------------------- /test/net/integration/icmp/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 128, 4 | "intrusive" : "True" 5 | } 6 | -------------------------------------------------------------------------------- /test/net/integration/icmp6/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_icmp6 "ICMPv6 test" ${SOURCES}) 12 | os_add_stdout(net_icmp6 default_stdout) 13 | 14 | # DRIVERS / PLUGINS: 15 | if ("$ENV{PLATFORM}" STREQUAL "x86_solo5") 16 | os_add_drivers(net_icmp6 17 | solo5net 18 | ) 19 | else() 20 | os_add_drivers(net_icmp6 21 | virtionet 22 | ) 23 | endif() 24 | 25 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 26 | -------------------------------------------------------------------------------- /test/net/integration/icmp6/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service C CXX) 5 | 6 | # Human-readable name of your service 7 | set(SERVICE_NAME "Linux userspace ICMP6 test") 8 | 9 | # Name of your service binary 10 | set(BINARY "icmp6") 11 | 12 | # Source files to be linked with OS library parts to form bootable image 13 | set(SOURCES 14 | ../service.cpp 15 | ) 16 | 17 | set(EXTRA_LIBS 18 | ) 19 | 20 | include($ENV{INCLUDEOS_PREFIX}/includeos/linux.service.cmake) 21 | -------------------------------------------------------------------------------- /test/net/integration/icmp6/linux/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export GPROF="OFF" 6 | export DBG="OFF" 7 | 8 | export num_jobs=${num_jobs:--j32} 9 | 10 | function make_linux(){ 11 | pushd $INCLUDEOS_SRC/linux/build 12 | cmake -DGPROF=$GPROF -DDEBUGGING=$DBG .. 13 | make $num_jobs install 14 | popd 15 | } 16 | 17 | function make_service(){ 18 | mkdir -p build 19 | pushd build 20 | cmake -DGPROF=$GPROF -DDEBUGGING=$DBG .. 21 | make $num_jobs 22 | popd 23 | } 24 | 25 | if [ -z "$1" ] 26 | then 27 | GPROF="OFF" 28 | elif [ "$1" == "gprof" ] 29 | then 30 | GPROF="ON" 31 | fi 32 | 33 | 34 | make_linux 35 | make_service 36 | 37 | #sudo mknod /dev/net/tap c 10 200 38 | BINARY=build/"`cat build/binary.txt`" 39 | sudo $BINARY 40 | -------------------------------------------------------------------------------- /test/net/integration/icmp6/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 &> /dev/null 3 | -------------------------------------------------------------------------------- /test/net/integration/icmp6/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 128 4 | } 5 | -------------------------------------------------------------------------------- /test/net/integration/microLB/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo apt-get -qqq install -y nodejs 3 | sudo -H pip -q install requests 4 | -------------------------------------------------------------------------------- /test/net/integration/microLB/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "VM with 3 interfaces for load balancing", 3 | "net" : [ 4 | {"device" : "virtio"}, 5 | {"device" : "virtio"}, 6 | {"device" : "virtio"} 7 | ], 8 | "mem" : 256 9 | } 10 | -------------------------------------------------------------------------------- /test/net/integration/nat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_nat "NAT test" ${SOURCES}) 12 | 13 | os_add_drivers(net_nat virtionet) 14 | os_add_stdout(net_nat default_stdout) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/net/integration/nat/README.md: -------------------------------------------------------------------------------- 1 | # Test NAT 2 | -------------------------------------------------------------------------------- /test/net/integration/nat/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | #TODO move timeout to ctest.. 9 | if len(sys.argv) > 1: 10 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 11 | else: 12 | vmrunner.vms[0].boot(30,image_name='net_nat.elf.bin') 13 | -------------------------------------------------------------------------------- /test/net/integration/nat/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [ 3 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}, 4 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2f"}, 5 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:20"}, 6 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:23"}, 7 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:24"} 8 | ], 9 | "mem" : 128 10 | } 11 | -------------------------------------------------------------------------------- /test/net/integration/router/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_router "Routing test" ${SOURCES}) 12 | 13 | os_add_drivers(net_router virtionet) 14 | os_add_stdout(net_router default_stdout) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | configure_file(setup.sh ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/net/integration/router/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem" : 320, 3 | "net" : [{"device" : "virtio"}, 4 | {"device" : "virtio"}], 5 | "intrusive": "True", 6 | "time_sensitive" : "True" 7 | } 8 | -------------------------------------------------------------------------------- /test/net/integration/router6/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | os_add_executable(net_router6 "Routing test ipv6" service.cpp) 8 | 9 | os_add_drivers(net_router6 virtionet) 10 | os_add_stdout(net_router6 default_stdout) 11 | 12 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 13 | configure_file(setup.sh ${CMAKE_CURRENT_BINARY_DIR}) 14 | -------------------------------------------------------------------------------- /test/net/integration/router6/README.md: -------------------------------------------------------------------------------- 1 | # IPv6 routing test 2 | 3 | Depends on iperf3. TODO: It currently seems to time out. 4 | -------------------------------------------------------------------------------- /test/net/integration/router6/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "test_router.img", 3 | "mem" : 320, 4 | "net" : [{"device" : "virtio"}, 5 | {"device" : "virtio"}], 6 | "intrusive": "True", 7 | "time_sensitive" : "True" 8 | } 9 | -------------------------------------------------------------------------------- /test/net/integration/slaac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (test_slaac) 5 | include(os) 6 | 7 | os_add_executable(net_slaac "IncludeOS Slaac test" service.cpp) 8 | 9 | os_add_drivers(net_slaac virtionet) 10 | os_add_stdout(net_slaac default_stdout) 11 | 12 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 13 | -------------------------------------------------------------------------------- /test/net/integration/slaac/README.md: -------------------------------------------------------------------------------- 1 | # Test SLAAC or Auto-configuration of Slaac functionality 2 | -------------------------------------------------------------------------------- /test/net/integration/slaac/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_slaac.img", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 4 | "time_sensitive" : "True" 5 | } 6 | -------------------------------------------------------------------------------- /test/net/integration/tcp/.gitignore: -------------------------------------------------------------------------------- 1 | test_tcp 2 | -------------------------------------------------------------------------------- /test/net/integration/tcp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(net_tcp "TCP test" ${SOURCES}) 12 | 13 | os_add_drivers(net_tcp virtionet e1000 vmxnet3) 14 | os_add_stdout(net_tcp default_stdout) 15 | 16 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 17 | -------------------------------------------------------------------------------- /test/net/integration/tcp/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service C CXX) 5 | 6 | # Human-readable name of your service 7 | set(SERVICE_NAME "Linux userspace TCP test") 8 | 9 | # Name of your service binary 10 | set(BINARY "tcp_test") 11 | 12 | # Source files to be linked with OS library parts to form bootable image 13 | set(SOURCES 14 | ../service.cpp 15 | ) 16 | 17 | set(EXTRA_LIBS 18 | ) 19 | 20 | include($ENV{INCLUDEOS_PREFIX}/includeos/linux.service.cmake) 21 | -------------------------------------------------------------------------------- /test/net/integration/tcp/linux/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export GPROF="OFF" 6 | export DBG="OFF" 7 | 8 | export num_jobs=${num_jobs:--j32} 9 | 10 | function make_linux(){ 11 | pushd $INCLUDEOS_SRC/linux/build 12 | cmake -DGPROF=$GPROF -DDEBUGGING=$DBG .. 13 | make $num_jobs install 14 | popd 15 | } 16 | 17 | function make_service(){ 18 | mkdir -p build 19 | pushd build 20 | cmake -DGPROF=$GPROF -DDEBUGGING=$DBG .. 21 | make $num_jobs 22 | popd 23 | } 24 | 25 | if [ -z "$1" ] 26 | then 27 | GPROF="OFF" 28 | elif [ "$1" == "gprof" ] 29 | then 30 | GPROF="ON" 31 | fi 32 | 33 | 34 | make_linux 35 | make_service 36 | 37 | #sudo mknod /dev/net/tap c 10 200 38 | BINARY=build/"`cat build/binary.txt`" 39 | sudo $BINARY 40 | -------------------------------------------------------------------------------- /test/net/integration/tcp/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 256 4 | } 5 | -------------------------------------------------------------------------------- /test/net/integration/udp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | os_add_executable(net_udp "UDP test" service.cpp) 8 | 9 | os_add_drivers(net_udp virtionet ip4_reassembly boot_logger) 10 | os_add_stdout(net_udp default_stdout) 11 | 12 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 13 | -------------------------------------------------------------------------------- /test/net/integration/udp/README.md: -------------------------------------------------------------------------------- 1 | # Test UDP functionality 2 | 3 | This service sets up a UDP "parrot" i.e. a UDP server that listens to a certain port, and echos back to you anything you send to it. 4 | 5 | ### TODO 6 | 7 | 1. Make an external test script (or a test program using e.g. google test) that writes random byte sequences in, and verifies that the output is identical. 8 | 2. Find out what happens when there is more data than one frame can hold (i.e. 1500 bytes minus headers) - and compare with what sould happen, i.e. what happens with a normal C-socket in Linux. 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/net/integration/udp/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 400, 4 | "time_sensitive": "True", 5 | "smp" : 16 6 | } 7 | -------------------------------------------------------------------------------- /test/net/integration/vlan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_config(net_vlan "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(net_vlan "VLAN test" ${SOURCES}) 14 | 15 | os_add_plugins(net_vlan autoconf) 16 | os_add_drivers(net_vlan virtionet e1000 vmxnet3) 17 | os_add_stdout(net_vlan default_stdout) 18 | 19 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 20 | -------------------------------------------------------------------------------- /test/net/integration/vlan/README.md: -------------------------------------------------------------------------------- 1 | # Test VLAN 2 | -------------------------------------------------------------------------------- /test/net/integration/vlan/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | if len(sys.argv) > 1: 9 | vmrunner.vms[0].boot(image_name=str(sys.argv[1])) 10 | else: 11 | vmrunner.vms[0].boot(20,image_name='net_vlan.elf.bin') 12 | -------------------------------------------------------------------------------- /test/net/integration/vlan/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [ 3 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}, 4 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2f"} 5 | ], 6 | "mem" : 128 7 | } 8 | -------------------------------------------------------------------------------- /test/net/integration/websocket/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include (os) 6 | 7 | 8 | set(SOURCES 9 | service.cpp 10 | ) 11 | 12 | os_add_executable(net_websocket "Websocket test" ${SOURCES}) 13 | 14 | os_add_drivers(net_websocket virtionet) 15 | os_add_stdout(net_websocket default_stdout) 16 | 17 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/net/integration/websocket/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | sudo -H pip -q install ws4py==0.4.2 4 | -------------------------------------------------------------------------------- /test/net/integration/websocket/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio"}], 3 | "mem" : 1024 4 | } 5 | -------------------------------------------------------------------------------- /test/performance/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/performance/.keep -------------------------------------------------------------------------------- /test/performance/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/performance/integration/.keep -------------------------------------------------------------------------------- /test/performance/unit/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/performance/unit/.keep -------------------------------------------------------------------------------- /test/plugin/integration/unik/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(plugin_unik "UNIK plugin test" ${SOURCES}) 14 | 15 | os_add_drivers(plugin_unik virtionet) 16 | os_add_plugins(plugin_unik unik) 17 | os_add_stdout(plugin_unik default_stdout) 18 | 19 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 20 | -------------------------------------------------------------------------------- /test/plugin/integration/unik/README.md: -------------------------------------------------------------------------------- 1 | # Test the Unik plugin initialization module 2 | 3 | *Note:* The test service needs to receive an UDP heartbeat on the Unik default port, and register it's mac-address over HTTP to the sender of the heartbeat in order for the test to succeed. This is future work. 4 | -------------------------------------------------------------------------------- /test/plugin/integration/unik/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | # TODO: Implement a mockup of the Unik registration protocol on 10.0.0.56 10 | 11 | vm=vmrunner.vms[0] 12 | 13 | if len(sys.argv) > 1: 14 | vm.boot(image_name=str(sys.argv[1])) 15 | else: 16 | # Boot the VM, taking a timeout as parameter 17 | vm.boot(60,image_name="plugin_unik.elf.bin") 18 | -------------------------------------------------------------------------------- /test/plugin/integration/unik/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [ 3 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}, 4 | {"device" : "virtio", "mac" : "c0:01:0a:00:00:2b"} 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /test/posix/integration/conf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | test_sysconf.c 10 | test_pathconf.c 11 | test_pwd.c 12 | ) 13 | 14 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 15 | 16 | os_add_executable(posix_conf "POSIX pathconf test" ${SOURCES}) 17 | 18 | os_add_plugins(posix_conf vfs) 19 | os_add_stdout(posix_conf default_stdout) 20 | 21 | # Create memdisk from folder 22 | os_diskbuilder(posix_conf disk) 23 | 24 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 25 | -------------------------------------------------------------------------------- /test/posix/integration/conf/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "vfs" : [ 3 | { 4 | "disk" : "memdisk", 5 | "root" : "/files", 6 | "mount" : "/etc", 7 | "description" : "test fs" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /test/posix/integration/conf/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | 9 | # Get an auto-created VM from the vmrunner 10 | vm = vmrunner.vms[0] 11 | 12 | # Boot the VM, taking a timeout as parameter 13 | if len(sys.argv) > 1: 14 | vm.boot(20,image_name=str(sys.argv[1])) 15 | else: 16 | vm.boot(20,image_name='posix_conf.elf.bin') 17 | -------------------------------------------------------------------------------- /test/posix/integration/conf/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem" : 128 3 | } 4 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *.img 4 | _elf_symbols.bin 5 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | test_file_fd.cpp 9 | ) 10 | 11 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(posix_file_fd "POSIX file descriptor test" ${SOURCES}) 14 | 15 | os_add_plugins(posix_file_fd vfs) 16 | os_add_stdout(posix_file_fd default_stdout) 17 | 18 | # Create memdisk from folder 19 | os_diskbuilder(posix_file_fd disk) 20 | 21 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 22 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/README.md: -------------------------------------------------------------------------------- 1 | # POSIX file_fd Test 2 | 3 | Testing POSIX file_fd implementation. 4 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "vfs" : [ 3 | { 4 | "disk" : "memdisk", 5 | "root" : "/", 6 | "mount" : "/mnt/disk", 7 | "description" : "test root" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/file2: -------------------------------------------------------------------------------- 1 | more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/file3: -------------------------------------------------------------------------------- 1 | even more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder1/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder1/file2: -------------------------------------------------------------------------------- 1 | more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder1/foldera/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder1/folderb/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder1/folderc/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder2/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder3/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/disk/folder3/file2: -------------------------------------------------------------------------------- 1 | more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | source ${INCLUDEOS_HOME-$HOME/IncludeOS_install}/etc/run.sh `make servicefile` 3 | -------------------------------------------------------------------------------- /test/posix/integration/file_fd/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_file_fd.img", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 4 | "mem" : 128 5 | } 6 | -------------------------------------------------------------------------------- /test/posix/integration/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | option(NORMAL "" ON) 8 | if (NORMAL) 9 | set(SOURCES service.cpp) 10 | else() 11 | set(SOURCES main_no_params.cpp) 12 | endif() 13 | 14 | os_add_executable(posix_main "POSIX main test" ${SOURCES}) 15 | 16 | os_add_plugins(posix_main vfs) 17 | os_add_stdout(posix_main default_stdout) 18 | 19 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 20 | -------------------------------------------------------------------------------- /test/posix/integration/main/README.md: -------------------------------------------------------------------------------- 1 | # Test "main" 2 | 3 | Test / show how to make a service that only has a "main" and no "Service::start" 4 | 5 | Success: Outputs SUCCESS if all tests pass 6 | Fail: Panic on any failed tests 7 | -------------------------------------------------------------------------------- /test/posix/integration/main/main_no_params.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | printf("Hello main - %s\n", os::cmdline_args()); 6 | assert(os::cmdline_args() == std::string("test_main booted with vmrunner")); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /test/posix/integration/pthread/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(pthread_test "pthread test" ${SOURCES}) 12 | os_add_stdout(pthread_test default_stdout) 13 | 14 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/posix/integration/pthread/README.md: -------------------------------------------------------------------------------- 1 | # POSIX threads test (Very WIP) 2 | 3 | Proof-of-concept test of pthreads on top of Fibers 4 | -------------------------------------------------------------------------------- /test/posix/integration/pthread/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | vm = vmrunner.vms[0] 9 | 10 | vm.boot(20,image_name='posix_pthread.elf.bin') 11 | -------------------------------------------------------------------------------- /test/posix/integration/stat/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *.img 4 | _elf_symbols.bin 5 | -------------------------------------------------------------------------------- /test/posix/integration/stat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | test_stat_ftw.cpp 9 | ftw_tests.cpp 10 | stat_tests.cpp 11 | ) 12 | 13 | os_add_executable(posix_stat "POSIX file descriptor test" ${SOURCES}) 14 | 15 | os_add_drivers(posix_stat boot_logger) 16 | os_add_plugins(posix_stat vfs) 17 | os_add_stdout(posix_stat default_stdout) 18 | 19 | # Create memdisk from folder 20 | os_diskbuilder(posix_stat disk) 21 | 22 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 23 | -------------------------------------------------------------------------------- /test/posix/integration/stat/README.md: -------------------------------------------------------------------------------- 1 | # POSIX stat Test 2 | 3 | Testing POSIX stat implementation. 4 | -------------------------------------------------------------------------------- /test/posix/integration/stat/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "vfs" : [ 3 | { 4 | "disk" : "memdisk", 5 | "root" : "/", 6 | "mount" : "/mnt/disk/", 7 | "description" : "test root" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/file2: -------------------------------------------------------------------------------- 1 | more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/file3: -------------------------------------------------------------------------------- 1 | even more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder1/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder1/file2: -------------------------------------------------------------------------------- 1 | more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder1/foldera/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder1/folderb/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder1/folderc/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder2/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder3/file1: -------------------------------------------------------------------------------- 1 | content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/disk/folder3/file2: -------------------------------------------------------------------------------- 1 | more content 2 | -------------------------------------------------------------------------------- /test/posix/integration/stat/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | source ${INCLUDEOS_HOME-$HOME/IncludeOS_install}/etc/run.sh `make servicefile` 3 | -------------------------------------------------------------------------------- /test/posix/integration/stat/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem" : 128 3 | } 4 | -------------------------------------------------------------------------------- /test/posix/integration/syslog_default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(posix_syslog_default "POSIX syslog test" ${SOURCES}) 14 | 15 | #os_add_drivers(service boot_logger) 16 | os_add_plugins(posix_syslog_default syslog) 17 | os_add_stdout(posix_syslog_default default_stdout) 18 | 19 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 20 | -------------------------------------------------------------------------------- /test/posix/integration/syslog_default/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "mem" : 128 3 | } 4 | -------------------------------------------------------------------------------- /test/posix/integration/syslog_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(posix_syslog_plugin "POSIX syslog plugin test" ${SOURCES}) 12 | 13 | os_add_drivers(posix_syslog_plugin virtionet) 14 | os_add_plugins(posix_syslog_plugin syslog syslogd) 15 | os_add_stdout(posix_syslog_plugin default_stdout) 16 | 17 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/posix/integration/syslog_plugin/README.md: -------------------------------------------------------------------------------- 1 | # Syslog Integration Test UDP 2 | 3 | Testing POSIX syslog and IncludeOS syslogd implementation. 4 | 5 | This tests the plugin behavior a.k.a. sending syslog data over UDP port 6514. 6 | 7 | The message format corresponds to the format specified in RFC5424. 8 | 9 | To achieve this behavior you have to add `set(PLUGINS syslogd)` to your CMakeLists.txt file. 10 | 11 | The default behavior for IncludeOS's syslog implementation is however to send the data to printf, which is 12 | what you get if you don't add `set(PLUGINS syslogd)` to your CMakeLists.txt file (see the syslog_default integration test). 13 | -------------------------------------------------------------------------------- /test/posix/integration/syslog_plugin/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "syslog": { 3 | "type": "udp", 4 | "path": "/dev/log", 5 | "iface": 0, 6 | "address": "10.0.0.2", 7 | "port": 6514 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/posix/integration/syslog_plugin/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 128 4 | } 5 | -------------------------------------------------------------------------------- /test/posix/integration/tcp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(posix_tcp "POSIX TCP test" ${SOURCES}) 14 | 15 | os_add_drivers(posix_tcp virtionet) 16 | os_add_stdout(posix_tcp default_stdout) 17 | 18 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 19 | -------------------------------------------------------------------------------- /test/posix/integration/tcp/README.md: -------------------------------------------------------------------------------- 1 | # POSIX TCP Test 2 | 3 | Testing POSIX TCP implementation. VERY bare bones. 4 | -------------------------------------------------------------------------------- /test/posix/integration/tcp/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:6a"}], 3 | "mem" : 128, 4 | "time_sensitive" : "True" 5 | } 6 | -------------------------------------------------------------------------------- /test/posix/integration/udp/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *.img 4 | _elf_symbols.bin 5 | -------------------------------------------------------------------------------- /test/posix/integration/udp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(posix_udp "POSIX UDP test" ${SOURCES}) 14 | 15 | os_add_drivers(posix_udp virtionet) 16 | os_add_stdout(posix_udp default_stdout) 17 | 18 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 19 | -------------------------------------------------------------------------------- /test/posix/integration/udp/README.md: -------------------------------------------------------------------------------- 1 | # POSIX UDP Test 2 | 3 | Testing POSIX UDP implementation. 4 | -------------------------------------------------------------------------------- /test/posix/integration/udp/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 128, 4 | "time_sensitive" : "True" 5 | } 6 | -------------------------------------------------------------------------------- /test/posix/integration/utsname/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project (service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | #os_add_config(service "${CMAKE_CURRENT_SOURCE_DIR}/config.json") 12 | 13 | os_add_executable(posix_utsname "POSIX utsname test" ${SOURCES}) 14 | 15 | os_add_stdout(posix_utsname default_stdout) 16 | 17 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 18 | -------------------------------------------------------------------------------- /test/posix/integration/utsname/README.md: -------------------------------------------------------------------------------- 1 | # POSIX Utsname Test 2 | 3 | Testing POSIX Utsname implementation. 4 | -------------------------------------------------------------------------------- /test/posix/integration/utsname/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | vm = vmrunner.vms[0] 9 | 10 | # Boot the VM, taking a timeout as parameter 11 | if len(sys.argv) > 1: 12 | vm.boot(image_name=str(sys.argv[1])) 13 | else: 14 | vm.boot(10,image_name='posix_utsname.elf.bin') 15 | -------------------------------------------------------------------------------- /test/posix/integration/utsname/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 3 | "mem" : 128 4 | } 5 | -------------------------------------------------------------------------------- /test/stl/integration/coroutines/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(stl_coroutines "C++ coroutines test" ${SOURCES}) 12 | os_add_stdout(stl_coroutines default_stdout) 13 | 14 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/stl/integration/coroutines/README.md: -------------------------------------------------------------------------------- 1 | # Test Coroutines 2 | 3 | Test the C++ Couroutines compatibility with IncludeOS and SMP 4 | -------------------------------------------------------------------------------- /test/stl/integration/coroutines/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | 6 | from vmrunner import vmrunner 7 | vm=vmrunner.vms[0] 8 | 9 | vm.boot(40,image_name='stl_coroutines.elf.bin') 10 | -------------------------------------------------------------------------------- /test/stl/integration/coroutines/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "smp" : 5 3 | } 4 | -------------------------------------------------------------------------------- /test/stl/integration/crt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(stl_crt "C/C++ runtime test" ${SOURCES}) 12 | os_add_stdout(stl_crt default_stdout) 13 | 14 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/stl/integration/crt/README.md: -------------------------------------------------------------------------------- 1 | # Test C runtime 2 | Essentially this tests global constructors, which needs crti.o, crtn.o etc. to be linked in properly to work. 3 | 4 | Internal test, self-explanatory output. 5 | 6 | Success: Outputs SUCCESS if all tests pass 7 | Fail: Panic on any failed tests 8 | -------------------------------------------------------------------------------- /test/stl/integration/crt/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from builtins import str 4 | import sys 5 | import os 6 | 7 | from vmrunner import vmrunner 8 | vm=vmrunner.vms[0] 9 | 10 | 11 | if len(sys.argv) > 1: 12 | vm.boot(image_name=str(sys.argv[1])) 13 | else: 14 | #the corutines is set in the CMakelists. 15 | vm.boot(40,image_name='stl_crt.elf.bin') 16 | -------------------------------------------------------------------------------- /test/stl/integration/exceptions/.gitignore: -------------------------------------------------------------------------------- 1 | /test_exceptions 2 | -------------------------------------------------------------------------------- /test/stl/integration/exceptions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(stl_exceptions "C++ exceptions test" ${SOURCES}) 12 | os_add_stdout(stl_exceptions default_stdout) 13 | os_add_drivers(stl_exceptions boot_logger) 14 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/stl/integration/exceptions/README.md: -------------------------------------------------------------------------------- 1 | # Test exceptions 2 | 3 | Exceptions are usually taken for granted, but they require proper unwinding, which is not itself a part of the standard C++ library. 4 | 5 | These tests are internal only, so just running `test.sh` should be enough, and the output will be self explanatory. 6 | 7 | Sucess: Outputs SUCCESS if all tests pass 8 | Fail: Panic if any test fails 9 | -------------------------------------------------------------------------------- /test/stl/integration/exceptions/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "smp" : 16 3 | } 4 | -------------------------------------------------------------------------------- /test/stl/integration/stl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(stl_stl "C++ STL test" ${SOURCES}) 12 | os_add_stdout(stl_stl default_stdout) 13 | 14 | os_add_plugins(stl_stl vfs) 15 | configure_file (test.py ${CMAKE_CURRENT_BINARY_DIR}) 16 | -------------------------------------------------------------------------------- /test/stl/integration/stl/README.md: -------------------------------------------------------------------------------- 1 | # Test basics of C++ Standard Template Library 2 | This just tests a fraction of STL functionality, but it's here to just verify that basic STL support is in place and working. Useful i.e. when working on porting STL or switching implementation (e.g. to EASTL) 3 | 4 | Sucess: Outputs SUCCESS if all tests pass 5 | Fail: Panic if any test fails 6 | 7 | NOTE: This test uses the `lest` unit test framework as well for some tests. The result of those tests will also be reported. 8 | -------------------------------------------------------------------------------- /test/stl/integration/stl/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from builtins import str 3 | import sys 4 | import os 5 | 6 | from vmrunner import vmrunner 7 | vm=vmrunner.vms[0] 8 | 9 | if len(sys.argv) > 1: 10 | vm.boot(image_name=str(sys.argv[1])) 11 | else: 12 | #the corutines is set in the CMakelists. 13 | vm.boot(40,image_name='stl_stl.elf.bin') 14 | -------------------------------------------------------------------------------- /test/stl/unit/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/stl/unit/.keep -------------------------------------------------------------------------------- /test/stress/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 3 | 4 | project(service) 5 | include(os) 6 | 7 | set(SOURCES 8 | service.cpp 9 | ) 10 | 11 | os_add_executable(stress "Stress test" ${SOURCES}) 12 | os_add_stdout(stress default_stdout) 13 | os_add_drivers(stress virtionet) 14 | configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR}) 15 | -------------------------------------------------------------------------------- /test/stress/README.md: -------------------------------------------------------------------------------- 1 | # Do some simple stress tests 2 | 3 | Systems being tested: 4 | 5 | * ICMP, using ping-flooding (`ping -f ...`) 6 | * UDP, using manual UDP package flooding 7 | * TCP, using `httperf` 8 | 9 | Sucess: test.py exits with status 0 10 | Fail: test.py exits with another status 11 | -------------------------------------------------------------------------------- /test/stress/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "stress.elf.bin", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 4 | "mem" : 300 5 | } 6 | -------------------------------------------------------------------------------- /test/userspace/fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | gmon.out 3 | tcp_callgraph.png 4 | -------------------------------------------------------------------------------- /test/userspace/fuzz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.9) 2 | if (NOT DEFINED ENV{INCLUDEOS_PREFIX}) 3 | set(ENV{INCLUDEOS_PREFIX} /usr/local) 4 | endif() 5 | project (service C CXX) 6 | 7 | set(SERVICE_NAME "Linux userspace IP-stack fuzzer") 8 | set(BINARY "linux_fuzz") 9 | 10 | set(SOURCES 11 | service.cpp fuzzy_packet.cpp fuzzy_stack.cpp fuzzy_webserver.cpp http.cpp 12 | ) 13 | 14 | #option(LIBCPP "" ON) 15 | option(LIBFUZZER "" ON) 16 | option(SANITIZE "" ON) 17 | option(ENABLE_LTO "" OFF) # disable LTO because so much issues with LLD 18 | option(STATIC_BUILD "" OFF) # asan doesnt support static builds 19 | option(STRIP_BINARY "" OFF) # we need to see symbol names 20 | 21 | include($ENV{INCLUDEOS_PREFIX}/cmake/linux.service.cmake) 22 | -------------------------------------------------------------------------------- /test/userspace/fuzz/apply_payloads.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=clang-7.0 4 | export CXX=clang++-7.0 5 | #RUN=OFF $INCLUDEOS_PREFIX/bin/lxp-run 6 | pushd build 7 | cmake .. -DSANITIZE=ON -DLIBFUZZER=OFF -DPAYLOAD_MODE=ON 8 | make -j4 9 | popd 10 | BINARY=build/"`cat build/binary.txt`" 11 | $BINARY 12 | -------------------------------------------------------------------------------- /test/userspace/fuzz/continous_fuzz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=clang-6.0 4 | export CXX=clang++-6.0 5 | RUN=OFF $INCLUDEOS_PREFIX/bin/lxp-run 6 | BINARY=build/"`cat build/binary.txt`" 7 | # use -help=1 to see parameters to libfuzzer 8 | LD_LIBRARY_PATH=$HOME/llvm/install/lib $BINARY -max_len=120 -rss_limit_mb=512 9 | -------------------------------------------------------------------------------- /test/userspace/fuzz/macfuzzy.hpp: -------------------------------------------------------------------------------- 1 | // __ __ ___ _ _ 2 | // | \/ | __ _ __ | __| _ _ ___ ___ | || | 3 | // | |\/| | / _` | / _| | _| | +| | |_ / |_ / \_, | 4 | // |_|__|_| \__,_| \__|_ _|_|_ \_,_| _/__| _/__| _|__/ 5 | // _|"""""|_|"""""|_|"""""|_| """ |_|"""""|_|"""""|_|"""""|_| """"| 6 | // "`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-' 7 | #pragma once 8 | #include "fuzzy_helpers.hpp" 9 | #include "fuzzy_stack.hpp" 10 | #include "fuzzy_packet.hpp" 11 | //#include "fuzzy_stream.hpp" 12 | extern void fuzzy_http(const uint8_t*, size_t); 13 | extern void fuzzy_websocket(const uint8_t*, size_t); 14 | -------------------------------------------------------------------------------- /test/userspace/fuzz/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=clang-6.0 4 | export CXX=clang++-6.0 5 | RUN=OFF $INCLUDEOS_PREFIX/bin/lxp-run 6 | 7 | if [ $? == 0 ]; then 8 | echo ">>> Building fuzzer success!" 9 | else 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /test/userspace/liveupdate/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | gmon.out 3 | tcp_callgraph.png 4 | -------------------------------------------------------------------------------- /test/userspace/liveupdate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.9) 2 | if (NOT DEFINED ENV{INCLUDEOS_PREFIX}) 3 | set(ENV{INCLUDEOS_PREFIX} /usr/local) 4 | endif() 5 | project (service C CXX) 6 | 7 | option(STRIP_BINARY "" OFF) 8 | option(STATIC_BUILD "" OFF) # avoid compiler bug 9 | 10 | # Human-readable name of your service 11 | set(SERVICE_NAME "Linux userspace LiveUpdate test") 12 | 13 | # Name of your service binary 14 | set(BINARY "linux_liu") 15 | 16 | # Source files to be linked with OS library parts to form bootable image 17 | set(SOURCES 18 | service.cpp 19 | ) 20 | 21 | include($ENV{INCLUDEOS_PREFIX}/cmake/linux.service.cmake) 22 | -------------------------------------------------------------------------------- /test/userspace/liveupdate/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=gcc-7 4 | export CXX=g++-7 5 | $INCLUDEOS_PREFIX/bin/lxp-run 6 | 7 | if [ $? == 0 ]; then 8 | echo ">>> Linux Userspace TCP test success!" 9 | else 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /test/userspace/microlb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project (service C CXX) 4 | 5 | option(PORTABLE "" OFF) 6 | option(ENABLE_S2N "" ON) 7 | 8 | # Human-readable name of your service 9 | set(SERVICE_NAME "Linux userspace microLB test") 10 | # Name of your service binary 11 | set(BINARY "linux_microlb") 12 | 13 | set(INCLUDES 14 | ) 15 | 16 | set(SOURCES 17 | service.cpp 18 | ) 19 | 20 | include($ENV{INCLUDEOS_PREFIX}/includeos/linux.service.cmake) 21 | -------------------------------------------------------------------------------- /test/userspace/microlb/README.md: -------------------------------------------------------------------------------- 1 | ### 2 | 3 | ``` 4 | $ ./create_bridge.sh bridge44 255.255.255.0 10.0.1.1 c0:ff:0a:00:00:01 5 | $ sudo ip addr flush dev bridge43 6 | $ sudo ip addr flush dev bridge44 7 | $ nodejs server.js 8 | ``` 9 | -------------------------------------------------------------------------------- /test/userspace/microlb/client.py: -------------------------------------------------------------------------------- 1 | import requests 2 | expected_string = "#" * 1024 * 50 3 | 4 | def validateRequest(addr): 5 | #response = requests.get('https://10.0.0.42:443', verify=False, timeout=5) 6 | response = requests.get('http://10.0.0.42', timeout=5) 7 | return (response.content) == str(addr) + expected_string 8 | 9 | print "Starting test..." 10 | assert validateRequest(6001) 11 | assert validateRequest(6002) 12 | assert validateRequest(6003) 13 | assert validateRequest(6004) 14 | 15 | assert validateRequest(6001) 16 | assert validateRequest(6002) 17 | assert validateRequest(6003) 18 | assert validateRequest(6004) 19 | -------------------------------------------------------------------------------- /test/userspace/microlb/memdisk.fat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/userspace/microlb/memdisk.fat -------------------------------------------------------------------------------- /test/userspace/microlb/run_cgroup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CGR=myGroup 3 | # create cgroup 4 | cgcreate -g memory:/$CGR 5 | # 40 MB memory limit 6 | echo $(( 40 * 1024 * 1024 )) > /sys/fs/cgroup/memory/$CGR/memory.limit_in_bytes 7 | # disable OOM killer 8 | echo 1 > /sys/fs/cgroup/memory/$CGR/memory.oom_control 9 | -------------------------------------------------------------------------------- /test/userspace/microlb/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=gcc-7 4 | export CXX=g++-7 5 | AS_ROOT=ON $INCLUDEOS_PREFIX/bin/lxp-run 6 | -------------------------------------------------------------------------------- /test/userspace/router/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.9) 2 | if (NOT DEFINED ENV{INCLUDEOS_PREFIX}) 3 | set(ENV{INCLUDEOS_PREFIX} /usr/local) 4 | endif() 5 | project (service C CXX) 6 | 7 | # Human-readable name of your service 8 | set(SERVICE_NAME "Linux userspace router test") 9 | 10 | # Name of your service binary 11 | set(BINARY "linux_router") 12 | 13 | # Source files to be linked with OS library parts to form bootable image 14 | set(SOURCES 15 | ../service.cpp 16 | nacl.cpp 17 | ) 18 | 19 | include($ENV{INCLUDEOS_PREFIX}/includeos/linux.service.cmake) 20 | -------------------------------------------------------------------------------- /test/userspace/s2n/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | gmon.out 3 | tcp_callgraph.png 4 | -------------------------------------------------------------------------------- /test/userspace/s2n/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | if (NOT DEFINED ENV{INCLUDEOS_PREFIX}) 4 | set(ENV{INCLUDEOS_PREFIX} /usr/local) 5 | endif() 6 | project (service C CXX) 7 | 8 | # Human-readable name of your service 9 | set(SERVICE_NAME "Linux userspace S2N test") 10 | # Name of your service binary 11 | set(BINARY "linux_s2n") 12 | 13 | set(INCLUDES 14 | ) 15 | 16 | set(SOURCES 17 | service.cpp 18 | serial.cpp 19 | ) 20 | 21 | option(ENABLE_S2N "" ON) 22 | option(STATIC_BUILD "" OFF) 23 | option(STRIP_BINARY "" OFF) 24 | 25 | include($ENV{INCLUDEOS_PREFIX}/cmake/linux.service.cmake) 26 | -------------------------------------------------------------------------------- /test/userspace/s2n/memdisk.fat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/userspace/s2n/memdisk.fat -------------------------------------------------------------------------------- /test/userspace/s2n/serial.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace s2n 4 | { 5 | using Stream_ptr = std::unique_ptr; 6 | 7 | extern void serial_test(const std::string&, const std::string&); 8 | extern s2n_config* serial_create_config(); 9 | extern s2n_config* serial_get_config(); 10 | extern void serial_free_config(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/userspace/s2n/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=gcc-7 4 | export CXX=g++-7 5 | $INCLUDEOS_PREFIX/bin/lxp-run 6 | -------------------------------------------------------------------------------- /test/userspace/tcp/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | gmon.out 3 | tcp_callgraph.png 4 | -------------------------------------------------------------------------------- /test/userspace/tcp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.9) 2 | if (NOT DEFINED ENV{INCLUDEOS_PREFIX}) 3 | set(ENV{INCLUDEOS_PREFIX} /usr/local) 4 | endif() 5 | project (service C CXX) 6 | 7 | # Human-readable name of your service 8 | set(SERVICE_NAME "Linux userspace TCP test") 9 | 10 | # Name of your service binary 11 | set(BINARY "linux_tcp") 12 | 13 | # Source files to be linked with OS library parts to form bootable image 14 | set(SOURCES 15 | service.cpp 16 | ) 17 | 18 | include($ENV{INCLUDEOS_PREFIX}/cmake/linux.service.cmake) 19 | -------------------------------------------------------------------------------- /test/userspace/tcp/pgo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=gcc-7 4 | export CXX=g++-7 5 | $INCLUDEOS_PREFIX/bin/lxp-pgo | grep 'Server received' 6 | 7 | if [ $? == 0 ]; then 8 | echo ">>> Linux Userspace TCP test success!" 9 | else 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /test/userspace/tcp/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | export CC=gcc-7 4 | export CXX=g++-7 5 | $INCLUDEOS_PREFIX/bin/lxp-run | grep 'Server received' 6 | 7 | if [ $? == 0 ]; then 8 | echo ">>> Userspace TCP benchmark success!" 9 | else 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /test/userspace/websockets/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | gmon.out 3 | tcp_callgraph.png 4 | -------------------------------------------------------------------------------- /test/userspace/websockets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.9) 2 | if (NOT DEFINED ENV{INCLUDEOS_PREFIX}) 3 | set(ENV{INCLUDEOS_PREFIX} /usr/local) 4 | endif() 5 | project (service C CXX) 6 | 7 | # Human-readable name of your service 8 | set(SERVICE_NAME "Linux userspace WebSocket test") 9 | 10 | # Name of your service binary 11 | set(BINARY "websockets") 12 | 13 | # Source files to be linked with OS library parts to form bootable image 14 | set(SOURCES 15 | service.cpp 16 | ) 17 | 18 | set(EXTRA_LIBS 19 | $ENV{INCLUDEOS_PREFIX}/includeos/x86_64/lib/libcrypto.a 20 | $ENV{INCLUDEOS_PREFIX}/includeos/x86_64/lib/libssl.a 21 | -ldl 22 | ) 23 | 24 | include($ENV{INCLUDEOS_PREFIX}/includeos/linux.service.cmake) 25 | -------------------------------------------------------------------------------- /test/userspace/websockets/memdisk.fat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/includeos/IncludeOS/ec759bd38457e3a504c5619447d02ec437c22b4b/test/userspace/websockets/memdisk.fat -------------------------------------------------------------------------------- /test/util/integration/tar/README.md: -------------------------------------------------------------------------------- 1 | # Tar Test Service 2 | 3 | -------------------------------------------------------------------------------- /test/util/integration/tar/tar_example/first_file.txt: -------------------------------------------------------------------------------- 1 | This is the first file's content. 2 | It is a text file. 3 | -------------------------------------------------------------------------------- /test/util/integration/tar/tar_example/l1_f1/l2/README.md: -------------------------------------------------------------------------------- 1 | ### IncludeOS Demo Service 2 | 3 | ``` 4 | make 5 | ./run.sh 6 | ``` 7 | 8 | This demo-service should start an instance of IncludeOS that brings up a minimal web service on port 80 with static content. 9 | Note: Remember to run the bridge creation script for networking to work on qemu (by running `etc/create_bridge.sh`). 10 | -------------------------------------------------------------------------------- /test/util/integration/tar/tar_example/second_file.md: -------------------------------------------------------------------------------- 1 | ## Second file 2 | 3 | This is the second file's content. 4 | 5 | The format is md. -------------------------------------------------------------------------------- /test/util/integration/tar/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_tar.img", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 4 | "mem" : 128 5 | } 6 | -------------------------------------------------------------------------------- /test/util/integration/tar_gz/README.md: -------------------------------------------------------------------------------- 1 | # Tar.gz Test Service 2 | 3 | -------------------------------------------------------------------------------- /test/util/integration/tar_gz/tar_example/first_file.txt: -------------------------------------------------------------------------------- 1 | This is the first file's content. 2 | It is a text file. 3 | -------------------------------------------------------------------------------- /test/util/integration/tar_gz/tar_example/l1_f1/l2/README.md: -------------------------------------------------------------------------------- 1 | ### IncludeOS Demo Service 2 | 3 | ``` 4 | make 5 | ./run.sh 6 | ``` 7 | 8 | This demo-service should start an instance of IncludeOS that brings up a minimal web service on port 80 with static content. 9 | Note: Remember to run the bridge creation script for networking to work on qemu (by running `etc/create_bridge.sh`). 10 | -------------------------------------------------------------------------------- /test/util/integration/tar_gz/tar_example/second_file.md: -------------------------------------------------------------------------------- 1 | ## Second file 2 | 3 | This is the second file's content. 4 | 5 | The format is md. -------------------------------------------------------------------------------- /test/util/integration/tar_gz/vm.json: -------------------------------------------------------------------------------- 1 | { 2 | "image" : "test_tar_gz.img", 3 | "net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}], 4 | "mem" : 128 5 | } 6 | -------------------------------------------------------------------------------- /test/util/unit/config.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char _CONFIG_JSON_START_; 5 | char _CONFIG_JSON_END_; 6 | 7 | CASE("Test empty config") 8 | { 9 | auto& config = Config::get(); 10 | EXPECT(config.data() == &_CONFIG_JSON_START_); 11 | EXPECT(config.size() != 0); 12 | EXPECT(config.empty() == false); 13 | } 14 | -------------------------------------------------------------------------------- /test/util/unit/corrupt-tar-gz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | INFILE="$1" 3 | OUTFILE="$2" 4 | 5 | printf '\x0a\x0f\x0a\x0f\x0a\x0f\x0a\x0f' | dd conv=notrunc bs=1 of=$OUTFILE seek=$((`ls -nl $INFILE | awk '{print $5}'` - 8)) 6 | -------------------------------------------------------------------------------- /test_solo5_hvt.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | . ./etc/set_traps.sh 3 | 4 | export SYSTEM=`uname -s` 5 | 6 | if [[ ! $SYSTEM =~ .*[L|l]inux.* ]] 7 | then 8 | echo -e "\nRunning Solo5 is currently only supported on Linux. \n" 9 | trap - EXIT 10 | exit 1 11 | fi 12 | 13 | pushd examples/demo_service 14 | mkdir -p build 15 | boot --with-solo5-hvt . 16 | popd 17 | trap - EXIT 18 | -------------------------------------------------------------------------------- /test_solo5_spt.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | . ./etc/set_traps.sh 3 | 4 | export SYSTEM=`uname -s` 5 | 6 | if [[ ! $SYSTEM =~ .*[L|l]inux.* ]] 7 | then 8 | echo -e "\nRunning Solo5 is currently only supported on Linux. \n" 9 | trap - EXIT 10 | exit 1 11 | fi 12 | 13 | pushd examples/demo_service 14 | mkdir -p build 15 | boot --with-solo5-spt . 16 | popd 17 | trap - EXIT 18 | -------------------------------------------------------------------------------- /userspace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(../api) 2 | include_directories(../mod) 3 | include_directories(../mod/GSL) 4 | include_directories(../src/include) 5 | 6 | add_subdirectory(src) 7 | if (BUILD_PLUGINS) 8 | add_subdirectory(src/plugins) 9 | endif() 10 | add_subdirectory(includeos) 11 | -------------------------------------------------------------------------------- /userspace/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCES 3 | arch.cpp 4 | config.cpp 5 | main.cpp 6 | os.cpp 7 | profile.cpp 8 | drivers/memdisk.cpp 9 | ) 10 | 11 | if (NOT PORTABLE) 12 | set(SOURCES ${SOURCES} drivers/tap_driver.cpp linux_evloop.cpp) 13 | endif() 14 | 15 | add_library(linuxrt STATIC ${SOURCES}) 16 | install(TARGETS linuxrt DESTINATION $ENV{INCLUDEOS_PREFIX}/includeos/linux) 17 | install(FILES drivers/usernet.hpp DESTINATION $ENV{INCLUDEOS_PREFIX}/includeos/linux/drivers) 18 | -------------------------------------------------------------------------------- /userspace/src/epoll_evloop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace linux 5 | { 6 | void epoll_add_fd(int fd, epoll_event& event); 7 | void epoll_del_fd(int fd); 8 | void epoll_wait_events(); 9 | } 10 | -------------------------------------------------------------------------------- /userspace/src/profile.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void StackSampler::begin() {} 4 | uint64_t StackSampler::samples_total() noexcept { 5 | return 1; 6 | } 7 | uint64_t StackSampler::samples_asleep() noexcept { 8 | return 0; 9 | } 10 | void StackSampler::print(int) {} 11 | void StackSampler::set_mode(mode_t) {} 12 | 13 | std::string HeapDiag::to_string() 14 | { 15 | return ""; 16 | } 17 | -------------------------------------------------------------------------------- /vmbuild.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs ? ./pinned.nix, 2 | pkgs ? import nixpkgs { config = { }; overlays = [ ]; }, 3 | }: 4 | 5 | pkgs.stdenv.mkDerivation rec { 6 | pname = "vmbuild"; 7 | version = "dev"; 8 | 9 | sourceRoot = pname; 10 | 11 | srcs = [ 12 | ./vmbuild 13 | ./src 14 | ./api 15 | ]; 16 | 17 | nativeBuildInputs = [ 18 | pkgs.buildPackages.cmake 19 | pkgs.buildPackages.nasm 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /vmbuild/.gitignore: -------------------------------------------------------------------------------- 1 | elf_syms 2 | vmbuild 3 | --------------------------------------------------------------------------------