Full Title: I See Your AUTOSAR and Raise You “Constexpr Everything”. No Seriously, Everything. The Standard Library, Microkernel, Apps, and Unit Tests.
This presentation will walk the audience through how we implemented an AUTOSAR compliant Hypervisor with all of it’s code including the microkernel, apps and unit tests as a “constexpr” using C++20, all in open source. Are you worried about undefined behavior in your applications? Are you curious how far “constexpr everything” can be taken and how it benefits you, or what “constexpr everything” is? Do you work with AUTOSAR? Or are you curious how you would write a microkernel as a “constexpr”? If so, this presentation is for you.
The original goal of our project was to implement an AUTOSAR compliant hypervisor using a microkernel archeicture, designed specifically for US government and critical systems applications all in open source. The first problem we ran into was there were no, open source, AUTOSAR compliant implementations of the C++ standard library. There also were no static analysis tools in open source to verify AUTOSAR compliance. To solve this, we implemented our own AUTOSAR static analysis tool using Clang Tidy in open source as well as a portion of the C++ standard library (called the BSL) using C++20 to AUTOSAR specifications. Since C++20 was used, we decided to see just how far we could take the idea of “constexpr everything”. To our surprise, we were able to implement everything as a “constexpr”. The C++ code for the microkernel, the C++ code for the applications that run on top of this microkernel, and yes, all of the unit tests for everything with 100% code coverage. What this means is that our unit tests are executed at compile-time and they test everything from the page fault handler and ELF loader in the microkernel, to the tools that run on Windows or Linux. Not only does this ensure that undefined behavior is almost impossible for the entire project, it means that the compiler can verify both the syntax and the “logic” at compile time as the unit tests tell the compiler what the code is supposed to do.
“constexpr everything” will change the way you think about coding and C++. It’s not just about performance and compile-time scripting. Its a way to tell the compiler what your application is supposed to do. Combined with Metaprogramming, the future of C++ in safety critical systems is boundless. This presentation will walk the audience through our experience of how we implemented everything as a “constexpr” and what the benefits of “constexpr everything” are to you and your projects from gaming and banking, to critical systems. This presentation will also cover how we overcame certain hurdles with “constexpr everything” in a real-world example, as well as how we implemented AUTOSAR compliance in open source. Think it’s impossible to write a kernel as a “constexpr”? Be prepared to have some fun, learn some cool tricks and to have your mind blown!
Dr. Rian Quinn is a Senior Principal Investigator in the Trusted Information Systems Group at Assured Information Security, Inc. were he has focused on trusted computing and hypervisor related technologies for nearly 10 years. He holds a Ph.D. in Computer Engineering with specializations in Information Assurance and Computer Architectures from Binghamton University. He is a lead developer and co-founder of the Bareflank Hypervisor, and is an active member of several open source projects including OpenXT. Specialties: computer architectures, virtualization, operating systems, kernel programming, cyber security, and open source.
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com