├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── Makefile ├── README.md ├── benchmarks ├── CMakeLists.txt ├── bench_collect │ ├── CMakeLists.txt │ ├── include │ │ └── bench_collect.h │ └── src │ │ └── main.c ├── calls │ ├── CMakeLists.txt │ ├── include │ │ └── template.h │ └── src │ │ └── main.c ├── exceptions │ ├── CMakeLists.txt │ ├── include │ │ └── template.h │ └── src │ │ └── main.c ├── message_send │ ├── CMakeLists.txt │ ├── include │ │ └── template.h │ └── src │ │ └── main.c ├── ping_dump │ ├── CMakeLists.txt │ └── src │ │ └── main.c └── revoke_bench │ ├── CMakeLists.txt │ ├── include │ └── template.h │ └── src │ └── main.c ├── boot ├── CMakeLists.txt ├── generate_fs.py ├── include │ ├── boot │ │ ├── boot.h │ │ └── boot_info.h │ ├── init.h │ └── plat.h ├── nanokernel │ └── src │ │ └── platform │ │ ├── mips │ │ ├── ccall_soft.S │ │ └── nano_kernel.S │ │ └── riscv │ │ └── nano_kernel.S └── src │ ├── boot │ ├── boot.c │ ├── boot_printf.c │ ├── boot_utils.c │ ├── init_elf.S │ ├── kernel_elf.S │ ├── nano_elf.S │ └── platform │ │ ├── mips │ │ ├── boot_init.S │ │ ├── boot_platform.c │ │ └── boot_tramp.S │ │ └── riscv │ │ ├── boot_init.S │ │ ├── boot_platform.c │ │ └── boot_tramp.S │ ├── init │ ├── init.c │ ├── init_utils.c │ ├── platform │ │ ├── mips │ │ │ └── init.S │ │ └── riscv │ │ │ └── init.S │ └── ufs_module.c │ └── platform │ ├── mips │ ├── caches.c │ └── plat.c │ └── riscv │ ├── caches.c │ └── plat.c ├── build.sh ├── cherios ├── CMakeLists.txt ├── core │ ├── CMakeLists.txt │ ├── memmgt │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── mmap.h │ │ │ ├── pmem.h │ │ │ └── vmem.h │ │ └── src │ │ │ ├── main.c │ │ │ ├── mmap.c │ │ │ ├── pmem.c │ │ │ ├── vmem.c │ │ │ └── vmem_init.c │ ├── namespace │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── lib.h │ │ └── src │ │ │ ├── main.c │ │ │ └── namespace.c │ └── proc_manager │ │ ├── CMakeLists.txt │ │ ├── include │ │ └── proc.h │ │ └── src │ │ ├── main.c │ │ └── platform │ │ ├── mips │ │ └── trampolines.c │ │ └── riscv │ │ └── trampolines.c ├── drivers │ ├── CMakeLists.txt │ ├── alteraSD │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── alteraSD.h │ │ └── src │ │ │ └── main.c │ ├── megacore │ │ └── include │ │ │ ├── a_api.h │ │ │ ├── mega_core.h │ │ │ └── msgdma.h │ ├── uart │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── uart.h │ │ └── src │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── printf.c │ │ │ ├── uart.c │ │ │ ├── uart_16550.c │ │ │ ├── uart_altera.c │ │ │ ├── uart_malta.c │ │ │ └── uart_qemu_debug.c │ └── virtio │ │ ├── CMakeLists.txt │ │ ├── include │ │ ├── malta_virtio_mmio.h │ │ ├── virtio.h │ │ ├── virtio_mmio.h │ │ ├── virtio_queue.h │ │ └── virtio_types.h │ │ ├── src │ │ └── virtio.c │ │ ├── virtio-blk │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── lib.h │ │ │ └── virtio_blk.h │ │ └── src │ │ │ ├── main.c │ │ │ └── virtio_blk.c │ │ └── virtio-net │ │ ├── CMakeLists.txt │ │ ├── include │ │ └── virtio_net.h │ │ └── src │ │ ├── main.c │ │ ├── virtio_net.c │ │ └── virtio_net_examples.c ├── kernel │ ├── CMakeLists.txt │ ├── include │ │ ├── activations.h │ │ ├── kernel.h │ │ ├── kernel_exceptions.h │ │ ├── klib.h │ │ ├── kutils.h │ │ ├── mutex.h │ │ ├── platform │ │ │ ├── mips │ │ │ │ └── cpu.h │ │ │ └── riscv │ │ │ │ └── cpu.h │ │ ├── regdump.h │ │ ├── sched.h │ │ └── syscall_ret.h │ └── src │ │ ├── act.c │ │ ├── init.c │ │ ├── interrupts.c │ │ ├── kernel_exceptions.c │ │ ├── kernel_printf.c │ │ ├── kernel_utils.c │ │ ├── msg.c │ │ ├── mutex.c │ │ ├── platform │ │ ├── mips │ │ │ ├── init.S │ │ │ ├── kernel_exceptions.c │ │ │ ├── kernel_utils.c │ │ │ ├── message_send.S │ │ │ └── regdump.c │ │ └── riscv │ │ │ ├── init.S │ │ │ ├── kernel_exceptions.c │ │ │ ├── kernel_utils.c │ │ │ ├── message_send.S │ │ │ └── regdump.c │ │ ├── sched.c │ │ ├── syscalls.c │ │ └── timer.c └── system │ ├── CMakeLists.txt │ ├── activation_events │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── block_cache │ ├── CMakeLists.txt │ └── src │ │ ├── aes.c │ │ └── main.c │ ├── dedup │ ├── CMakeLists.txt │ ├── dedup_init │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── main.c │ ├── include │ │ └── template.h │ └── src │ │ └── main.cpp │ ├── dummyfs │ ├── CMakeLists.txt │ ├── include │ │ └── template.h │ └── src │ │ └── main.c │ ├── dylink │ ├── CMakeLists.txt │ ├── include │ │ ├── dylink.h │ │ ├── dylink_client.h │ │ ├── dylink_server.h │ │ ├── manual_dylink_server.c │ │ └── platform │ │ │ ├── mips │ │ │ └── dylink_platform.h │ │ │ └── riscv │ │ │ └── dylink_platform.h │ └── src │ │ ├── client.c │ │ ├── platform │ │ ├── mips │ │ │ └── stubs.S │ │ └── riscv │ │ │ └── stubs.S │ │ └── server.c │ ├── fatfs │ ├── CMakeLists.txt │ ├── include │ │ ├── diskio.h │ │ ├── ff.h │ │ ├── ffconf.h │ │ └── integer.h │ └── src │ │ ├── 00history.txt │ │ ├── 00readme.txt │ │ ├── diskio.c │ │ ├── ff.c │ │ ├── ff_sync.c │ │ ├── main.c │ │ └── self_test.c │ ├── idle │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── libsocket │ ├── CMakeLists.txt │ ├── include │ │ ├── libsockets.h │ │ └── socket_common.h │ └── src │ │ ├── main.c │ │ └── sockets.c │ ├── lwip │ ├── CMakeLists.txt │ ├── include │ │ ├── arch │ │ │ └── cc.h │ │ ├── bug_fsdata.c │ │ ├── hostconfig.h │ │ ├── lwip_driver.h │ │ └── lwipopts.h │ ├── src │ │ ├── httpd.c │ │ ├── main.c │ │ ├── megacore │ │ │ ├── altera_fifo.c │ │ │ ├── altera_sgdma.c │ │ │ ├── fifo_asm.S │ │ │ └── megacore_driver.c │ │ ├── platform │ │ │ └── mips │ │ │ │ └── checksum.S │ │ ├── sys_arch.c │ │ └── virtio │ │ │ └── virtio_driver.c │ └── static_fs │ │ ├── 404.html │ │ ├── bug.jpg │ │ └── index.html │ ├── sched_balance │ ├── CMakeLists.txt │ └── src │ │ └── main.cpp │ └── type_manager │ ├── CMakeLists.txt │ ├── include │ └── type_manager.h │ └── src │ └── main.c ├── churn ├── CMakeLists.txt ├── include │ └── churn.h └── src │ └── main.c ├── client ├── CMakeLists.txt └── src │ └── main.c ├── cpptest ├── CMakeLists.txt └── src │ └── main.cpp ├── dedup_test ├── CMakeLists.txt └── src │ └── main.c ├── demos ├── CMakeLists.txt └── alice_bob │ ├── CMakeLists.txt │ ├── README.txt │ ├── alice │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── alice_reference │ └── src │ │ └── main.c │ ├── bob │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ ├── eve │ ├── CMakeLists.txt │ └── src │ │ └── main.c │ └── include │ └── alice_bob.h ├── docs ├── boot.md ├── docs_index.md ├── dylink.md ├── malloc.md ├── memman.md ├── microkernel.md ├── nanokernel.md └── proc.md ├── dylink_test ├── CMakeLists.txt ├── app │ ├── CMakeLists.txt │ └── src │ │ └── main.c ├── include │ └── shared_stuff.h ├── lib1 │ ├── CMakeLists.txt │ └── src │ │ └── main.c └── lib2 │ ├── CMakeLists.txt │ └── src │ └── main.c ├── elf ├── include │ ├── cprogram.h │ ├── elf.h │ └── platform │ │ ├── mips │ │ ├── elf_platform.h │ │ └── reg_abi.h │ │ └── riscv │ │ ├── elf_platform.h │ │ └── reg_abi.h └── src │ ├── cprogram.c │ └── elf_loader.c ├── exception_test ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── foundation_test ├── CMakeLists.txt └── src │ └── main.c ├── fs_test ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── generate_captable_usage.py ├── generate_found_id.py ├── hello ├── CMakeLists.txt └── src │ └── main.c ├── include ├── _ctype.h ├── aes.h ├── ansi_escapes.h ├── asm_common.S ├── assert.h ├── capmalloc.h ├── ccall.h ├── cdefs.h ├── cheri_pic.h ├── cheric.h ├── cheriplt.h ├── cheristd.h ├── colors.h ├── condition.h ├── cp0.h ├── ctype.h ├── debug.h ├── errno.h ├── exception_cause.h ├── exceptions.h ├── fcntl.h ├── idnamespace.h ├── inttypes.h ├── langinfo.h ├── lightweight_ccall.h ├── limits.h ├── lists.h ├── locale.h ├── lorem.h ├── macroutils.h ├── marshall_args.h ├── math.h ├── math_utils.h ├── misc.h ├── msg.h ├── namespace.h ├── nano │ ├── foundations.h │ ├── nano_if_list.h │ ├── nanokernel.h │ └── nanotypes.h ├── net.h ├── nl_types.h ├── nonce.h ├── object.h ├── osreldate.h ├── platform │ ├── mips │ │ ├── asm.S │ │ ├── assembly_utils.h │ │ ├── atomic.h │ │ ├── cheriplt_platform.h │ │ ├── condition_platform.h │ │ ├── exceptions_platform.h │ │ ├── mips.h │ │ ├── nano │ │ │ ├── nano_reg_list.h │ │ │ ├── nanoif_platform.h │ │ │ ├── nanotypes_platform.h │ │ │ └── usernano.h │ │ ├── platform.h │ │ ├── spinlock.h │ │ └── statcounters.h │ └── riscv │ │ ├── asm.S │ │ ├── asm.h │ │ ├── assembly_utils.h │ │ ├── atomic.h │ │ ├── cheriplt_platform.h │ │ ├── condition_platform.h │ │ ├── exceptions_platform.h │ │ ├── nano │ │ ├── nano_reg_list.h │ │ ├── nanoif_platform.h │ │ ├── nanotypes_platform.h │ │ └── usernano.h │ │ ├── platform.h │ │ ├── risv.h │ │ ├── spinlock.h │ │ └── statcounters.h ├── pthread.h ├── queue.h ├── ringbuffers.h ├── runetype.h ├── sched.h ├── setjmp.h ├── sockets.h ├── stdio.h ├── stdlib.h ├── string.h ├── string_enums.h ├── sys │ ├── _types.h │ ├── act_events.h │ ├── deduplicate.h │ ├── endian.h │ ├── mman.h │ ├── time.h │ ├── tman.h │ └── types.h ├── syscalls.h ├── temporal.h ├── thread.h ├── unistd.h ├── utils.h ├── virtioblk.h ├── wchar.h ├── wctype.h ├── xlocale.h └── xlocale │ ├── _ctype.h │ ├── _inttypes.h │ ├── _langinfo.h │ ├── _locale.h │ ├── _monetary.h │ ├── _stdio.h │ ├── _stdlib.h │ ├── _string.h │ ├── _strings.h │ ├── _time.h │ ├── _uchar.h │ └── _wchar.h ├── init_asm └── platform │ ├── mips │ ├── init.S │ └── secure_init.S │ └── riscv │ ├── init.S │ └── secure_init.S ├── ldscripts └── platform │ ├── mips │ ├── boot.ld │ ├── common.ld │ ├── init.ld │ ├── kernel.ld │ ├── mips.ld │ └── nano.ld │ └── riscv │ ├── boot.ld │ ├── common.ld │ ├── init.ld │ ├── kernel.ld │ ├── nano.ld │ └── riscv.ld ├── libcrt ├── crtbeginC.c ├── crtendC.c ├── include │ └── crt.h ├── libc │ ├── atoi.c │ ├── freebsd_ports │ │ ├── memchr.c │ │ ├── memset.c │ │ ├── qsort.c │ │ ├── strbprk.c │ │ ├── strcat.c │ │ ├── strcmp.c │ │ ├── strcpy.c │ │ ├── strcspn.c │ │ ├── strlen.c │ │ ├── strncat.c │ │ ├── strncpy.c │ │ ├── strrchr.c │ │ ├── strstr.c │ │ ├── strtol.c │ │ └── subr_prf.c │ ├── mem_cmp.c │ ├── strchr.c │ └── strdup.c └── platform │ ├── mips │ ├── cp0.c │ └── memcpy_l.S │ └── riscv │ └── memcpy_l.S ├── libuser ├── CMakeLists.txt └── src │ ├── act_events.c │ ├── assert.c │ ├── capmalloc │ ├── capmalloc_bump.c │ └── capmalloc_slabs.cpp │ ├── ctype.c │ ├── dedup.c │ ├── dylink.c │ ├── errno.c │ ├── exceptions.c │ ├── libuser.c │ ├── lightdummies.c │ ├── mmap.c │ ├── msg.c │ ├── namespace.c │ ├── net.c │ ├── object.c │ ├── panic.c │ ├── platform │ ├── mips │ │ ├── exceptions.S │ │ ├── init.S │ │ ├── invoke_function_pointer.S │ │ ├── msg.S │ │ ├── temporal.c │ │ ├── thread.c │ │ └── unaligned.c │ └── riscv │ │ ├── exceptions.S │ │ ├── init.S │ │ ├── invoke_function_pointer.S │ │ ├── msg.S │ │ ├── temporal.c │ │ └── thread.c │ ├── plt_allocations.c │ ├── printf.c │ ├── pthread.c │ ├── pthread_mutex.c │ ├── sockets.c │ ├── ssleep.c │ ├── stdio.c │ ├── stdlib.c │ ├── temporal.c │ ├── thread.c │ ├── type_man.c │ ├── unistd.c │ └── virtioblk.c ├── lwip ├── .gitattributes ├── .gitignore ├── CHANGELOG ├── COPYING ├── FILES ├── README ├── UPGRADING ├── astylerc ├── doc │ ├── FILES │ ├── NO_SYS_SampleCode.c │ ├── ZeroCopyRx.c │ ├── contrib.txt │ ├── doxygen │ │ ├── generate.bat │ │ ├── generate.sh │ │ ├── lwip.Doxyfile │ │ ├── lwip.Doxyfile.cmake.in │ │ ├── main_page.h │ │ └── output │ │ │ └── index.html │ ├── mdns.txt │ ├── mqtt_client.txt │ ├── ppp.txt │ └── savannah.txt ├── src │ ├── FILES │ ├── Filelists.cmake │ ├── Filelists.mk │ ├── api │ │ ├── api_lib.c │ │ ├── api_msg.c │ │ ├── err.c │ │ ├── if_api.c │ │ ├── netbuf.c │ │ ├── netdb.c │ │ ├── netifapi.c │ │ ├── sockets.c │ │ └── tcpip.c │ ├── apps │ │ ├── altcp_tls │ │ │ ├── altcp_tls_mbedtls.c │ │ │ ├── altcp_tls_mbedtls_mem.c │ │ │ ├── altcp_tls_mbedtls_mem.h │ │ │ └── altcp_tls_mbedtls_structs.h │ │ ├── http │ │ │ ├── altcp_proxyconnect.c │ │ │ ├── fs.c │ │ │ ├── fs │ │ │ │ ├── 404.html │ │ │ │ ├── img │ │ │ │ │ └── sics.gif │ │ │ │ └── index.html │ │ │ ├── fsdata.c │ │ │ ├── fsdata.h │ │ │ ├── http_client.c │ │ │ ├── httpd.c │ │ │ ├── httpd_structs.h │ │ │ └── makefsdata │ │ │ │ ├── makefsdata │ │ │ │ ├── makefsdata.c │ │ │ │ ├── readme.txt │ │ │ │ └── tinydir.h │ │ ├── lwiperf │ │ │ └── lwiperf.c │ │ ├── mdns │ │ │ └── mdns.c │ │ ├── mqtt │ │ │ └── mqtt.c │ │ ├── netbiosns │ │ │ └── netbiosns.c │ │ ├── smtp │ │ │ └── smtp.c │ │ ├── snmp │ │ │ ├── snmp_asn1.c │ │ │ ├── snmp_asn1.h │ │ │ ├── snmp_core.c │ │ │ ├── snmp_core_priv.h │ │ │ ├── snmp_mib2.c │ │ │ ├── snmp_mib2_icmp.c │ │ │ ├── snmp_mib2_interfaces.c │ │ │ ├── snmp_mib2_ip.c │ │ │ ├── snmp_mib2_snmp.c │ │ │ ├── snmp_mib2_system.c │ │ │ ├── snmp_mib2_tcp.c │ │ │ ├── snmp_mib2_udp.c │ │ │ ├── snmp_msg.c │ │ │ ├── snmp_msg.h │ │ │ ├── snmp_netconn.c │ │ │ ├── snmp_pbuf_stream.c │ │ │ ├── snmp_pbuf_stream.h │ │ │ ├── snmp_raw.c │ │ │ ├── snmp_scalar.c │ │ │ ├── snmp_snmpv2_framework.c │ │ │ ├── snmp_snmpv2_usm.c │ │ │ ├── snmp_table.c │ │ │ ├── snmp_threadsync.c │ │ │ ├── snmp_traps.c │ │ │ ├── snmpv3.c │ │ │ ├── snmpv3_mbedtls.c │ │ │ └── snmpv3_priv.h │ │ ├── sntp │ │ │ └── sntp.c │ │ └── tftp │ │ │ └── tftp_server.c │ ├── core │ │ ├── altcp.c │ │ ├── altcp_alloc.c │ │ ├── altcp_tcp.c │ │ ├── def.c │ │ ├── dns.c │ │ ├── inet_chksum.c │ │ ├── init.c │ │ ├── ip.c │ │ ├── ipv4 │ │ │ ├── autoip.c │ │ │ ├── dhcp.c │ │ │ ├── etharp.c │ │ │ ├── icmp.c │ │ │ ├── igmp.c │ │ │ ├── ip4.c │ │ │ ├── ip4_addr.c │ │ │ └── ip4_frag.c │ │ ├── ipv6 │ │ │ ├── dhcp6.c │ │ │ ├── ethip6.c │ │ │ ├── icmp6.c │ │ │ ├── inet6.c │ │ │ ├── ip6.c │ │ │ ├── ip6_addr.c │ │ │ ├── ip6_frag.c │ │ │ ├── mld6.c │ │ │ └── nd6.c │ │ ├── mem.c │ │ ├── memp.c │ │ ├── netif.c │ │ ├── pbuf.c │ │ ├── raw.c │ │ ├── stats.c │ │ ├── sys.c │ │ ├── tcp.c │ │ ├── tcp_in.c │ │ ├── tcp_out.c │ │ ├── timeouts.c │ │ └── udp.c │ ├── include │ │ ├── compat │ │ │ ├── posix │ │ │ │ ├── arpa │ │ │ │ │ └── inet.h │ │ │ │ ├── net │ │ │ │ │ └── if.h │ │ │ │ ├── netdb.h │ │ │ │ └── sys │ │ │ │ │ └── socket.h │ │ │ └── stdc │ │ │ │ └── errno.h │ │ ├── lwip │ │ │ ├── altcp.h │ │ │ ├── altcp_tcp.h │ │ │ ├── altcp_tls.h │ │ │ ├── api.h │ │ │ ├── apps │ │ │ │ ├── FILES │ │ │ │ ├── altcp_proxyconnect.h │ │ │ │ ├── altcp_tls_mbedtls_opts.h │ │ │ │ ├── fs.h │ │ │ │ ├── http_client.h │ │ │ │ ├── httpd.h │ │ │ │ ├── httpd_opts.h │ │ │ │ ├── lwiperf.h │ │ │ │ ├── mdns.h │ │ │ │ ├── mdns_opts.h │ │ │ │ ├── mdns_priv.h │ │ │ │ ├── mqtt.h │ │ │ │ ├── mqtt_opts.h │ │ │ │ ├── mqtt_priv.h │ │ │ │ ├── netbiosns.h │ │ │ │ ├── netbiosns_opts.h │ │ │ │ ├── smtp.h │ │ │ │ ├── smtp_opts.h │ │ │ │ ├── snmp.h │ │ │ │ ├── snmp_core.h │ │ │ │ ├── snmp_mib2.h │ │ │ │ ├── snmp_opts.h │ │ │ │ ├── snmp_scalar.h │ │ │ │ ├── snmp_snmpv2_framework.h │ │ │ │ ├── snmp_snmpv2_usm.h │ │ │ │ ├── snmp_table.h │ │ │ │ ├── snmp_threadsync.h │ │ │ │ ├── snmpv3.h │ │ │ │ ├── sntp.h │ │ │ │ ├── sntp_opts.h │ │ │ │ ├── tftp_opts.h │ │ │ │ └── tftp_server.h │ │ │ ├── arch.h │ │ │ ├── autoip.h │ │ │ ├── debug.h │ │ │ ├── def.h │ │ │ ├── dhcp.h │ │ │ ├── dhcp6.h │ │ │ ├── dns.h │ │ │ ├── err.h │ │ │ ├── errno.h │ │ │ ├── etharp.h │ │ │ ├── ethip6.h │ │ │ ├── icmp.h │ │ │ ├── icmp6.h │ │ │ ├── if_api.h │ │ │ ├── igmp.h │ │ │ ├── inet.h │ │ │ ├── inet_chksum.h │ │ │ ├── init.h │ │ │ ├── init.h.cmake.in │ │ │ ├── ip.h │ │ │ ├── ip4.h │ │ │ ├── ip4_addr.h │ │ │ ├── ip4_frag.h │ │ │ ├── ip6.h │ │ │ ├── ip6_addr.h │ │ │ ├── ip6_frag.h │ │ │ ├── ip6_zone.h │ │ │ ├── ip_addr.h │ │ │ ├── mem.h │ │ │ ├── memp.h │ │ │ ├── mld6.h │ │ │ ├── nd6.h │ │ │ ├── netbuf.h │ │ │ ├── netdb.h │ │ │ ├── netif.h │ │ │ ├── netifapi.h │ │ │ ├── opt.h │ │ │ ├── pbuf.h │ │ │ ├── priv │ │ │ │ ├── altcp_priv.h │ │ │ │ ├── api_msg.h │ │ │ │ ├── mem_priv.h │ │ │ │ ├── memp_priv.h │ │ │ │ ├── memp_std.h │ │ │ │ ├── nd6_priv.h │ │ │ │ ├── raw_priv.h │ │ │ │ ├── sockets_priv.h │ │ │ │ ├── tcp_priv.h │ │ │ │ └── tcpip_priv.h │ │ │ ├── prot │ │ │ │ ├── autoip.h │ │ │ │ ├── dhcp.h │ │ │ │ ├── dhcp6.h │ │ │ │ ├── dns.h │ │ │ │ ├── etharp.h │ │ │ │ ├── ethernet.h │ │ │ │ ├── iana.h │ │ │ │ ├── icmp.h │ │ │ │ ├── icmp6.h │ │ │ │ ├── ieee.h │ │ │ │ ├── igmp.h │ │ │ │ ├── ip.h │ │ │ │ ├── ip4.h │ │ │ │ ├── ip6.h │ │ │ │ ├── mld6.h │ │ │ │ ├── nd6.h │ │ │ │ ├── tcp.h │ │ │ │ └── udp.h │ │ │ ├── raw.h │ │ │ ├── sio.h │ │ │ ├── snmp.h │ │ │ ├── sockets.h │ │ │ ├── stats.h │ │ │ ├── sys.h │ │ │ ├── tcp.h │ │ │ ├── tcpbase.h │ │ │ ├── tcpip.h │ │ │ ├── timeouts.h │ │ │ └── udp.h │ │ └── netif │ │ │ ├── bridgeif.h │ │ │ ├── bridgeif_opts.h │ │ │ ├── etharp.h │ │ │ ├── ethernet.h │ │ │ ├── ieee802154.h │ │ │ ├── lowpan6.h │ │ │ ├── lowpan6_ble.h │ │ │ ├── lowpan6_common.h │ │ │ ├── lowpan6_opts.h │ │ │ ├── ppp │ │ │ ├── ccp.h │ │ │ ├── chap-md5.h │ │ │ ├── chap-new.h │ │ │ ├── chap_ms.h │ │ │ ├── eap.h │ │ │ ├── ecp.h │ │ │ ├── eui64.h │ │ │ ├── fsm.h │ │ │ ├── ipcp.h │ │ │ ├── ipv6cp.h │ │ │ ├── lcp.h │ │ │ ├── magic.h │ │ │ ├── mppe.h │ │ │ ├── polarssl │ │ │ │ ├── arc4.h │ │ │ │ ├── des.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ └── sha1.h │ │ │ ├── ppp.h │ │ │ ├── ppp_impl.h │ │ │ ├── ppp_opts.h │ │ │ ├── pppapi.h │ │ │ ├── pppcrypt.h │ │ │ ├── pppdebug.h │ │ │ ├── pppoe.h │ │ │ ├── pppol2tp.h │ │ │ ├── pppos.h │ │ │ ├── upap.h │ │ │ └── vj.h │ │ │ ├── slipif.h │ │ │ └── zepif.h │ └── netif │ │ ├── FILES │ │ ├── bridgeif.c │ │ ├── bridgeif_fdb.c │ │ ├── ethernet.c │ │ ├── lowpan6.c │ │ ├── lowpan6_ble.c │ │ ├── lowpan6_common.c │ │ ├── ppp │ │ ├── PPPD_FOLLOWUP │ │ ├── auth.c │ │ ├── ccp.c │ │ ├── chap-md5.c │ │ ├── chap-new.c │ │ ├── chap_ms.c │ │ ├── demand.c │ │ ├── eap.c │ │ ├── ecp.c │ │ ├── eui64.c │ │ ├── fsm.c │ │ ├── ipcp.c │ │ ├── ipv6cp.c │ │ ├── lcp.c │ │ ├── magic.c │ │ ├── mppe.c │ │ ├── multilink.c │ │ ├── polarssl │ │ │ ├── README │ │ │ ├── arc4.c │ │ │ ├── des.c │ │ │ ├── md4.c │ │ │ ├── md5.c │ │ │ └── sha1.c │ │ ├── ppp.c │ │ ├── pppapi.c │ │ ├── pppcrypt.c │ │ ├── pppoe.c │ │ ├── pppol2tp.c │ │ ├── pppos.c │ │ ├── upap.c │ │ ├── utils.c │ │ └── vj.c │ │ ├── slipif.c │ │ └── zepif.c └── test │ ├── fuzz │ ├── Makefile │ ├── README │ ├── config.h │ ├── fuzz.c │ ├── inputs │ │ ├── arp │ │ │ └── arp_req.bin │ │ ├── icmp │ │ │ └── icmp_ping.bin │ │ ├── ipv6 │ │ │ ├── neighbor_solicitation.bin │ │ │ └── router_adv.bin │ │ ├── tcp │ │ │ └── tcp_syn.bin │ │ └── udp │ │ │ └── udp_port_5000.bin │ ├── lwipopts.h │ └── output_to_pcap.sh │ ├── sockets │ ├── sockets_stresstest.c │ └── sockets_stresstest.h │ └── unit │ ├── Filelists.cmake │ ├── Filelists.mk │ ├── api │ ├── test_sockets.c │ └── test_sockets.h │ ├── arch │ ├── sys_arch.c │ └── sys_arch.h │ ├── core │ ├── test_def.c │ ├── test_def.h │ ├── test_mem.c │ ├── test_mem.h │ ├── test_netif.c │ ├── test_netif.h │ ├── test_pbuf.c │ ├── test_pbuf.h │ ├── test_timers.c │ └── test_timers.h │ ├── dhcp │ ├── test_dhcp.c │ └── test_dhcp.h │ ├── etharp │ ├── test_etharp.c │ └── test_etharp.h │ ├── ip4 │ ├── test_ip4.c │ └── test_ip4.h │ ├── lwip_check.h │ ├── lwip_unittests.c │ ├── lwipopts.h │ ├── mdns │ ├── test_mdns.c │ └── test_mdns.h │ ├── mqtt │ ├── test_mqtt.c │ └── test_mqtt.h │ ├── tcp │ ├── tcp_helper.c │ ├── tcp_helper.h │ ├── test_tcp.c │ ├── test_tcp.h │ ├── test_tcp_oos.c │ └── test_tcp_oos.h │ └── udp │ ├── test_udp.c │ └── test_udp.h ├── nc_shell ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── prga ├── CMakeLists.txt ├── include │ └── lib.h └── src │ ├── main.c │ └── sockets.c ├── pthread_test ├── CMakeLists.txt └── src │ └── main.c ├── requirements.txt ├── secure_template ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── server ├── CMakeLists.txt ├── include │ └── webserver.h └── src │ ├── main.c │ ├── parser.c │ └── webserver.c ├── sha256 ├── include │ ├── platform │ │ ├── mips │ │ │ └── sha256_platform.h │ │ └── riscv │ │ │ └── sha256_platform.h │ └── sha256.h └── src │ ├── platform │ ├── mips │ │ └── sha256.S │ └── riscv │ │ └── sha256.S │ ├── sha256_c.S │ └── sha256_k.S ├── snake ├── CMakeLists.txt └── src │ └── main.c ├── socket_test ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── template ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── test1a ├── CMakeLists.txt ├── include │ └── lib.h └── src │ └── main.c ├── test1b ├── CMakeLists.txt ├── include │ └── lib.h └── src │ └── main.c ├── test2a ├── CMakeLists.txt ├── include │ └── lib.h └── src │ ├── loop.S │ └── main.c ├── test2b ├── CMakeLists.txt ├── include │ └── lib.h └── src │ ├── loop.S │ └── main.c ├── test3 ├── CMakeLists.txt ├── include │ └── lib.h └── src │ ├── fwd.S │ └── main.c ├── tmpalloc ├── include │ └── tmpalloc.h └── src │ └── alloc.c ├── top ├── CMakeLists.txt └── src │ └── main.c ├── ufs ├── include │ ├── dinode.h │ ├── dir.h │ ├── fs.h │ └── ufs_read.h └── src │ └── ufs_read.c ├── unaligned_test ├── CMakeLists.txt └── src │ └── main.c ├── unsafe_test ├── CMakeLists.txt ├── include │ └── template.h └── src │ └── main.c ├── zlib ├── CMakeLists.txt ├── include │ ├── zconf.h │ └── zlib.h ├── src │ └── main.c └── zlib │ ├── CMakeLists.txt │ ├── ChangeLog │ ├── FAQ │ ├── INDEX │ ├── Makefile │ ├── Makefile.in │ ├── README │ ├── adler32.c │ ├── compress.c │ ├── configure │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── dummy.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── make_vms.com │ ├── treebuild.xml │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zconf.h.cmakein │ ├── zconf.h.in │ ├── zlib.3 │ ├── zlib.3.pdf │ ├── zlib.h │ ├── zlib.map │ ├── zlib.pc.cmakein │ ├── zlib.pc.in │ ├── zlib2ansi │ ├── zutil.c │ └── zutil.h └── zlib_test ├── CMakeLists.txt ├── include ├── zconf.h └── zlib.h └── src ├── main.c └── zlib.c /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | # Working tools 32 | *.wsh 33 | 34 | # Debug files 35 | *.dSYM/ 36 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lwip"] 2 | path = lwip 3 | url = https://git.savannah.nongnu.org/git/lwip.git 4 | [submodule "nginx"] 5 | path = nginx 6 | url = https://github.com/CTSRD-CHERI/nginx.git 7 | [submodule "libcxxrt"] 8 | path = libcxxrt 9 | url = https://github.com/CTSRD-CHERI/libcxxrt 10 | [submodule "libcxx"] 11 | path = libcxx 12 | url = https://github.com/CTSRD-CHERI/libcxx.git 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BUILDDIR= build 2 | 3 | default: all 4 | 5 | run: all 6 | ../output/sdk256/bin/qemu-system-cheri -M malta -m 2048 -nographic -kernel ${BUILDDIR}/boot/cherios.elf -drive format=raw,file=${BUILDDIR}/boot/fs.img 7 | 8 | all: ${BUILDDIR}/build.ninja 9 | cd ${BUILDDIR} && ninja 10 | 11 | ${BUILDDIR}: 12 | mkdir -p ${BUILDDIR} 13 | 14 | ${BUILDDIR}/build.ninja: ${BUILDDIR} 15 | cd ${BUILDDIR} && cmake -GNinja .. 16 | 17 | clean: 18 | rm -rfv ${BUILDDIR} 19 | 20 | -------------------------------------------------------------------------------- /benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(bench_collect/include) 2 | 3 | add_subdirectory(bench_collect) 4 | add_subdirectory(message_send) 5 | add_subdirectory(calls) 6 | add_subdirectory(exceptions) 7 | add_subdirectory(revoke_bench) 8 | add_subdirectory(ping_dump) -------------------------------------------------------------------------------- /benchmarks/bench_collect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /benchmarks/calls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /benchmarks/calls/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /benchmarks/exceptions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /benchmarks/exceptions/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /benchmarks/message_send/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /benchmarks/message_send/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /benchmarks/ping_dump/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /benchmarks/revoke_bench/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /benchmarks/revoke_bench/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /boot/generate_fs.py: -------------------------------------------------------------------------------- 1 | # Generate two files that define a bunch of symbols containing files 2 | import os 3 | import sys 4 | 5 | def main(): 6 | in_directory = sys.argv[1] 7 | asm_path = sys.argv[2] 8 | header_path = sys.argv[3] 9 | 10 | hdr = open(header_path, 'w') 11 | asm = open(asm_path, 'w') 12 | 13 | hdr.write("// AUTO GENERATED. DO NOT EDIT.\n") 14 | 15 | asm.write("// AUTO GENERATED. DO NOT EDIT.\n") 16 | asm.write(".data\n") 17 | 18 | 19 | for filename in os.listdir(in_directory): 20 | _,name = os.path.split(filename) 21 | no_ext = name.split(".")[0] 22 | 23 | hdr.write("extern const char __%s_start, __%s_end;\n" % (no_ext, no_ext)) 24 | 25 | asm.write(".p2align 6\n") 26 | asm.write(".global __%s_start\n" % no_ext) 27 | asm.write(".global __%s_end\n" % no_ext) 28 | asm.write("__%s_start:\n" % no_ext) 29 | asm.write(".incbin \"%s\"\n" % filename) 30 | asm.write("__%s_end:\n" % no_ext) 31 | asm.write(".size __%s_start, __%s_end - __%s_start\n" % (no_ext, no_ext, no_ext)) 32 | asm.write(".size __%s_end, 1\n" % no_ext) 33 | 34 | if __name__== "__main__": 35 | main() 36 | -------------------------------------------------------------------------------- /boot/include/plat.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 SRI International 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _PLAT_H_ 32 | #define _PLAT_H_ 33 | 34 | #include "cdefs.h" 35 | 36 | void hw_reboot(void) __dead2; 37 | 38 | void caches_invalidate(void * addr, size_t size); 39 | 40 | #endif /* _PLAT_H_ */ 41 | -------------------------------------------------------------------------------- /boot/src/boot/init_elf.S: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2016 SRI International 3 | # All rights reserved. 4 | # 5 | # This software was developed by SRI International and the University of 6 | # Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | # ("CTSRD"), as part of the DARPA CRASH research programme. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | # SUCH DAMAGE. 29 | # 30 | 31 | .global __init_elf_start 32 | .global __init_elf_end 33 | .p2align 10 34 | __init_elf_start: 35 | .incbin "init.elf" 36 | .p2align 10 37 | __init_elf_end: 38 | nop 39 | .size __init_elf_start, __init_elf_end - __init_elf_start 40 | .size __init_elf_end, 1 41 | -------------------------------------------------------------------------------- /boot/src/boot/kernel_elf.S: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2016 SRI International 3 | # All rights reserved. 4 | # 5 | # This software was developed by SRI International and the University of 6 | # Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | # ("CTSRD"), as part of the DARPA CRASH research programme. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | # SUCH DAMAGE. 29 | # 30 | 31 | .global __kernel_elf_start 32 | .global __kernel_elf_end 33 | .p2align 10 34 | __kernel_elf_start: 35 | .incbin "kernel.elf" 36 | .p2align 10 37 | __kernel_elf_end: 38 | nop 39 | .size __kernel_elf_start, __kernel_elf_end - __kernel_elf_start 40 | .size __kernel_elf_end, 1 41 | -------------------------------------------------------------------------------- /boot/src/boot/nano_elf.S: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2017 Lawrence Esswood 3 | # All rights reserved. 4 | # 5 | # This software was developed by SRI International and the University of 6 | # Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | # ("CTSRD"), as part of the DARPA CRASH research programme. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | # SUCH DAMAGE. 29 | # 30 | 31 | .global __nano_elf_start 32 | .global __nano_elf_end 33 | .p2align 10 34 | __nano_elf_start: 35 | .incbin "nano.elf" 36 | .p2align 10 37 | __nano_elf_end: 38 | nop 39 | .size __nano_elf_start, __nano_elf_end - __nano_elf_start 40 | .size __nano_elf_end, 1 41 | -------------------------------------------------------------------------------- /boot/src/boot/platform/mips/boot_tramp.S: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2017 SRI International 3 | # All rights reserved. 4 | # 5 | # This software was developed by SRI International and the University of 6 | # Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | # ("CTSRD"), as part of the DARPA CRASH research programme. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | # SUCH DAMAGE. 29 | # 30 | 31 | .set noreorder 32 | .set nobopt 33 | .set noat 34 | 35 | # Trampoline loaded at hard-coded BERI load address to jump to the real start. 36 | .section .boot, "xa" 37 | .global beri_boot_start 38 | .ent beri_boot_start 39 | beri_boot_start: 40 | j start 41 | -------------------------------------------------------------------------------- /boot/src/boot/platform/riscv/boot_tramp.S: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "asm.S" 32 | 33 | # TODO RISCV 34 | # This trampoline _must_ be placed at the correct address. 35 | # To keep things simple, we will just jump to a more cannonical start. 36 | .section .boot, "xa" 37 | START_FUNC boot_start 38 | call_func_early start 39 | END_FUNC boot_start 40 | -------------------------------------------------------------------------------- /boot/src/platform/riscv/caches.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | //TODO RISCV 32 | -------------------------------------------------------------------------------- /boot/src/platform/riscv/plat.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | //TODO RISCV 32 | 33 | void hw_reboot(void) { 34 | for(;;); 35 | } 36 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | BUILDDIR=build 4 | 5 | if [ ! -d "$BUILDDIR" ]; then 6 | mkdir -p $BUILDDIR 7 | ln -sf $BUILDDIR/boot/cherios.elf . 8 | cd $BUILDDIR 9 | cmake -GNinja .. 10 | cd .. 11 | fi 12 | cd $BUILDDIR 13 | ninja 14 | cd .. 15 | -------------------------------------------------------------------------------- /cherios/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(kernel) 2 | add_subdirectory(core) 3 | add_subdirectory(drivers) 4 | add_subdirectory(system) 5 | -------------------------------------------------------------------------------- /cherios/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(memmgt) 2 | add_subdirectory(namespace) 3 | add_subdirectory(proc_manager) -------------------------------------------------------------------------------- /cherios/core/memmgt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 2 | 3 | set(SRCS 4 | ${INIT_ASM} 5 | src/main.c 6 | src/mmap.c 7 | src/vmem.c 8 | src/pmem.c 9 | src/vmem_init.c 10 | ) 11 | 12 | add_cherios_memmgr(memmgt ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 13 | 14 | -------------------------------------------------------------------------------- /cherios/core/namespace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 2 | 3 | set(NAMESPACE_SRCS 4 | ${INIT_ASM} 5 | src/main.c 6 | src/namespace.c 7 | ) 8 | 9 | add_cherios_namespace(namespace ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${NAMESPACE_SRCS}) 10 | -------------------------------------------------------------------------------- /cherios/core/proc_manager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 2 | include_directories(${CMAKE_SOURCE_DIR}/elf/include) 3 | include_directories(${CMAKE_SOURCE_DIR}/tmpalloc/include) 4 | 5 | set(PROC_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ${CMAKE_SOURCE_DIR}/elf/src/elf_loader.c 9 | ${CMAKE_SOURCE_DIR}/elf/src/cprogram.c 10 | ${CMAKE_SOURCE_DIR}/tmpalloc/src/alloc.c 11 | src/platform/${PLATFORM}/trampolines.c 12 | ) 13 | 14 | add_cherios_executable_early(proc ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${PROC_SRCS}) 15 | -------------------------------------------------------------------------------- /cherios/drivers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(include) 2 | 3 | add_subdirectory(uart) 4 | 5 | if(NOT ${BAREBONES}) 6 | if("${HARDWARE}" STREQUAL "qemu") 7 | add_subdirectory(virtio) 8 | elseif("${HARDWARE}" STREQUAL "fpga") 9 | add_subdirectory(alteraSD) 10 | endif() 11 | endif() 12 | -------------------------------------------------------------------------------- /cherios/drivers/alteraSD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM CAN_VARY_SS LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /cherios/drivers/uart/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(UART_SRCS 5 | ${INIT_ASM} 6 | src/main.c 7 | src/uart.c 8 | ${UART_CONSOLE} 9 | ) 10 | 11 | add_cherios_executable_early(uart ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${UART_SRCS}) 12 | -------------------------------------------------------------------------------- /cherios/drivers/uart/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file just exists to define the source file that should be directly included 2 | # by anything that wants uart (boot/kernel/uart driver etc). It should only be included 3 | # by the toplevel cmake. 4 | 5 | 6 | 7 | if("${CONSOLE}" STREQUAL "malta") 8 | set(UART_CONSOLE ${CMAKE_SOURCE_DIR}/cherios/drivers/uart/src/uart_malta.c) 9 | elseif("${CONSOLE}" STREQUAL "altera") 10 | set(UART_CONSOLE ${CMAKE_SOURCE_DIR}/cherios/drivers/uart/src/uart_altera.c) 11 | elseif("${CONSOLE}" STREQUAL "qemu_debug") 12 | set(UART_CONSOLE ${CMAKE_SOURCE_DIR}/cherios/drivers/uart/src/uart_qemu_debug.c) 13 | elseif("${CONSOLE}" STREQUAL "16550") 14 | set(UART_CONSOLE ${CMAKE_SOURCE_DIR}/cherios/drivers/uart/src/uart_16550.c) 15 | else() 16 | message(FATAL_ERROR "Invalid choice for CONSOLE: ${CONSOLE}") 17 | endif() 18 | -------------------------------------------------------------------------------- /cherios/drivers/virtio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 2 | 3 | set(VIRTIO_SRCS 4 | ${CMAKE_CURRENT_SOURCE_DIR}/src/virtio.c 5 | ) 6 | 7 | add_subdirectory(virtio-blk) 8 | #add_subdirectory(virtio-net) -------------------------------------------------------------------------------- /cherios/drivers/virtio/virtio-blk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(VIRTIOBLK_SRCS 5 | ${INIT_ASM} 6 | ${VIRTIO_SRCS} 7 | src/main.c 8 | src/virtio_blk.c 9 | ) 10 | 11 | add_cherios_executable(virtio_blk ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${VIRTIOBLK_SRCS}) 12 | -------------------------------------------------------------------------------- /cherios/drivers/virtio/virtio-net/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(include) 3 | 4 | set(VIRTIONET_SRCS 5 | ${INIT_ASM} 6 | ${VIRTIO_SRCS} 7 | src/main.c 8 | src/virtio_net.c 9 | ) 10 | 11 | add_cherios_executable(virtio_net ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${VIRTIONET_SRCS}) 12 | -------------------------------------------------------------------------------- /cherios/drivers/virtio/virtio-net/src/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "virtio_net.h" 32 | #include "stdio.h" 33 | 34 | int main(capability carg, register_t arg) { 35 | printf("Virtio-net: Hello world\n"); 36 | 37 | virtio_daemon_start(); 38 | } -------------------------------------------------------------------------------- /cherios/kernel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | include/platform/${PLATFORM} 4 | ${CMAKE_SOURCE_DIR}/boot/include/boot 5 | ${DRIVERS_DIR}/uart/include) 6 | 7 | if(GO_FAST) 8 | set(KERNEL_DEBUG_SRCS) 9 | else() 10 | set(KERNEL_DEBUG_SRCS 11 | ${DRIVERS_DIR}/uart/src/uart.c 12 | ${UART_CONSOLE} 13 | ) 14 | endif() 15 | 16 | set(KERNEL_SRCS 17 | src/act.c 18 | src/init.c 19 | src/interrupts.c 20 | src/kernel_exceptions.c 21 | src/platform/${PLATFORM}/kernel_exceptions.c 22 | src/kernel_printf.c 23 | src/kernel_utils.c 24 | src/platform/${PLATFORM}/kernel_utils.c 25 | src/msg.c 26 | src/platform/${PLATFORM}/regdump.c 27 | src/sched.c 28 | src/syscalls.c 29 | src/timer.c 30 | src/mutex.c 31 | ${KERNEL_DEBUG_SRCS} 32 | ) 33 | set(KERNEL_ASM_SRCS 34 | src/platform/${PLATFORM}/init.S 35 | src/platform/${PLATFORM}/message_send.S 36 | ${PLT_ASM} 37 | ) 38 | 39 | add_cherios_kernel(kernel LINKER_SCRIPT kernel.ld SOURCES 40 | ${KERNEL_SRCS} 41 | ${KERNEL_ASM_SRCS} 42 | ) 43 | #set_target_properties(kernel PROPERTIES COMPILE_FLAGS "-mllvm -cheri-no-global-bounds") 44 | -------------------------------------------------------------------------------- /cherios/system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(activation_events) 2 | add_subdirectory(idle) 3 | add_subdirectory(type_manager) 4 | add_subdirectory(dylink) 5 | 6 | if(NOT ${BAREBONES}) 7 | add_subdirectory(fatfs) 8 | #add_subdirectory(dummyfs) 9 | add_subdirectory(dedup) 10 | add_subdirectory(lwip) 11 | add_subdirectory(block_cache) 12 | endif() 13 | 14 | add_subdirectory(libsocket) -------------------------------------------------------------------------------- /cherios/system/activation_events/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /cherios/system/block_cache/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${DEFAULT_SECURE_ASM} 7 | src/main.c 8 | src/aes.c 9 | ) 10 | 11 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM TEMPORAL_A CAN_VARY_SS LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 12 | -------------------------------------------------------------------------------- /cherios/system/dedup/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.cpp 8 | ${CMAKE_SOURCE_DIR}/sha256/src/sha256_c.S 9 | ) 10 | 11 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 12 | 13 | add_subdirectory(dedup_init) 14 | -------------------------------------------------------------------------------- /cherios/system/dedup/dedup_init/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | make_usage(user) 6 | 7 | set(X_SRCS 8 | ${INIT_ASM} 9 | user_usage.S 10 | src/main.c 11 | ) 12 | 13 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM FREESTANDING 14 | LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 15 | -------------------------------------------------------------------------------- /cherios/system/dedup/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /cherios/system/dummyfs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /cherios/system/dummyfs/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /cherios/system/dylink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -------------------------------------------------------------------------------- /cherios/system/dylink/include/dylink_server.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2019 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | #ifndef CHERIOS_DYLINK_SERVER_H 31 | #define CHERIOS_DYLINK_SERVER_H 32 | 33 | // DEPRACATED: This is for the old manual dynamic linking. 34 | 35 | int server_start(void); 36 | 37 | #endif // CHERIOS_DYLINK_SERVER_H 38 | -------------------------------------------------------------------------------- /cherios/system/fatfs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(FATFS_SRCS 5 | ${DEFAULT_INSECURE_ASM} 6 | src/main.c 7 | src/diskio.c 8 | src/ff.c 9 | src/ff_sync.c 10 | ) 11 | 12 | add_cherios_executable(fatfs ADD_TO_FILESYSTEM FREESTANDING CAN_VARY_SS 13 | LINKER_SCRIPT sandbox.ld SOURCES ${FATFS_SRCS}) 14 | -------------------------------------------------------------------------------- /cherios/system/fatfs/include/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _FF_INTEGER 6 | #define _FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | typedef unsigned __int64 QWORD; 13 | 14 | 15 | #else /* Embedded platform */ 16 | 17 | /* These types MUST be 16-bit or 32-bit */ 18 | typedef int INT; 19 | typedef unsigned int UINT; 20 | 21 | /* This type MUST be 8-bit */ 22 | typedef unsigned char BYTE; 23 | 24 | /* These types MUST be 16-bit */ 25 | typedef int16_t SHORT; 26 | typedef uint16_t WORD; 27 | typedef uint16_t WCHAR; 28 | 29 | /* These types MUST be 32-bit */ 30 | typedef int32_t LONG; 31 | typedef uint32_t DWORD; 32 | 33 | /* This type MUST be 64-bit (Remove this for C89 compatibility) */ 34 | typedef uint64_t QWORD; 35 | 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /cherios/system/fatfs/src/00readme.txt: -------------------------------------------------------------------------------- 1 | FatFs Module Source Files R0.12 2 | 3 | 4 | FILES 5 | 6 | 00readme.txt This file. 7 | history.txt Revision history. 8 | ffconf.h Configuration file for FatFs module. 9 | ff.h Common include file for FatFs and application module. 10 | ff.c FatFs module. 11 | diskio.h Common include file for FatFs and disk I/O module. 12 | diskio.c An example of glue function to attach existing disk I/O module to FatFs. 13 | integer.h Integer type definitions for FatFs. 14 | option Optional external functions. 15 | 16 | 17 | Low level disk I/O module is not included in this archive because the FatFs 18 | module is only a generic file system layer and not depend on any specific 19 | storage device. You have to provide a low level disk I/O module that written 20 | to control the target storage device. 21 | 22 | -------------------------------------------------------------------------------- /cherios/system/idle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable_early(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /cherios/system/libsocket/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${SECURE_INIT_ASM} 7 | src/main.c 8 | src/sockets.c 9 | ) 10 | 11 | add_cherios_executable_light(${ACT_NAME} ADD_TO_FILESYSTEM CAN_VARY_SS TEMPORAL_A LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 12 | -------------------------------------------------------------------------------- /cherios/system/lwip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | include_directories(${LWIP_INCLUDE}) 5 | include_directories(${DRIVERS_DIR}/virtio/include) 6 | include_directories(${DRIVERS_DIR}/virtio/virtio-net/include) 7 | include_directories(${DRIVERS_DIR}/megacore/include) 8 | 9 | if("${HARDWARE}" STREQUAL "qemu") 10 | set(DRIVER_SRCS src/virtio/virtio_driver.c) 11 | elseif("${HARDWARE}" STREQUAL "fpga") 12 | if("${MSGDMA}") 13 | set(DRIVER_SRCS src/megacore/megacore_driver.c src/megacore/altera_sgdma.c) 14 | else() 15 | set(DRIVER_SRCS src/megacore/megacore_driver.c src/megacore/altera_fifo.c) 16 | endif() 17 | endif() 18 | 19 | 20 | set(X_SRCS 21 | ${DEFAULT_INSECURE_ASM} 22 | ${lwipcore_SRCS} 23 | ${lwipcore4_SRCS} 24 | ${LWIP_DIR}/src/netif/ethernet.c 25 | ${LWIP_DIR}/src/netif/bridgeif.c 26 | ${LWIP_DIR}/src/netif/bridgeif_fdb.c 27 | ${LWIP_DIR}/src/apps/http/httpd.c 28 | ${LWIP_DIR}/src/apps/http/fs.c 29 | ${LWIP_DIR}/src/api/err.c 30 | src/sys_arch.c 31 | src/main.c 32 | src/httpd.c 33 | src/platform/${PLATFORM}/checksum.S 34 | ${DRIVERS_DIR}/virtio/src/virtio.c 35 | ${DRIVER_SRCS} 36 | ) 37 | 38 | # libuser now provides this 39 | list(REMOVE_ITEM X_SRCS ${LWIP_DIR}/src/core/ipv4/ip4_addr.c) 40 | 41 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM CAN_VARY_SS LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 42 | 43 | if("${HARDWARE}" STREQUAL "fpga") 44 | if("${MSGDMA}") 45 | else() 46 | target_compile_definitions(${ACT_NAME} PUBLIC -DDRIVER_ASM="megacore/fifo_asm.S") 47 | endif() 48 | endif() 49 | -------------------------------------------------------------------------------- /cherios/system/lwip/src/sys_arch.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "arch/cc.h" 32 | #include "syscalls.h" 33 | 34 | u32_t sys_now(void) { 35 | return CLOCK_TO_MS(syscall_now()); 36 | } -------------------------------------------------------------------------------- /cherios/system/lwip/static_fs/404.html: -------------------------------------------------------------------------------- 1 | 2 | CheriOS 3 | 4 | 5 | 6 |

CheriOS

7 |

404 - Page not found

8 |

9 | There are limitations on filenames (i.e. they are only allowed to have 3 character extentions). 10 | Try something shorter. 11 |

12 | 13 | 14 | -------------------------------------------------------------------------------- /cherios/system/lwip/static_fs/bug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/cherios/system/lwip/static_fs/bug.jpg -------------------------------------------------------------------------------- /cherios/system/lwip/static_fs/index.html: -------------------------------------------------------------------------------- 1 | 2 | CheriOS 3 | 4 |

CheriOS

5 | 6 | Bug 7 | 8 |

9 | This Bug was served to you by CheriOS. Yay! 10 |

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cherios/system/sched_balance/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.cpp 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /cherios/system/sched_balance/src/main.cpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | extern "C" { 32 | #include "cheric.h" 33 | } 34 | 35 | 36 | 37 | extern "C" { 38 | int main(register_t arg, capability carg) { 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cherios/system/type_manager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /churn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /churn/include/churn.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /cpptest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.cpp 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM NEED_LIBCXX LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /dedup_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /demos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(alice_bob) 2 | -------------------------------------------------------------------------------- /demos/alice_bob/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(include) 2 | 3 | add_subdirectory(alice) 4 | add_subdirectory(bob) 5 | add_subdirectory(eve) 6 | -------------------------------------------------------------------------------- /demos/alice_bob/alice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | include_directories(${AUTOGENERATED_IDS_DIR}) 5 | 6 | set(X_SRCS 7 | ${SECURE_INIT_ASM} 8 | src/main.c 9 | ) 10 | 11 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM TEMPORAL_A LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 12 | add_dependencies(${ACT_NAME} bob_id) 13 | -------------------------------------------------------------------------------- /demos/alice_bob/alice/src/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2019 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "cheric.h" 32 | #include "bob_id.h" 33 | #include "stdio.h" 34 | #include "nano/foundations.h" 35 | #include "namespace.h" 36 | #include "alice_bob.h" 37 | #include "assert.h" 38 | #include "capmalloc.h" 39 | #include "lorem.h" 40 | 41 | int main(void) { 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /demos/alice_bob/bob/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${SECURE_INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM TEMPORAL_A LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | make_id(${ACT_NAME}) 12 | -------------------------------------------------------------------------------- /demos/alice_bob/eve/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${SECURE_INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM TEMPORAL_A LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /dylink_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(include) 3 | 4 | add_subdirectory(lib1) 5 | add_subdirectory(lib2) 6 | add_subdirectory(app) -------------------------------------------------------------------------------- /dylink_test/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(app ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | target_link_libraries(app PRIVATE lib1) 12 | target_link_libraries(app PRIVATE lib2) -------------------------------------------------------------------------------- /dylink_test/include/shared_stuff.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_SHARED_STUFF_H 32 | #define CHERIOS_SHARED_STUFF_H 33 | 34 | extern void function_in_another_lib(void); 35 | extern void function_in_lib2(void); 36 | 37 | #endif //CHERIOS_SHARED_STUFF_H 38 | -------------------------------------------------------------------------------- /dylink_test/lib1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | src/main.c 7 | ) 8 | 9 | add_cherios_library(lib1 ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 10 | -------------------------------------------------------------------------------- /dylink_test/lib2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | src/main.c 7 | ) 8 | 9 | add_cherios_library(lib2 ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 10 | -------------------------------------------------------------------------------- /dylink_test/lib2/src/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "cheric.h" 32 | #include "stdio.h" 33 | #include "dylink.h" 34 | 35 | 36 | extern const char* dynamic_normal_sym; 37 | 38 | VIS_EXTERNAL void function_in_lib2(void) { 39 | printf("Lib 2 calling with sym in lib 1: %s\n", dynamic_normal_sym); 40 | return; 41 | } -------------------------------------------------------------------------------- /exception_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /exception_test/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /foundation_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${SECURE_INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /fs_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /fs_test/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /generate_captable_usage.py: -------------------------------------------------------------------------------- 1 | 2 | # 3 | 4 | import sys 5 | 6 | def main(): 7 | print ("# DO NOT EDIT. AUTO-GENERATED.") 8 | print(".text") 9 | type = "UNKNOWN" 10 | should_include = True 11 | 12 | for line in sys.stdin: 13 | parts = line.split() 14 | if(len(parts) == 1): 15 | parts2 = line.split(".") 16 | type = (parts2[len(parts2)-2]).lower() 17 | if(type == "c" or type == "cpp" or type == "cxx" or type == "s"): 18 | should_include = True 19 | else: 20 | should_include = False 21 | elif (len(parts) == 3): 22 | if(parts[1] == "T" and should_include): 23 | sym = parts[2] 24 | print ("clcbi $c1, %captab20(" + sym + ")($c25)") 25 | 26 | if __name__== "__main__": 27 | main() 28 | 29 | -------------------------------------------------------------------------------- /hello/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(HELLO_SRCS 5 | ${INIT_ASM} 6 | src/main.c 7 | ) 8 | 9 | add_cherios_executable(hello ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${HELLO_SRCS}) 10 | -------------------------------------------------------------------------------- /include/ccall.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | 32 | #ifndef CHERIOS_CCALL_H 33 | #define CHERIOS_CCALL_H 34 | 35 | #include "cheric.h" 36 | 37 | struct cheri_object { 38 | capability code; 39 | capability data; 40 | }; 41 | 42 | #define CONTEXT(C, D) (struct cheri_object){.code = C, .data = D} 43 | 44 | #endif //CHERIOS_CCALL_H 45 | -------------------------------------------------------------------------------- /include/debug.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | -------------------------------------------------------------------------------- /include/fcntl.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_FCNTL_H 32 | #define CHERIOS_FCNTL_H 33 | 34 | 35 | #endif //CHERIOS_FCNTL_H 36 | -------------------------------------------------------------------------------- /include/langinfo.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_LANGINFO_H 32 | #define CHERIOS_LANGINFO_H 33 | 34 | #endif //CHERIOS_LANGINFO_H 35 | -------------------------------------------------------------------------------- /include/math_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by LawrenceEsswood on 25/03/2020. 3 | // 4 | 5 | #ifndef CHERIOS_MATH_UTILS_H 6 | #define CHERIOS_MATH_UTILS_H 7 | 8 | #ifndef __ASSEMBLY__ 9 | 10 | #include "stddef.h" 11 | 12 | static inline int imax(int a, int b) { 13 | return (a>b ? a : b); 14 | } 15 | 16 | static inline int imin(int a, int b) { 17 | return (ab ? a : b); 22 | } 23 | 24 | static inline size_t umin(size_t a, size_t b) { 25 | return (a>= 1; 33 | } 34 | return i; 35 | } 36 | 37 | static inline int is_power_2(size_t x) { 38 | return (x & (x-1)) == 0; 39 | } 40 | 41 | static inline size_t align_up_to(size_t size, size_t align) { 42 | size_t mask = align - 1; 43 | return (size + mask) & ~mask; 44 | } 45 | 46 | static inline size_t align_down_to(size_t size, size_t align) { 47 | return size & ~(align-1); 48 | } 49 | 50 | static inline size_t round_up_to_nearest_power_2(size_t v) { 51 | v--; 52 | v |= v >> 1L; 53 | v |= v >> 2L; 54 | v |= v >> 4L; 55 | v |= v >> 8L; 56 | v |= v >> 16L; 57 | v |= v >> 32L; 58 | v++; 59 | return v; 60 | } 61 | 62 | #define SLICE_W(Val, Width, LowNdx, Bits) (((Val) << ((Width) - ((LowNdx) + (Bits)))) >> ((Width) - (Bits))) 63 | 64 | #define SLICE_64(Val, LowNdx, Bits) SLICE_W(Val, 64, LowNdx, Bits) 65 | 66 | #else // __ASSEMBLY__ 67 | 68 | #define ALIGN_UP_2(X, P) (((X) + ((1 << (P)) - 1)) &~ ((1 << (P)) - 1)) 69 | #define ALIGN_DOWN_2(X, P) ((X) &~ ((1 << (P)) - 1)) 70 | 71 | #endif // __ASSEMBLY__ 72 | 73 | #endif //CHERIOS_MATH_UTILS_H 74 | -------------------------------------------------------------------------------- /include/osreldate.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2019 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | #ifndef CHERIOS_OSRELDATE_H 31 | #define CHERIOS_OSRELDATE_H 32 | 33 | //Dummy for libcxx which thinks we are FreeBSD 34 | 35 | #endif //CHERIOS_OSRELDATE_H 36 | -------------------------------------------------------------------------------- /include/platform/mips/platform.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_PLATFORM_H 32 | #define CHERIOS_PLATFORM_H 33 | 34 | #include "mips.h" 35 | 36 | #endif //CHERIOS_PLATFORM_H 37 | -------------------------------------------------------------------------------- /include/platform/riscv/asm.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_ASM_H 32 | #define CHERIOS_ASM_H 33 | 34 | #define START_FUNC(X) ".global " #X "; .type " #X ", \"function\"; " #X ":" 35 | 36 | #endif //CHERIOS_ASM_H 37 | -------------------------------------------------------------------------------- /include/platform/riscv/platform.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_PLATFORM_H 32 | #define CHERIOS_PLATFORM_H 33 | 34 | #include "risv.h" 35 | 36 | #endif //CHERIOS_PLATFORM_H 37 | -------------------------------------------------------------------------------- /include/platform/riscv/statcounters.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_STATCOUNTERS_H 32 | #define CHERIOS_STATCOUNTERS_H 33 | 34 | // TODO RISCV 35 | // I don't even know if we have stat counters on RISCV as well. But if we do, here is where to define them 36 | 37 | #define ALL_THE_STATS 0 38 | #define STAT_ALL_LIST(ITEM, ...) 39 | 40 | #endif //CHERIOS_STATCOUNTERS_H 41 | -------------------------------------------------------------------------------- /include/sched.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_SCHED_H 32 | #define CHERIOS_SCHED_H 33 | 34 | // TODO, but we need this so libcxx does not complain 35 | 36 | #endif //CHERIOS_SCHED_H 37 | -------------------------------------------------------------------------------- /include/setjmp.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | #ifndef CHERIOS_SETJMP_H 31 | #define CHERIOS_SETJMP_H 32 | 33 | #include "exceptions.h" 34 | typedef struct env { 35 | exception_restore_frame ex_frame; 36 | } env; 37 | 38 | int setjmp(jmp_buf env); 39 | 40 | void longjmp(jmp_buf env, int value); 41 | 42 | #endif //CHERIOS_SETJMP_H 43 | -------------------------------------------------------------------------------- /include/sys/_types.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | #ifndef CHERIOS__TYPES_H 31 | #define CHERIOS__TYPES_H 32 | 33 | typedef int __ct_rune_t; 34 | typedef __ct_rune_t __rune_t; 35 | typedef __ct_rune_t __wint_t; 36 | 37 | #endif //CHERIOS__TYPES_H 38 | -------------------------------------------------------------------------------- /include/xlocale/_langinfo.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 | * 4 | * Copyright (c) 2011, 2012 The FreeBSD Foundation 5 | * All rights reserved. 6 | * 7 | * This software was developed by David Chisnall under sponsorship from 8 | * the FreeBSD Foundation. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | * 31 | * $FreeBSD$ 32 | */ 33 | 34 | #ifndef _XLOCALE_LANGINFO_H 35 | #define _XLOCALE_LANGINFO_H 36 | 37 | #ifndef _LOCALE_T_DEFINED 38 | #define _LOCALE_T_DEFINED 39 | typedef struct _xlocale *locale_t; 40 | #endif 41 | 42 | char *nl_langinfo_l(nl_item, locale_t); 43 | 44 | #endif /* _XLOCALE_LANGINFO_H */ 45 | -------------------------------------------------------------------------------- /init_asm/platform/mips/init.S: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright (c) 2016 Hadrien Barral 3 | # All rights reserved. 4 | # 5 | # This software was developed by SRI International and the University of 6 | # Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | # ("CTSRD"), as part of the DARPA CRASH research programme. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | # SUCH DAMAGE. 29 | # 30 | 31 | .set noreorder 32 | .set nobopt 33 | .set noat 34 | 35 | #include "asm.S" 36 | 37 | .text 38 | .global start 39 | .ent start 40 | .hidden start 41 | start: 42 | jmp_in_segment start_common, $at, $c1 43 | cmove $c8, $c16 44 | 45 | .end start 46 | -------------------------------------------------------------------------------- /init_asm/platform/riscv/init.S: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "asm.S" 32 | #include "reg_abi.h" 33 | 34 | START_HIDDEN_FUNC start 35 | 36 | # Insecure entry has the program loader do most of the early setup work, can just jump to common 37 | cmove abi_cert, cnull 38 | call_func_early start_common 39 | 40 | END_FUNC start 41 | -------------------------------------------------------------------------------- /ldscripts/platform/riscv/riscv.ld: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | /* The nanokernel will set up simple direct mappings at this base */ 32 | __uncached_base = 0x80000000; 33 | -------------------------------------------------------------------------------- /libcrt/libc/freebsd_ports/strcat.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1988, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 4. Neither the name of the University nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | char * 31 | strcat(char * __restrict s, const char * __restrict append) 32 | { 33 | char *save = s; 34 | 35 | for (; *s; ++s); 36 | while ((*s++ = *append++) != 0); 37 | return(save); 38 | } 39 | -------------------------------------------------------------------------------- /libcrt/libc/freebsd_ports/strcpy.c: -------------------------------------------------------------------------------- 1 | 2 | /*- 3 | * SPDX-License-Identifier: BSD-3-Clause 4 | * 5 | * Copyright (c) 1988, 1993 6 | * The Regents of the University of California. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of the University nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 | * SUCH DAMAGE. 31 | */ 32 | 33 | char * 34 | strcpy(char * __restrict to, const char * __restrict from) 35 | { 36 | char *save = to; 37 | 38 | for (; (*to = *from) != 0; ++from, ++to); 39 | return(save); 40 | } 41 | -------------------------------------------------------------------------------- /libcrt/libc/freebsd_ports/strlen.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 4. Neither the name of the University nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | /* __FBSDID("$FreeBSD: stable/8/sys/libkern/strlen.c 199583 2009-11-20 15:27:52Z jhb $"); */ 31 | 32 | #include "cheric.h" 33 | 34 | size_t 35 | strlen(const char *str) 36 | { 37 | register const char *s; 38 | 39 | for (s = str; *s; ++s); 40 | return(s - str); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /libcrt/libc/strchr.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "string.h" 32 | #include "cdefs.h" 33 | 34 | char * strchr(const char * s, int c) { 35 | while(*s != '\0' && *s != c) s++; 36 | return *s == '\0' ? NULL : __DECONST(char*, s); 37 | } -------------------------------------------------------------------------------- /libcrt/libc/strdup.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2019 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "string.h" 32 | #include "stdlib.h" 33 | 34 | char * strdup(const char *str1) { 35 | size_t size = strlen(str1) + 1; 36 | char* new_string = (char*)malloc(size); 37 | for(size_t i = 0; i != size; i++) new_string[i] = str1[i]; 38 | return new_string; 39 | } 40 | -------------------------------------------------------------------------------- /libcrt/platform/riscv/memcpy_l.S: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "asm.S" 32 | 33 | # TODO RISCV 34 | 35 | .text 36 | 37 | /* 38 | START_FUNC memcpy 39 | END_FUNC memcpy 40 | */ 41 | -------------------------------------------------------------------------------- /libuser/src/errno.c: -------------------------------------------------------------------------------- 1 | int errno = 0; 2 | -------------------------------------------------------------------------------- /libuser/src/platform/riscv/exceptions.S: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "asm.S" 32 | 33 | START_FUNC user_exception_trampoline_vector 34 | # TODO RISCV 35 | j user_exception_trampoline_vector 36 | 37 | END_FUNC user_exception_trampoline_vector 38 | -------------------------------------------------------------------------------- /libuser/src/platform/riscv/temporal.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "temporal.h" 32 | #include "stdint.h" 33 | 34 | // TODO RISCV 35 | 36 | void try_replace_usp(void) { 37 | 38 | } 39 | void consume_usp(void) { 40 | 41 | } 42 | 43 | int temporal_check_insts(uint32_t fault_instr, uint32_t prev_fault_instr) { 44 | (void)fault_instr; 45 | (void)prev_fault_instr; 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /libuser/src/platform/riscv/thread.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * SPDX-License-Identifier: BSD-2-Clause 3 | * 4 | * Copyright (c) 2021 Lawrence Esswood 5 | * 6 | * This work was supported by Innovate UK project 105694, "Digital Security 7 | * by Design (DSbD) Technology Platform Prototype". 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "asm.h" 32 | 33 | // TODO: Delete me 34 | -------------------------------------------------------------------------------- /libuser/src/plt_allocations.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2018 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "syscalls.h" 32 | #include "nano/nanokernel.h" 33 | 34 | ALLOCATE_PLT_SYSCALLS 35 | ALLOCATE_PLT_NANO 36 | -------------------------------------------------------------------------------- /libuser/src/ssleep.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * Copyright (c) 2017 Lawrence Esswood 4 | * All rights reserved. 5 | * 6 | * This software was developed by SRI International and the University of 7 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 8 | * ("CTSRD"), as part of the DARPA CRASH research programme. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | * SUCH DAMAGE. 30 | */ 31 | 32 | #include "syscalls.h" 33 | 34 | void ssleep(int n) { 35 | sleep(n); 36 | } 37 | 38 | void nssleep(int n) { 39 | for(int i=0; i 30 | * 31 | */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /lwip/FILES: -------------------------------------------------------------------------------- 1 | src/ - The source code for the lwIP TCP/IP stack. 2 | doc/ - The documentation for lwIP. 3 | test/ - Some code to test whether the sources do what they should. 4 | 5 | See also the FILES file in each subdirectory. 6 | -------------------------------------------------------------------------------- /lwip/astylerc: -------------------------------------------------------------------------------- 1 | # lwIP astyle formatting options 2 | 3 | # NOT FINISHED - DON'T USE 4 | 5 | # braces and indent 6 | style=otbs 7 | indent=spaces=2 8 | attach-extern-c 9 | #attach-closing-while 10 | # indentation 11 | indent-switches 12 | #max-continuation-indent=40 13 | # padding 14 | pad-oper 15 | pad-comma 16 | pad-header 17 | align-pointer=name 18 | # formatting 19 | break-one-line-headers 20 | keep-one-line-blocks 21 | # don't use "other options" (e.g. formatted) in this file 22 | # send them as additional command line options 23 | -------------------------------------------------------------------------------- /lwip/doc/FILES: -------------------------------------------------------------------------------- 1 | doxygen/ - Configuration files and scripts to create the lwIP doxygen source 2 | documentation (found at http://www.nongnu.org/lwip/) 3 | 4 | savannah.txt - How to obtain the current development source code. 5 | contrib.txt - How to contribute to lwIP as a developer. 6 | rawapi.txt - The documentation for the core API of lwIP. 7 | Also provides an overview about the other APIs and multithreading. 8 | sys_arch.txt - The documentation for a system abstraction layer of lwIP. 9 | ppp.txt - Documentation of the PPP interface for lwIP. 10 | -------------------------------------------------------------------------------- /lwip/doc/ZeroCopyRx.c: -------------------------------------------------------------------------------- 1 | typedef struct my_custom_pbuf 2 | { 3 | struct pbuf_custom p; 4 | void* dma_descriptor; 5 | } my_custom_pbuf_t; 6 | 7 | LWIP_MEMPOOL_DECLARE(RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool"); 8 | 9 | void my_pbuf_free_custom(void* p) 10 | { 11 | SYS_ARCH_DECL_PROTECT(old_level); 12 | 13 | my_custom_pbuf_t* my_puf = (my_custom_pbuf_t*)p; 14 | 15 | // invalidate data cache here - lwIP and/or application may have written into buffer! 16 | // (invalidate is faster than flushing, and noone needs the correct data in the buffer) 17 | invalidate_cpu_cache(p->payload, p->tot_len); 18 | 19 | SYS_ARCH_PROTECT(old_level); 20 | free_rx_dma_descriptor(my_pbuf->dma_descriptor); 21 | LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf); 22 | SYS_ARCH_UNPROTECT(old_level); 23 | } 24 | 25 | void eth_rx_irq() 26 | { 27 | dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet(); 28 | my_custom_pbuf_t* my_pbuf = (my_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(RX_POOL); 29 | 30 | my_pbuf->p.custom_free_function = my_pbuf_free_custom; 31 | my_pbuf->dma_descriptor = dma_desc; 32 | 33 | invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length); 34 | 35 | struct pbuf* p = pbuf_alloced_custom(PBUF_RAW, 36 | dma_desc->rx_length, 37 | PBUF_REF, 38 | &my_pbuf->p, 39 | dma_desc->rx_data, 40 | dma_desc->max_buffer_size); 41 | 42 | if(netif->input(p, netif) != ERR_OK) { 43 | pbuf_free(p); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lwip/doc/doxygen/generate.bat: -------------------------------------------------------------------------------- 1 | doxygen lwip.Doxyfile 2 | -------------------------------------------------------------------------------- /lwip/doc/doxygen/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | doxygen lwip.Doxyfile 4 | -------------------------------------------------------------------------------- /lwip/doc/doxygen/output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirection 5 | 6 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /lwip/src/FILES: -------------------------------------------------------------------------------- 1 | api/ - The code for the high-level wrapper API. Not needed if 2 | you use the lowel-level call-back/raw API. 3 | 4 | apps/ - Higher layer applications that are specifically programmed 5 | with the lwIP low-level raw API. 6 | 7 | core/ - The core of the TPC/IP stack; protocol implementations, 8 | memory and buffer management, and the low-level raw API. 9 | 10 | include/ - lwIP include files. 11 | 12 | netif/ - Generic network interface device drivers are kept here. 13 | 14 | For more information on the various subdirectories, check the FILES 15 | file in each directory. 16 | -------------------------------------------------------------------------------- /lwip/src/apps/http/fs/404.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 19 |
7 | SICS logo 9 | 10 |

lwIP - A Lightweight TCP/IP Stack

11 |

404 - Page not found

12 |

13 | Sorry, the page you are requesting was not found on this 14 | server. 15 |

16 |
17 |   18 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /lwip/src/apps/http/fs/img/sics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/src/apps/http/fs/img/sics.gif -------------------------------------------------------------------------------- /lwip/src/apps/http/fs/index.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 44 |
7 | SICS logo 9 | 10 |

lwIP - A Lightweight TCP/IP Stack

11 |

12 | The web page you are watching was served by a simple web 13 | server running on top of the lightweight TCP/IP stack lwIP. 15 |

16 |

17 | lwIP is an open source implementation of the TCP/IP 18 | protocol suite that was originally written by Adam Dunkels 20 | of the Swedish Institute of Computer Science but now is 21 | being actively developed by a team of developers 22 | distributed world-wide. Since it's release, lwIP has 23 | spurred a lot of interest and has been ported to several 24 | platforms and operating systems. lwIP can be used either 25 | with or without an underlying OS. 26 |

27 |

28 | The focus of the lwIP TCP/IP implementation is to reduce 29 | the RAM usage while still having a full scale TCP. This 30 | makes lwIP suitable for use in embedded systems with tens 31 | of kilobytes of free RAM and room for around 40 kilobytes 32 | of code ROM. 33 |

34 |

35 | More information about lwIP can be found at the lwIP 36 | homepage at http://savannah.nongnu.org/projects/lwip/ 38 | or at the lwIP wiki at http://lwip.wikia.com/. 40 |

41 |
42 |   43 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /lwip/src/apps/http/makefsdata/makefsdata: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | open(OUTPUT, "> fsdata.c"); 4 | 5 | chdir("/local/scratch/cheri/cherios/cherios/system/lwip/static_fs"); 6 | open(FILES, "find . -type f |"); 7 | 8 | while($file = ) { 9 | 10 | # Do not include files in CVS directories nor backup files. 11 | if($file =~ /(CVS|~)/) { 12 | next; 13 | } 14 | 15 | chop($file); 16 | 17 | system("cp $file /tmp/file"); 18 | 19 | open(FILE, "/tmp/file"); 20 | unlink("/tmp/file"); 21 | 22 | $file =~ s/\.//; 23 | $fvar = $file; 24 | $fvar =~ s-/-_-g; 25 | $fvar =~ s-\.-_-g; 26 | print(OUTPUT "static const unsigned char data".$fvar."[] = {\n"); 27 | print(OUTPUT "\t/* $file */\n\t"); 28 | for($j = 0; $j < length($file); $j++) { 29 | printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); 30 | } 31 | printf(OUTPUT "0,\n"); 32 | 33 | 34 | $i = 0; 35 | while(read(FILE, $data, 1)) { 36 | if($i == 0) { 37 | print(OUTPUT "\t"); 38 | } 39 | printf(OUTPUT "%#02x, ", unpack("C", $data)); 40 | $i++; 41 | if($i == 10) { 42 | print(OUTPUT "\n"); 43 | $i = 0; 44 | } 45 | } 46 | print(OUTPUT "};\n\n"); 47 | close(FILE); 48 | push(@fvars, $fvar); 49 | push(@files, $file); 50 | } 51 | 52 | for($i = 0; $i < @fvars; $i++) { 53 | $file = $files[$i]; 54 | $fvar = $fvars[$i]; 55 | 56 | if($i == 0) { 57 | $prevfile = "NULL"; 58 | } else { 59 | $prevfile = "file" . $fvars[$i - 1]; 60 | } 61 | print(OUTPUT "const struct fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, "); 62 | print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); 63 | print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); 64 | } 65 | 66 | print(OUTPUT "#define FS_ROOT file$fvars[$i - 1]\n\n"); 67 | print(OUTPUT "#define FS_NUMFILES $i\n"); 68 | -------------------------------------------------------------------------------- /lwip/src/apps/http/makefsdata/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains a script ('makefsdata') to create C code suitable for 2 | httpd for given html pages (or other files) in a directory. 3 | 4 | There is also a plain C console application doing the same and extended a bit. 5 | 6 | Usage: htmlgen [targetdir] [-s] [-i]s 7 | targetdir: relative or absolute path to files to convert 8 | switch -s: toggle processing of subdirectories (default is on) 9 | switch -e: exclude HTTP header from file (header is created at runtime, default is on) 10 | switch -11: include HTTP 1.1 header (1.0 is default) 11 | 12 | if targetdir not specified, makefsdata will attempt to 13 | process files in subdirectory 'fs'. 14 | -------------------------------------------------------------------------------- /lwip/src/include/compat/posix/arpa/inet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/sockets.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/sockets.h" 34 | -------------------------------------------------------------------------------- /lwip/src/include/compat/posix/net/if.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/if_api.h. 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | */ 35 | 36 | #include "lwip/if_api.h" 37 | -------------------------------------------------------------------------------- /lwip/src/include/compat/posix/netdb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/netdb.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/netdb.h" 34 | -------------------------------------------------------------------------------- /lwip/src/include/compat/posix/sys/socket.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/sockets.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/sockets.h" 34 | -------------------------------------------------------------------------------- /lwip/src/include/compat/stdc/errno.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix/stdc wrapper for lwip/errno.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/errno.h" 34 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/FILES: -------------------------------------------------------------------------------- 1 | This directory contains application headers. 2 | Every application shall provide one api file APP.h and optionally one options file APP_opts.h 3 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/netbiosns.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * NETBIOS name service responder 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | #ifndef LWIP_HDR_APPS_NETBIOS_H 33 | #define LWIP_HDR_APPS_NETBIOS_H 34 | 35 | #include "lwip/apps/netbiosns_opts.h" 36 | 37 | void netbiosns_init(void); 38 | #ifndef NETBIOS_LWIP_NAME 39 | void netbiosns_set_name(const char* hostname); 40 | #endif 41 | void netbiosns_stop(void); 42 | 43 | #endif /* LWIP_HDR_APPS_NETBIOS_H */ 44 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/snmp_snmpv2_framework.h: -------------------------------------------------------------------------------- 1 | /* 2 | Generated by LwipMibCompiler 3 | */ 4 | 5 | #ifndef LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H 6 | #define LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H 7 | 8 | #include "lwip/apps/snmp_opts.h" 9 | #if LWIP_SNMP 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #include "lwip/apps/snmp_core.h" 16 | 17 | extern const struct snmp_obj_id usmNoAuthProtocol; 18 | extern const struct snmp_obj_id usmHMACMD5AuthProtocol; 19 | extern const struct snmp_obj_id usmHMACSHAAuthProtocol; 20 | 21 | extern const struct snmp_obj_id usmNoPrivProtocol; 22 | extern const struct snmp_obj_id usmDESPrivProtocol; 23 | extern const struct snmp_obj_id usmAESPrivProtocol; 24 | 25 | extern const struct snmp_mib snmpframeworkmib; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif /* __cplusplus */ 30 | 31 | #endif /* LWIP_SNMP */ 32 | #endif /* LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H */ 33 | -------------------------------------------------------------------------------- /lwip/src/include/lwip/apps/snmp_snmpv2_usm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Generated by LwipMibCompiler 3 | */ 4 | 5 | #ifndef LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H 6 | #define LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H 7 | 8 | #include "lwip/apps/snmp_opts.h" 9 | #if LWIP_SNMP 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #include "lwip/apps/snmp_core.h" 16 | 17 | extern const struct snmp_mib snmpusmmib; 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* LWIP_SNMP */ 24 | #endif /* LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H */ 25 | -------------------------------------------------------------------------------- /lwip/src/include/netif/etharp.h: -------------------------------------------------------------------------------- 1 | /* ARP has been moved to core/ipv4, provide this #include for compatibility only */ 2 | #include "lwip/etharp.h" 3 | #include "netif/ethernet.h" 4 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/chap-md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap-md5.h - New CHAP/MD5 implementation. 3 | * 4 | * Copyright (c) 2003 Paul Mackerras. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. The name(s) of the authors of this software must not be used to 14 | * endorse or promote products derived from this software without 15 | * prior written permission. 16 | * 17 | * 3. Redistributions of any form whatsoever must retain the following 18 | * acknowledgment: 19 | * "This product includes software developed by Paul Mackerras 20 | * ". 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | */ 30 | 31 | #include "netif/ppp/ppp_opts.h" 32 | #if PPP_SUPPORT && CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 33 | 34 | extern const struct chap_digest_type md5_digest; 35 | 36 | #endif /* PPP_SUPPORT && CHAP_SUPPORT */ 37 | -------------------------------------------------------------------------------- /lwip/src/include/netif/ppp/chap_ms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap_ms.h - Challenge Handshake Authentication Protocol definitions. 3 | * 4 | * Copyright (c) 1995 Eric Rosenquist. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * 3. The name(s) of the authors of this software must not be used to 19 | * endorse or promote products derived from this software without 20 | * prior written permission. 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | * 30 | * $Id: chap_ms.h,v 1.13 2004/11/15 22:13:26 paulus Exp $ 31 | */ 32 | 33 | #include "netif/ppp/ppp_opts.h" 34 | #if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 35 | 36 | #ifndef CHAPMS_INCLUDE 37 | #define CHAPMS_INCLUDE 38 | 39 | extern const struct chap_digest_type chapms_digest; 40 | extern const struct chap_digest_type chapms2_digest; 41 | 42 | #endif /* CHAPMS_INCLUDE */ 43 | 44 | #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */ 45 | -------------------------------------------------------------------------------- /lwip/src/netif/FILES: -------------------------------------------------------------------------------- 1 | This directory contains generic network interface device drivers that 2 | do not contain any hardware or architecture specific code. The files 3 | are: 4 | 5 | ethernet.c 6 | Shared code for Ethernet based interfaces. 7 | 8 | lowpan6.c 9 | A 6LoWPAN implementation as a netif. 10 | 11 | lowpan6_ble.c 12 | A 6LoWPAN over Bluetooth Low Energy (BLE) implementation as netif, 13 | according to RFC-7668. 14 | 15 | slipif.c 16 | A generic implementation of the SLIP (Serial Line IP) 17 | protocol. It requires a sio (serial I/O) module to work. 18 | 19 | ppp/ Point-to-Point Protocol stack 20 | The lwIP PPP support is based from pppd (http://ppp.samba.org) with 21 | huge changes to match code size and memory requirements for embedded 22 | devices. Please read /doc/ppp.txt and ppp/PPPD_FOLLOWUP for a detailed 23 | explanation. 24 | -------------------------------------------------------------------------------- /lwip/src/netif/ppp/polarssl/README: -------------------------------------------------------------------------------- 1 | About PolarSSL files into lwIP PPP support 2 | ------------------------------------------ 3 | 4 | This folder contains some files fetched from the latest BSD release of 5 | the PolarSSL project (PolarSSL 0.10.1-bsd) for ciphers and encryption 6 | methods we need for lwIP PPP support. 7 | 8 | The PolarSSL files were cleaned to contain only the necessary struct 9 | fields and functions needed for lwIP. 10 | 11 | The PolarSSL API was not changed at all, so if you are already using 12 | PolarSSL you can choose to skip the compilation of the included PolarSSL 13 | library into lwIP. 14 | 15 | If you are not using the embedded copy you must include external 16 | libraries into your arch/cc.h port file. 17 | 18 | Beware of the stack requirements which can be a lot larger if you are not 19 | using our cleaned PolarSSL library. 20 | 21 | 22 | PolarSSL project website: http://polarssl.org/ 23 | -------------------------------------------------------------------------------- /lwip/test/fuzz/README: -------------------------------------------------------------------------------- 1 | 2 | Fuzzing the lwIP stack (afl-fuzz requires linux/unix or similar) 3 | 4 | This directory contains a small app that reads Ethernet frames from stdin and 5 | processes them. It is used together with the 'american fuzzy lop' tool (found 6 | at http://lcamtuf.coredump.cx/afl/) and the sample inputs to test how 7 | unexpected inputs are handled. The afl tool will read the known inputs, and 8 | try to modify them to exercise as many code paths as possible, by instrumenting 9 | the code and keeping track of which code is executed. 10 | 11 | Just running make will produce the test program. 12 | 13 | Running make with parameter 'D=-DLWIP_FUZZ_MULTI_PACKET' will produce a binary 14 | that parses the input data as multiple packets (experimental!). 15 | 16 | Then run afl with: 17 | 18 | afl-fuzz -i inputs/ -o output ./lwip_fuzz 19 | 20 | and it should start working. It will probably complain about CPU scheduler, 21 | set AFL_SKIP_CPUFREQ=1 to ignore it. 22 | If it complains about invalid "/proc/sys/kernel/core_pattern" setting, try 23 | executing "sudo bash -c 'echo core > /proc/sys/kernel/core_pattern'". 24 | 25 | The input is split into different subdirectories since they test different 26 | parts of the code, and since you want to run one instance of afl-fuzz on each 27 | core. 28 | 29 | When afl finds a crash or a hang, the input that caused it will be placed in 30 | the output directory. If you have hexdump and text2pcap tools installed, 31 | running output_to_pcap.sh will create pcap files for each input 32 | file to simplify viewing in wireshark. 33 | 34 | The lwipopts.h file needs to have checksum checking off, otherwise almost every 35 | packet will be discarded because of that. The other options can be tuned to 36 | expose different parts of the code. 37 | 38 | -------------------------------------------------------------------------------- /lwip/test/fuzz/config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/config.h -------------------------------------------------------------------------------- /lwip/test/fuzz/inputs/arp/arp_req.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/inputs/arp/arp_req.bin -------------------------------------------------------------------------------- /lwip/test/fuzz/inputs/icmp/icmp_ping.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/inputs/icmp/icmp_ping.bin -------------------------------------------------------------------------------- /lwip/test/fuzz/inputs/ipv6/neighbor_solicitation.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/inputs/ipv6/neighbor_solicitation.bin -------------------------------------------------------------------------------- /lwip/test/fuzz/inputs/ipv6/router_adv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/inputs/ipv6/router_adv.bin -------------------------------------------------------------------------------- /lwip/test/fuzz/inputs/tcp/tcp_syn.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/inputs/tcp/tcp_syn.bin -------------------------------------------------------------------------------- /lwip/test/fuzz/inputs/udp/udp_port_5000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/lwip/test/fuzz/inputs/udp/udp_port_5000.bin -------------------------------------------------------------------------------- /lwip/test/fuzz/output_to_pcap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$1" ] 4 | then 5 | echo "This script will make pcap files from the afl-fuzz crash/hang files" 6 | echo "It needs hexdump and text2pcap" 7 | echo "Please give output directory as argument" 8 | exit 2 9 | fi 10 | 11 | for i in `ls $1/crashes/id*` 12 | do 13 | PCAPNAME=`echo $i | grep pcap` 14 | if [ -z "$PCAPNAME" ]; then 15 | hexdump -C $i > $1/$$.tmp 16 | text2pcap $1/$$.tmp ${i}.pcap 17 | fi 18 | done 19 | for i in `ls $1/hangs/id*` 20 | do 21 | PCAPNAME=`echo $i | grep pcap` 22 | if [ -z "$PCAPNAME" ]; then 23 | hexdump -C $i > $1/$$.tmp 24 | text2pcap $1/$$.tmp ${i}.pcap 25 | fi 26 | done 27 | rm -f $1/$$.tmp 28 | 29 | echo 30 | echo "Created pcap files:" 31 | ls $1/*/*.pcap 32 | -------------------------------------------------------------------------------- /lwip/test/unit/Filelists.cmake: -------------------------------------------------------------------------------- 1 | # This file is indended to be included in end-user CMakeLists.txt 2 | # include(/path/to/Filelists.cmake) 3 | # It assumes the variable LWIP_DIR is defined pointing to the 4 | # root path of lwIP sources. 5 | # 6 | # This file is NOT designed (on purpose) to be used as cmake 7 | # subdir via add_subdirectory() 8 | # The intention is to provide greater flexibility to users to 9 | # create their own targets using the *_SRCS variables. 10 | 11 | set(LWIP_TESTDIR ${LWIP_DIR}/test/unit) 12 | set(LWIP_TESTFILES 13 | ${LWIP_TESTDIR}/lwip_unittests.c 14 | ${LWIP_TESTDIR}/api/test_sockets.c 15 | ${LWIP_TESTDIR}/arch/sys_arch.c 16 | ${LWIP_TESTDIR}/core/test_def.c 17 | ${LWIP_TESTDIR}/core/test_mem.c 18 | ${LWIP_TESTDIR}/core/test_netif.c 19 | ${LWIP_TESTDIR}/core/test_pbuf.c 20 | ${LWIP_TESTDIR}/core/test_timers.c 21 | ${LWIP_TESTDIR}/dhcp/test_dhcp.c 22 | ${LWIP_TESTDIR}/etharp/test_etharp.c 23 | ${LWIP_TESTDIR}/ip4/test_ip4.c 24 | ${LWIP_TESTDIR}/mdns/test_mdns.c 25 | ${LWIP_TESTDIR}/mqtt/test_mqtt.c 26 | ${LWIP_TESTDIR}/tcp/tcp_helper.c 27 | ${LWIP_TESTDIR}/tcp/test_tcp_oos.c 28 | ${LWIP_TESTDIR}/tcp/test_tcp.c 29 | ${LWIP_TESTDIR}/udp/test_udp.c 30 | ) 31 | -------------------------------------------------------------------------------- /lwip/test/unit/api/test_sockets.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_SOCKETS_H 2 | #define LWIP_HDR_TEST_SOCKETS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *sockets_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/core/test_def.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_DEF_H 2 | #define LWIP_HDR_TEST_DEF_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *def_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/core/test_mem.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_MEM_H 2 | #define LWIP_HDR_TEST_MEM_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *mem_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/core/test_netif.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_NETIF_H 2 | #define LWIP_HDR_TEST_NETIF_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *netif_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/core/test_pbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_PBUF_H 2 | #define LWIP_HDR_TEST_PBUF_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *pbuf_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/core/test_timers.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_TIMERS_H 2 | #define LWIP_HDR_TEST_TIMERS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *timers_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/dhcp/test_dhcp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_DHCP_H 2 | #define LWIP_HDR_TEST_DHCP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* dhcp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/etharp/test_etharp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_ETHARP_H 2 | #define LWIP_HDR_TEST_ETHARP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* etharp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/ip4/test_ip4.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_IP4_H 2 | #define LWIP_HDR_TEST_IP4_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* ip4_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/lwip_check.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_LWIP_CHECK_H 2 | #define LWIP_HDR_LWIP_CHECK_H 3 | 4 | /* Common header file for lwIP unit tests using the check framework */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #define FAIL_RET() do { fail(); return; } while(0) 11 | #define EXPECT(x) fail_unless(x) 12 | #define EXPECT_RET(x) do { fail_unless(x); if(!(x)) { return; }} while(0) 13 | #define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0) 14 | #define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL) 15 | 16 | typedef struct { 17 | TFun func; 18 | const char *name; 19 | } testfunc; 20 | 21 | #define TESTFUNC(x) {(x), "" # x "" } 22 | 23 | /* Modified function from check.h, supplying function name */ 24 | #define tcase_add_named_test(tc,tf) \ 25 | _tcase_add_test((tc),(tf).func,(tf).name,0, 0, 0, 1) 26 | 27 | /** typedef for a function returning a test suite */ 28 | typedef Suite* (suite_getter_fn)(void); 29 | 30 | /** Create a test suite */ 31 | Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown); 32 | 33 | #ifdef LWIP_UNITTESTS_LIB 34 | int lwip_unittests_run(void) 35 | #endif 36 | 37 | /* helper functions */ 38 | #define SKIP_POOL(x) (1 << x) 39 | #define SKIP_HEAP (1 << MEMP_MAX) 40 | void lwip_check_ensure_no_alloc(unsigned int skip); 41 | 42 | #endif /* LWIP_HDR_LWIP_CHECK_H */ 43 | -------------------------------------------------------------------------------- /lwip/test/unit/mdns/test_mdns.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_MDNS_H__ 2 | #define LWIP_HDR_TEST_MDNS_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* mdns_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/mqtt/test_mqtt.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_MQTT_H__ 2 | #define LWIP_HDR_TEST_MQTT_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* mqtt_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/tcp/test_tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_TCP_H 2 | #define LWIP_HDR_TEST_TCP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *tcp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/tcp/test_tcp_oos.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_TCP_OOS_H 2 | #define LWIP_HDR_TEST_TCP_OOS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *tcp_oos_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip/test/unit/udp/test_udp.c: -------------------------------------------------------------------------------- 1 | #include "test_udp.h" 2 | 3 | #include "lwip/udp.h" 4 | #include "lwip/stats.h" 5 | 6 | #if !LWIP_STATS || !UDP_STATS || !MEMP_STATS 7 | #error "This tests needs UDP- and MEMP-statistics enabled" 8 | #endif 9 | 10 | /* Helper functions */ 11 | static void 12 | udp_remove_all(void) 13 | { 14 | struct udp_pcb *pcb = udp_pcbs; 15 | struct udp_pcb *pcb2; 16 | 17 | while(pcb != NULL) { 18 | pcb2 = pcb; 19 | pcb = pcb->next; 20 | udp_remove(pcb2); 21 | } 22 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 0); 23 | } 24 | 25 | /* Setups/teardown functions */ 26 | 27 | static void 28 | udp_setup(void) 29 | { 30 | udp_remove_all(); 31 | lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT)); 32 | } 33 | 34 | static void 35 | udp_teardown(void) 36 | { 37 | udp_remove_all(); 38 | lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT)); 39 | } 40 | 41 | 42 | /* Test functions */ 43 | 44 | START_TEST(test_udp_new_remove) 45 | { 46 | struct udp_pcb* pcb; 47 | LWIP_UNUSED_ARG(_i); 48 | 49 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 0); 50 | 51 | pcb = udp_new(); 52 | fail_unless(pcb != NULL); 53 | if (pcb != NULL) { 54 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 1); 55 | udp_remove(pcb); 56 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 0); 57 | } 58 | } 59 | END_TEST 60 | 61 | 62 | /** Create the suite including all tests for this module */ 63 | Suite * 64 | udp_suite(void) 65 | { 66 | testfunc tests[] = { 67 | TESTFUNC(test_udp_new_remove), 68 | }; 69 | return create_suite("UDP", tests, sizeof(tests)/sizeof(testfunc), udp_setup, udp_teardown); 70 | } 71 | -------------------------------------------------------------------------------- /lwip/test/unit/udp/test_udp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_UDP_H 2 | #define LWIP_HDR_TEST_UDP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* udp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /nc_shell/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /nc_shell/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /prga/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(PRGA_SRCS 5 | ${INIT_ASM} 6 | src/main.c 7 | src/sockets.c 8 | ) 9 | 10 | add_cherios_executable(prga ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${PRGA_SRCS}) 11 | -------------------------------------------------------------------------------- /prga/include/lib.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "all.h" 32 | 33 | int socket(void); 34 | int bind(int socket, int port); 35 | void * recfrom(int socket); 36 | int sendto(int socket, void * msg); 37 | int connect(int socket, int port); 38 | 39 | -------------------------------------------------------------------------------- /pthread_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyelftools>=0.25 2 | -------------------------------------------------------------------------------- /secure_template/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${SECURE_INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM TEMPORAL_A LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /secure_template/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /secure_template/src/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "cheric.h" 32 | 33 | int main(register_t arg, capability carg) { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | src/webserver.c 9 | src/parser.c 10 | ) 11 | 12 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 13 | -------------------------------------------------------------------------------- /server/src/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "cheric.h" 32 | #include "webserver.h" 33 | #include "assert.h" 34 | 35 | int main(void) { 36 | handle_loop(); 37 | assert(0); 38 | while(1); 39 | } 40 | -------------------------------------------------------------------------------- /sha256/src/sha256_c.S: -------------------------------------------------------------------------------- 1 | #ifdef PLATFORM_mips 2 | #include "platform/mips/sha256.S" 3 | #else 4 | #include "platform/riscv/sha256.S" 5 | #endif -------------------------------------------------------------------------------- /sha256/src/sha256_k.S: -------------------------------------------------------------------------------- 1 | #define SHA_COPY 2 | #ifdef PLATFORM_mips 3 | #include "platform/mips/sha256.S" 4 | #else 5 | #include "platform/riscv/sha256.S" 6 | #endif 7 | -------------------------------------------------------------------------------- /snake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /socket_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /socket_test/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /template/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /template/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /template/src/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "cheric.h" 32 | 33 | int main(register_t arg, capability carg) { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /test1a/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(SRCS 5 | ${INIT_ASM} 6 | src/main.c 7 | ) 8 | 9 | add_cherios_executable(test1a ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 10 | -------------------------------------------------------------------------------- /test1a/include/lib.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "all.h" 32 | 33 | -------------------------------------------------------------------------------- /test1b/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(SRCS 5 | ${INIT_ASM} 6 | src/main.c 7 | ) 8 | 9 | add_cherios_executable(test1b ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 10 | -------------------------------------------------------------------------------- /test1b/include/lib.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "all.h" 32 | 33 | -------------------------------------------------------------------------------- /test2a/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(SRCS 5 | ${INIT_ASM} 6 | src/loop.S 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(test2a ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 11 | -------------------------------------------------------------------------------- /test2a/include/lib.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "all.h" 32 | 33 | -------------------------------------------------------------------------------- /test2b/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(SRCS 5 | ${INIT_ASM} 6 | src/loop.S 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(test2b ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) -------------------------------------------------------------------------------- /test2b/include/lib.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "all.h" 32 | 33 | -------------------------------------------------------------------------------- /test3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(SRCS 5 | ${INIT_ASM} 6 | src/fwd.S 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(test3 ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 11 | -------------------------------------------------------------------------------- /test3/include/lib.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2016 Hadrien Barral 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #include "all.h" 32 | 33 | -------------------------------------------------------------------------------- /top/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /unaligned_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /unsafe_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(ACT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(X_SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_executable(${ACT_NAME} ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${X_SRCS}) 11 | -------------------------------------------------------------------------------- /unsafe_test/include/template.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Lawrence Esswood 3 | * All rights reserved. 4 | * 5 | * This software was developed by SRI International and the University of 6 | * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 7 | * ("CTSRD"), as part of the DARPA CRASH research programme. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CHERIOS_TEMPLATE_H 32 | #define CHERIOS_TEMPLATE_H 33 | 34 | #endif //CHERIOS_TEMPLATE_H 35 | -------------------------------------------------------------------------------- /zlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ExternalProject) 2 | 3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(SRCS 6 | ${INIT_ASM} 7 | src/main.c 8 | ) 9 | 10 | add_cherios_module(zlib ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 11 | add_subdirectory(zlib) 12 | 13 | target_link_libraries(zlib CheriOS::LibZ) 14 | target_link_libraries(zlib CheriOS::LibUser) 15 | -------------------------------------------------------------------------------- /zlib/zlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(LIBZ_SRCS 2 | adler32.c 3 | crc32.c 4 | deflate.c 5 | infback.c 6 | inffast.c 7 | inflate.c 8 | inftrees.c 9 | trees.c 10 | zutil.c 11 | compress.c 12 | uncompr.c 13 | gzclose.c 14 | gzlib.c 15 | gzread.c 16 | gzwrite.c 17 | ) 18 | 19 | add_library(z STATIC ${LIBZ_SRCS}) 20 | 21 | add_library(CheriOS::LibZ ALIAS z) 22 | -------------------------------------------------------------------------------- /zlib/zlib/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/zlib/zlib/ChangeLog -------------------------------------------------------------------------------- /zlib/zlib/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | -@echo "Please use ./configure first. Thank you." 3 | 4 | distclean: 5 | make -f Makefile.in distclean 6 | -------------------------------------------------------------------------------- /zlib/zlib/dummy.h: -------------------------------------------------------------------------------- 1 | /* fixme: dummy header for zlib */ 2 | 3 | #ifndef __DUMMY_H 4 | #define __DUMMY_H 5 | 6 | #include "stdlib.h" 7 | #include "stdio.h" 8 | 9 | #pragma clang diagnostic ignored "-Wunused-parameter" 10 | #pragma clang diagnostic ignored "-Wswitch-enum" 11 | #pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" 12 | #pragma clang diagnostic ignored "-Wmacro-redefined" 13 | 14 | static inline int open(const char *path, int oflag, ... ) { 15 | panic("open"); 16 | } 17 | 18 | static inline int read( int handle, void *buffer, int nbyte ) { 19 | panic("read"); 20 | } 21 | 22 | static inline off_t lseek(int fd, off_t offset, int whence) { 23 | panic("lseek"); 24 | } 25 | 26 | static inline ssize_t write(int fd, const void *buf, size_t count) { 27 | panic("write"); 28 | } 29 | 30 | static inline int close(int fildes) { 31 | panic("close"); 32 | } 33 | 34 | int open(const char *path, int oflag, ... ); 35 | int read( int handle, void *buffer, int nbyte ); 36 | off_t lseek(int fd, off_t offset, int whence); 37 | ssize_t write(int fd, const void *buf, size_t count); 38 | int close(int fildes); 39 | #define O_WRONLY 0 40 | #define O_CREAT 0 41 | #define O_TRUNC 0 42 | #define O_APPEND 0 43 | #define O_RDONLY 0 44 | 45 | int sprintf ( char * str, const char * format, ... ); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /zlib/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /zlib/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /zlib/zlib/zlib.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTSRD-CHERI/cherios/ebffe983e8ed56bff515d93e53798360ba6c9151/zlib/zlib/zlib.3.pdf -------------------------------------------------------------------------------- /zlib/zlib/zlib.map: -------------------------------------------------------------------------------- 1 | ZLIB_1.2.0 { 2 | global: 3 | compressBound; 4 | deflateBound; 5 | inflateBack; 6 | inflateBackEnd; 7 | inflateBackInit_; 8 | inflateCopy; 9 | local: 10 | deflate_copyright; 11 | inflate_copyright; 12 | inflate_fast; 13 | inflate_table; 14 | zcalloc; 15 | zcfree; 16 | z_errmsg; 17 | gz_error; 18 | gz_intmax; 19 | _*; 20 | }; 21 | 22 | ZLIB_1.2.0.2 { 23 | gzclearerr; 24 | gzungetc; 25 | zlibCompileFlags; 26 | } ZLIB_1.2.0; 27 | 28 | ZLIB_1.2.0.8 { 29 | deflatePrime; 30 | } ZLIB_1.2.0.2; 31 | 32 | ZLIB_1.2.2 { 33 | adler32_combine; 34 | crc32_combine; 35 | deflateSetHeader; 36 | inflateGetHeader; 37 | } ZLIB_1.2.0.8; 38 | 39 | ZLIB_1.2.2.3 { 40 | deflateTune; 41 | gzdirect; 42 | } ZLIB_1.2.2; 43 | 44 | ZLIB_1.2.2.4 { 45 | inflatePrime; 46 | } ZLIB_1.2.2.3; 47 | 48 | ZLIB_1.2.3.3 { 49 | adler32_combine64; 50 | crc32_combine64; 51 | gzopen64; 52 | gzseek64; 53 | gztell64; 54 | inflateUndermine; 55 | } ZLIB_1.2.2.4; 56 | 57 | ZLIB_1.2.3.4 { 58 | inflateReset2; 59 | inflateMark; 60 | } ZLIB_1.2.3.3; 61 | 62 | ZLIB_1.2.3.5 { 63 | gzbuffer; 64 | gzoffset; 65 | gzoffset64; 66 | gzclose_r; 67 | gzclose_w; 68 | } ZLIB_1.2.3.4; 69 | 70 | ZLIB_1.2.5.1 { 71 | deflatePending; 72 | } ZLIB_1.2.3.5; 73 | 74 | ZLIB_1.2.5.2 { 75 | deflateResetKeep; 76 | gzgetc_; 77 | inflateResetKeep; 78 | } ZLIB_1.2.5.1; 79 | 80 | ZLIB_1.2.7.1 { 81 | inflateGetDictionary; 82 | gzvprintf; 83 | } ZLIB_1.2.5.2; 84 | -------------------------------------------------------------------------------- /zlib/zlib/zlib.pc.cmakein: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@INSTALL_LIB_DIR@ 4 | sharedlibdir=@INSTALL_LIB_DIR@ 5 | includedir=@INSTALL_INC_DIR@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /zlib/zlib/zlib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | sharedlibdir=@sharedlibdir@ 5 | includedir=@includedir@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /zlib_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 3 | 4 | set(SRCS 5 | ${INIT_ASM} 6 | src/main.c 7 | src/zlib.c 8 | ) 9 | 10 | add_cherios_executable(zlib_test ADD_TO_FILESYSTEM LINKER_SCRIPT sandbox.ld SOURCES ${SRCS}) 11 | -------------------------------------------------------------------------------- /zlib_test/src/zlib.c: -------------------------------------------------------------------------------- 1 | #include "namespace.h" 2 | #include "zlib.h" 3 | #include "syscalls.h" 4 | 5 | static void * zlib_ref = NULL; 6 | 7 | int ZEXPORT deflateInit_ OF((z_streamp strm, int level, 8 | const char *version, int stream_size)) { 9 | if(zlib_ref == NULL) { 10 | zlib_ref = namespace_get_ref(namespace_num_zlib); 11 | } 12 | return (int)message_send(level, stream_size, 0, 0, strm, (char *)version, NULL, NULL, zlib_ref, SYNC_CALL, 0); 13 | } 14 | 15 | int ZEXPORT deflate OF((z_streamp strm, int flush)) { 16 | return (int)message_send(flush, 0, 0, 0, strm, NULL, NULL, NULL, zlib_ref, SYNC_CALL, 1); 17 | } 18 | 19 | int ZEXPORT deflateEnd OF((z_streamp strm)) { 20 | return (int)message_send(0, 0, 0, 0, strm, NULL, NULL, NULL, zlib_ref, SYNC_CALL, 2); 21 | } 22 | --------------------------------------------------------------------------------