diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b3a3f145..bc1bf2f246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,156 +1,73 @@ -# uber eXtensible Micro-Hypervisor Framework (uberXMHF) - -## Changelog - -* Version 6.1.0 - - * Features - * uxmhf: add support for Intel 1st generation core CPU (HP 2540p laptop platform) - - * Documentation - * uxmhf: revise documentation to clarify OS and boot-loader support - * uxmhf: clarify documentation on required OS kernel command line parameters and module blacklistings - - -* Version 6.0.0 - - * Features - * uxmhf: add new üapp uhcalltest for testing hypercalls; add corresponding rich guest app for linux - * uxmhf: add configure option --with-debug-serial-maxcpus to specify platform cores while in debugging mode - * uxmhf: add support for non linear CPU id mappings setup by some BIOSes - * uxmhf-rpi3: add support for receive functionality (getc) within uart.h - * uxmhf-rpi3: add PL011 full UART uart_getc implementation - * uxmhf-rpi3: add support for PL011 full UART hardware flow control functionality - * uxmhf-rpi3: add support for mailboxes - * uxmhf-rpi3: add support for PL011 full UART based debugging - * uxmhf-rpi3/uapps: add new uberapp (stateDB) to track state entries updates (bounded by a max. value) via in-memory database. - * uxmhf-rpi3/uapps: add uapp-pvdriver-uart, a para-virtualized guest OS UART driver backend - * uxmhf-rpi3/uapps: add uapp-uagent, an uberapp that takes an input buffer and returns the encrypt/decrypt of the data based upon an AES secret key. - * uxmhf-rpi3/uapps: add new uapp (uhsign) for protected HMAC calculation - * uxmhf-rpi3/uapps: switch to using sha256 within uapp-uhsign - * uxmhf-rpi3/rgapps/linux - revise libuhcall and uhcallkmod and migrate the va2pa function from user space to kernel driver. - * uxmhf-rpi3/libs: add sha256 support within libxmhfcrypto - * uxmhf-rpi3/rgapps/linux/libs: add kernel library libkhcall for performing hypercall from OS kernel mode - - * Documentation - * revise top-level README with instructions on documentation build - * add software requirements within a top-level index toctree - * uxmhf: revise build and installation documentation to clarify grub and debug settings, kernel command line parameters, and modules that need to be blacklisted currently - * uxmhf: revise instructions to add a new üapp and clarify OS kernel boot configuration details - * uxmhf: migrate documentation from markdown to restructured text syntax - * uxmhf-rpi3: add information to turn on UART debugging and select mini/PL011 UART during build - * uxmhf-rpi3: add information to enable uhsign uberApp during build - * uxmhf-rpi3: add information about different USB to serial cabling for miniuart and PL011 UART based debugging - * uxmhf-rpi3: add documentation on how to enable and use uapp-uagent - * uxmhf-rpi3: revise documentation on how to enable and use uapp-pvdriver-uart - * uxmhf-rpi3: add stateDB uberapp build documentation - * uxmhf-rpi3: add documentation to describe libuhcall (user-mode) and libkhcall (kernel-mode) hypercall libraries - * uxmhf-rpi3: revise instructions to configure existing üapps and add new üapps - * uxmhf-rpi3: clarify OS kernel boot configuration details - * uxmhf-rpi3: migrate documentation from markdown to restructured text syntax - * xmhf: migrate documentation from markdown to restructured text syntax - - * Fixes - * uxmhf: revise xmhf-bootloader sources to cope with --disable-drt and --disable-dmap configure options - * uxmhf-rpi3: modify main.c to place uart_testrecv() inside a #ifdef to eliminate build errors if not configured for UART debugging - - * Build - * add sphinx based documentation build harness - * uxmhf-rpi3: revise build harness to include --enable-debug-uart, --enable-debug-uart-PL011, and --enable-uapp-uhsign configure options - * uxmhf-rpi3: autogenerate rpi3 config based on UART selection so we can enable/disable bluetooth UART accordingly - * uxmhf-rpi3: add docker container for building and installing uberXMHF on Raspberry Pi 3 - * uxmhf-rpi3: rework build configuration options to decouple --enable-debug-uart and --enable-uart-{pl011,mini} - - * Others - * uxmhf-rpi3: clean up and use debug printf interface throughout - * uxmhf-rpi3: add function declarations to header files to remove warnings about implicit function declarations. - * uxmhf-rpi3: clean up some unused variables - * uxmhf-rpi3: use top-level uart.h to bring in UART backend interfaces (mini or PL011 UART) - * uxmhf-rpi3: move code whitelisting functionality into common/ (as it is used by uapp-uhsign and uapp-uagent). - - -* Version 5.0 - * various documentation fixes - * rpi3-cortex_a53-armv8_32: refactored secure-boot, interrupt protection, - DMA protection, and FIQ reflection as modular build-time options - * rpi3-cortex_a53-armv8_32: fixed stability issues within core micro-hypervisor framework - * pc-intel-x86_32: migrated debug and uobject info library to core uberspark framework - * pc-intel-x86_32: migrated data types to be stdint compatible - * pc-intel-x86_32: removed micro-hypervisor specific dependencies on uobject info table - * pc-intel-x86_32: added new uobject uhmpgtbl to deal with hypervisor page tables for - unverified hypervisor uobjects - * pc-intel-x86_32: added new uobject iotbl to deal with hypervisor legacy I/O tables - for unverified hypervisor uobjects - * pc-intel-x86_32: revised exhub uobject to handle IDT initialization and operation - * pc-intel-x86_32: refactored build process to eliminate redundant passes - -* Version 4.1 - * added support for Ubuntu 16.04 LTS with Linux kernel 4.4.x 32-bits (CONFIG_X86_PAE=n) - * migrated uberobject manifests to JSON format - * various documentation updates - -* Version 4.0 - * first stand-alone uberXMHF release - * added Raspberry PI 3 hardware platform support - * consolidated past XMHF x86-32 AMD PC and x86-32 Intel PC (legacy) releases - * various documentation updates - -* Version 3.1 - * fixed uxmhf build errors - -* Version 3.0 - * added support for Frama-C Phosphorus-20170501 - * added support for Compcert 3.0.1 - * fixed error due to improper inclusion of xh_ssteptrace in the verification process - * minor build harness fixes and documentation updates - -* Version 2.0 - * separated uberspark, uberspark libraries and uxmhf verification/build processes - * refined and streamlined uberspark and uxmhf verification/build harness - * fixed minor errors in documentation and updates to reflect release changes - -* Version 1.0 - * initial release of uberXMHF x86-32 Intel PC - -* Version 0.2.2 - * various general documentation fixes and cleanup - * tee-sdk: added patches for newlib and openssl libraries and removed deprecated/non-working examples - * re-organized framework components and revised configuration/build harness and related documentation - * fixed build errors with gcc 4.6.3 - * xmhf-core: re-factored verification harness and added support for 64-bit CBMC - -* Version 0.2.1 - * tools: add scripts to deal with release tasks - * xmhf-core: refactor runtime build harness - * xmhf-core: add build debug information within generated binaries - * xmhf-core: segregate Dynamic Root-of-Trust and DMA protection logic and build configuration options - * xmhf-core: add support for upto 8 CPU cores - * xmhf-core: add XSETBV intercept handling on Intel platforms for CPUs with XSAVE capabilities - * xmhf-core: fix MTRR logic on Intel platforms to obtain required variable range MTRRs - * xmhf-core: fix issue related to physical/virtual address overlap for runtime - -* Version 0.2 - * xmhf-core: clarify documentation and add description for build configuration options and verification - * xmhf-core: add build configuration options --with-target-platform and --with-target-arch to choose target platform and CPU arch. - * xmhf-core: restructure core components and general cleanup - * xmhf-core: add XMHF/hypapp verification harness for verifying core memory integrity - * xmhf-core: fix build error with --enable-debug-vga configure option - -* Version 0.1.2 - * xmhf-core: stability improvements - we can now handle guest NMIs gracefully - * xmhf-core: stability improvements - we now support stock MTRR-enabled (linux) guest kernels on Intel platforms - * test-bed fixes, refactoring and improvements - now supporting 3.2.0-27-generic (and below) with ubuntu - * added documentation generator which takes in-tree markdown files and generates html output - * fixed build target install-bin to include correct destination path - -* Version 0.1.1 +Introduction +============ + +XMHF is an eXtensible and Modular Hypervisor Framework +that strives to be a +comprehensible and flexible platform for performing +hypervisor research and development. The framework allows others to +build custom (security-sensitive) hypervisor-based solutions +(called "hypapps"). + +XMHF is designed to achieve three goals – modular extensibility, +automated verification, and high performance. XMHF includes a +core that provides functionality common to many hypervisor-based security +architectures and supports extensions that augment the core with +additional security or functional properties while preserving the +fundamental hypervisor security property of memory integrity +(i.e., ensuring that the hypervisor’s memory is not modified by +software running at a lower privilege level). + +XMHF advocates a "rich" single-guest execution model where the +hypervisor framework supports only a single-guest and allows the +guest direct access to all performance-critical system devices and +device interrupts. + +XMHF currently runs on recent multicore x86 hardware +virtualized platforms with support for dynamic root of trust +and nested (2-dimensional) paging. The framework is capable of +running unmodified legacy multiprocessor capable OSes such as +Windows and Linux. + +Documentation is automatically generated from markdown files in the +code repository, and is viewable at http://xmhf.sourceforge.net/doc/ + + +Changelog +========= + + * 0.1 Initial Release + * 0.1.1 * Added TPM performance profiling. - * Stability improvements. + * Stability improvements (ticket-28 fixed). * Intercept handling now serialized in the core. * XMHF now builds and runs on Ubuntu 12.04 (precise). * Replaced LGPL tlsf implementation with public domain implementation. * Added design-documents. - -* Version 0.1 - * Initial Release - \ No newline at end of file + * 0.1.2 + * xmhf-core: stability improvements (ticket-73 fixed) - we can now handle guest NMIs gracefully + * xmhf-core: stability improvements (ticket-10 fixed) - we now support stock MTRR-enabled (linux) guest kernels on Intel platforms + * test-bed fixes, refactoring and improvements - now supporting 3.2.0-27-generic (and below) with ubuntu + * added documentation generator which takes in-tree markdown files and generates html output + * fixed build target install-bin to include correct destination path + * 0.2 + * xmhf-core: clarify documentation and add description for build configuration options and verification + * xmhf-core: add build configuration options --with-target-platform and --with-target-arch to choose target platform and CPU arch. + * xmhf-core: restructure core components and general cleanup + * xmhf-core: add XMHF/hypapp verification harness for verifying core memory integrity + * xmhf-core: fix build error with --enable-debug-vga configure option + * 0.2.1 + * tools: add scripts to deal with release tasks + * xmhf-core: refactor runtime build harness + * xmhf-core: add build debug information within generated binaries + * xmhf-core: segregate Dynamic Root-of-Trust and DMA protection logic and build configuration options + * xmhf-core: add support for upto 8 CPU cores (ticket-74) + * xmhf-core: add XSETBV intercept handling on Intel platforms for CPUs with XSAVE capabilities (ticket-74) + * xmhf-core: fix MTRR logic on Intel platforms to obtain required variable range MTRRs (ticket-74) + * xmhf-core: fix issue related to physical/virtual address overlap for runtime (ticket-31) + * 0.2.2 + * various general documentation fixes and cleanup + * tee-sdk: added patches for newlib and openssl libraries and removed deprecated/non-working examples + * re-organized framework components and revised configuration/build harness and related documentation + * fixed build errors with gcc 4.6.3 + * xmhf-core: re-factored verification harness and added support for 64-bit CBMC + diff --git a/COPYING.md b/COPYING.md index 401b39657a..0be5260ecf 100644 --- a/COPYING.md +++ b/COPYING.md @@ -1,11 +1,10 @@ -This repository includes code from multiple sources, under -different licenses including the top-level LICENSE. -The authoritative licenses and conditions -are in file-headers and notices in the individual sub-folders -and files. All the licenses and notices must be reproduced -any source or binary-only distribution. -(i.e., typical BSD-style requirement): +This repository includes several sub-projects, many of which use code +from multiple sources, under different licenses. The AUTHORITATIVE +licenses and conditions are in file-headers and notices in the +individual sub-projects. +For CONVENIENCE, we here attempt to summarize the state of +licensing for this repository. Our view on licensing ===================== @@ -26,7 +25,8 @@ legal entanglements. it be used more widely and have greater impact. For these reasons, code generated specifically for this project is -placed under a BSD-style license, as in the top-level LICENSE file. +placed under a BSD-style license, as in the accompanying [LICENSE](LICENSE) +file. We have attempted to minimize the incorporation of third party code that would place additional restrictions on how our code is used. We @@ -56,10 +56,1020 @@ Binary distribution There is currently some GPL-licensed code in this repository. See below. -GPL status of sub-folders +GPL status of sub-projects ========================== -./uxmhf/xmhf-uobjs/xc_newlog uberobject uses some GPL code for E1000 network hardware -interactions. +* xmhf: + No GPL. -./xmhf/ uses some GPL code as documented in ./xmhf/COPYING.md + * libbaremetal: + No GPL. + + * third-party: + No GPL. + +* trustvisor: + No GPL. + + * tee-sdk: + hypapps/trustvisor/tee-sdk/ports/newlib is GPLv2. Therefore, PALs + that link with newlib are necessarily GPLv2, including some of the + examples in hypapps/trustvisor/tee-sdk/examples. + +* lockdown: + The lockdown hypervisor itself is not GPL. Some third-party + tools may be, though. See lockdown/src/COPYING for a summary. + +* tools: + No GPL. + +Third party code in repository history +====================================== + +We attempt to summarize third-party code and their respective +licenses that appear somewhere in the history of this repository. +Note that these are no longer present in a checkout of the current +HEAD of the repository, but git always retrieves the exhaustive history. + +* OSLO (GPLv2), +* Putty (MIT license), +* OpenSSH (BSD), +* Linux kernel (GPLv2), +* Xen (GPLv2) +* Google Protocol Buffers (Apache 2.0) +* amtterm (GPLv2) (NOTE: A copy of amtterm's source code was accidentally + updated with our own headers in a now-defunct demo subdirectory of + TrustVisor. This was in error.) +* tlsf_malloc (special LGPL) + +Third party code in current HEAD as of 2013-10-21 +================================================= + +We attempt to summarize third-party code and their respective +license that appear in the current repository HEAD. + +* libtommath (WTFPL) +* libtomcrypto (WTFPL) +* Tboot (BSD-style) +* OpenSSL (BSD-style), +* newlib (GPL) +* tlsf.baisoku.org (public domain) + +Lockdown-specific: + +* RTFM Inc ssldump (http://www.rtfm.com/ssldump/) (BSD) +* LPCUSB, an USB device driver for LPC microcontrollers (BSD) +* LPC ARM processor runtime environment (no restrictions) +* Generic ARM CRC module by Gary S. Brown (no restrictions) + +Notices that must be reproduced +=============================== + +We attempt to catalogue license headers in source files that are +required to be included in any binary-only distribution (i.e., typical +BSD-style requirement): + +XMHF +---- + +---------------------------------------------------------------------- + + Copyright (c) 2003-2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- + + Copyright (c) 2007 Henric Jungheim + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---------------------------------------------------------------------- + +Lockdown +-------- + +---------------------------------------------------------------------- + /** + + Copyright (C) 1999-2000 RTFM, Inc. + All Rights Reserved + + This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla + and licensed by RTFM, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + + This product includes software developed by Eric Rescorla for + RTFM, Inc. + + 4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be + used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE. + + */ + +---------------------------------------------------------------------- + + /*- + ****************************************************************************** + * + * $RCSfile: $ + * $Revision: $ + * + * Header file for Philips LPC ARM Processors. + * Copyright 2004 R O SoftWare + * + * No guarantees, warrantees, or promises, implied or otherwise. + * May be used for hobby or commercial purposes provided copyright + * notice remains intact. + * + *****************************************************************************/ + +---------------------------------------------------------------------- + + /*- + LPCUSB, an USB device driver for LPC microcontrollers + Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +------------------------------------------------------------------- + +Automatically extracted +----------------------- + +The following are automatically extracted headers from files with +FreeBSD-style C-style license header comments starting with `/*-` (note +the dash). One way to identify such files: `egrep -rl '^\/\*-' > +filelist.txt` One way to do most of the heavy lifting (w/ a few false +positives): + + for i in `cat filelist.txt`; do \ + perl -n -e 'print "$_" if /\/\*-/ .. /\*\//;' $i; \ + done + +-------------------------------------------------------------------- + + /*- + ** Two Level Segregated Fit memory allocator, version 1.9. + ** Written by Matthew Conte, and placed in the Public Domain. + ** http://tlsf.baisoku.org + ** + ** Based on the original documentation by Miguel Masmano: + ** http://rtportal.upv.es/rtmalloc/allocators/tlsf/index.shtml + ** + ** Please see the accompanying Readme.txt for implementation + ** notes and caveats. + ** + ** This implementation was written to the specification + ** of the document, therefore no GPL restrictions apply. + */ + /*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz and Don Ahn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 + */ + /*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)ns16550.h 7.1 (Berkeley) 5/9/91 + * $FreeBSD: src/sys/dev/ic/ns16550.h,v 1.20 2010/01/11 04:13:06 imp Exp $ + */ + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: @(#)strtoul.c 8.1 (Berkeley) 6/4/93 + */ + /*- + * Copyright (c) 2001 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/sys/stdint.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + * $FreeBSD: stable/8/sys/i386/include/_limits.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: stable/8/sys/i386/include/endian.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 2001, 2002 Mike Barcroft + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Klaus Klein. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/i386/include/_stdint.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 2003 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/sys/_null.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1982, 1986, 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.6 (Berkeley) 2/19/95 + * $FreeBSD: stable/8/sys/sys/types.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 2002 Mike Barcroft + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * From: @(#)types.h 8.3 (Berkeley) 1/5/94 + * $FreeBSD: stable/8/sys/i386/include/_types.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)libkern.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/sys/libkern.h,v 1.60.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $ + */ + /*- + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + * $FreeBSD: stable/8/sys/i386/include/limits.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/sys/cdefs.h,v 1.102.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $ + */ + /*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Klaus Klein. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ + * $FreeBSD: stable/8/sys/i386/include/_inttypes.h 213956 2010-10-17 12:11:42Z marius $ + */ + /*- + * Copyright (c) 2002 Maxime Henrion + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/sys/stddef.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/sys/limits.h 219757 2011-03-18 22:35:48Z jilles $ + */ + /*- + * Copyright (c) 1982, 1988, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/sys/ctype.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 2002 Thomas Moestl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: stable/8/sys/sys/endian.h 199583 2009-11-20 15:27:52Z jhb $ + */ + /*- + * Copyright (c) 1986, 1988, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 + */ + /*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /*- + * Copyright (c) 2008 Damien Bergamini + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +------------------------------------------------------------ diff --git a/LICENSE b/LICENSE index 66636db72b..43ad96f45c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,46 @@ -See ./xmhf/LICENSE, ./uxmhf/LICENSE and ./uxmhf-rpi3/LICENSE for license -and copyright notices. +The following license and copyright notice applies to all content in +this repository where some other license does not take precedence. In +particular, notices in sub-project directories and individual source +files take precedence over this file. + +See COPYING for more information. + +eXtensible, Modular Hypervisor Framework (XMHF) +Copyright (c) 2009-2012 Carnegie Mellon University +Copyright (c) 2010-2012 VDG Inc. +All Rights Reserved. + +Developed by: XMHF Team + Carnegie Mellon University / CyLab + VDG Inc + http://xmhf.org + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the +distribution. + +Neither the names of Carnegie Mellon or VDG Inc, nor the names of +its contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/xmhf/Makefile.in b/Makefile.in similarity index 100% rename from xmhf/Makefile.in rename to Makefile.in diff --git a/README.rst b/README.rst deleted file mode 100644 index 9ac608fb65..0000000000 --- a/README.rst +++ /dev/null @@ -1,73 +0,0 @@ -uber eXtensible Micro-Hypervisor Framework (uberXMHF) -===================================================== - - -Introduction ------------- - -The uber eXtensible Micro-Hypervisor Framework (uberXMHF) is a formally -verifiable micro-hypervisor framework which forms the foundation for a -new class of (security-oriented) micro-hypervisor based applications -("uberapps") on commodity computing platforms. - -uberXMHF currently runs on both x86 (Intel and AMD) and ARM (Raspberry -PI) multi-core hardware virtualized platforms. The framework is capable -of running unmodified legacy multiprocessor capable OSes such as Windows -and Linux. - -Visit: http://uberxmhf.org for more information on how to download, -build, install, contribute and get involved. - - -Documentation -------------- - -Documentation sources are within ``docs/`` in reStructuredText (reST) -format and can be browsed using a simple text editor (start at -``docs/index.rst``). - -HTML version of the documentation can also be built locally using -``make clean`` followed by ``make docs_html`` within the ``docs/`` -folder. Load the resulting ``docs/_build/index.html`` into a browser of -your choice. - -Note that you will need a working installation of sphinx to build the -documentation within your development environment. For example, within -Ubuntu/Debian distributions the following will install sphinx: - -``sudo apt install python3-pip`` -``python3 -m pip install sphinx==2.2.0`` -``python3 -m pip install sphinx-jsondomain==0.0.3`` - -The formatted documentation can be read online at: -http://docs.uberxmhf.org - - -Software Requirements ---------------------- - -uberSpark (http://uberspark.org) is used to build and verify security -invariants of uberXMHF. - - -Contacts, Maintainers and Contributors --------------------------------------- - -- Amit Vasudevan [http://hypcode.org] -- uberXMHF: pc-intel-x86-32 (Intel PC), rpi3-cortex\_a53\_armv8\_32 - (Raspberry PI 3), and pc-lagacy-x86-32 (AMD PC, Intel PC (legacy)) -- libbaremetal and Lockdown - -- Zongwei Zhou -- TrustVisor and tee-sdk - -- Other contributors: Jonathan McCune, James Newsome, Ning Qu, and - Yanlin Li - - -Copying -------- - -The uberXMHF project comprises code from multiple sources, under -multiple open source licenses. See `COPYING.md `__ for -details. diff --git a/RELEASE b/RELEASE deleted file mode 100644 index 73bb5076ec..0000000000 --- a/RELEASE +++ /dev/null @@ -1,10 +0,0 @@ -Version: 6.1.0 -Release Tagline: you gotta have faith not in who you are, but who you can be -Release Date: 02-Apr-2021 -Release Notes:: - * Features - * uxmhf: add support for Intel 1st generation core CPU (HP 2540p laptop platform) - - * Documentation - * uxmhf: revise documentation to clarify OS and boot-loader support - * uxmhf: clarify documentation on required OS kernel command line parameters and module blacklistings diff --git a/xmhf/autogen.sh b/autogen.sh similarity index 100% rename from xmhf/autogen.sh rename to autogen.sh diff --git a/xmhf/configure.ac b/configure.ac similarity index 100% rename from xmhf/configure.ac rename to configure.ac diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 489e82c881..0000000000 --- a/docs/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# uberXMHF documentation makefile -# author: Amit Vasudevan (amitvasudevan@acm.org) -# - -UBERXMHF_DOC_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -SPHINXBUILD ?= sphinx-build -UBERXMHF_DOC_SOURCEDIR = $(UBERXMHF_DOC_PATH). -UBERXMHF_DOC_BUILDDIR = $(UBERXMHF_DOC_PATH)_build - -###### targets - -### common documentation build prep -.PHONY: docs_build_prep -docs_build_prep: - mkdir -p $(UBERXMHF_DOC_PATH)/_temp - mkdir -p $(UBERXMHF_DOC_PATH)/_build - mkdir -p $(UBERXMHF_DOC_PATH)/_themes - cd $(UBERXMHF_DOC_PATH)/_temp && git clone https://github.com/uberspark/uberspark-htmlcss-themes.git uberspark-htmlcss-themes.git - cd $(UBERXMHF_DOC_PATH)/_themes && ln -sf ../_temp/uberspark-htmlcss-themes.git/rtd_uberspark/sphinx_rtd_theme/ rtd_uberspark - -.PHONY: docs_pdf -docs_pdf: docs_build_prep - @$(SPHINXBUILD) -b latex "$(UBERXMHF_DOC_SOURCEDIR)" "$(UBERXMHF_DOC_BUILDDIR)" - @cd $(UBERXMHF_DOC_BUILDDIR) && make - -.PHONY: docs_html -docs_html: docs_build_prep - @$(SPHINXBUILD) -b html "$(UBERXMHF_DOC_SOURCEDIR)" "$(UBERXMHF_DOC_BUILDDIR)" - -.PHONY: clean -clean: - rm -rf $(UBERXMHF_DOC_PATH)_build - rm -rf $(UBERXMHF_DOC_PATH)_themes - rm -rf $(UBERXMHF_DOC_PATH)_temp \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 487515ff8a..0000000000 --- a/docs/conf.py +++ /dev/null @@ -1,105 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -project = 'überXMHF Documentation' -copyright = '2020, Amit Vasudevan' -author = 'https://uberxmhf.org' -release = 'Version: 6.0.0' - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. - -extensions = [ - 'sphinx.ext.autosectionlabel', - 'sphinxjsondomain' -] -autosectionlabel_prefix_document = True -autosectionlabel_maxdepth = 4 - - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_themes', '_temp'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# - -html_theme = 'rtd_uberspark' -html_theme_path = ["_themes", ] -html_theme_options = { - 'repository' : 'https://github.com/uberspark/uberxmhf', - 'style_external_links': True, - 'collapse_navigation' : False, - 'navigation_depth': 4, - - 'current_language' : 'en', - 'current_version' : 'latest', - - 'languages' : { - 'en' : '' - }, - - 'versions' : { - 'latest' : '' - }, - - 'downloads' : { - 'PDF' : '' - } - -} - - -# -- Options for LaTeX output --------------------------------------------- - -latex_engine = 'pdflatex' -latex_elements = { - 'papersize': 'letterpaper', - 'figure_align':'htbp', - 'pointsize': '12pt', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'uberxmhf_documentation.tex', project, - author, 'manual') -] - - - diff --git a/docs/general-swreq.rst b/docs/general-swreq.rst deleted file mode 100644 index a31ce33127..0000000000 --- a/docs/general-swreq.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. uberXMHF general software requirements - author: Amit Vasudevan (amitvasudevan@acm.org) - -.. include:: /macros.rst - -General Software Requirements -============================= - -Unless otherwise specified the development environment of choice is -Ubuntu 16.04.x LTS 64-bit. This can either be a Virtual Machine (VM) (e.g., VirtualBox) or a -container (e.g., Windows WSL and/or Docker). As of this writing, the Ubuntu 16.04.x LTS VM ISO -image is available at: - -.. parsed-literal:: - - http://releases.ubuntu.com/16.04/ubuntu-16.04.6-desktop-amd64.iso - -You will need to first perform an ``update`` to download the latest package -lists from the repositories as shown below: - -:: - - sudo apt-get update - -After the update completes, you will need to install the following base -packages required for development as shown below: - -:: - - sudo apt-get install git gcc binutils autoconf - sudo apt-get install gcc-multilib - sudo apt-get install make unzip - - -.. _swreqs_documentation: - -Optionally, you will need to install Latex, Python and Sphinx in order to -generate the documentation locally for |uxmhf|. More specifically, you will need -to perform the following operations: - -:: - - sudo apt install python3 python3-pip - sudo apt install texlive-latex-recommended texlive-fonts-recommended - sudo apt install texlive-latex-extra latexmk - pip3 install -U 'Sphinx==2.2.0' - - -The documentation can be generated by the following commands: - -:: - - cd docs - make clean - makd docs_html - -Upon successful build, the documentation can be viewed in a browser by -opening ``docs/_build/index.html`` - - - diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 15f9331423..0000000000 --- a/docs/index.rst +++ /dev/null @@ -1,71 +0,0 @@ -.. uberXMHF documentation master index - author: Amit Vasudevan (amitvasudevan@acm.org) - -.. include:: /macros.rst - -Welcome to |uxmhflong|'s documentation! -======================================= - -The |uxmhflong| (|uxmhf|) is a compositionally verifiable, extensible, micro-hypervisor framework for -commodity platforms advocating the design and development of a new class of security-oriented -micro-hypervisor based applications (“|uberapps|”). - -|uxmhf| is designed to achieve three goals: modular extensibility, automated (compositional) verification, and -high performance. - -|uxmhf| includes a core that provides functionality common to many hypervisor-based security architectures and -supports extensions that augment the core with additional security or functional properties while preserving -the fundamental hypervisor security property of memory integrity (i.e., ensuring that the hypervisor’s memory is -not modified by software running at a lower privilege level). - -|uxmhf| advocates a “rich” commodity single-guest execution model (uberguest) where the hypervisor framework -supports only a single, commodity guest OS and allows the guest direct access to all performance-critical system -devices and device interrupts. In principle, the uberguest could also be a traditional hypervisor/VMM. - -|uxmhf| currently runs on both x86 (Intel and AMD) and ARM (Raspberry PI) multi-core hardware virtualized -platforms with support for nested (2-dimensional) paging. The framework is capable of running unmodified -legacy multiprocessor capable OSes such as Linux and Windows. - -This documentation describes the details on the supported hardware platforms, -supported OSes, building, verifying, installing and debugging of the -framework and associated components. - -.. toctree:: - :maxdepth: 2 - - general-swreq.rst - -.. toctree:: - :maxdepth: 2 - :caption: PC Intel x86 32-bit: - - pc-intel-x86_32/hw-requirements - pc-intel-x86_32/supported-os - pc-intel-x86_32/build/intro.rst - pc-intel-x86_32/installing - pc-intel-x86_32/debugging - - -.. toctree:: - :maxdepth: 2 - :caption: Raspberry Pi3 ARMv8 32-bit: - - rpi3-cortex_a53-armv8_32/hw-requirements - rpi3-cortex_a53-armv8_32/supported-os - rpi3-cortex_a53-armv8_32/build/intro.rst - rpi3-cortex_a53-armv8_32/installing - rpi3-cortex_a53-armv8_32/debugging - - -.. toctree:: - :maxdepth: 2 - :caption: Legacy PC AMD/Intel x86 32-bit: - - pc-legacy-x86_32/hw-requirements - pc-legacy-x86_32/supported-os - pc-legacy-x86_32/verify-build - pc-legacy-x86_32/installing - pc-legacy-x86_32/debugging - pc-legacy-x86_32/uberapp-trustvisor - pc-legacy-x86_32/uberapp-lockdown - diff --git a/docs/macros.rst b/docs/macros.rst deleted file mode 100644 index e684028e3a..0000000000 --- a/docs/macros.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. |uxmhf| replace:: überXMHF -.. |uberxmhf| replace:: überXMHF -.. |uxmhflong| replace:: über eXtensible Micro-Hypervisor Framework -.. |uberxmhflong| replace:: über eXtensible Micro-Hypervisor Framework - -.. |coss| replace:: CoSS -.. |cosslong| replace:: Commodity System Software - -.. |uberapp| replace:: überApp -.. |uberapps| replace:: überApps -.. |uberappuhvext| replace:: überApp micro-hypervisor extension - -.. |uobj| replace:: üobject -.. |uobject| replace:: üobject -.. |uobjs| replace:: üobjects -.. |uobjects| replace:: üobjects - - -.. |br| raw:: html - -
\ No newline at end of file diff --git a/docs/pc-intel-x86_32/build/adding-uapps.rst b/docs/pc-intel-x86_32/build/adding-uapps.rst deleted file mode 100644 index 2977a92451..0000000000 --- a/docs/pc-intel-x86_32/build/adding-uapps.rst +++ /dev/null @@ -1,72 +0,0 @@ -.. include:: /macros.rst - - -Adding new |uberapps| -===================== - -Integrating a new |uberapp| into the micro-hypervisor requires the following -integration pieces: - -1. Create directory for |uberapp| functionality (e.g., ``xh_newapp``) within - the ``xmhf-uobjs`` folder - - * ``xh_newapp.gsm`` defines key attributes of the |uberapp| - * ``xhnewapp_main.c`` is used to invoke different operations (e.g., initialize, hypercall, shutdown, etc.). Where each of these opertions has a related file (``xhnewapp_hcbinit.c``) - - -2. To integrate the |uberapp| add references in the following locations: - - * Add ``xh_newapp`` to the list in ``xmhf-uobjs/UOBJLIST.in`` - * Add a ``DEFINE XMHFGEEC_SLAB_XH_NEWAPP`` to ``include/xmhf-config.h`` - * Add a table entry to ``static xc_hypapp_info_t _xcihub_hypapp_info_table[]`` corresponding - to the operations your hypapp performs in ``xmhf-uobjs/include/xc.h`` - * Add ``xh_newapp`` to the list of ``uobj-callees`` in ``xmhf-uobjs/xc_init/sc_init.gsm`` and ``xmhf-uobj/xc_ihub/xc_ihub.gsm`` - - -3. Ensure that your reconfigure prior to building (this is required to - rewrite ``xmhf-uobjs/UOBJLST`` that is used by the ``Makefile``). Follow the - steps in :doc:`uberXMHF (pc-intel-x86_32) Veryfying and Building ` - - -4. Add a test program that exercises your |uberapp| in ``xmhf-rgapps/linux`` - - * Create a directory for the test program (``rgapp-newapp``) that includes - a ``Makefile`` and the testprogram (``rgapp-newapp.c``). - * This test program will need to call ``__vmcall(eax, ebx, edx, ecx)``, - where ``eax`` is the hypercall ID, ``ebx`` is the high order 32-bit of the - physical address, ``edx`` is the low-order 32-bit of the - physical address (e.g., of an up to 4KB buffer being passed to the |uberapp|), - and ``ecx`` is variable based upon the |uberapp|. - * This test program needs to convert the data buffer being sent to the - |uberapps| from a virtual to a physical address. Some approaches for - this (such as reading ``/proc/self/pagemap``) require root permissions. - - -5. Run the test program (using permissions as required, see above). - -``xh_uhcalltest`` is an example |uberapp| that follows the above steps to -demonstrate a simple hypercall handling functionality. The corresponding -rich-guest application is found within ``xmhf-rgapps/linux/rgapp-uhcalltest``. - - -.. note:: - Currently, the preferred method of adding |uberapps| is to switch out an - existing |uberapp| - (to preserve the memory mapping). By default the following |uberapps| are - enabled: ``syscalllog``, ``hyperdep``, and ``ssteptrace``. - Thus to add a new |uberapp|, one would replace one of the above with the - new |uberapp|. - -.. note:: - To expand the number of |uberapps| that can be enabled, the memory map must - be expanded. This requires changing the size within ``include/xmhf-config.h`` - by modifying definitions such as ``XMHFGEEC_xxx_{BASE/MAX}_IDX``; - and `uxmhf-common.mk.in`` by modifying exports such as ``UXMHF_TOTAL_xxSLABS``, - ``XMHF_CONFIG_LOADADDR``, ``XMHF_CONFIG_LOADMAXSIZE``, and ``XMHF_CONFIG_LOADMAXADDR``. - -.. note:: - The folloinwg are default naming conventions for |uobjs| within the - micro-hypervisor: - * xc = uberXMHF core - * xh = uberXMHF hypapps - * xg = uberXMHF Guest diff --git a/docs/pc-intel-x86_32/build/build-core.rst b/docs/pc-intel-x86_32/build/build-core.rst deleted file mode 100644 index 13d72eaa21..0000000000 --- a/docs/pc-intel-x86_32/build/build-core.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. include:: /macros.rst - -Build Micro-Hypervisor Core Framework -===================================== - -Execute the following, in order, within the ``uxmhf/`` folder in the root -tree of the sources: - -#. - Generate the configure script - - ``./bsconfigure.sh`` - - -#. - Configure the serial debug output - - ``./configure --enable-debug-serial= --with-debug-serial-maxcpus=`` - - replace ```` with the system serial port number (e.g., ``0x3f8`` for ``COM1``). - replace ```` with the number of cores on the platform that will run uxmhf. Note, that this is required when serial debugging is enabled. Also, it is not recommended to use tools such as ``nproc`` as the number of cores may differ between the build and target systems. - - -#. Building the uberobject binaries and the final hypervisor image - -.. code-block:: bash - - ``make uxmhf-image`` - -If everything goes well then a final hypervisor image ``xmhf-x86-vmx-x86pc.bin.gz`` will be generated. Copy this to the target machine's ``/boot/`` diff --git a/docs/pc-intel-x86_32/build/build-swreq.rst b/docs/pc-intel-x86_32/build/build-swreq.rst deleted file mode 100644 index 69dd04e64e..0000000000 --- a/docs/pc-intel-x86_32/build/build-swreq.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. include:: /macros.rst - -Software Requirements and Dependencies -====================================== - -The uberSpark development and verification framework is required to -verify the micro-hypervisor and and build the micro-hypervisor binaries. -It is available at: `https://uberspark.org `_\ ). - -.. note:: - überSpark v6.0.0 (Current Generation Toolkit) is required. - -.. note:: - These tools require a 64-bit environment, so the micro-hypervisor cannot - be built on the ``target`` platform where it is installed and runs. diff --git a/docs/pc-intel-x86_32/build/build-verify.rst b/docs/pc-intel-x86_32/build/build-verify.rst deleted file mode 100644 index 6559b87179..0000000000 --- a/docs/pc-intel-x86_32/build/build-verify.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. include:: /macros.rst - - -Verfying -======== - -Execute the following, in order, within the ``uxmhf/`` folder in the root -tree of the sources: - - -#. - Prepare for verification - - ``./bsconfigure.sh`` - - ``./configure --disable-debug-serial`` - - ``make uxmhf-verifyuobjs-prep`` - - -#. - Verifying individual uberobjects - - ``cd xmhf-uobjs/`` - - ``make verify`` - - ``cd ../..`` - - replace ```` with the uberobject directory name (e.g., ``xh_hyperdep``\ ) - - -#. - Verifying all the uberobjects - - ``make uxmhf-verifyuobjs-all`` diff --git a/docs/pc-intel-x86_32/build/intro.rst b/docs/pc-intel-x86_32/build/intro.rst deleted file mode 100644 index 9ee04b879a..0000000000 --- a/docs/pc-intel-x86_32/build/intro.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. include:: /macros.rst - - -.. _uxmhfx86-build-intro: - -Verifying and Building -====================== - -Building comprises of verifying and building the micro-hypervisor core -configured with selected functionality corresponding to |uberapp| micro-hypervisor extensions. - -An |uberapp| comprises of a legacy guest OS application -(found within ``uxmhf/xmhf-rgapps/linux``) -and a micro-hypervisor extension (found within ``uxmhf/xmhf-uobjs/xh_*``) - -.. toctree:: - :maxdepth: 4 - - Software Requirements and Dependencies - Verifying - Build micro-hypervisor core framework - Adding new überApps \ No newline at end of file diff --git a/docs/pc-intel-x86_32/debugging.rst b/docs/pc-intel-x86_32/debugging.rst deleted file mode 100644 index 6b6cca6444..0000000000 --- a/docs/pc-intel-x86_32/debugging.rst +++ /dev/null @@ -1,108 +0,0 @@ -.. include:: /macros.rst - - -Debugging -========= - -Terminology ------------ - - -* ``host system`` -- system where the serial log is collected and examined. -* ``target system`` -- system where XMHF runs and ouputs debug information via the serial port. - - -Debugging Setup ---------------- - -XMHF debugging is done primarily via the serial port. -See :doc:`Installing uberXMHF (pc-intel-x86_32) ` for how to pass serial -port configuration parameters to XMHF. - -You can use ``dmesg | grep ttyS`` on a Linux guest OS on the target -system to examine the serial ports that the target system recognizes. - -For machines without a physical -serial port (e.g., laptops), you may leverage Intel Active Management -Technology (AMT) Serial-Over-LAN (SOL) capability. AMT SOL exposes -a serial port to the underlying platform once enabled (typically in -the BIOS). - -Serial Debuging without AMT -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -* - Connect the ``host system`` and the ``target system`` via a NULL serial - cable. - -* - On the ``target system`` ensure that you pass the correct serial port - configuration parameters to XMHF (see :doc:`Installing uberXMHF (pc-intel-x86_32) `\ ). - A typical non-AMT configuration parameter will be similar to this: ``serial=115200,8n1,0x3f8`` - -* - On the ``host system`` run a terminal emulation program such as ``minicom`` (Ubuntu) - or ``hyperterminal`` (Windows). Ensure that the serial port configuration baud rate, parity, data and stop bits match (e.g., ``115200, 8n1``\ ) - -Serial Debugging with AMT -^^^^^^^^^^^^^^^^^^^^^^^^^ - -You will typically need to enable AMT in the BIOS/firmware of the ``target system`` . -Since various BIOSes expose AMT in different ways, we will use the -HP EliteBook 8540p/2540p laptop as a running example; the AMT specific instructions -probably need a little adaptation on other platforms running AMT. - - -* - Connect the ``host system`` and the ``target system`` via an ethernet - cable. This can be a cross-over cable (for direct connection) or a - straight cable (if going via a switch/router). - -* - It is best not to make AMT accessible from an open network, since by default there is no encryption for password authentication. - It seems possible to enable encryption and stronger authentication, but for our example we will assume a private network setup. - In our example, we statically configure the ``host system`` and - ``target system`` to be on the private ``192.168.0.0`` network. - -* - Enable AMT in the BIOS/firmware on the ``target system``. On the 8540p, you need to turn on - ``system_config -> amt_options -> firmware_verbosity -> setup_prompt``. - -* - Once AMT is enabled, you should see an AMT prompt during boot of the ``target system``. - Enter the AMT configuration; on the 8540p, hit - ``Ctrl-p`` to enter AMT configuration. The default password is - 'admin'. Once you've logged in: - - - * **You'll be forced to change the admin password**. Take care not - lose or compromise this password! The system will enforce some - password rules. See this `AMT Howto `_ for more information. - * **Setup the AMT IP**. In our example, we statically configure the - ``target system`` to have the IP ``192.168.0.2`` - * **Activate the network** - * **Ensure serial-over-lan (SOL) is enabled** - * **Enable ``legacy redirection mode`` (or ``SMB (Small Business) - management mode``\ )** This enables a simpler network - protocol. You'll need it to use ``amtterm``. - -* - On the ``target system`` ensure that you pass the correct serial port - configuration parameters to XMHF (see :doc:`Installing uberXMHF (pc-intel-x86_32) `\ ). - A typical AMT serial configuration parameter will be similar to this: ``serial=115200,8n1,0x6080`` - -* - On the ``host system``\ , install ``amtterm`` to obtain the serial debugging - messages - - - * - Use amtterm 1.3 or higher. Older versions have bugs that effect - the ability to log output, and have more frequent disconnections. - It is available from the `amtterm git repository `_ - or `amtterm releases directory `_. - - * - Connect to the ``target system`` by using the following command: ``./amtterm 192.168.0.2 -p 'YourAMTpassword' | tee output-log.txt``. - Note: you may have to bring up the ethernet interface on the ``host system`` prior to issuing the above command. This can be done - via ``sudo ifconfig eth0 192.168.0.1`` (assuming the ``host system`` IP is ``192.168.0.1``\ ). diff --git a/docs/pc-intel-x86_32/hw-requirements.rst b/docs/pc-intel-x86_32/hw-requirements.rst deleted file mode 100644 index 328c1e0959..0000000000 --- a/docs/pc-intel-x86_32/hw-requirements.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. include:: /macros.rst - - -Hardware Requirements -===================== - -* **A TPM (v1.2 or above)** The BIOS feature is often called something like "embedded security device" - -* **Hardware Virtualization extensions** - - * Intel Virtualization Technology (VT-x) - -* **Hardware Support for DMA Isolation** - - * Intel Virtualization Technology for Directed I/O (VT-d) - -* **2nd-level page tables** Typically turned on implicitly along with Virtualization extensions, if the processor supports it. - - * Intel Extended Page Tables (EPT) - -* **Dynamic root of trust** - - * Intel Trusted Execution Technology (TXT). - -.. note:: - When purchasing a new machine, do *not* take it for granted that any - newer Intel will have the necessary capabilities. Check Intel processor - capabilities at: http://ark.intel.com/ diff --git a/docs/pc-intel-x86_32/installing.rst b/docs/pc-intel-x86_32/installing.rst deleted file mode 100644 index 2ec8f90f60..0000000000 --- a/docs/pc-intel-x86_32/installing.rst +++ /dev/null @@ -1,182 +0,0 @@ -.. include:: /macros.rst - - -Installing -========== - -Prerequisites -------------- - -As a first step, check the :doc:`uberXMHF (pc-intel-x86_32) Hardware Requirements `\ , and -be sure to enable the corresponding BIOS options (enable TPM, enable VT-x, enable VT-d, and enable TXT--often many of these are disabled by default in the BIOS). -Also make sure your BIOS is up to date; you could ruin your motherboard if your BIOS is buggy. -Secondly, ensure that you are running one of the supported -guest operating systems (see :doc:`uberXMHF (pc-intel-x86_32) Supported Guest Operating Systems `\ -- 32-bit page tables, blacklisted kernel modules ). -Thirdly, ensure you have copied the mico-hypervisor (``xmhf-x86-vmx-x86pc.bin.gz``) and the SINIT module (`Intel TXT webpage `_) into your `/boot/` directory. -Lastly, configure your system to boot uberXMHF as described below. - - -Configure target system to boot uberXMHF ----------------------------------------- - -You will need to install Grub 1, if you haven't already. On most -modern Linux distributions, you will need to downgrade from Grub 2. On -Windows machines without a Linux installation, you will need to -install Grub. This can be done by installing a minimal Linux -installation, which will typically take care of non-destructively -repartitioning for you. - -Downgrade from Grub 2 to Grub 1 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Booting uberXMHF is currently only supported using Grub 1. If Grub 2 is already -installed (as it typically is on recent Linux distributions), you will -need to downgrade to Grub 1. - -The following commands accomplish the above task on Ubuntu: - -.. code-block:: bash - - # remove all GRUB 2 files (answer yes to any questions) - sudo apt-get purge grub-pc grub-common os-prober - sudo apt-get purge grub-gfxpayload-lists - sudo apt-get install grub - # If asked about creating a /boot/grub/menu.lst answer yes - sudo update-grub - grub-install /dev/sda - - -You should have an automatically filled in ``/boot/grub/menu.lst`` with entries for any kernels installed on the machine. While unlikely, check this file for any lines attempting to load GRUB 2 (such as the snippet below): - -.. code-block:: bash - - title Chainload into GRUB 2 - root b5912383-7f9e-4911-b51d-b14ce8cea70b - kernel /boot/grub/core.img - - -For further details about downgradeing GRUB, please refer to the following posts on `downgrading GRUB for Ubuntu `_ and `downgrading GRUB for Debian `_ respectively. - -Get the correct SINIT module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -uberXMHF launches itself with a *dynamic root of trust*. On Intel -platforms, this requires a signed SINIT module provided by Intel, that -matches your platform CPU and chipset. - -SINIT modules can be found here: -http://software.intel.com/en-us/articles/intel-trusted-execution-technology/ - -You can determine the appropriate SINIT module by determining your CPU's ``Product Collection`` and ``Code Name``. If unsure about these details. First, find your CPU's model name (``cat /proc/cpuinfo | grep 'model name'``). Second, use the CPU model to search `Intel's product specifications `_. You should now have your CPU's ``Product Collection`` and ``Code Name``, which you can use to identify the appropriate `SINIT module `_. Note, as of the time of writing, there was a second table at the bottom of the page with the attached SINIT modules (in case the links in the main table do not work). - -Ensure that the ``.BIN`` from this module is copied into your ``/boot/`` directory. - -Building and Installing uberXMHF binaries -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If you haven't already built and installed uberXMHF, -see :doc:`Verifying and Building uberXMHF (pc-intel-x86_32) ` - -Ensure that the ``xmhf-x86-vmx-x86pc.bin.gz`` is copied into your ``/boot/`` directory. - -Adding a Grub entry to boot Linux -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -You will need to add a Grub entry to ``/boot/grub/menu.lst``. To ensure -that it doesn't get clobbered, put it **outside** the **AUTOMAGIC KERNEL -LIST** (i.e., append it to the end of the file). - -To boot a Linux guest, we create a grub entry that loads the -micro-hypervisor, and then re-loads grub. When booting the machine, first -choose the uberXMHF entry, and then choose a normal Linux entry. - -A grub entry for uberXMHF should look something like this: - -.. code-block:: bash - - title uberXMHF - uuid xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # copy this from an AUTOMAGIC entry - kernel /boot/xmhf-x86-vmx-x86pc.bin.gz serial=115200,8n1,0x3f8 nmi_watchdog=0 # substitute in the correct serial address - modulenounzip (hd0)+1 # should point to where grub is installed - modulenounzip /boot/4th_gen_i5_i7_SINIT_75.BIN # Intel TXT SINIT AC module - - -This will boot uberXMHF with debug output going to the specified serial -port, and then reload grub. -Note, check if the AUTOMAGIC KERNELS refernce ``/boot/vmlinuz-*`` or simply ``/vmlinuz-*`` and have your uberXMHF entry match (i.e., some do not require the ``/boot/`` prefix in the above example). - -Additionally, you must specify new command line option to disable the NMI -watchdog kernel-module on your guest OS (linux). The added command line -options must include ``nmi_watchdog=0`` - -If your Default OS (the Linux kernel that will be booting after the micro-hypervisor) uses an LVM filesystem, -you might need to alter its GRUB entry. Modify the kernel entry to specify the root as the LVM disk. For example, change: - - -.. code-block:: bash - - kernel /vmlinuz-4.4.236+ root=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx ro quiet splash - - -to - -.. code-block:: bash - - kernel /vmlinuz-4.4.236+ root=/dev/${Volume Group name}/root ro text nomodeset nmi_watchdog=0 - - -Where you can find the appropriate ``${Volume Group name}`` using ``sudo vgs --noheadings -o vg_name`` - -savedefault for unattended boot -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Booting linux involves loading the grub menu twice. The first time you -must select the uberXMHF entry, and the second time you must select an OS -entry. You can automate this by using savedefault. - -Set grub to boot the saved default: - -.. code-block:: bash - - default saved - - -Have your uberXMHF entry and what you want as your default OS entry save -each-other as the new default: - -.. code-block:: bash - - title Default OS - savedefault 1 # where the number equates to the subsequent grub entry to load (i.e. 0 == the first in the list of options) - - title uberXMHF - savedefault 0 - - -The parameter to savedefault is the menu entry that you would like as -the new default. - - -Example GRUB `menu.lst` -^^^^^^^^^^^^^^^^^^^^^^^ - -A minimal grub ``menu.lst`` example is shown below. - -.. code-block:: bash - - default saved - - title Default OS - uuid c8abe43f-8658-42bb-b238-60b97320c50 - kernel /vmlinuz-4.4.236+ root=/dev/uberXMHF-vg/root ro text nomodeset memblock=debug nmi_watchdog=0 - initrd /initrd.img-4.4.236+ - savedefault 1 - - title uberXMHF - uuid c8abe43f-8658-42bb-b238-60b97320c50 - kernel /xmhf-x86-vmx-x86pc.bin.gz serial=11520,8n1,0x3f8 - modulenounzip (hd0)+1 - modulenounzip /4th_gen_i5_i7_SINIT_75.BIN - savedefault 0 - - diff --git a/docs/pc-intel-x86_32/supported-os.rst b/docs/pc-intel-x86_32/supported-os.rst deleted file mode 100644 index f0eff74725..0000000000 --- a/docs/pc-intel-x86_32/supported-os.rst +++ /dev/null @@ -1,39 +0,0 @@ -.. include:: /macros.rst - - -Supported OS -============ - -In principle, any guest operating system should be supported so -long as it: - -* Uses 'normal' 32-bit page tables. ** PAE is not supported ** - - -The actively supported OS/distribution is: - -* Ubuntu 16.04.x LTS with Linux Kernel 4.4.x (#CONFIG_X86_PAE is not set) and below with GRUB v0.97 (default version that - ships with Ubuntu 16.04.x LTS) - -.. note:: - Sources and pre-built binaries of the supported kernels are available at: - https://github.com/uberspark/uberxmhf-linux-kernels.git - - -.. note:: - Currently certain kernel modules must be black-listed (e.g., in ``/etc/modprobe.d/blacklist.conf``): - - * ``kvm`` - * ``kvm_intel`` - * ``intel_rapl`` - -.. note:: - You will also need to disable NMI watchdog if one is present. See - see :doc:`uberXMHF (pc-intel-x86_32) Installing ` - - -The following guest OSes are also known to work: - -* Ubuntu 12.04 LTS with Linux Kernel 3.2.0-27-generic and below -* Windows XP - diff --git a/docs/pc-legacy-x86_32/debugging.rst b/docs/pc-legacy-x86_32/debugging.rst deleted file mode 100644 index b2a76de9f0..0000000000 --- a/docs/pc-legacy-x86_32/debugging.rst +++ /dev/null @@ -1,108 +0,0 @@ -.. include:: /macros.rst - - -Debugging -========= - -Terminology ------------ - - -* ``host system`` -- system where the serial log is collected and examined. -* ``target system`` -- system where uberXMHF (pc-legacy-x86_32) runs and - ouputs debug information via the serial port. - -Debugging Setup ---------------- - -uberXMHF (pc-legacy-x86_32) debugging is done primarily via the serial port. -See :doc:`Installing uberXMHF (pc-legacy-x86_32) ` for how to pass serial -port configuration parameters to uberXMHF (pc-legacy-x86_32). -You can use ``dmesg | grep ttyS`` on a Linux guest OS on the target -system to examine the serial ports that the target system recognizes. - -For machines without a physical -serial port (e.g., laptops), you may leverage Intel Active Management -Technology (AMT) Serial-Over-LAN (SOL) capability. AMT SOL exposes -a serial port to the underlying platform once enabled (typically in -the BIOS). - -Serial Debuging without AMT -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - -* - Connect the ``host system`` and the ``target system`` via a NULL serial - cable. - -* - On the ``target system`` ensure that you pass the correct serial port - configuration parameters to uberXMHF (pc-legacy-x86_32) (see :doc:`Installing uberXMHF (pc-legacy-x86_32) `\ ). - A typical non-AMT configuration parameter will be similar to this: ``serial=115200,8n1,0x3f8`` - -* - On the ``host system`` run a terminal emulation program such as ``minicom`` (Ubuntu) - or ``hyperterminal`` (Windows). Ensure that the serial port configuration baud rate, parity, data and stop bits match (e.g., ``115200, 8n1``\ ) - -Serial Debugging with AMT -^^^^^^^^^^^^^^^^^^^^^^^^^ - -You will typically need to enable AMT in the BIOS/firmware of the ``target system`` . -Since various BIOSes expose AMT in different ways, we will use the -HP EliteBook 8540p/2540p laptop as a running example; the AMT specific instructions -probably need a little adaptation on other platforms running AMT. - - -* - Connect the ``host system`` and the ``target system`` via an ethernet - cable. This can be a cross-over cable (for direct connection) or a - straight cable (if going via a switch/router). - -* - It is best not to make AMT accessible from an open network, since by default there is no encryption for password authentication. - It seems possible to enable encryption and stronger authentication, but for our example we will assume a private network setup. - In our example, we statically configure the ``host system`` and - ``target system`` to be on the private ``192.168.0.0`` network. - -* - Enable AMT in the BIOS/firmware on the ``target system``. On the 8540p, you need to turn on - ``system_config -> amt_options -> firmware_verbosity -> setup_prompt``. - -* - Once AMT is enabled, you should see an AMT prompt during boot of the ``target system``. - Enter the AMT configuration; on the 8540p, hit - ``Ctrl-p`` to enter AMT configuration. The default password is - 'admin'. Once you've logged in: - - - * **You'll be forced to change the admin password**. Take care not - lose or compromise this password! The system will enforce some - password rules. See this `AMT Howto `_ for more information. - * **Setup the AMT IP**. In our example, we statically configure the - ``target system`` to have the IP ``192.168.0.2`` - * **Activate the network** - * **Ensure serial-over-lan (SOL) is enabled** - * **Enable ``legacy redirection mode`` (or ``SMB (Small Business) - management mode``\ )** This enables a simpler network - protocol. You'll need it to use ``amtterm``. - -* - On the ``target system`` ensure that you pass the correct serial port - configuration parameters to XMHF (see :doc:`Installing uberXMHF (pc-legacy-x86_32) `\ ). - A typical AMT serial configuration parameter will be similar to this: ``serial=115200,8n1,0x6080`` - -* - On the ``host system``\ , install ``amtterm`` to obtain the serial debugging - messages - - - * - Use amtterm 1.3 or higher. Older versions have bugs that effect - the ability to log output, and have more frequent disconnections. - It is available from the `amtterm git repository `_ - or `amtterm releases directory `_. - - * - Connect to the ``target system`` by using the following command: ``./amtterm 192.168.0.2 -p 'YourAMTpassword' | tee output-log.txt``. - Note: you may have to bring up the ethernet interface on the ``host system`` prior to issuing the above command. This can be done - via ``sudo ifconfig eth0 192.168.0.1`` (assuming the ``host system`` IP is ``192.168.0.1``\ ). diff --git a/docs/pc-legacy-x86_32/hw-requirements.rst b/docs/pc-legacy-x86_32/hw-requirements.rst deleted file mode 100644 index 699a48fd0d..0000000000 --- a/docs/pc-legacy-x86_32/hw-requirements.rst +++ /dev/null @@ -1,40 +0,0 @@ -.. include:: /macros.rst - - -Hardware Requirements -===================== - - -* **A TPM (v1.2)** The BIOS feature is often called something like "embedded security device" - -* **Hardware Virtualization extensions** - - * **AMD**\ : Secure Virtual Machine (SVM) or AMD Virtualization (AMD-V) - * **Intel**\ : Virtualization Technology (VT-x) - -* **Hardware Support for DMA Isolation** - - * **AMD**\ : Device Exclusion Vector (DEV) - * **Intel**\ : Virtualization Technology for Directed I/O (VT-d) - -* **2nd-level page tables** Typically turned on implicitly along with Virtualization extensions, if the processor supports it. - - * **AMD**\ : Nested Page Tables (NPT) - * **Intel**\ : Extended Page Tables (EPT) - -* **Dynamic root of trust** - - * **AMD**\ : Late-launch (default with AMD-V) - * **Intel**\ : Trusted Execution Technology (TXT). This feature is implemented partially by a signed software - module, called an SINIT module. Some processors exist that have the TXT hardware support but do not (yet) have - an SINIT module. Look for the SINIT module here: http://software.intel.com/en-us/articles/intel-trusted-execution-technology/ - -.. note:: - When purchasing a new machine, do *not* take it for granted that any - newer Intel or AMD processor will have the necessary capabilities. - - * Check Intel processor capabilities: http://ark.intel.com/ - * Check AMD processor capabilities: http://www.amd.com/us/products/pages/processors.aspx. - - * Look for AMD Virtualization (AMD-V) Technology With Rapid Virtualization Indexing capability for the - desired CPU model. diff --git a/docs/pc-legacy-x86_32/installing.rst b/docs/pc-legacy-x86_32/installing.rst deleted file mode 100644 index ce34a43e42..0000000000 --- a/docs/pc-legacy-x86_32/installing.rst +++ /dev/null @@ -1,166 +0,0 @@ -.. include:: /macros.rst - - -Installing -========== - -Prerequisites -------------- - -As a first step, check the :doc:`uberXMHF (pc-legacy-x86_32) Hardware Requirements `\ , and -be sure to enable the corresponding BIOS options. Also make sure your -BIOS is up to date; you could ruin your motherboard if your BIOS is -buggy. Secondly, ensure that you are running one of the supported -guest operating systems (see :doc:`uberXMHF (pc-legacy-x86_32) Supported Guest -Operating Systems `\ ). -Lastly, configure your system to boot uberXMHF (pc-legacy-x86_32) as -described below. - -Configure target system to boot uberXMHF ----------------------------------------- - -You will need to install Grub 1, if you haven't already. On most -modern Linux distributions, you will need to downgrade from Grub 2. On -Windows machines without a Linux installation, you will need to -install Grub. This can be done by installing a minimal Linux -installation, which will typically take care of non-destructively -repartitioning for you. - -Downgrade from Grub 2 to Grub 1 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Booting uberXMHF (pc-legacy-x86_32) is currently only supported -using Grub 1. If Grub 2 is already -installed (as it typically is on recent Linux distributions), you will -need to downgrade to Grub 1. - -The following commands accomplish the above task on Ubuntu: - -.. code-block:: bash - - sudo apt-get purge grub* os-prober - sudo apt-get purge grub-gfxpayload-lists - sudo apt-get install grub - sudo update-grub - grub-install /dev/sda - - -And remove lines (if any) from ``/boot/grub/menu.lst``\ : - -.. code-block:: bash - - title Chainload into GRUB 2 - root b5912383-7f9e-4911-b51d-b14ce8cea70b - kernel /boot/grub/core.img - - -For further details refer to the following posts on `downgrading GRUB for Ubuntu `_ and `downgrading GRUB for Debian `_ respectively. - -Get the correct SINIT module (Intel only) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -uberXMHF (pc-legacy-x86_32) launches itself with a *dynamic root of trust*. -On Intel -platforms, this requires a signed SINIT module provided by Intel, that -matches your platform CPU and chipset. - -SINIT modules can be found here: -http://software.intel.com/en-us/articles/intel-trusted-execution-technology/ - -Building and Installing uberXMHF (pc-legacy-x86_32) binaries -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If you haven't already built and installed uberXMHF (pc-legacy-x86_32), -see :doc:`Building uberXMHF (pc-legacy-x86_32) ` - -Adding a Grub entry -^^^^^^^^^^^^^^^^^^^ - -You will need to add a Grub entry to ``/boot/grub/menu.lst``. To ensure -that it doesn't get clobbered, put it **outside** the **AUTOMAGIC KERNEL -LIST**. - -Grub entry to boot Linux -^^^^^^^^^^^^^^^^^^^^^^^^ - -To boot a Linux guest, we create a grub entry that loads the -hypervisor, and then re-loads grub. When booting the machine, first -choose the uberXMHF (pc-legacy-x86_32) entry, and then choose a -normal Linux entry. - -A grub entry for uberXMHF (pc-legacy-x86_32) should look something like this: - -.. code-block:: bash - - title uberXMHF (pc-legacy-x86_32) - rootnoverify (hd0,1) # should point to /boot - kernel /init-x86.bin serial=115200,8n1,0x3f8 # substitute in the correct serial address - module /hypervisor-x86.bin.gz - modulenounzip (hd0)+1 # should point to where grub is installed - - -On Intel it is necessary to append one more line to provide the SINIT -Authenticated Code module, or "ACmod". This should be the *last* -line. E.g., - -.. code-block:: bash - - module /i5_i7_DUAL_SINIT_18.BIN - - -This will boot uberXMHF (pc-legacy-x86_32) with debug output going to -the specified serial -port, and then reload grub. - -Grub entry to boot Windows -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -To boot Windows, configure uberXMHF (pc-legacy-x86_32) to load the -Windows boot sector -instead of recursively loading grub. Do this by modifying the -``modulenounzip`` line to point to the partition where Windows is -installed instead of pointing to the MBR. For example, if Windows is -installed on ``/dev/sda3``\ : - -.. code-block:: bash - - title Windows on uberXMHF (pc-legacy-x86_32) - rootnoverify (hd0,1) # should point to /boot - kernel /init-x86.bin serial=115200,8n1,0x3f8 # substitute in the correct serial address - module /hypervisor-x86.bin.gz - modulenounzip (hd0,2)+1 # point to Windows partition - - -The rest of the settings are the same as for Linux, above. Again, you -will need to add a line for the SINIT module on Intel platforms. - -savedefault for unattended boot -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Booting linux involves loading the grub menu twice. The first time you -must select the uberXMHF (pc-legacy-x86_32) entry, and the second time -you must select an OS -entry. You can automate this by using savedefault. - -Set grub to boot the saved default: - -.. code-block:: bash - - default saved - - -Have your uberXMHF (pc-legacy-x86_32) entry and what you want as your -default OS entry save -each-other as the new default: - -.. code-block:: bash - - title uberXMHF (pc-legacy-x86_32) - savedefault 1 - - title Default OS - savedefault 0 - - -The parameter to savedefault is the menu entry that you would like as -the new default. diff --git a/docs/pc-legacy-x86_32/supported-os.rst b/docs/pc-legacy-x86_32/supported-os.rst deleted file mode 100644 index 783e827cc3..0000000000 --- a/docs/pc-legacy-x86_32/supported-os.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. include:: /macros.rst - - -Supported OS -============ - -In principle, any 32-bit guest operating system should be supported so -long as it: - - -* Uses 'normal' 32-bit page tables. PAE is also supported on - AMD. - -The following guest OSes are known to work: - - -* Ubuntu 12.04 LTS with kernel 3.2.0-27-generic and below -* Windows XP -* Windows Server 2003 diff --git a/docs/pc-legacy-x86_32/uberapp-lockdown.rst b/docs/pc-legacy-x86_32/uberapp-lockdown.rst deleted file mode 100644 index 662b54fb76..0000000000 --- a/docs/pc-legacy-x86_32/uberapp-lockdown.rst +++ /dev/null @@ -1,39 +0,0 @@ -.. include:: /macros.rst - - -|uberapp| - Lockdown -==================== - - -Introduction ------------- - -Lockdown provides the user with a red/green system: an isolated and -constrained environment for performing online transactions, as well as -a high-performance, general-purpose environment for all other -(non-security-sensitive) applications. An external device verifies -which environment is active and allows the user to securely learn -which environment is active and to switch between them. - -The original design and implementation of Lockdown is described in: - - -* - Lockdown: Towards a Safe and Practical Architecture for Security - Applications on Commodity Platforms. Amit Vasudevan and Bryan Parno - and Ning Qu and Virgil D. Gligor and Adrian Perrig. Proceedings of - the 5th International Conference on Trust and Trustworthy Computing - (TRUST), June 2012. - http://hypcode.org/paper-lockdown-TRUST-2012.pdf - -* - Lockdown: A Safe and Practical Environment for Security Applications - (CMU-CyLab-09-011) Amit Vasudevan and Bryan Parno and Ning Qu and - Virgil D. Gligor and Adrian Perrig. Technical Report - CMU-CyLab-09-011, June 2009. - http://www.cylab.cmu.edu/files/pdfs/tech_reports/CMUCyLab09011.pdf - -The implementation of Lockdown contained herein can be via the -core build process (see :doc:`Building uberXMHF (pc-legacy-x86_32) `\ ). Note that the implementation -is a **research prototype** and does not yet fully provide the -security properties of the design. diff --git a/docs/pc-legacy-x86_32/uberapp-trustvisor.rst b/docs/pc-legacy-x86_32/uberapp-trustvisor.rst deleted file mode 100644 index 3838f1497b..0000000000 --- a/docs/pc-legacy-x86_32/uberapp-trustvisor.rst +++ /dev/null @@ -1,570 +0,0 @@ -.. include:: /macros.rst - - -|uberapp| - TrustVisor -====================== - -Introduction ------------- - -TrustVisor is a special-purpose hypervisor that provides measured, -isolated execution environments for security-sensitive -code modules (Pieces of Application Logic - PALs) -without trusting the OS or the application that invokes the code modules. - -The isolated execution environment protects the code -integrity, execution integrity, as well as data integrity and secrecy -for PALs. TrustVisor produces evidence of -its initialization in the TPM's Platform Configuration Registers. -This evidence (in the form of a hash chain) can be used to generate a -TPM-based attestation that TrustVisor has loaded on a platform. -Further, TrustVisor implements a software-based, micro-TPM (uTPM) -that can execute at higher speed on the platform's primary CPU than -hardware TPM. It also generates and manages its own identity keypair -that can be used to generate subsequent attestations to the isolation -and execution of individual PALs, leveraging the uTPM. - -The implementation of TrustVisor contained herein leverages -uberXMHF (pc-legacy-x86_32).\ -The original design and implementation of TrustVisor is described in: - -*TrustVisor: Efficient TCB Reduction and Attestation*. Jonathan -M. McCune, Yanlin Li, Ning Qu, Zongwei Zhou, Anupam Datta, Virgil -Gligor, and Adrian Perrig. IEEE Symposium on Security and Privacy, May -2010.\ `(pdf) `_ - -.. _building: - -Building --------- - -The TrustVisor build is primarily driven from the uberXMHF (pc-legacy-x86_32) build process; -see :doc:`Building uberXMHF (pc-legacy-x86_32) `. When -running ``configure`` , you will need to set ``--with-approot=hypapps/trustvisor`` -to point to the TrustVisor source code. To install trustvisor -development headers (for :ref:`teesdk` ), please -use ``./configure --prefix=...`` to specify -the install path, and run ``make install-dev``. - - -Installing ----------- - -To *run* TrustVisor on a given machine, installation is similar to that -of any other hypapp. See :doc:`Installing uberXMHF (pc-legacy-x86_32) `. - -Note that for certain platforms (e.g., HP EliteBook 2540p), if the TPM locality -are not properly configured, trustvisor crashes at startup when attempting to -clear all TPM localities. An intrusive work-around is to restore -the TPM to factory state via BIOS. - -TrustVisor uses TPM NVRAM to securely store a master secret that is -used to derive its long-term encryption and MAC keys. During startup, if no NVRAM -Index is found, Trustvisor will downgrade to a 'ephemeral'mode, generating a -new MasterSecret. Please following the below guideline to define NVRAM spaces -for TrustVisor using TPM tools. - -Disable the infineon driver -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Modern Ubuntu has a tendency to load the Infineon-specific v1.1b TPM -driver, when it should be using ``tpm_tis``. Thus, we blacklist -``tpm_infineon``. Don't forget to reboot after making this change. It -is possible to manually remove this driver (\ ``modprobe -r -tpm_infineon``\ ) and ``modprobe tpm_tis``\ , if you know what you're -doing. In ``/etc/modprobe.d/blacklist.conf`` add - -.. code-block:: c - - blacklist tpm_infineon - - -Shut down trousers, if it is running -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -See if trousers is running first, shut down if necessary. It will -probably start up again after the next reboot. You may wish to -uninstall it or disable it more permanently if you're not otherwise -using it. - -.. code-block:: c - - /etc/init.d/trousers status - /etc/init.d/trousers stop - - -Install jTpmTools -^^^^^^^^^^^^^^^^^ - -Our current testing has been with v0.6 but we will soon move to -v0.7. https://sourceforge.net/projects/trustedjava/files/jTPM%20Tools/ - -.. code-block:: c - - sudo dpkg -i jtpmtools_0.6.deb - - -Set the tpm device to be accessible by jtss -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code-block:: bash - - chown jtss:tss /dev/tpm0 - /etc/init.d/jtss start - /etc/init.d/jtss status - - cat /var/log/jtss/tcs_daemon.log - - -Take ownership of the TPM -^^^^^^^^^^^^^^^^^^^^^^^^^ - -You will need to take ownership of the TPM, and set an owner -password. It is important not to lose the owner password that you -set. In TrustVisor's security model it is *not* security critical that -the owner password is not compromised, so feel free to use a well -known password or empty string if you are not using the TPM for other -purposes that might require a strong TPM owner password. - -.. code-block:: bash - - jtt take_owner -e ASCII -o 'owner_password' - - -Define the NV spaces -^^^^^^^^^^^^^^^^^^^^ - -We actually define two nv spaces. One stores TrustVisor's master -secret. The other stores the root of a hash chain used for replay -protection (see [Memoir]) - -.. code-block:: bash - - jtt nv_definespace \ - --index 0x00015213 \ - --size 20 \ - -o 'owner_password' \ - -e ASCII \ - -p 11,12 \ - -w \ - --permission 0x00000000 \ - --writelocality 2 \ - --readlocality 2 - jtt nv_definespace \ - --index 0x00014e56 \ - --size 32 \ - -o 'owner_password' \ - -e ASCII \ - -p 11,12 \ - -w \ - --permission 0x00000000 \ - --writelocality 2 \ - --readlocality 2 - - -Unload Linux TPM driver -^^^^^^^^^^^^^^^^^^^^^^^ - -Before running Trustvisor or PAL code that requires access to the NV -RAM, we need to ensure the Linux TPM device driver is indeed -removed. Hence, we want to stop all the drivers that rely on the Linux -TPM device driver. This requirement will go away once issue 15 is -closed. https://sourceforge.net/p/xmhf/tickets/15/ - -.. code-block:: bash - - /etc/init.d/jtss stop - modprobe -r tpm_tis - -.. _teesdk: - -Trusted Execution Environment (TEE) SDK ---------------------------------------- - -Overview -^^^^^^^^ - -The Trusted-Execution-Environment Software-Development-Kit -(tee-sdk) comprises tools and documentation for developing -*services* that run in a trusted environments, and *clients* that -communicate with those services, in Linux system. -Initially, this means writing PALs that run under TrustVisor, -and applications that use PALs. However, -the APIs provided here are intended to provide sufficient abstraction -such that additional back-ends can be implemented, allowing services -and applications to be ported to use alternative trusted environments -with little or no modification. - -Terminology -^^^^^^^^^^^ - -Service - ~ A piece of code running in a trusted execution environment - provided by a *device*. (e.g., a PAL) -Client - ~ An application that communicates with one or more *services*. -Device - ~ A module providing a trusted execution environment (e.g., TrustVisor) - -Files (relative to ``xmhf/hypapps/trustvisor/tee-sdk/``\ ) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - -* tz/: TrustZone API. This library is to be used by *clients* - to communicate with *services*. This library supports multiple - *device* back-ends, abstracting them in such a way that most *client* - code can be oblivious to which back-end is in use. -* toolchain/: A cross-compiling toolchain for compiling - and linking PALs. Implemented as wrappers around gcc. -* ports/: Support libraries for *services*. These have been - ported to run in a trusted environment provided by some *device*. - i.e., they do not make system calls, and all dependencies should - be satisfied by other ports, svcapi, or other libraries provided - as part of this package. -* examples/: Examples and tests. - - -Installing TEE-SDK ------------------- - -Installing TrustVisor Headers -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -On a machine where you are planning to develop PALs, you will also -need to install the TrustVisor development headers. The -tee-sdk currently expects those headers to be -installed in two places. - -*First*\ , install the headers in a 'normal' system location. This can be -installed by ``make install-dev``\ , when you build -:ref:`building`. -If you directly install TrustVisor binary on your platform without building -it, please download and uncompress the uberXMHF package, go to the ``xmhf`` -directory -and run the following commands: - -.. code-block:: bash - - ./autogen.sh - ./configure --with-approot=hypapps/trustvisor - make install-dev - - -*Second*\ , you will then need to reconfigure to point to the Trustvisor PAL -cross-compilation environment and install the headers again: - -.. code-block:: bash - - ./configure --with-approot=hypapps/trustvisor --prefix=$(SYSROOT)/usr - make install-dev - - -Note: $(SYSROOT) depends on your configuration of building TEE-SDK, -see below for more details. The default $(SYSROOT) is ``/usr/local/i586-tsvc`` - -Downloading and Patching Third Party Libraries -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Before installing TEE-SDK, you need to download a few third party -libraries (e.g., newlib, openssl), and apply patches to them so -that they could be used for PAL development. - -For newlib library, we use newlib-1.19.0 version. -Download the ``newlib-1.19.0.tar.gz`` from ftp://sourceware.org/pub/newlib/index.html, -untar it to ../ports/newlib/ directory, then execute the following commands: - -.. code-block:: bash - - cd ../ports/newlib/newlib-1.19.0 - patch -p1 < ../newlib-tee-sdk-131021.patch - - -For openssl library, we use openssl-1.0.0d version. -Download the ``openssl-1.0.0d.tar.gz`` from http://www.openssl.org/source/, -untar it to ../ports/openssl/ directory, then execute the following commands: - -.. code-block:: bash - - cd ../ports/openssl/openssl-1.0.0d - patch -p1 < ../openssl-tee-sdk-131021.patch - - -Note that you would have prompts as follows: - -.. code-block:: bash - - Reversed (or previously applied) patch detected! Assume -R? [n] - Apply anyway? [n] - - -This is caused by trying to patch the symbolic link file in -include/openssl/opensslconf.h, which is unnecessary. -Just press Enter twice to skip them, and ignore the .rej file created. - -Building and Installing TEE-SDK -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -After installing TrustVisor headers, downloading and patching third party -libraries, go to TEE-SDK directory and run -``make`` to build and install TEE-SDK. - -If you would like to override the default paths, specify your overrides -as parameters to ``make``\ : - -.. code-block:: bash - - make PREFIX=$(PREFIX) HOST=$(HOST) SYSROOT=$(SYSROOT) - - -$(PREFIX) specifies where you will install various utilities, -libraries, and headers. The default $(PREFIX) is ``/usr/local``. - -$(HOST) is the host-name to use for PAL code. The default $(HOST) -is ``i586-tsvc``. - -$(SYSROOT) points to the path where libraries to be linked against PAL -code will be installed. The default $(SYSROOT) is ``$(PREFIX)/$(HOST)`` - -Of course, you may install each tee-sdk component individually, -either by specifying a target to ``make``\ , or by manually performing the -steps in the corresponding make recipe. At the time of this writing, -the components installed by ``make`` are: - - -* - toolchain : these are wrappers to utilities such as gcc, with names - like ``i586-tsvc-gcc``. They mostly serve to override the system paths - with paths in $(SYSROOT). - -* - tz : This implements the TrustZone API for managing and - communicating with services (pals) running the trusted execution - environment (trustvisor). - -* - newlib : this is an implementation of libc targeted for - PALs. Functions that do not involve IO should work as expected. IO - functions currently fail gracefully. The toolchain ``i586-tsvc-gcc`` - will link against this library by default, unless ``-nostdlib`` is used. - -* - openssl : This is the well-known openssl library, ported for use - with pals. It is not installed by default, but can be installed with - ``make openssl`` - - -Using TEE-SDK -------------- - -Compiling applications -^^^^^^^^^^^^^^^^^^^^^^ - -The TEE-SDK installs several libraries to the development machine. -There is a front-end library for applications (tee-sdk-app), a -front-end library for services (tee-sdk-svc), and for each device -there are application and service back-end libraries -(tee-sdk-app-devname and tee-sdk-svc-devname). - -We use `pkgconfig `_ to simplify management of these libraries. The -compile time flags needed to link against a package can be obtained -using ``pkg-config --cflags packagename``. The linking flags can be -obtained using ``pkg-config --libs --static packagename``. Note that we -only support static linking for now. If you installed ``tz`` to a -non-standard location ``$tzinstallprefix``\ , you may need to set -``PKG_CONFIG_LIBDIR`` to include ``$tzinstallprefix/lib/pkgconfig``. - -An application using the tee-sdk to communicate with a service running -in a trusted environment must link against at least one application -back-end. It is also permissable to link against multiple back-ends; a -single application can communicate with services running on multiple -devices. - -Compiling services (PALs) -^^^^^^^^^^^^^^^^^^^^^^^^^ - -You must compile and link using exactly one service back-end -package. At the time of this writing, there is only one anyways: -``tee-sdk-svc-tv``. pkgconfig will automatically pull in the service -front-end ``tee-sdk-svc`` as a dependency. Using the compile and link -flags from those packages is important not only to link against the -corresponding libraries; they also reference compiler options to -eliminate code-constructs that are unsupported inside services, and -linker options to ensure the necessary layout in the final binary. - -Services to be run under TrustVisor need to be compiled somewhat -specially. A PAL is linked together into the same binary with the -application that runs it. At run-time, the application registers the -PAL with TrustVisor. Using the raw TrustVisor interfaces for PAL -management, you would need to keep track of which address ranges belong to -PAL code, data, etc., and make sure those sections are page-aligned. -Things can get tricky if you want some code to be accessible to both -the PAL code and the application code, and trickier still if you want -to use different implementations for the same function in PAL and -application code (such as linking the PAL against a version of libc -that does not make system calls while linking the regular code with the -standard version of libc). - -The TEE-SDK has some tools to take care of these details for you. The -basic approach is use *partial linking* to link all PAL code into a -single object file (.o), rewrite all symbols except for the PAL -entry-point in that object file to be private, and then use a linker -script to link this object file with the regular application while -mapping the code and data of the PAL to special page-aligned sections. The -TrustVisor back-end provides simplified functions for registering a -PAL that has been built and linked this way. - -The TEE-SDK includes ``pkg-config`` files that specify the necessary -compilation and link flags, and Makefile snippets that can be included -in your own Makefiles to automate most of the process. Pointing your -makefile at those makefile snippets and\or ``pkg-config`` files (rather -than copying and modifying a monolithic Makefile with these things -hard-coded) will help keep your pal up to date as the build process -evolves. See ``examples/newlib/Makefile`` for -a good starting point of a Makefile that dynamically incorporates the -TEE-SDK-provided Makefile snippets and pkg-config files. - -Compiling and running the test example -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -After installation in ``tz``\ , you should be able to compile and run -the test example in ``../examples/test``. Remember to set -the ``PKG_CONFIG_LIBDIR`` environment variable if you installed to a -non-system directory. - -Loading and unloading services -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Services are loaded and unloaded through the TrustZone service manager: - -.. code-block:: c - - tz_return_t tzRet; - tz_device_t tzDevice; - tz_session_t tzManagerSession; - tz_uuid_t tzSvcId; - - /* open isolated execution environment device */ - /* Use NULL for default device, or 'tv' to specify trustvisor */ - tzRet = TZDeviceOpen(NULL, NULL, &tzDevice); - assert(tzRet == TZ_SUCCESS); - - /* prepare service descriptor */ - /* this is currently device-specific (i.e., trustvisor-specific). - eventually it would be good to provide a common abstraction here. */ - scode_sections_info_init(&scode_info, - &__scode_start, scode_ptr_diff(&__scode_end, &__scode_start), - NULL, 0, - PAGE_SIZE, PAGE_SIZE); - - /* open session with device manager */ - tzRet = TZManagerOpen(&tzDevice, NULL, &tzManagerSession); - assert(tzRet == TZ_SUCCESS); - - /* download */ - tzRet = TZManagerDownloadService(&tzManagerSession, - &pal, - sizeof(pal), - &tzSvcId); - assert(tzRet == TZ_SUCCESS); - - /* do useful work with the service */ - - /* unload the service. */ - /* This is currently CRITICAL when using TrustVisor. Exiting the - application without unloading the service will lead to system - instability. */ - tzRet = TZManagerRemoveService(&tzManagerSession, - &tzSvcId); - assert(tzRet == TZ_SUCCESS); - - /* close session */ - tzRet = TZManagerClose(&tzManagerSession); - assert(tzRet == TZ_SUCCESS); - - -The TrustVisor back-end provides some convenience functions for an -application to load an unload a single PAL: - -.. code-block:: c - - tz_device_t tzDevice; - tz_session_t tzPalSession; - tz_uuid_t tzSvcId; - tz_return_t rv; - int rv=0; - - /* configurable options */ - pal_fn_t *pal_fn = &pal_entry_point; - size_t param_size = PAGE_SIZE; - size_t stack_size = PAGE_SIZE; - - /* register the pal */ - rv = tv_tz_init(&tzDevice, - &tzPalSession, - &tzSvcId, - pal_entry_point, - param_size, - stack_size); - assert(rv == TZ_SUCCESS); - - /* do useful work with the pal */ - /* .... */ - - /* register the pal */ - rv = tv_tz_teardown(&tzDevice, - &tzPalSession, - &tzSvcId); - assert(rv == TZ_SUCCESS); - - -Calling services -^^^^^^^^^^^^^^^^ - -Services are called through the TrustZone API. You must open a session -with a currently-loaded service. A session can be used for multiple -invocations of a service. See the -`TrustZone API specification `_ for details. - -Developing services -^^^^^^^^^^^^^^^^^^^ - -Service development is currently very trustvisor-specific. - -Memory Layout -^^^^^^^^^^^^^ - -While eventually services will be compiled as standalone binaries, -currently they are compiled together with the application that calls -them. When loading the service, memory pages that contain service code -and data are registered with trustvisor to be measured and protected. -This means that service code and data must be on separate memory -pages from application code and data, and that you must be able to identify -the relevant memory ranges. This is most easily done by putting service -code in separate object files or in separate sections, e.g. - -A linker script must then be used to ensure page-alignment, and to -identify the beginning and end of the relevant sections. See -``../tz/conf/pal-template.ld`` for an example of such a linker script. - -Service entry point -^^^^^^^^^^^^^^^^^^^ - -The service entry point should have the following prototype: - -.. code-block:: c - - void pal_entry(uint32_t uiCommand, - tzi_encode_buffer_t *psInBuf, - tzi_encode_buffer_t *psOutBuf, - tz_return_t *puiRv) - - - -* ``uiCommand`` will contain command specified in the call to - ``TZOperationPrepareInvoke`` -* ``psInBuf`` will contain the parameters marshalled by ``TZEncode*``. - Use the API in [tz/include/marshal.h] to decode this buffer. -* ``psOutBuf`` is an output buffer for marshalled data. Use the - API in [tz/include/marshal.h] to encode this buffer. -* ``puiRv`` is a status code to be returned. Success should be indicated - by setting this to ``TZ_SUCCESS``. diff --git a/docs/pc-legacy-x86_32/verify-build.rst b/docs/pc-legacy-x86_32/verify-build.rst deleted file mode 100644 index 5ad039a95e..0000000000 --- a/docs/pc-legacy-x86_32/verify-build.rst +++ /dev/null @@ -1,232 +0,0 @@ -.. include:: /macros.rst - -.. _pc-legacy-x86_32-verifybuilding: - -Verifying and Building -====================== - -Verifying ---------- - -One of the main design goals of uberXMHF (pc-legacy-x86_32) is to achieve -automated verification -while coping with implementation changes as a result of development. -The uberXMHF (pc-legacy-x86_32) core provides functionality common to many hypervisor-based -security architectures and supports hypapps that augment the core with -additional security or functional properties while preserving the -fundamental hypervisor security property of memory integrity -(i.e., ensuring that the hypervisor’s memory is not modified by -software running at a lower privilege level). - -We have verified the memory integrity of the uberXMHF (pc-legacy-x86_32) core -using a combination of automated and manual techniques. -The model checker `CBMC `_ is employed for -automatic verification. -Manual audits apply to a small portion of the code which we anticipate -to remain mostly unchanged as -development proceeds. The manual audits include constructs -that CBMC cannot verify, including loops that iterate over -entire page tables, platform hardware initialization and interaction, -and concurrent threads coordinating multiple CPUs during initialization -that are challenging for current model-checkers. For more details -please refer to our 2013 IEEE Security and Privacy `paper `_. - -Verification Environment and Tools -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -OS: Ubuntu 10.10, 32-bit; Available `here `_ - -Verification Tools: -CBMC: v4.1 32-bit; Available `here `_ - -Install using: - -.. code-block:: bash - - sudo dpkg -i cbmc_4.1_i386.deb - - - -How do I verify uberXMHF (pc-legacy-x86_32) and/or a uberapp? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Configure and build uberXMHF (pc-legacy-x86_32)/uberapp as described in -the :ref:`Building` -section below. The following describe the specific steps to verify the -uberXMHF (pc-legacy-x86_32) core memory integrity using the example -verify uberapp. - -Change working directory to the uberXMHF (pc-legacy-x86_32) source tree root. - -.. code-block:: bash - - cd ./xmhf - - -Generate the ``./configure`` script. - -.. code-block:: bash - - ./autogen.sh - - -Configure the XMHF verify hypapp. - -.. code-block:: bash - - ./configure --with-approot=hypapps/verify - - -Verify - -.. code-block:: bash - - make verifyall - or - make verify - - -``make verifyall`` will perform full verification of the -uberXMHF (pc-legacy-x86_32) core -as well as the uberapp. Subsequently, you can use ``make verify`` to -verify the uberapp assuming there are no further changes to the -uberXMHF (pc-legacy-x86_32) core. - -Note that we assume CBMC is sound. i.e., if CBMC -reports a successful verification, then uberXMHF (pc-legacy-x86_32)/uberapp -preserve -memory integrity. - -For verification purposes, we also assume that a uberapp built on top -of uberXMHF (pc-legacy-x86_32) uses the prescribed core APIs and that -it does not write to arbitrary -code and data. In fact, these are the only assumptions -required of any new uberapp to ensure the memory integrity -property of uberXMHF (pc-legacy-x86_32). -In the current uberXMHF (pc-legacy-x86_32) implementation, a single -core API function ``xmhf_memprot_setprot`` -allows manipulating guest memory protections -via 2nd level hardware page tables. - - -Building --------- - -uberXMHF (pc-legacy-x86_32) and uberapps (e.g., :doc:`TrustVisor `\ , -:doc:`Lockdown `\ ) get built -in a Linux environment with -a recent version of gcc. uberXMHF (pc-legacy-x86_32) has been verified to -build on Ubuntu 10, 11, and 12 series, both 32 and 64 bit. - -Build tools -^^^^^^^^^^^ - -A (partial) list of packages to install: - -.. code-block:: bash - - aptitude install pbuilder texinfo ruby build-essential autoconf libtool - - -On 64-bit platforms, you will also need to install 32-bit -libraries. On Ubuntu 12: - -.. code-block:: bash - - aptitude install gcc-multilib - - - -High-level Build Summary -^^^^^^^^^^^^^^^^^^^^^^^^ - -One "drives" the build from the root directory of uberXMHF (pc-legacy-x86_32): - -The interesting high-level build commands include: - -.. code-block:: bash - - ./autogen.sh # creates ./configure - ./configure # creates Makefile from Makefile.in - make # builds the selected hypapp and the XMHF core - make install # installs binaries - make install-dev # (hypapp specific) installs dev headers and libs - make test # (hypapp specific) runs various automated tests - make clean # cleanup - make htmldoc # generates the HTML documentation you are reading in the `./doc` sub-folder - - -The functioning of ``make install-dev`` and ``make test`` are -uberapp-specific. For example, in the TrustVisor uberapp, the primary prerequisite -for tee-sdk and PAL development is having successfully run -``make install-dev``. - -How do I build a uberXMHF (pc-legacy-x86_32) uberapp? -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The method for building different uberapps (e.g., TrustVisor, -Lockdown) is by specifying which uberapp to build using ``./configure``. -The following describes the sequence of steps for building a -uberXMHF (pc-legacy-x86_32) uberapp using the helloworld -uberapp as a running example. - -Change working directory to the uberXMHF (pc-legacy-x86_32) root directory. - -.. code-block:: bash - - cd ./xmhf - - -Generate the ``./configure`` script. - -.. code-block:: bash - - ./autogen.sh - - -Configure the uberXMHF (pc-legacy-x86_32) uberapp. - -.. code-block:: bash - - ./configure --with-approot=hypapps/helloworld - - -Generate and install the binaries: - -.. code-block:: bash - - make - make install - make install-dev # optional (hypapp-specific) - make test # optional (hypapp-specific) - - -Note that ``make install`` is only useful if the development system and -the target system (on which uberXMHF (pc-legacy-x86_32) is installed) are -the same. If not, -you will need to manually copy the files ``./xmhf/init-x86.bin`` -and ``./xmhf/hypervisor-x86.bin.gz`` to the ``/boot`` folder of the -target system (see :doc:`Installing uberXMHF (pc-legacy-x86_32) ` ). - -Build configuration options -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - -* - --with-approot=[UBERAPP_PATH], specifies the uberapp source root; must be provided - -* - --with-target-platform=[PLATFORM], specifies the target platform for the build; - optional, current options are: x86pc (x86 hardware virtualized platforms, default) - -* - --with-target-arch=[ARCH], specifies the target CPU architecture; - optional, current options are: x86vmx (Intel, default), x86svm (AMD) - -* - --disable-drt, disables Dynamic Root-of-Trust (DRT); optional, useful for builds - targeting platforms without support for DRT and/or TPM - -* - --disable-dmap, disables DMA protection; optional, useful for builds targeting - platforms without DMA protection capabilities diff --git a/docs/rpi3-cortex_a53-armv8_32/build/adding-uapps.rst b/docs/rpi3-cortex_a53-armv8_32/build/adding-uapps.rst deleted file mode 100644 index 040914bce4..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/build/adding-uapps.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. include:: /macros.rst - - -Adding new |uberapps| -===================== - -Integrating a new |uberapp| into the micro-hypervisor requires the following integration pieces: - -1. Create directory for |uberapp| functionality (e.g., `uapp_newapp`) within `uapps` directory - - * `uapp-newapp.c` is used to perform the funcaitonality within a - `bool uapp_newapp_handlehcall(uhcall_function, uhcall_buffer, uhcall_buffer_len)` - * Place header files in `include` as `newapp.h`. This header defines any data structures used for - passing data, and a |uberapp| ID (`#define UAPP_NEWAPP_ACTION`) - -2. To integrate the |uberapp| add references in the following locations: - - * Add an `if(uapp_newapp_handlecall(r->r0, r->r1, r->r3))` conditional to `core/ghcall.c` to hook in the - |uberapp| runtime service processing - * Add an entry to the `core/Makefile` (`uapp-newapp.o: ../uapps/uapp-newapp/uapp-newapp.c`), and add - the `uapp-newapp.o` to the `core.bin:` line. - -3. Add a test program that exercises your hypapp in `rgapps/linux` - - * Create a directory for the test program (`rgapp-newapp`) that includes a `Makefile` and the - testprogram (`rgapp-newapp.c`). - * In userspace, this test program will need to include `uhcall.h`, where the |uberapp| is called - using `uhcall(UAPP_NEWAPP_ACTION, buf_ptr, sizeof(buf))` - -4. Running userspace test programs. - - * Load the kernel module (`uhcallkmod` in `rgapps/linux/rgapp-uhcallkmod`) - * Ensure the new device is read and writable from the calling applications (`chmod +x /dev/uhcallkmod`) - * Test program can now invoke |uberapp| - - diff --git a/docs/rpi3-cortex_a53-armv8_32/build/build-core.rst b/docs/rpi3-cortex_a53-armv8_32/build/build-core.rst deleted file mode 100644 index 0211024722..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/build/build-core.rst +++ /dev/null @@ -1,92 +0,0 @@ -.. include:: /macros.rst - - -Build Micro-Hypervisor Core Framework -===================================== - -#. - Prepare raspberry pi sd-card image - - - #. Download https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2016-11-29/2016-11-25-raspbian-jessie-lite.zip - #. Use `win32diskimager `_ under Windows OS to burn contents of .zip - #. Use ImageWriter tool under Ubuntu - -#. - Boot into raspbian using the sd-card on the pi and resize the root filesystem to - fit the entire sd card. Use the following commands once logged in: - - - #. ``sudo raspi-config`` - #. (optional) run the bottom option ``update`` to make sure you have latest version of - the configuration software - #. run the second option ``expand_rootfs`` - #. click ``finish`` - #. select ``YES`` when asked for a reboot - -#. - Development system (VM, baremetal or Windows/WSL with Ubuntu 16.04.x) setup - - - #. ``sudo apt-get update`` - #. ``sudo apt-get install build-essential autoconf autotools-dev`` - #. ``sudo apt-get install git`` - #. ``sudo apt-get install bc`` - -#. - Install Raspberry PI development tools on development system - - - #. ``git clone https://github.com/raspberrypi/tools`` - #. Add ``~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/`` to ``PATH`` - -#. - Install and build RPI kernel on development system - - - #. ``git clone https://github.com/raspberrypi/linux.git`` - #. ``cd linux`` - #. ``git checkout rpi-4.4.y`` - #. ``export KERNEL=kernel7`` - #. ``make ARCH=arm CROSS_COMPILE=~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- bcm2709_defconfig`` - #. ``make -j 4 ARCH=arm CROSS_COMPILE=~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- zImage modules dtbs`` - #. ``mkdir -p ~/uxmhf-rpi3-staging/mod_install`` - #. ``make -j 4 ARCH=arm CROSS_COMPILE=~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- INSTALL_MOD_PATH=~/uxmhf-rpi3-staging/mod_install/ modules_install`` - #. ``./scripts/mkknlimg arch/arm/boot/zImage ~/uxmhf-rpi3-staging/$KERNEL.img`` - #. ``mkdir -p ~/uxmhf-rpi3-staging/overlays`` - #. ``cp ./arch/arm/boot/dts/overlays/*.dtb* ~/uxmhf-rpi3-staging/overlays/.`` - #. ``cp ./arch/arm/boot/dts/overlays/README ~/uxmhf-rpi3-staging/overlays/.`` - #. ``mkdir -p ~/uxmhf-rpi3-staging/boot`` - #. ``cp ./arch/arm/boot/dts/*.dtb ~/uxmhf-rpi3-staging/boot/.`` - -#. - Build uberXMHF Raspbery PI 3 on development system - - - #. ``cd uxmhf-rpi3`` - #. ``./bsconfigure.sh`` - #. ``./configure`` - #. ``make clean`` - #. ``make OSKRNLIMG=~/uxmhf-rpi3-staging/kernel7.img`` - #. ``cp uxmhf-rpi3.img ~/uxmhf-rpi3-staging/.`` - #. ``cp rpi3-config.txt ~/uxmhf-rpi3-staging/config.txt`` - -#. - Note: you can run ``./configure`` above using any combination of the following - optional (experimental) parameters as needed: - - - #. ``./configure --enable-dmaprot`` to enable DMA protection capabilities - #. ``./configure --enable-secboot --with-boot-partition-start=BP_START_SECTOR --with-boot-partition-end=BP_END_SECTOR`` to enable secure boot capabilities. In this case ``BP_START_SECTOR`` and - ``BP_END_SECTOR`` are the values of the starting and ending sectors of the boot partition (\ ``/dev/mmcblk0p0``\ ) as obtained from the output of the following command: - ``sudo fdisk -l /dev/mmcblk0``. Replace ``/dev/mmcblk0`` with the sdcard device on the development - system. - #. ``./configure --enable-intprot`` to enable interrupt protection capabilities - #. ``./configure --enable-fiqreflection`` to enable guest FIQ interrupts to be handled within micro-hypervisor - #. ``./configure --enable-debug-uart`` to enable debug output via UART; you must additionally either specify, - Mini UART (via ``--enable-uart-mini``) or full (PL011) UART (via ``--enable-uart-pl011``). - Also, if using PL011 UART, you can specify ``--enable-uart-pl011-ctsrts`` to enable UART hardware flow control. - - - - diff --git a/docs/rpi3-cortex_a53-armv8_32/build/build-uapp-others.rst b/docs/rpi3-cortex_a53-armv8_32/build/build-uapp-others.rst deleted file mode 100644 index 43b06ce3e2..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/build/build-uapp-others.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. include:: /macros.rst - - -Other |uberapp| Micro-Hypervisor Extensions -=========================================== - -The following are other available |uberapp| micro-hypervisor extensions: - - -.. note:: You can enable these extensions by running ``./configure`` with the appropriate - parameters specified below while building the micro-hypervisor core framework. - - -#. ``./configure --enable-uapp-uhsign`` to enable a |uberapp| micro-hypervisor extension which provides HMAC key signing functionality -#. ``./configure --enable-uapp-uagent`` to enable a |uberapp| micro-hypervisor extension which provides AES encryption functionality -#. ``./configure --enable-uapp-uhstateDB`` to enable a |uberapp| micro-hypervisor extension which provides a simple database that tracks the state of each entry -#. ``./configure --enable-uapp-pvdriver-uart`` to enable a |uberapp| micro-hypervisor extension which provides a guest OS UART para-virtualized driver backend - - -For the UART para-virtualized driver backend |uberapp| micro-hypervisor extension, you -will need to build the RPi kernel by ensuring that -``CONFIG_SERIAL_AMBA_PL011=y`` and ``CONFIG_SERIAL_AMBA_PL011_CONSOLE=y`` within the file ``.config`` is replaced -by ``# CONFIG_SERIAL_AMBA_PL011 is not set`` and ``# CONFIG_SERIAL_AMBA_PL011_CONSOLE is not set`` respectively between -the ``make ARCH=arm CROSS_COMPILE=~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- bcm2709_defconfig`` -and ``make -j 4 ARCH=arm CROSS_COMPILE=~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- zImage modules dtbs`` -steps in the **Install and build RPI kernel on development system** section within -:doc:`Build Micro-Hypervisor Core Framework `. - diff --git a/docs/rpi3-cortex_a53-armv8_32/build/build-uapp-uhcalltest.rst b/docs/rpi3-cortex_a53-armv8_32/build/build-uapp-uhcalltest.rst deleted file mode 100644 index bc43bdb81d..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/build/build-uapp-uhcalltest.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. include:: /macros.rst - - -uhcalltest |uberapp| micro-hypervisor extension -=============================================== - -The following instructions show how the example |uberapp| -``uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest`` (to test -hypercalls) is built. - - -#. Building ``uhcallkmod`` on development system - - #. ``cd rgapps/linux/rgapp-uhcallkmod`` - #. ``./build.sh ~/linux ~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/`` - #. ``cp ./uhcallkmod.ko ~/uxmhf-rpi3-staging/.`` - -#. Building ``uhcalltest`` on development system - - #. ``cd rgapps/linux`` - #. ``make -w all`` - #. ``cd rgapp-uhcalltest`` - #. ``make -w all`` - #. ``cp ./uhcalltest ~/uxmhf-rpi3-staging/.`` diff --git a/docs/rpi3-cortex_a53-armv8_32/build/intro.rst b/docs/rpi3-cortex_a53-armv8_32/build/intro.rst deleted file mode 100644 index 91c90b696f..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/build/intro.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. include:: /macros.rst - - -.. _uxmhfrpi3-build-intro: - -Building -======== - -Building comprises of building the micro-hypervisor core configured with selected -functionality corresponding to |uberapp| micro-hypervisor extensions. - -An |uberapp| comprises of a legacy guest OS application (found within ``uxmhf-rpi3/rgapps/linux``) -and a micro-hypervisor extension (found within ``uxmhf-rpi3/uapps/``) - -.. note:: There are two libraries to support refactoring legacy guest OS code into - |uberapps|. There is a userspace library (``uxmhf-rpi3/rgapps/linux/libs/libuhcall``) - and a kernel space library (``uxmhf-rpi3/rgapps/linux/libs/libkhcall``). - These provide a function call interface for making a micro-hypervisor - extension call (e.g., ``uhcall()`` for making userspace calls to invoke an - |uberapp| micro-hypervisor extension). - - -.. toctree:: - :maxdepth: 4 - - Build micro-hypervisor core framework - uhcalltest überApp micro-hypervisor extension - Other überApp micro-hypervisor extensions - Adding new überApps \ No newline at end of file diff --git a/docs/rpi3-cortex_a53-armv8_32/debugging.rst b/docs/rpi3-cortex_a53-armv8_32/debugging.rst deleted file mode 100644 index 5124ac264f..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/debugging.rst +++ /dev/null @@ -1,68 +0,0 @@ -.. include:: /macros.rst - - -Debugging -========= - -Terminology ------------ - - -* ``host system`` -- system where the serial log is collected and examined. -* ``target system`` -- system where uberXMHF runs and ouputs debug information - via the serial port. - - -Debugging Setup ---------------- - -uberXMHF (rpi3-cortex_a53-armv8_32) debugging is done primarily via the -Raspberry PI 3 serial port using a USB to TTL serial cable. - -There are two types of USB to TTL serial cables available: - -* *without* hardware-flow control (RTS/CTS) pins such as the one available - `here `_. This cable has four wires: - red (power), black (ground), white (TX out of PI), and green (RX into PI). - The following - is the connection to the PI 40-pin header: - - * Physical Pin 6 <--> ground (black) of serial cable - * Physical Pin 8 <--> TX out of PI (white) of serial cable - * Physical Pin 10 <--> RX into PI (green) of serial cable - -* *with* hardware-flow control (RTS/CTS) pins such as the one available - `here `_. This cable has six wires: - black (ground), brown (CTS), red (power, 5V), orange (RXD into PI), yellow (TXD out of PI), green (RTS). The following - is the connection to the PI 40-pin header: - - * Physical Pin 6 <--> ground (black) of serial cable - * Physical Pin 8 <--> TXD out of PI (yellow) of serial cable - * Physical Pin 10 <--> RXD into PI (orange) of serial cable - * Physical Pin 11 <--> CTS (brown) of serial cable - * Physical Pin 36 <--> RTS (green) of serial cable - - - - -See :doc:`Installing uberXMHF (rpi3-cortex_a53-armv8_32) ` for how to install -the uberXMHF binaries on the SD card. In the -*Deploying binaries to SD Card* section, perform the following on -the ``host system`` where development is done: - -Edit ``~/mnt/pi-boot/config.txt`` and add the following lines: - -.. code-block:: bash - - enable_uart=1 - init_uart_baud=115200 - force_turbo=0 - - -Before powering up the PI 3 and performing a boot, do the following on -the ``host system`` in a seperate terminal (replace ttyUSB0 with the -serial port of the USB to TTL adapter): - -.. code-block:: bash - - sudo screen /dev/ttyUSB0 115200 8N1 diff --git a/docs/rpi3-cortex_a53-armv8_32/hw-requirements.rst b/docs/rpi3-cortex_a53-armv8_32/hw-requirements.rst deleted file mode 100644 index d77fd57307..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/hw-requirements.rst +++ /dev/null @@ -1,18 +0,0 @@ -.. include:: /macros.rst - - -Hardware Requirements -===================== - - -* **A Raspberry PI v3 board** Ensure that the model B or B+ with the Cortex-A53 quad-core processor - -* **Hardware Virtualization extensions** - - * **Cortex A53**\ : Hardware Support for Virtualization - -* **2nd-level page tables** Typically turned on implicitly along with Virtualization extensions, if the processor supports it. - - * **Cortex A53**\ : Second-stage Page Tables - - diff --git a/docs/rpi3-cortex_a53-armv8_32/installing.rst b/docs/rpi3-cortex_a53-armv8_32/installing.rst deleted file mode 100644 index 9347a3f1a8..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/installing.rst +++ /dev/null @@ -1,86 +0,0 @@ -.. include:: /macros.rst - - -Installing -========== - -Refer to the :doc:`build process ` -to build the required binaries for installation. Then proceed with the -following instructions to deploy uberXMHF on the SD card: - -Deploying binaries to SD Card ------------------------------ - - -#. - ``mkdir -p ~/mnt/pi-boot`` - -#. - ``mkdir -p ~/mnt/pi-root`` - -#. - ``sudo mount /dev/mmcblk0p1 ~/mnt/pi-boot`` - -#. - ``sudo mount /dev/mmcblk0p2 ~/mnt/pi-root`` - -#. - ``sudo cp ~/uxmhf-rpi3-staging/uhcalltest ~/mnt/pi-root/home/pi/.`` - -#. - ``sudo cp ~/uxmhf-rpi3-staging/uhcallkmod.ko ~/mnt/pi-root/home/pi/.`` - -#. - ``sudo cp ~/uxmhf-rpi3-staging/uxmhf-rpi3.img ~/mnt/pi-boot/.`` - -#. - ``sudo cp ~/uxmhf-rpi3-staging/config.txt ~/mnt/pi-boot/.`` - -#. - Append ``loglevel=8 memblock=debug dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0`` to ``~/mnt/pi-boot/cmdline.txt`` - -#. - ``sudo cp ~/uxmhf-rpi3-staging/boot/* ~/mnt/pi-boot/.`` - -#. - ``sudo mkdir -p ~/mnt/pi-boot/overlays`` - -#. - ``sudo cp -R ~/uxmhf-rpi3-staging/overlays/* ~/mnt/pi-boot/overlays/.`` - -#. - ``sudo cp ~/uxmhf-rpi3-staging/kernel7.img ~/mnt/pi-boot/.`` - -#. - ``sudo mkdir -p ~/mnt/pi-root/lib/firmware`` - -#. - ``sudo cp -R ~/uxmhf-rpi3-staging/mod_install/lib/firmware/* ~/mnt/pi-root/lib/firmware/.`` - -#. - ``sudo mkdir -p ~/mnt/pi-root/lib/modules/4.4.50-v7+`` - -#. - ``sudo cp -R ~/uxmhf-rpi3-staging/mod_install/lib/modules/4.4.50-v7+/* ~/mnt/pi-root/lib/modules/4.4.50-v7+/.`` - -#. - Edit ``~/mnt/pi-root/etc/fstab`` and comment out line beginning with ``/dev/mmcblk0p1`` which is mounted to boot - -Boot up and test ----------------- - - -#. - ``umount ~/mnt/pi-boot`` - -#. - ``umount ~/mnt/pi-root`` - -#. - Insert sd-card into the Raspberry PI 3 - -#. - Power on the Raspberry PI 3 - -#. - ... and you should see uberXMHF booting up with debug output and the guest starting soon thereafter diff --git a/docs/rpi3-cortex_a53-armv8_32/supported-os.rst b/docs/rpi3-cortex_a53-armv8_32/supported-os.rst deleted file mode 100644 index ef9f467c17..0000000000 --- a/docs/rpi3-cortex_a53-armv8_32/supported-os.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. include:: /macros.rst - - -Supported OS -============ - -In principle, any guest operating system should be supported so -long as it: - - -* Uses 'normal' 32-bit page tables - -The following guest OSes are known to work: - - -* Raspbian Jessie Lite with Linux Kernel 4.4.y -* Raspbian with Emlid Real-Time (RT) Linux Kernel 4.4.y diff --git a/xmhf/hypapps/helloworld/Makefile b/hypapps/helloworld/Makefile similarity index 100% rename from xmhf/hypapps/helloworld/Makefile rename to hypapps/helloworld/Makefile diff --git a/xmhf/hypapps/helloworld/app/Makefile b/hypapps/helloworld/app/Makefile similarity index 100% rename from xmhf/hypapps/helloworld/app/Makefile rename to hypapps/helloworld/app/Makefile diff --git a/xmhf/hypapps/helloworld/app/appmain.c b/hypapps/helloworld/app/appmain.c similarity index 100% rename from xmhf/hypapps/helloworld/app/appmain.c rename to hypapps/helloworld/app/appmain.c diff --git a/xmhf/hypapps/lockdown/Makefile b/hypapps/lockdown/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/Makefile rename to hypapps/lockdown/Makefile diff --git a/xmhf/hypapps/lockdown/src/COPYING b/hypapps/lockdown/src/COPYING similarity index 100% rename from xmhf/hypapps/lockdown/src/COPYING rename to hypapps/lockdown/src/COPYING diff --git a/xmhf/hypapps/lockdown/src/Makefile b/hypapps/lockdown/src/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/Makefile rename to hypapps/lockdown/src/Makefile diff --git a/xmhf/hypapps/lockdown/src/app/Makefile b/hypapps/lockdown/src/app/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/app/Makefile rename to hypapps/lockdown/src/app/Makefile diff --git a/xmhf/hypapps/lockdown/src/app/appmain.c b/hypapps/lockdown/src/app/appmain.c similarity index 100% rename from xmhf/hypapps/lockdown/src/app/appmain.c rename to hypapps/lockdown/src/app/appmain.c diff --git a/xmhf/hypapps/lockdown/src/app/approvedexec-windows.c b/hypapps/lockdown/src/app/approvedexec-windows.c similarity index 100% rename from xmhf/hypapps/lockdown/src/app/approvedexec-windows.c rename to hypapps/lockdown/src/app/approvedexec-windows.c diff --git a/xmhf/hypapps/lockdown/src/app/approvedexec.c b/hypapps/lockdown/src/app/approvedexec.c similarity index 100% rename from xmhf/hypapps/lockdown/src/app/approvedexec.c rename to hypapps/lockdown/src/app/approvedexec.c diff --git a/xmhf/hypapps/lockdown/src/app/hyperpart-disk.c b/hypapps/lockdown/src/app/hyperpart-disk.c similarity index 100% rename from xmhf/hypapps/lockdown/src/app/hyperpart-disk.c rename to hypapps/lockdown/src/app/hyperpart-disk.c diff --git a/xmhf/hypapps/lockdown/src/app/hyperpart-switch.c b/hypapps/lockdown/src/app/hyperpart-switch.c similarity index 100% rename from xmhf/hypapps/lockdown/src/app/hyperpart-switch.c rename to hypapps/lockdown/src/app/hyperpart-switch.c diff --git a/xmhf/hypapps/lockdown/src/app/include/approvedexec.h b/hypapps/lockdown/src/app/include/approvedexec.h similarity index 100% rename from xmhf/hypapps/lockdown/src/app/include/approvedexec.h rename to hypapps/lockdown/src/app/include/approvedexec.h diff --git a/xmhf/hypapps/lockdown/src/app/include/hyperpart.h b/hypapps/lockdown/src/app/include/hyperpart.h similarity index 100% rename from xmhf/hypapps/lockdown/src/app/include/hyperpart.h rename to hypapps/lockdown/src/app/include/hyperpart.h diff --git a/xmhf/hypapps/lockdown/src/app/include/lockdown-acpi.h b/hypapps/lockdown/src/app/include/lockdown-acpi.h similarity index 100% rename from xmhf/hypapps/lockdown/src/app/include/lockdown-acpi.h rename to hypapps/lockdown/src/app/include/lockdown-acpi.h diff --git a/xmhf/hypapps/lockdown/src/app/include/lockdown-atapi.h b/hypapps/lockdown/src/app/include/lockdown-atapi.h similarity index 100% rename from xmhf/hypapps/lockdown/src/app/include/lockdown-atapi.h rename to hypapps/lockdown/src/app/include/lockdown-atapi.h diff --git a/xmhf/hypapps/lockdown/src/app/include/lockdown-exepe.h b/hypapps/lockdown/src/app/include/lockdown-exepe.h similarity index 100% rename from xmhf/hypapps/lockdown/src/app/include/lockdown-exepe.h rename to hypapps/lockdown/src/app/include/lockdown-exepe.h diff --git a/xmhf/hypapps/lockdown/src/app/include/lockdown.h b/hypapps/lockdown/src/app/include/lockdown.h similarity index 100% rename from xmhf/hypapps/lockdown/src/app/include/lockdown.h rename to hypapps/lockdown/src/app/include/lockdown.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/Find.pm b/hypapps/lockdown/src/guestos/windows/genhashes/Find.pm similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/Find.pm rename to hypapps/lockdown/src/guestos/windows/genhashes/Find.pm diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/Makefile b/hypapps/lockdown/src/guestos/windows/genhashes/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/Makefile rename to hypapps/lockdown/src/guestos/windows/genhashes/Makefile diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/generate-hashes.pl b/hypapps/lockdown/src/guestos/windows/genhashes/generate-hashes.pl similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/generate-hashes.pl rename to hypapps/lockdown/src/guestos/windows/genhashes/generate-hashes.pl diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/pe_codesections_dump.awk b/hypapps/lockdown/src/guestos/windows/genhashes/pe_codesections_dump.awk similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/pe_codesections_dump.awk rename to hypapps/lockdown/src/guestos/windows/genhashes/pe_codesections_dump.awk diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/pehashdump.c b/hypapps/lockdown/src/guestos/windows/genhashes/pehashdump.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/pehashdump.c rename to hypapps/lockdown/src/guestos/windows/genhashes/pehashdump.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/sha1.c b/hypapps/lockdown/src/guestos/windows/genhashes/sha1.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/sha1.c rename to hypapps/lockdown/src/guestos/windows/genhashes/sha1.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/sha1.h b/hypapps/lockdown/src/guestos/windows/genhashes/sha1.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/sha1.h rename to hypapps/lockdown/src/guestos/windows/genhashes/sha1.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genhashes/tomcrypt_custom.h b/hypapps/lockdown/src/guestos/windows/genhashes/tomcrypt_custom.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genhashes/tomcrypt_custom.h rename to hypapps/lockdown/src/guestos/windows/genhashes/tomcrypt_custom.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/genldnpb/generate-ldnpb.pl b/hypapps/lockdown/src/guestos/windows/genldnpb/generate-ldnpb.pl similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/genldnpb/generate-ldnpb.pl rename to hypapps/lockdown/src/guestos/windows/genldnpb/generate-ldnpb.pl diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/Makefile b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/Makefile rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/Makefile diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/README b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/README similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/README rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/README diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/main.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/main.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/main.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/main.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/common.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/common.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/common.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/common.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/network.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/pcap-snoop.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/pcap-snoop.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/pcap-snoop.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/pcap-snoop.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/print_utils.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/proto_mod.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcpconn.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/base/tcppack.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_assoc.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_assoc.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_assoc.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_assoc.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_bitfield.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_bitfield.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_bitfield.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_bitfield.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_common.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_common.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_common.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_common.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_data.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_data.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_data.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_data.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_defaults.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_defaults.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_defaults.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_defaults.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_errors.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_errors.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_errors.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_errors.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_includes.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_includes.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_includes.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_includes.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_list.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_list.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_list.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_list.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_macros.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_macros.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_macros.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_macros.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_thread.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_thread.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_thread.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_thread.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_time.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_time.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_time.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_time.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_types.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_types.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_types.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/include/r_types.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/assoc.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/assoc.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/assoc.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/assoc.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/debug.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_assoc.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_assoc.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_assoc.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_assoc.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_data.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_errors.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_errors.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_errors.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_errors.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_list.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_list.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_list.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_list.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_replace.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_replace.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_replace.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_replace.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_time.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_time.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_time.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/common/lib/r_time.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/null/null_analyze.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ciphersuites.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl.enums.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_analyze.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_h.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_h.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_h.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_h.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssl_rec.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslciphers.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslciphers.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslciphers.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslciphers.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/ssldecode.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslprint.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfctl/sslpa/ssl/sslxprint.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/README b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/README similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/README rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/README diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/ldnvfdrv.inf b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/ldnvfdrv.inf similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/ldnvfdrv.inf rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvfdrv/ldnvfdrv.inf diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/Makefile b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/Makefile rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/Makefile diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/README b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/README similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/README rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/README diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/mksys.bat b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/mksys.bat similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/mksys.bat rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/mksys.bat diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/init.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/init.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/init.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/init.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ioctl.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ioctl.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ioctl.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ioctl.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.inf b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.inf similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.inf rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.inf diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.rc b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.rc similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.rc rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/ldnvnet.rc diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/makefile b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/makefile rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/makefile diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/miniport.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/public.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/public.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/public.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/public.h diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/request.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/request.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/request.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/request.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sendrcv.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sendrcv.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sendrcv.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sendrcv.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sources b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sources similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sources rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/sources diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.c b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.c similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.c rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.c diff --git a/xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.h b/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.h similarity index 100% rename from xmhf/hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.h rename to hypapps/lockdown/src/guestos/windows/win2k3/ldnvnet/sys/txrxfifo.h diff --git a/xmhf/hypapps/lockdown/src/verifier/README b/hypapps/lockdown/src/verifier/README similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/README rename to hypapps/lockdown/src/verifier/README diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/Makefile b/hypapps/lockdown/src/verifier/ds2148wz/Makefile similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/Makefile rename to hypapps/lockdown/src/verifier/ds2148wz/Makefile diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/armVIC.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/armVIC.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/armVIC.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/armVIC.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpc21xx.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpc21xx.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpc21xx.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpc21xx.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcGPIO.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcGPIO.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcGPIO.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcGPIO.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcI2C.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcI2C.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcI2C.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcI2C.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcSCB.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcSCB.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcSCB.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcSCB.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcTMR.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcTMR.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcTMR.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcTMR.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcUART.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcUART.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcUART.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcUART.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcVIC.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcVIC.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcVIC.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/lpcVIC.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/startup.h b/hypapps/lockdown/src/verifier/ds2148wz/arm2148/startup.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/arm2148/startup.h rename to hypapps/lockdown/src/verifier/ds2148wz/arm2148/startup.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/console.c b/hypapps/lockdown/src/verifier/ds2148wz/console.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/console.c rename to hypapps/lockdown/src/verifier/ds2148wz/console.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/console.h b/hypapps/lockdown/src/verifier/ds2148wz/console.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/console.h rename to hypapps/lockdown/src/verifier/ds2148wz/console.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/crt.S b/hypapps/lockdown/src/verifier/ds2148wz/crt.S similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/crt.S rename to hypapps/lockdown/src/verifier/ds2148wz/crt.S diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/ds5300.h b/hypapps/lockdown/src/verifier/ds2148wz/include_netif/ds5300.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/ds5300.h rename to hypapps/lockdown/src/verifier/ds2148wz/include_netif/ds5300.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/iinchip_conf.h b/hypapps/lockdown/src/verifier/ds2148wz/include_netif/iinchip_conf.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/iinchip_conf.h rename to hypapps/lockdown/src/verifier/ds2148wz/include_netif/iinchip_conf.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/socket.h b/hypapps/lockdown/src/verifier/ds2148wz/include_netif/socket.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/socket.h rename to hypapps/lockdown/src/verifier/ds2148wz/include_netif/socket.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/sockutil.h b/hypapps/lockdown/src/verifier/ds2148wz/include_netif/sockutil.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/sockutil.h rename to hypapps/lockdown/src/verifier/ds2148wz/include_netif/sockutil.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/types.h b/hypapps/lockdown/src/verifier/ds2148wz/include_netif/types.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/types.h rename to hypapps/lockdown/src/verifier/ds2148wz/include_netif/types.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/w5300.h b/hypapps/lockdown/src/verifier/ds2148wz/include_netif/w5300.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/include_netif/w5300.h rename to hypapps/lockdown/src/verifier/ds2148wz/include_netif/w5300.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpc2148-rom.ld b/hypapps/lockdown/src/verifier/ds2148wz/lpc2148-rom.ld similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpc2148-rom.ld rename to hypapps/lockdown/src/verifier/ds2148wz/lpc2148-rom.ld diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpcGPIO.h b/hypapps/lockdown/src/verifier/ds2148wz/lpcGPIO.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpcGPIO.h rename to hypapps/lockdown/src/verifier/ds2148wz/lpcGPIO.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpcTMR.h b/hypapps/lockdown/src/verifier/ds2148wz/lpcTMR.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpcTMR.h rename to hypapps/lockdown/src/verifier/ds2148wz/lpcTMR.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpcVIC.h b/hypapps/lockdown/src/verifier/ds2148wz/lpcVIC.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/lpcVIC.h rename to hypapps/lockdown/src/verifier/ds2148wz/lpcVIC.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/main.c b/hypapps/lockdown/src/verifier/ds2148wz/main.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/main.c rename to hypapps/lockdown/src/verifier/ds2148wz/main.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_ds5300.c b/hypapps/lockdown/src/verifier/ds2148wz/netif_ds5300.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_ds5300.c rename to hypapps/lockdown/src/verifier/ds2148wz/netif_ds5300.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_socket.c b/hypapps/lockdown/src/verifier/ds2148wz/netif_socket.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_socket.c rename to hypapps/lockdown/src/verifier/ds2148wz/netif_socket.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_sockutil.c b/hypapps/lockdown/src/verifier/ds2148wz/netif_sockutil.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_sockutil.c rename to hypapps/lockdown/src/verifier/ds2148wz/netif_sockutil.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_w5300.c b/hypapps/lockdown/src/verifier/ds2148wz/netif_w5300.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/netif_w5300.c rename to hypapps/lockdown/src/verifier/ds2148wz/netif_w5300.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/startup.c b/hypapps/lockdown/src/verifier/ds2148wz/startup.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/startup.c rename to hypapps/lockdown/src/verifier/ds2148wz/startup.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/type.h b/hypapps/lockdown/src/verifier/ds2148wz/type.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/type.h rename to hypapps/lockdown/src/verifier/ds2148wz/type.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbapi.h b/hypapps/lockdown/src/verifier/ds2148wz/usbapi.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbapi.h rename to hypapps/lockdown/src/verifier/ds2148wz/usbapi.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbcontrol.c b/hypapps/lockdown/src/verifier/ds2148wz/usbcontrol.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbcontrol.c rename to hypapps/lockdown/src/verifier/ds2148wz/usbcontrol.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbdebug.h b/hypapps/lockdown/src/verifier/ds2148wz/usbdebug.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbdebug.h rename to hypapps/lockdown/src/verifier/ds2148wz/usbdebug.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.c b/hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.c rename to hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.h b/hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.h rename to hypapps/lockdown/src/verifier/ds2148wz/usbhw_lpc.h diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbinit.c b/hypapps/lockdown/src/verifier/ds2148wz/usbinit.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbinit.c rename to hypapps/lockdown/src/verifier/ds2148wz/usbinit.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbstdreq.c b/hypapps/lockdown/src/verifier/ds2148wz/usbstdreq.c similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbstdreq.c rename to hypapps/lockdown/src/verifier/ds2148wz/usbstdreq.c diff --git a/xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbstruct.h b/hypapps/lockdown/src/verifier/ds2148wz/usbstruct.h similarity index 100% rename from xmhf/hypapps/lockdown/src/verifier/ds2148wz/usbstruct.h rename to hypapps/lockdown/src/verifier/ds2148wz/usbstruct.h diff --git a/xmhf/hypapps/quiesce/Makefile b/hypapps/quiesce/Makefile similarity index 100% rename from xmhf/hypapps/quiesce/Makefile rename to hypapps/quiesce/Makefile diff --git a/xmhf/hypapps/quiesce/app/Makefile b/hypapps/quiesce/app/Makefile similarity index 100% rename from xmhf/hypapps/quiesce/app/Makefile rename to hypapps/quiesce/app/Makefile diff --git a/xmhf/hypapps/quiesce/app/appmain.c b/hypapps/quiesce/app/appmain.c similarity index 100% rename from xmhf/hypapps/quiesce/app/appmain.c rename to hypapps/quiesce/app/appmain.c diff --git a/xmhf/hypapps/quiesce/guestos/linux/Makefile b/hypapps/quiesce/guestos/linux/Makefile similarity index 100% rename from xmhf/hypapps/quiesce/guestos/linux/Makefile rename to hypapps/quiesce/guestos/linux/Makefile diff --git a/xmhf/hypapps/quiesce/guestos/linux/qcontrol.c b/hypapps/quiesce/guestos/linux/qcontrol.c similarity index 100% rename from xmhf/hypapps/quiesce/guestos/linux/qcontrol.c rename to hypapps/quiesce/guestos/linux/qcontrol.c diff --git a/xmhf/hypapps/trustvisor/Makefile b/hypapps/trustvisor/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/Makefile rename to hypapps/trustvisor/Makefile diff --git a/xmhf/hypapps/trustvisor/autogen.sh b/hypapps/trustvisor/autogen.sh similarity index 100% rename from xmhf/hypapps/trustvisor/autogen.sh rename to hypapps/trustvisor/autogen.sh diff --git a/xmhf/hypapps/trustvisor/configure.ac b/hypapps/trustvisor/configure.ac similarity index 100% rename from xmhf/hypapps/trustvisor/configure.ac rename to hypapps/trustvisor/configure.ac diff --git a/xmhf/hypapps/trustvisor/create-deb.sh b/hypapps/trustvisor/create-deb.sh similarity index 100% rename from xmhf/hypapps/trustvisor/create-deb.sh rename to hypapps/trustvisor/create-deb.sh diff --git a/xmhf/hypapps/trustvisor/src/Makefile b/hypapps/trustvisor/src/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/src/Makefile rename to hypapps/trustvisor/src/Makefile diff --git a/xmhf/hypapps/trustvisor/src/appmain.c b/hypapps/trustvisor/src/appmain.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/appmain.c rename to hypapps/trustvisor/src/appmain.c diff --git a/xmhf/hypapps/trustvisor/src/crypto_init.c b/hypapps/trustvisor/src/crypto_init.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/crypto_init.c rename to hypapps/trustvisor/src/crypto_init.c diff --git a/xmhf/hypapps/trustvisor/src/dump.c b/hypapps/trustvisor/src/dump.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/dump.c rename to hypapps/trustvisor/src/dump.c diff --git a/xmhf/hypapps/trustvisor/src/emhf_callbacks.c b/hypapps/trustvisor/src/emhf_callbacks.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/emhf_callbacks.c rename to hypapps/trustvisor/src/emhf_callbacks.c diff --git a/xmhf/hypapps/trustvisor/src/emhfc_log_error.c b/hypapps/trustvisor/src/emhfc_log_error.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/emhfc_log_error.c rename to hypapps/trustvisor/src/emhfc_log_error.c diff --git a/xmhf/hypapps/trustvisor/src/hc_utpm.c b/hypapps/trustvisor/src/hc_utpm.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/hc_utpm.c rename to hypapps/trustvisor/src/hc_utpm.c diff --git a/xmhf/hypapps/trustvisor/src/hptw_emhf.c b/hypapps/trustvisor/src/hptw_emhf.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/hptw_emhf.c rename to hypapps/trustvisor/src/hptw_emhf.c diff --git a/xmhf/hypapps/trustvisor/src/include/crypto_init.h b/hypapps/trustvisor/src/include/crypto_init.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/crypto_init.h rename to hypapps/trustvisor/src/include/crypto_init.h diff --git a/xmhf/hypapps/trustvisor/src/include/hc_utpm.h b/hypapps/trustvisor/src/include/hc_utpm.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/hc_utpm.h rename to hypapps/trustvisor/src/include/hc_utpm.h diff --git a/xmhf/hypapps/trustvisor/src/include/hptw_emhf.h b/hypapps/trustvisor/src/include/hptw_emhf.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/hptw_emhf.h rename to hypapps/trustvisor/src/include/hptw_emhf.h diff --git a/xmhf/hypapps/trustvisor/src/include/malloc.h b/hypapps/trustvisor/src/include/malloc.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/malloc.h rename to hypapps/trustvisor/src/include/malloc.h diff --git a/xmhf/hypapps/trustvisor/src/include/nv.h b/hypapps/trustvisor/src/include/nv.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/nv.h rename to hypapps/trustvisor/src/include/nv.h diff --git a/xmhf/hypapps/trustvisor/src/include/pages.h b/hypapps/trustvisor/src/include/pages.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/pages.h rename to hypapps/trustvisor/src/include/pages.h diff --git a/xmhf/hypapps/trustvisor/src/include/random.h b/hypapps/trustvisor/src/include/random.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/random.h rename to hypapps/trustvisor/src/include/random.h diff --git a/xmhf/hypapps/trustvisor/src/include/scode.h b/hypapps/trustvisor/src/include/scode.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/scode.h rename to hypapps/trustvisor/src/include/scode.h diff --git a/xmhf/hypapps/trustvisor/src/include/tlsf.h b/hypapps/trustvisor/src/include/tlsf.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/tlsf.h rename to hypapps/trustvisor/src/include/tlsf.h diff --git a/xmhf/hypapps/trustvisor/src/include/tlsfbits.h b/hypapps/trustvisor/src/include/tlsfbits.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/tlsfbits.h rename to hypapps/trustvisor/src/include/tlsfbits.h diff --git a/xmhf/hypapps/trustvisor/src/include/trustvisor.h b/hypapps/trustvisor/src/include/trustvisor.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/trustvisor.h rename to hypapps/trustvisor/src/include/trustvisor.h diff --git a/xmhf/hypapps/trustvisor/src/include/tv_emhf.h b/hypapps/trustvisor/src/include/tv_emhf.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/tv_emhf.h rename to hypapps/trustvisor/src/include/tv_emhf.h diff --git a/xmhf/hypapps/trustvisor/src/include/tv_log.h b/hypapps/trustvisor/src/include/tv_log.h similarity index 100% rename from xmhf/hypapps/trustvisor/src/include/tv_log.h rename to hypapps/trustvisor/src/include/tv_log.h diff --git a/xmhf/hypapps/trustvisor/src/linuxrelc.c b/hypapps/trustvisor/src/linuxrelc.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/linuxrelc.c rename to hypapps/trustvisor/src/linuxrelc.c diff --git a/xmhf/hypapps/trustvisor/src/ltc_rng_get_bytes.c b/hypapps/trustvisor/src/ltc_rng_get_bytes.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/ltc_rng_get_bytes.c rename to hypapps/trustvisor/src/ltc_rng_get_bytes.c diff --git a/xmhf/hypapps/trustvisor/src/ltc_sprng.c b/hypapps/trustvisor/src/ltc_sprng.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/ltc_sprng.c rename to hypapps/trustvisor/src/ltc_sprng.c diff --git a/xmhf/hypapps/trustvisor/src/malloc.c b/hypapps/trustvisor/src/malloc.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/malloc.c rename to hypapps/trustvisor/src/malloc.c diff --git a/xmhf/hypapps/trustvisor/src/nv.c b/hypapps/trustvisor/src/nv.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/nv.c rename to hypapps/trustvisor/src/nv.c diff --git a/xmhf/hypapps/trustvisor/src/pages.c b/hypapps/trustvisor/src/pages.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/pages.c rename to hypapps/trustvisor/src/pages.c diff --git a/xmhf/hypapps/trustvisor/src/pt.c b/hypapps/trustvisor/src/pt.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/pt.c rename to hypapps/trustvisor/src/pt.c diff --git a/xmhf/hypapps/trustvisor/src/random.c b/hypapps/trustvisor/src/random.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/random.c rename to hypapps/trustvisor/src/random.c diff --git a/xmhf/hypapps/trustvisor/src/scode.c b/hypapps/trustvisor/src/scode.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/scode.c rename to hypapps/trustvisor/src/scode.c diff --git a/xmhf/hypapps/trustvisor/src/tlsf.c b/hypapps/trustvisor/src/tlsf.c similarity index 100% rename from xmhf/hypapps/trustvisor/src/tlsf.c rename to hypapps/trustvisor/src/tlsf.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/Makefile b/hypapps/trustvisor/tee-sdk/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/Makefile rename to hypapps/trustvisor/tee-sdk/Makefile diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/Makefile b/hypapps/trustvisor/tee-sdk/examples/newlib/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/Makefile rename to hypapps/trustvisor/tee-sdk/examples/newlib/Makefile diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/hello.c b/hypapps/trustvisor/tee-sdk/examples/newlib/hello.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/hello.c rename to hypapps/trustvisor/tee-sdk/examples/newlib/hello.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/hellopal.c b/hypapps/trustvisor/tee-sdk/examples/newlib/hellopal.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/hellopal.c rename to hypapps/trustvisor/tee-sdk/examples/newlib/hellopal.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/pal-aux.c b/hypapps/trustvisor/tee-sdk/examples/newlib/pal-aux.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/pal-aux.c rename to hypapps/trustvisor/tee-sdk/examples/newlib/pal-aux.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/pal.h b/hypapps/trustvisor/tee-sdk/examples/newlib/pal.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/pal.h rename to hypapps/trustvisor/tee-sdk/examples/newlib/pal.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/rtassert.h b/hypapps/trustvisor/tee-sdk/examples/newlib/rtassert.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/newlib/rtassert.h rename to hypapps/trustvisor/tee-sdk/examples/newlib/rtassert.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/test/Makefile b/hypapps/trustvisor/tee-sdk/examples/test/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/test/Makefile rename to hypapps/trustvisor/tee-sdk/examples/test/Makefile diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/test/pals.c b/hypapps/trustvisor/tee-sdk/examples/test/pals.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/test/pals.c rename to hypapps/trustvisor/tee-sdk/examples/test/pals.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/test/pals.h b/hypapps/trustvisor/tee-sdk/examples/test/pals.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/test/pals.h rename to hypapps/trustvisor/tee-sdk/examples/test/pals.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/examples/test/test.c b/hypapps/trustvisor/tee-sdk/examples/test/test.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/examples/test/test.c rename to hypapps/trustvisor/tee-sdk/examples/test/test.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/build.sh b/hypapps/trustvisor/tee-sdk/ports/newlib/build.sh similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/build.sh rename to hypapps/trustvisor/tee-sdk/ports/newlib/build.sh diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/example/Makefile b/hypapps/trustvisor/tee-sdk/ports/newlib/example/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/example/Makefile rename to hypapps/trustvisor/tee-sdk/ports/newlib/example/Makefile diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/example/crt0.s b/hypapps/trustvisor/tee-sdk/ports/newlib/example/crt0.s similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/example/crt0.s rename to hypapps/trustvisor/tee-sdk/ports/newlib/example/crt0.s diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/example/hello.c b/hypapps/trustvisor/tee-sdk/ports/newlib/example/hello.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/example/hello.c rename to hypapps/trustvisor/tee-sdk/ports/newlib/example/hello.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/newlib-tee-sdk-131021.patch b/hypapps/trustvisor/tee-sdk/ports/newlib/newlib-tee-sdk-131021.patch similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/newlib/newlib-tee-sdk-131021.patch rename to hypapps/trustvisor/tee-sdk/ports/newlib/newlib-tee-sdk-131021.patch diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/openssl/build.sh b/hypapps/trustvisor/tee-sdk/ports/openssl/build.sh similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/openssl/build.sh rename to hypapps/trustvisor/tee-sdk/ports/openssl/build.sh diff --git a/xmhf/hypapps/trustvisor/tee-sdk/ports/openssl/openssl-tee-sdk-131021.patch b/hypapps/trustvisor/tee-sdk/ports/openssl/openssl-tee-sdk-131021.patch similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/ports/openssl/openssl-tee-sdk-131021.patch rename to hypapps/trustvisor/tee-sdk/ports/openssl/openssl-tee-sdk-131021.patch diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/Makefile.in b/hypapps/trustvisor/tee-sdk/toolchain/Makefile.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/Makefile.in rename to hypapps/trustvisor/tee-sdk/toolchain/Makefile.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/ar.in b/hypapps/trustvisor/tee-sdk/toolchain/ar.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/ar.in rename to hypapps/trustvisor/tee-sdk/toolchain/ar.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/as.in b/hypapps/trustvisor/tee-sdk/toolchain/as.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/as.in rename to hypapps/trustvisor/tee-sdk/toolchain/as.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/autogen.sh b/hypapps/trustvisor/tee-sdk/toolchain/autogen.sh similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/autogen.sh rename to hypapps/trustvisor/tee-sdk/toolchain/autogen.sh diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/build-aux/config.sub b/hypapps/trustvisor/tee-sdk/toolchain/build-aux/config.sub similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/build-aux/config.sub rename to hypapps/trustvisor/tee-sdk/toolchain/build-aux/config.sub diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/cc.in b/hypapps/trustvisor/tee-sdk/toolchain/cc.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/cc.in rename to hypapps/trustvisor/tee-sdk/toolchain/cc.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/configure.ac b/hypapps/trustvisor/tee-sdk/toolchain/configure.ac similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/configure.ac rename to hypapps/trustvisor/tee-sdk/toolchain/configure.ac diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/ld.in b/hypapps/trustvisor/tee-sdk/toolchain/ld.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/ld.in rename to hypapps/trustvisor/tee-sdk/toolchain/ld.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/nm.in b/hypapps/trustvisor/tee-sdk/toolchain/nm.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/nm.in rename to hypapps/trustvisor/tee-sdk/toolchain/nm.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/objdump.in b/hypapps/trustvisor/tee-sdk/toolchain/objdump.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/objdump.in rename to hypapps/trustvisor/tee-sdk/toolchain/objdump.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/pkg-config.in b/hypapps/trustvisor/tee-sdk/toolchain/pkg-config.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/pkg-config.in rename to hypapps/trustvisor/tee-sdk/toolchain/pkg-config.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/ranlib.in b/hypapps/trustvisor/tee-sdk/toolchain/ranlib.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/ranlib.in rename to hypapps/trustvisor/tee-sdk/toolchain/ranlib.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/toolchain/strip.in b/hypapps/trustvisor/tee-sdk/toolchain/strip.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/toolchain/strip.in rename to hypapps/trustvisor/tee-sdk/toolchain/strip.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/TrustZone_API_3.0_Specification.pdf b/hypapps/trustvisor/tee-sdk/tz/TrustZone_API_3.0_Specification.pdf similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/TrustZone_API_3.0_Specification.pdf rename to hypapps/trustvisor/tee-sdk/tz/TrustZone_API_3.0_Specification.pdf diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/conf/onepal.mk b/hypapps/trustvisor/tee-sdk/tz/conf/onepal.mk similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/conf/onepal.mk rename to hypapps/trustvisor/tee-sdk/tz/conf/onepal.mk diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/conf/pal-template.ld b/hypapps/trustvisor/tee-sdk/tz/conf/pal-template.ld similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/conf/pal-template.ld rename to hypapps/trustvisor/tee-sdk/tz/conf/pal-template.ld diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/conf/pal.mk b/hypapps/trustvisor/tee-sdk/tz/conf/pal.mk similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/conf/pal.mk rename to hypapps/trustvisor/tee-sdk/tz/conf/pal.mk diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/conf/pkgconfig.mk b/hypapps/trustvisor/tee-sdk/tz/conf/pkgconfig.mk similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/conf/pkgconfig.mk rename to hypapps/trustvisor/tee-sdk/tz/conf/pkgconfig.mk diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/conf/svc.ld b/hypapps/trustvisor/tee-sdk/tz/conf/svc.ld similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/conf/svc.ld rename to hypapps/trustvisor/tee-sdk/tz/conf/svc.ld diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/configure.ac b/hypapps/trustvisor/tee-sdk/tz/configure.ac similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/configure.ac rename to hypapps/trustvisor/tee-sdk/tz/configure.ac diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/create-deb.sh b/hypapps/trustvisor/tee-sdk/tz/create-deb.sh similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/create-deb.sh rename to hypapps/trustvisor/tee-sdk/tz/create-deb.sh diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/dev/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/dev/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/dev/null/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/dev/null/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/src/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/dev/null/src/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/src/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/dev/null/src/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/src/svcapi.c b/hypapps/trustvisor/tee-sdk/tz/dev/null/src/svcapi.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/src/svcapi.c rename to hypapps/trustvisor/tee-sdk/tz/dev/null/src/svcapi.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/tee-sdk-svc-null.pc.in b/hypapps/trustvisor/tee-sdk/tz/dev/null/tee-sdk-svc-null.pc.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/null/tee-sdk-svc-null.pc.in rename to hypapps/trustvisor/tee-sdk/tz/dev/null/tee-sdk-svc-null.pc.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.old b/hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.old similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.old rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/Makefile.old diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/include/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tv.h b/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tv.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tv.h rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tv.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tz_platform.h b/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tz_platform.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tz_platform.h rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/include/tz_platform.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/app_vmcalls.c b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/app_vmcalls.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/app_vmcalls.c rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/app_vmcalls.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/scode.c b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/scode.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/scode.c rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/scode.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc.c b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc.c rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc_vmcalls.c b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc_vmcalls.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc_vmcalls.c rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/svc_vmcalls.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tv.c b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tv.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tv.c rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tv.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tz_aligned_malloc.c b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tz_aligned_malloc.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tz_aligned_malloc.c rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/tz_aligned_malloc.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/vmcalls.h b/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/vmcalls.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/src/vmcalls.h rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/src/vmcalls.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-app-tv.pc.in b/hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-app-tv.pc.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-app-tv.pc.in rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-app-tv.pc.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-svc-tv.pc.in b/hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-svc-tv.pc.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-svc-tv.pc.in rename to hypapps/trustvisor/tee-sdk/tz/dev/tv/tee-sdk-svc-tv.pc.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/include/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/include/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/list.h b/hypapps/trustvisor/tee-sdk/tz/include/list.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/list.h rename to hypapps/trustvisor/tee-sdk/tz/include/list.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/missing.h b/hypapps/trustvisor/tee-sdk/tz/include/missing.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/missing.h rename to hypapps/trustvisor/tee-sdk/tz/include/missing.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/sections.h b/hypapps/trustvisor/tee-sdk/tz/include/sections.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/sections.h rename to hypapps/trustvisor/tee-sdk/tz/include/sections.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/svcapi.h b/hypapps/trustvisor/tee-sdk/tz/include/svcapi.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/svcapi.h rename to hypapps/trustvisor/tee-sdk/tz/include/svcapi.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/tz.h b/hypapps/trustvisor/tee-sdk/tz/include/tz.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/tz.h rename to hypapps/trustvisor/tee-sdk/tz/include/tz.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/tze.h b/hypapps/trustvisor/tee-sdk/tz/include/tze.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/tze.h rename to hypapps/trustvisor/tee-sdk/tz/include/tze.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/include/tzmarshal.h b/hypapps/trustvisor/tee-sdk/tz/include/tzmarshal.h similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/include/tzmarshal.h rename to hypapps/trustvisor/tee-sdk/tz/include/tzmarshal.h diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/src/Makefile.am b/hypapps/trustvisor/tee-sdk/tz/src/Makefile.am similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/src/Makefile.am rename to hypapps/trustvisor/tee-sdk/tz/src/Makefile.am diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/src/marshal.c b/hypapps/trustvisor/tee-sdk/tz/src/marshal.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/src/marshal.c rename to hypapps/trustvisor/tee-sdk/tz/src/marshal.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/src/tz.c b/hypapps/trustvisor/tee-sdk/tz/src/tz.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/src/tz.c rename to hypapps/trustvisor/tee-sdk/tz/src/tz.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/src/tze.c b/hypapps/trustvisor/tee-sdk/tz/src/tze.c similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/src/tze.c rename to hypapps/trustvisor/tee-sdk/tz/src/tze.c diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/tee-sdk-app.pc.in b/hypapps/trustvisor/tee-sdk/tz/tee-sdk-app.pc.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/tee-sdk-app.pc.in rename to hypapps/trustvisor/tee-sdk/tz/tee-sdk-app.pc.in diff --git a/xmhf/hypapps/trustvisor/tee-sdk/tz/tee-sdk-svc.pc.in b/hypapps/trustvisor/tee-sdk/tz/tee-sdk-svc.pc.in similarity index 100% rename from xmhf/hypapps/trustvisor/tee-sdk/tz/tee-sdk-svc.pc.in rename to hypapps/trustvisor/tee-sdk/tz/tee-sdk-svc.pc.in diff --git a/xmhf/hypapps/trustvisor/test/Makefile b/hypapps/trustvisor/test/Makefile similarity index 100% rename from xmhf/hypapps/trustvisor/test/Makefile rename to hypapps/trustvisor/test/Makefile diff --git a/xmhf/hypapps/trustvisor/test/hpt.c b/hypapps/trustvisor/test/hpt.c similarity index 100% rename from xmhf/hypapps/trustvisor/test/hpt.c rename to hypapps/trustvisor/test/hpt.c diff --git a/xmhf/hypapps/trustvisor/test/nist_test_vectors.h b/hypapps/trustvisor/test/nist_test_vectors.h similarity index 100% rename from xmhf/hypapps/trustvisor/test/nist_test_vectors.h rename to hypapps/trustvisor/test/nist_test_vectors.h diff --git a/xmhf/hypapps/trustvisor/test/pt.c b/hypapps/trustvisor/test/pt.c similarity index 100% rename from xmhf/hypapps/trustvisor/test/pt.c rename to hypapps/trustvisor/test/pt.c diff --git a/xmhf/hypapps/trustvisor/test/test_drbg.c b/hypapps/trustvisor/test/test_drbg.c similarity index 100% rename from xmhf/hypapps/trustvisor/test/test_drbg.c rename to hypapps/trustvisor/test/test_drbg.c diff --git a/xmhf/hypapps/trustvisor/test/test_pages.c b/hypapps/trustvisor/test/test_pages.c similarity index 100% rename from xmhf/hypapps/trustvisor/test/test_pages.c rename to hypapps/trustvisor/test/test_pages.c diff --git a/xmhf/hypapps/trustvisor/trustvisor.pc.in b/hypapps/trustvisor/trustvisor.pc.in similarity index 100% rename from xmhf/hypapps/trustvisor/trustvisor.pc.in rename to hypapps/trustvisor/trustvisor.pc.in diff --git a/xmhf/hypapps/verify/Makefile b/hypapps/verify/Makefile similarity index 100% rename from xmhf/hypapps/verify/Makefile rename to hypapps/verify/Makefile diff --git a/xmhf/hypapps/verify/app/Makefile b/hypapps/verify/app/Makefile similarity index 100% rename from xmhf/hypapps/verify/app/Makefile rename to hypapps/verify/app/Makefile diff --git a/xmhf/hypapps/verify/app/appmain.c b/hypapps/verify/app/appmain.c similarity index 100% rename from xmhf/hypapps/verify/app/appmain.c rename to hypapps/verify/app/appmain.c diff --git a/xmhf/tools/docgen/render-doc.sh b/tools/docgen/render-doc.sh similarity index 100% rename from xmhf/tools/docgen/render-doc.sh rename to tools/docgen/render-doc.sh diff --git a/xmhf/tools/docgen/template/template.html b/tools/docgen/template/template.html similarity index 100% rename from xmhf/tools/docgen/template/template.html rename to tools/docgen/template/template.html diff --git a/uxmhf-rpi3/.gitignore b/uxmhf-rpi3/.gitignore deleted file mode 100644 index 6eaceb56b1..0000000000 --- a/uxmhf-rpi3/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.*~ -*~ -*.cache -*.log -*.status -confdefs.h -Makefile -configure -rpi3-config.txt \ No newline at end of file diff --git a/uxmhf-rpi3/LICENSE b/uxmhf-rpi3/LICENSE deleted file mode 100644 index 46302d2b30..0000000000 --- a/uxmhf-rpi3/LICENSE +++ /dev/null @@ -1,66 +0,0 @@ -uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - -Copyright 2018 Carnegie Mellon University. All Rights Reserved. - -BSD (SEI) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -3. Products derived from this software may not -include Carnegie Mellon University, "SEI and/or -Software Engineering Institute" in the name of such derived product, -nor shall Carnegie Mellon University, "SEI and/or Software Engineering -Institute" be used to endorse or promote products derived from this software -without prior written permission. For written permission, please -contact permission@sei.cmu.edu. - -ACKNOWLEDGMENTS AND DISCLAIMERS: -uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) includes and/or -can make use of certain third party software ("Third Party Software"). The -Third Party Software that is used by uber eXtensible Micro-Hypervisor -Framework (Raspberry Pi) is dependent upon your system configuration, but -typically includes the software identified below. By using uber -eXtensible Micro-Hypervisor Framework (Raspberry Pi), You agree to comply -with any and all relevant Third Party Software terms and conditions contained -in any such Third Party Software or separate license file distributed with such -Third Party Software. The parties who own the Third Party -Software ("Third Party Licensors") are intended third party beneficiaries to -this License with respect to the terms applicable to their Third Party Software. -Third Party Software licenses only apply to the Third Party Software and not -any other portion of uber eXtensible Micro-Hypervisor Framework (Raspberry Pi), -or uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) as a whole. - -This material is based upon work funded and supported by the Department of -Defense under Contract No. FA8702-15-D-0002 with Carnegie Mellon University -for the operation of the Software Engineering Institute, a federally funded -research and development center. - -The view, opinions, and/or findings contained in this material are those -of the author(s) and should not be construed as an official -Government position, policy, or decision, unless designated by other -documentation. - -NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING -INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY -MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER -INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR -MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. -CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH -RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. - -[DISTRIBUTION STATEMENT A] This material has been approved for public -release and unlimited distribution. Please see Copyright notice for -non-US Government use and distribution. - -Carnegie Mellon is registered in the U.S. Patent and Trademark Office -by Carnegie Mellon University. - -DM18-0513 diff --git a/uxmhf-rpi3/Makefile.in b/uxmhf-rpi3/Makefile.in deleted file mode 100644 index 87bd5b99b6..0000000000 --- a/uxmhf-rpi3/Makefile.in +++ /dev/null @@ -1,166 +0,0 @@ -# -# uxmhf-rpi3 top-level Makefile -# -# author: amit vasudevan (amitvasudevan@acm.org) -# -# - - -check_defined = \ - $(strip $(foreach 1,$1, \ - $(call __check_defined,$1,$(strip $(value 2))))) -__check_defined = \ - $(if $(value $1),, \ - $(error Error: Set $1$(if $2, ($2))$(if $(value @), \ - to OS kernel image file [required by target `$@']))) - - -export UXMHFRPI3_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) - -TOOLPREFIX ?= arm-linux-gnueabihf- - - -###### -# autoconf controlled variables -###### - -export MAKE = @MAKE@ -export CCERT = @CCERT@ -export CC = @CC@ -export AS = @AS@ -export AR = @AR@ -export RM = @RM@ -export CP = @CP@ -export MKDIR = @MKDIR@ -export LD = @LD@ -export OBJCOPY = @OBJCOPY@ -export CAT = @CAT@ - -export prefix=@prefix@ - -export SECBOOT := @SECBOOT@ -export DMAPROT := @DMAPROT@ - -export ENABLE_UAPP_UHSIGN := @ENABLE_UAPP_UHSIGN@ -export ENABLE_UAPP_UAGENT := @ENABLE_UAPP_UAGENT@ -export ENABLE_UAPP_PVDRIVER_UART := @ENABLE_UAPP_PVDRIVER_UART@ - -export ENABLE_DEBUG_UART := @ENABLE_DEBUG_UART@ -export ENABLE_UART_MINI := @ENABLE_UART_MINI@ -export ENABLE_UART_PL011 := @ENABLE_UART_PL011@ -export ENABLE_UART_PL011_CTSRTS := @ENABLE_UART_PL011_CTSRTS@ - - -INCS = -I$(UXMHFRPI3_DIR)/libs/libxmhfc/include -INCS += -I$(UXMHFRPI3_DIR)/libs/libxmhfcrypto/include -INCS += -I$(UXMHFRPI3_DIR)/libs/libutpm/include - -CFLAGS_DEFS = $(INCS) -I./include -I../include - -###### -# refine CFLAG definitions based on uxmhf rpi3 configure options -###### - -ifeq ($(SECBOOT), y) - CFLAGS_DEFS += -D__SECBOOT__ -endif - -ifeq ($(DMAPROT), y) - CFLAGS_DEFS += -D__DMAPROT__ -endif - -ifeq ($(INTPROT), y) - CFLAGS_DEFS += -D__INTPROT__ -endif - -ifeq ($(FIQREFLECTION), y) - CFLAGS_DEFS += -D__FIQREFLECTION__ -endif - -ifeq ($(ENABLE_UAPP_UHSIGN),y) - CFLAGS_DEFS += -D__ENABLE_UAPP_UHSIGN__ -endif - -ifeq ($(ENABLE_UAPP_UAGENT),y) - CFLAGS_DEFS += -D__ENABLE_UAPP_UAGENT__ -endif - -ifeq ($(ENABLE_UAPP_PVDRIVER_UART),y) - CFLAGS_DEFS += -D__ENABLE_UAPP_PVDRIVER_UART__ -endif - - -ifeq ($(ENABLE_DEBUG_UART),y) - CFLAGS_DEFS += -D__DEBUG_UART__ -endif - - -ifeq ($(ENABLE_UART_MINI),y) - CFLAGS_DEFS += -D__ENABLE_UART_MINI__ -endif - -ifeq ($(ENABLE_UART_PL011),y) - CFLAGS_DEFS += -D__ENABLE_UART_PL011__ -endif - -ifeq ($(ENABLE_UART_PL011_CTSRTS),y) - CFLAGS_DEFS += -D__ENABLE_UART_PL011_CTSRTS__ -endif - -CFLAGS = $(CFLAGS_DEFS) -c -Wall -nostdlib -nostartfiles -ffreestanding -mcpu=cortex-a53 -CCLIB = $(shell $(TOOLPREFIX)gcc --print-lib) - -LIBS = $(UXMHFRPI3_DIR)/libs/libutpm/libutpm.a -LIBS += $(UXMHFRPI3_DIR)/libs/libxmhfcrypto/libxmhfcrypto.a -LIBS += $(UXMHFRPI3_DIR)/libs/libxmhfc/libxmhfc.a - - - - - -export CCERT_FLAGS=$(CFLAGS) -export TOOLPREFIX -export CFLAGS_DEFS -export CFLAGS -export CCLIB -export LIBS - -.PHONY: all -all: checkoskrnlimg - cd libs/libxmhfc && make -w all - cd libs/libxmhfcrypto && make -w all - cd libs/libutpm && make -w all - cd core && make -w all - cd bootstrap && make -w all - cat ./bootstrap/bootstrap.bin ./oskrnlimg.tmp ./core/core.bin > uxmhf-rpi3.img - -.PHONY: checkoskrnlimg -checkoskrnlimg: - @:$(call check_defined, OSKRNLIMG) - $(eval OSKRNLIMG_SIZE := $(shell stat -L -c %s $(OSKRNLIMG))) - @echo OSKRNLIMG_SIZE=$(OSKRNLIMG_SIZE) - $(eval OSKRNLIMG_ENDADDR := $(shell echo "$(OSKRNLIMG_SIZE) + 32768" | bc)) - @echo OSKRNLIMG_ENDADDR=$(OSKRNLIMG_ENDADDR) - $(eval OSKRNLIMG_PADSIZE := $(shell echo "16777216 -( $(OSKRNLIMG_ENDADDR) % 16777216)" | bc)) - @echo OSKRNLIMG_PADSIZE=$(OSKRNLIMG_PADSIZE) - $(eval OSKRNLIMG_FINALSIZE := $(shell echo "$(OSKRNLIMG_SIZE) + $(OSKRNLIMG_PADSIZE) " | bc)) - @echo OSKRNLIMG_FINALSIZE=$(OSKRNLIMG_FINALSIZE) - #$(eval CORE_STARTADDR := $(shell echo "$(OSKRNLIMG_FINALSIZE)" | bc)) - #$(eval CORE_STARTADDR_HEX=$(shell printf "0x%08x" $(CORE_STARTADDR))) - #@echo $(CORE_STARTADDR) - #@echo $(CORE_STARTADDR_HEX) - cp $(OSKRNLIMG) ./oskrnlimg.tmp - truncate --size=$(OSKRNLIMG_FINALSIZE) ./oskrnlimg.tmp - #./configure --with-core-startaddr=$(CORE_STARTADDR_HEX) --with-core-size=0xC00000 - #./configure --with-core-startaddr=0x1000000 --with-core-size=0xC00000 - - -.PHONY: clean -clean: - cd core && make -w clean - cd bootstrap && make -w clean - rm -f *.o - rm -f *.img - rm -f *.elf - rm -f *.tmp - rm -f *.bin diff --git a/uxmhf-rpi3/bootstrap/Makefile b/uxmhf-rpi3/bootstrap/Makefile deleted file mode 100644 index 3fa514b2e6..0000000000 --- a/uxmhf-rpi3/bootstrap/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# uxmhf-rpi3 bootstrap Makefile -# -# author: amit vasudevan (amitvasudevan@acm.org) -# -# - - -.PHONY: all -all: bootstrap.bin - -bsentry.o : bsentry.S - $(TOOLPREFIX)gcc $(CFLAGS) bsentry.S -o bsentry.o - -bsmain.o : bsmain.c - $(TOOLPREFIX)gcc $(CFLAGS) bsmain.c -o bsmain.o - -#miniuart.o : ../common/miniuart.c -# $(TOOLPREFIX)gcc $(CFLAGS) ../common/miniuart.c -o miniuart.o - -#mailbox.o : ../common/mailbox.c -# $(TOOLPREFIX)gcc $(CFLAGS) ../common/mailbox.c -o mailbox.o - -#pl011uart.o : ../common/pl011uart.c -# $(TOOLPREFIX)gcc $(CFLAGS) ../common/pl011uart.c -o pl011uart.o - -#debug.o : ../common/debug.c -# $(TOOLPREFIX)gcc $(CFLAGS) ../common/debug.c -o debug.o - -arm8-32.o : ../common/arm8-32.s - $(TOOLPREFIX)gcc $(CFLAGS) -D__ASSEMBLY__ ../common/arm8-32.s -o arm8-32.o - - -#bootstrap.bin: bsentry.o bsmain.o miniuart.o mailbox.o pl011uart.o arm8-32.o debug.o -# $(TOOLPREFIX)ld bsentry.o bsmain.o miniuart.o mailbox.o pl011uart.o arm8-32.o debug.o -T bootstrap.lscript -o bootstrap.elf $(LIBS) $(CCLIB) -# $(TOOLPREFIX)objcopy bootstrap.elf -O binary bootstrap.bin - -bootstrap.bin: bsentry.o bsmain.o arm8-32.o - $(TOOLPREFIX)ld bsentry.o bsmain.o arm8-32.o -T bootstrap.lscript -o bootstrap.elf $(LIBS) $(CCLIB) - $(TOOLPREFIX)objcopy bootstrap.elf -O binary bootstrap.bin - -.PHONY: clean -clean: - rm -f *.o - rm -f *.elf - rm -f *.bin \ No newline at end of file diff --git a/uxmhf-rpi3/bootstrap/bootstrap.lscript b/uxmhf-rpi3/bootstrap/bootstrap.lscript deleted file mode 100644 index 87b48398b0..0000000000 --- a/uxmhf-rpi3/bootstrap/bootstrap.lscript +++ /dev/null @@ -1,82 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - uxmhf-rpi3 bootstrap image linker script - - author: amit vasudevan (amitvasudevan@acm.org) -*/ -ENTRY(bootstrap_entry) - -MEMORY -{ - ram (rwxai) : ORIGIN = 0x7000, LENGTH = 0x1000 - unaccounted (rwxai) : ORIGIN = 0, LENGTH = 0 /* see section .unaccounted at end */ -} - -SECTIONS -{ - . = 0x7000; - - .text : { - *(.text*) - } > ram = 0x0000 - - .bss : { - *(.bss*) - } > ram = 0x0000 - - .data : { - *(.data*) - *(.rodata*) - . = ALIGN(0x1000); - } > ram = 0x0000 - - /DISCARD/ : { - *(.ARM.attributes) - *(.comment) - } - - /* this is to cause the link to fail if there is - * anything we didn't explicitly place. - * when this does cause link to fail, temporarily comment - * this part out to see what sections end up in the output - * which are not handled above, and handle them. - */ - .unaccounted : { - *(*) - } >unaccounted - -} - diff --git a/uxmhf-rpi3/bootstrap/bsentry.S b/uxmhf-rpi3/bootstrap/bsentry.S deleted file mode 100644 index 96fe0acfcb..0000000000 --- a/uxmhf-rpi3/bootstrap/bsentry.S +++ /dev/null @@ -1,59 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - bootstrap code - - resides in a page below the actual os kernel - transfers control to the initramfs image (which is the - microhypervisor image) - - author: amit vasudevan (amitvasudevan@acm.org) -*/ -#include - -.globl bootstrap_entry -bootstrap_entry: - ldr sp, =0x00007f00 - bl bsmain - -halt: - b halt - - -.globl call_core -call_core: - ldr r3, =(UXMHF_CORE_START_ADDR) - blx r3 - diff --git a/uxmhf-rpi3/bootstrap/bsmain.c b/uxmhf-rpi3/bootstrap/bsmain.c deleted file mode 100644 index 771c001a5a..0000000000 --- a/uxmhf-rpi3/bootstrap/bsmain.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include -#include -#include -#include -#include - -extern void call_core(u32 r0, u32 id, struct atag *at); - -void bsmain(u32 r0, u32 id, struct atag *at){ - u32 hsctlr, cpsr; - - //uart_init(); - - //uart_puts("uXMHF-rpi3: bootstrap: Hello World!\n"); - - cpsr = sysreg_read_cpsr(); - //uart_puts(" CPSR[mode]= "); - //debug_hexdumpu32((cpsr & 0xF)); - - if(! ((cpsr & 0xF) == 0xA) ){ - //uart_puts("uXMHF-rpi3: core: not in HYP mode. Halting!\n"); - HALT(); - } - - - hsctlr = sysreg_read_hsctlr(); - //uart_puts(" HSCTLR before= "); - //debug_hexdumpu32(hsctlr); - - hsctlr |= (1 << 12); //enable instruction caching - hsctlr |= (1 << 2); //enable data caching - - sysreg_write_hsctlr(hsctlr); - - //hsctlr = sysreg_read_hsctlr(); - //uart_puts(" HSCTLR after= "); - //debug_hexdumpu32(hsctlr); - - //uart_puts(" r0= "); - //debug_hexdumpu32(r0); - //uart_puts(" id= "); - //debug_hexdumpu32(id); - //uart_puts(" ATAGS= "); - //debug_hexdumpu32(at); - //uart_puts("uXMHF-rpi3: bootstrap: passing control to core...\n"); - - //uart_flush(); - call_core(r0, id, at); -} diff --git a/uxmhf-rpi3/bsconfigure.sh b/uxmhf-rpi3/bsconfigure.sh deleted file mode 100755 index 9829cff49e..0000000000 --- a/uxmhf-rpi3/bsconfigure.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# top-level configure boot-strap script -# author: amit vasudevan (amitvasudevan@acm.org) - -autoconf --output=configure configure.ac -exit 0 diff --git a/uxmhf-rpi3/common/arm8-32.s b/uxmhf-rpi3/common/arm8-32.s deleted file mode 100644 index 20bb9e697f..0000000000 --- a/uxmhf-rpi3/common/arm8-32.s +++ /dev/null @@ -1,485 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 32-bit low-level cpu state access functions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include - -.section ".text" - -.globl mmio_write32 -mmio_write32: - dsb st - str r1,[r0] - bx lr - -.globl mmio_read32 -mmio_read32: - ldr r0,[r0] - bx lr - -.globl sysreg_read_spsr_hyp -sysreg_read_spsr_hyp: - mrs r0, SPSR_hyp - bx lr - - -.globl sysreg_read_scr -sysreg_read_scr: - mrc p15, 0, r0, c1, c1, 0 - bx lr - -.globl sysreg_read_cpsr -sysreg_read_cpsr: - mrs r0, cpsr - bx lr - -.globl sysreg_write_cpsr -sysreg_write_cpsr: - msr cpsr, r0 - bx lr - - -.global sysreg_read_hvbar -sysreg_read_hvbar: - mrc p15, 4, r0, c12, c0, 0 - bx lr - - -.global sysreg_write_hvbar -sysreg_write_hvbar: - mcr p15, 4, r0, c12, c0, 0 - bx lr - - -.global sysreg_read_hcr -sysreg_read_hcr: - mrc p15, 4, r0, c1, c1, 0 - bx lr - -.global sysreg_write_hcr -sysreg_write_hcr: - mcr p15, 4, r0, c1, c1, 0 - bx lr - -.global sysreg_read_hsctlr -sysreg_read_hsctlr: - mrc p15, 4, r0, c1, c0, 0 - bx lr - -.global sysreg_write_hsctlr -sysreg_write_hsctlr: - isb - mcr p15, 4, r0, c1, c0, 0 - isb - bx lr - -.global sysreg_read_actlr -sysreg_read_actlr: - mrc p15, 0, r0, c1, c0, 1 - bx lr - -.global sysreg_write_actlr -sysreg_write_actlr: - mcr p15, 0, r0, c1, c0, 1 - bx lr - -.global sysreg_read_idisar4 -sysreg_read_idisar4: - mrc p15, 0, r0, c0, c2, 4 - bx lr - -.global cpu_isb -cpu_isb: - isb - bx lr - -.global cpu_dsb -cpu_dsb: - dsb - bx lr - -.global cpu_dmbish -cpu_dmbish: - dmb ish - bx lr - -.global cpu_read_sp -cpu_read_sp: - mov r0, sp - bx lr - - -.global hypcall -hypcall: - hvc #0 - bx lr - -.global svccall -svccall: - svc #0 - bx lr - -.global sysreg_read_sctlr -sysreg_read_sctlr: - mrc p15, 0, r0, c1, c0, 0 - bx lr - -.global sysreg_write_sctlr -sysreg_write_sctlr: - mcr p15, 0, r0, c1, c0, 0 - bx lr - -.global sysreg_read_vbar -sysreg_read_vbar: - mrc p15, 0, r0, c12, c0, 0 - bx lr - -.global sysreg_write_vbar -sysreg_write_vbar: - mcr p15, 0, r0, c12, c0, 0 - bx lr - -.global sysreg_read_vtcr -sysreg_read_vtcr: - mrc p15, 4, r0, c2, c1, 2 - bx lr - -.global sysreg_write_vtcr -sysreg_write_vtcr: - mcr p15, 4, r0, c2, c1, 2 - bx lr - -.global sysreg_read_hdcr -sysreg_read_hdcr: - mrc p15, 4, r0, c1, c1, 1 - bx lr - -.global sysreg_write_hdcr -sysreg_write_hdcr: - mcr p15, 4, r0, c1, c1, 1 - bx lr - -.global sysreg_read_hcptr -sysreg_read_hcptr: - mrc p15, 4, r0, c1, c1, 2 - bx lr - -.global sysreg_write_hcptr -sysreg_write_hcptr: - mcr p15, 4, r0, c1, c1, 2 - bx lr - -.global sysreg_read_hstr -sysreg_read_hstr: - mrc p15, 4, r0, c1, c1, 3 - bx lr - -.global sysreg_write_hstr -sysreg_write_hstr: - mcr p15, 4, r0, c1, c1, 3 - bx lr - -//returns a 64-bit value: -//r0=lower 32-bits; r1=upper 32-bits (c.f. AAPCS) -.global sysreg_read_vttbr -sysreg_read_vttbr: - mrrc p15, 6, r0, r1, c2 - bx lr - -//inputs: 64-bit value -//r0=lower 32-bits; r1=upper 32-bits (c.f. AAPCS) -.global sysreg_write_vttbr -sysreg_write_vttbr: - mcrr p15, 6, r0, r1, c2 - bx lr - - -.global sysreg_read_hsr -sysreg_read_hsr: - mrc p15, 4, r0, c5, c2, 0 - bx lr - - -.global sysreg_read_elrhyp -sysreg_read_elrhyp: - mrs r0, ELR_hyp - bx lr - - -.global sysreg_write_elrhyp -sysreg_write_elrhyp: - msr ELR_hyp, r0 - bx lr - - -.global sysreg_tlbiallh -sysreg_tlbiallh: - mcr p15,4,r0,c8,c7,0 - dsb ish - bx lr - -.global sysreg_iciallu -sysreg_iciallu: - mcr p15,0,r0,c7,c5,0 - bx lr - - -//r0=ipa to flush s2pgtbl tlb entries for -//vmid is obtained from current vttbr -.global sysreg_tlbiipas2is -sysreg_tlbiipas2is: - mcr p15,4,r0,c8,c0,1 - isb - dsb ish - bx lr - - -.global sysreg_tlbiallis -sysreg_tlbiallis: - mcr p15,0,r0,c8,c3,0 - isb - dsb ish - bx lr - -.global sysreg_read_mair0 -sysreg_read_mair0: - mrc p15,0,r0,c10,c2,0 - bx lr - -.global sysreg_write_mair0 -sysreg_write_mair0: - mcr p15,0,r0,c10,c2,0 - bx lr - - -.global sysreg_read_mair1 -sysreg_read_mair1: - mrc p15,0,r0,c10,c2,1 - bx lr - -.global sysreg_write_mair1 -sysreg_write_mair1: - mcr p15,0,r0,c10,c2,1 - bx lr - - -.global sysreg_read_hmair0 -sysreg_read_hmair0: - mrc p15,4,r0,c10,c2,0 - bx lr - -.global sysreg_write_hmair0 -sysreg_write_hmair0: - mcr p15,4,r0,c10,c2,0 - bx lr - -.global sysreg_read_hmair1 -sysreg_read_hmair1: - mrc p15,4,r0,c10,c2,1 - bx lr - -.global sysreg_write_hmair1 -sysreg_write_hmair1: - mcr p15,4,r0,c10,c2,1 - bx lr - - -//returns a 64-bit value: -//r0=lower 32-bits; r1=upper 32-bits (c.f. AAPCS) -.global sysreg_read_httbr -sysreg_read_httbr: - mrrc p15,4,r0,r1,c2 - bx lr - - -//inputs: 64-bit value -//r0=lower 32-bits; r1=upper 32-bits (c.f. AAPCS) -.global sysreg_write_httbr -sysreg_write_httbr: - mcrr p15, 4, r0, r1, c2 - bx lr - - -.global sysreg_read_htcr -sysreg_read_htcr: - mrc p15,4,r0,c2,c0,2 - bx lr - -.global sysreg_write_htcr -sysreg_write_htcr: - mcr p15,4,r0,c2,c0,2 - bx lr - -.global sysreg_read_dacr -sysreg_read_dacr: - mrc p15,0,r0,c3,c0,0 - bx lr - -.global sysreg_write_dacr -sysreg_write_dacr: - mcr p15,0,r0,c3,c0,0 - bx lr - - -.global sysreg_read_hdfar -sysreg_read_hdfar: - mrc p15,4,r0,c6,c0,0 - bx lr - -.global sysreg_read_hpfar -sysreg_read_hpfar: - mrc p15,4,r0,c6,c0,4 - bx lr - - - - - - -//r0 specifies the 32-bit lock variable address -.global spin_lock -spin_lock: - mov r1, #0 //load r1 with 32-bit constant 0, signifies lock is occupied -1: - ldrex r2, [r0] //load current 32-bit value of lock and mark its memory region exclusive - teq r2, #1 //check if it is 1 i.e, free - wfene //if not free, then put this core in the wait-for-event state - strexeq r3, r1, [r0] //if free, try occupying the lock (storing 0); status is in r3 - teqeq r3, #0 //if free, test the status of the store, 0=success, 1=fail - bne 1b //start all over again if failure to store - - dmb ish //data memory barrier inner shareability; make memory updates visible to all cores - - bx lr - - -//r0 specifies the 32-bit lock variable address -.global spin_unlock -spin_unlock: - dmb ish //data memory barrier - mov r1, #1 //load r1 with 32-bit constant 1, signifies lock is free - str r1, [r0] //store 1 into lock indicating it is now free - dsb ishst //allow other cores to see the value - sev //signal other cores to wake up (if they are in the spinloop) - - bx lr - - -////// -// pl0,1 system register access functions -// chiefly used for emulation/pass-thru -////// -.global sysreg_read_ttbcr -sysreg_read_ttbcr: - mrc p15,0,r0,c2,c0,2 - bx lr - -.global sysreg_write_ttbcr -sysreg_write_ttbcr: - mcr p15,0,r0,c2,c0,2 - bx lr - -.global sysreg_read_ttbr0 -sysreg_read_ttbr0: - mrc p15,0,r0,c2,c0,0 - bx lr - -.global sysreg_write_ttbr0 -sysreg_write_ttbr0: - mcr p15,0,r0,c2,c0,0 - bx lr - -.global sysreg_read_ttbr1 -sysreg_read_ttbr1: - mrc p15,0,r0,c2,c0,1 - bx lr - -.global sysreg_write_ttbr1 -sysreg_write_ttbr1: - mcr p15,0,r0,c2,c0,1 - bx lr - -//r0 is the input virtual address -.global sysreg_ats12nsour -sysreg_ats12nsour: - mcr p15,0,r0,c7,c8,6 - bx lr - - -//r0 is the input virtual address -.global sysreg_ats1cpr -sysreg_ats1cpr: - mcr p15,0,r0,c7,c8,0 - bx lr - - -.global sysreg_read_par -sysreg_read_par: - mrc p15,0,r0,c7,c4,0 - bx lr - -////// -// generic timer system registers -////// -.global sysreg_read_cntpct -sysreg_read_cntpct: - mrrc p15, 0, r0, r1, c14 - bx lr - -.global sysreg_read_cnthp_tval -sysreg_read_cnthp_tval: - mrc p15,4,r0,c14,c2,0 - bx lr - -.global sysreg_write_cnthp_tval -sysreg_write_cnthp_tval: - mcr p15,4,r0,c14,c2,0 - bx lr - - -.global sysreg_read_cnthp_ctl -sysreg_read_cnthp_ctl: - mrc p15,4,r0,c14,c2,1 - bx lr - -.global sysreg_write_cnthp_ctl -sysreg_write_cnthp_ctl: - mcr p15,4,r0,c14,c2,1 - bx lr diff --git a/uxmhf-rpi3/common/atags.c b/uxmhf-rpi3/common/atags.c deleted file mode 100644 index fabb01fbe9..0000000000 --- a/uxmhf-rpi3/common/atags.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ATAGS (ARM bootloader tags) implementation - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include - -void atag_dumptags(struct atag *at){ - //uart_puts("uXMHF-rpi3: Dumping ATAG list...\n"); -/* - while(at->hdr.tag != ATAG_NONE){ - switch(at->hdr.tag){ - case ATAG_CORE: - uart_puts(" Found ATAG_CORE\n"); - break; - - case ATAG_MEM: - uart_puts(" Found ATAG_MEM\n"); - break; - - case ATAG_INITRD2: - uart_puts(" Found ATAG_INITRD2\n"); - break; - - case ATAG_CMDLINE: - uart_puts(" Found ATAG_CMDLINE\n"); - break; - - default: - uart_puts(" Unknown ATAG\n"); - break; - } - - at=atag_next(at); - } -*/ - //uart_puts("uXMHF-rpi3: Dumped ATAG list.\n"); - -} diff --git a/uxmhf-rpi3/common/debug.c b/uxmhf-rpi3/common/debug.c deleted file mode 100644 index fd1a28280f..0000000000 --- a/uxmhf-rpi3/common/debug.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - debug module definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include - -extern __attribute__(( section(".data") )) u32 xdprintfsmp_lock=1; - - -// gcc requires this for division by 0 on 64-bit values; used for debugging output -void raise(void){ - //uart_puts("uXMHF-rpi3: core: compiler raise invoked -- division by 0!\n"); - //uart_puts("uXMHF-rpi3: core: Halting!\n"); - HALT(); -} - -#if 0 -void debug_hexdumpu32(u32 value){ - u32 num_bits; - u32 ch; - - num_bits = 32; - - while(num_bits){ - num_bits -= 4; - - ch=(value >> num_bits) & 0xF; - if(ch > 9) - ch += 0x37; - else - ch += 0x30; - - uart_putc((u8)ch); - } - - uart_putc(' '); - uart_putc('\n'); -} -#endif \ No newline at end of file diff --git a/uxmhf-rpi3/common/mailbox.c b/uxmhf-rpi3/common/mailbox.c deleted file mode 100644 index ba8efa1983..0000000000 --- a/uxmhf-rpi3/common/mailbox.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 mailbox implementation - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include - -//mailbox message buffer -//has to be aligned on a 16 byte boundary -__attribute__((aligned(16))) __attribute__((section(".data"))) volatile unsigned int mailbox_msgbuf[MAILBOX_MAXBUFSIZE]; - -// make a mailbox call -// return: 0 if failure, non-zero on success -int bcm2837_mailbox_call(unsigned char channel, unsigned char *buffer, unsigned int buffer_size){ - unsigned int mailbox_msgbuf_channel_addr; - int i; - - // sanity check buffer size - if (buffer_size > MAILBOX_MAXBUFSIZE) - return 0; - - //first copy the buffer into our mailbox message buffer - memcpy(mailbox_msgbuf, buffer, buffer_size); - - //compute address of the message buffer including the channel identifier - mailbox_msgbuf_channel_addr = (((unsigned int)((unsigned long)&mailbox_msgbuf) & ~0xF) | ( channel &0xF )); - - // wait till we are clear to write to the mailbox - do { - for(i=0; i<5; i++); // nop - } while ( mmio_read32(MAILBOX_STATUS_REG) & MAILBOX_FULL); - - //write the address of the message to the mailbox with channel identifier - mmio_write32(MAILBOX_WRITE_REG, mailbox_msgbuf_channel_addr); - - //now wait for the response - while(1) { - // check for a reaponse - do{ - for(i=0; i<5; i++); // nop - }while ( mmio_read32(MAILBOX_STATUS_REG) & MAILBOX_EMPTY); - - // is it a response to our message? - if( mmio_read32(MAILBOX_READ_REG) == mailbox_msgbuf_channel_addr){ - // return 0 or non-zero based on if it isa valid successful response - if( mailbox_msgbuf[1] == MAILBOX_RESPONSE){ - //copy mailbox message buffer into user buffer - memcpy(buffer, mailbox_msgbuf, buffer_size); - } - return (mailbox_msgbuf[1] == MAILBOX_RESPONSE); - } - - } - - //we never get here - _XDPRINTF_("%s[%u]\n", __func__, __LINE__); - return 0; -} - -// mailbox return serial number -// return 0 on failure -u64 bcm2837_mailbox_get_board_serial(void){ - u64 board_serial=0; - unsigned int mailbox_msg[8]; - - // get the board's unique serial number with a mailbox call - mailbox_msg[0] = sizeof(mailbox_msg); // length of the message in bytes - mailbox_msg[1] = MAILBOX_REQUEST; // this is a request message - mailbox_msg[2] = MAILBOX_TAG_GETSERIAL; // get serial number command - mailbox_msg[3] = 8; // output buffer size in bytes - mailbox_msg[4] = 0; // - mailbox_msg[5] = 0; // clear output buffer - mailbox_msg[6] = 0; - mailbox_msg[7] = MAILBOX_TAG_LAST; - - if ( bcm2837_mailbox_call(MAILBOX_CHANNEL_PROP, &mailbox_msg, sizeof(mailbox_msg)) ){ - board_serial = ((u64)mailbox_msg[6] << 32) | (u64)mailbox_msg[5]; - } - - return (board_serial); -} - - diff --git a/uxmhf-rpi3/common/miniuart.c b/uxmhf-rpi3/common/miniuart.c deleted file mode 100644 index 6f7a0e127f..0000000000 --- a/uxmhf-rpi3/common/miniuart.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 mini uart support - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include - - -extern u32 mmio_read32 (u32 address); -extern void mmio_write32 (u32 address, u32 value); - - -/* mini UART functions */ -void bcm2837_miniuart_init(void){ - unsigned int gpio_fnsel, i; - - mmio_write32(AUX_ENABLES,1); - mmio_write32(AUX_MU_IER_REG,0); //clear interrupt enable - mmio_write32(AUX_MU_CNTL_REG,0); - mmio_write32(AUX_MU_LCR_REG,3); - mmio_write32(AUX_MU_MCR_REG,0); - mmio_write32(AUX_MU_IER_REG,0); - mmio_write32(AUX_MU_IIR_REG,0xC6); - mmio_write32(AUX_MU_BAUD_REG,270); //((250,000,000/115200)/8)-1 = 270 - - gpio_fnsel=mmio_read32(GPFSEL1); - gpio_fnsel &= ~(7<<12); //GPIO 14 (TX) - gpio_fnsel |= 2<<12; //GPIO 14 -- Alternate Function 5 - gpio_fnsel &= ~(7<<15); //GPIO 15 (RX) - gpio_fnsel |= 2<<15; //GPIO 15 -- Alternate Function 5 - mmio_write32(GPFSEL1,gpio_fnsel); - - mmio_write32(GPPUD,0); - for(i=0; i<150; i++); - mmio_write32(GPPUDCLK0,(1<<14)|(1<<15)); - for(i=0; i<150; i++); - mmio_write32(GPPUDCLK0,0); - mmio_write32(AUX_MU_CNTL_REG,3); -} - - -bool bcm2837_miniuart_can_send(void){ - if (! (mmio_read32(AUX_MU_LSR_REG) & 0x20) ) - return false; - else - return true; -} - -bool bcm2837_miniuart_can_recv(void){ - if( mmio_read32(AUX_MU_LSR_REG) & 0x01 ) - return true; - else - return false; -} - - -void bcm2837_miniuart_putc(u8 ch){ - while( bcm2837_miniuart_can_send() == false ); - mmio_write32(AUX_MU_IO_REG,(u32)ch); -} - -void bcm2837_miniuart_puts(char *buffer){ - while (*buffer) - bcm2837_miniuart_putc(*buffer++); -} - - -// UART character read function (non-blocking) -// return true if character read; false if no characters to read -bool bcm2837_miniuart_getc(u8 *recv_ch) { - - //do we have a character to receive? - if( bcm2837_miniuart_can_recv() ) { - - //yes, so store the character - *recv_ch=(u8)(mmio_read32(AUX_MU_IO_REG) & 0xFF); - - return true; - }else{ - return false; - } - -} - - -void bcm2837_miniuart_flush(void){ - while( (mmio_read32(AUX_MU_LSR_REG) & 0x100) ); -} - - diff --git a/uxmhf-rpi3/common/pl011uart.c b/uxmhf-rpi3/common/pl011uart.c deleted file mode 100644 index 26576b1fdd..0000000000 --- a/uxmhf-rpi3/common/pl011uart.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 mini uart support - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -extern u32 mmio_read32 (u32 address); -extern void mmio_write32 (u32 address, u32 value); - - -/* UART initialization function */ -void bcm2837_pl011uart_init(void){ - register unsigned int r; - unsigned int mbox_msg[9]; - unsigned int i; - - mmio_write32(PL011_UART_CR_REG, 0); // turn off PL011 when we work with it - - // set up clock for consistent divisor values - mbox_msg[0] = sizeof(mbox_msg); - mbox_msg[1] = MAILBOX_REQUEST; - mbox_msg[2] = MAILBOX_TAG_SETCLKRATE; // set clock rate - mbox_msg[3] = 12; - mbox_msg[4] = 0; - mbox_msg[5] = 2; // UART clock - mbox_msg[6] = 4000000; // 4Mhz - mbox_msg[7] = 0; // clear turbo - mbox_msg[8] = MAILBOX_TAG_LAST; - - bcm2837_mailbox_call(MAILBOX_CHANNEL_PROP, &mbox_msg, sizeof(mbox_msg)); - - //map PL011 UART to GPIO pins - r=mmio_read32(GPFSEL1); - r &= ~((7<<12) | (7<<15)); // gpio14, gpio15 - r |= (4<<12) | (4<<15); // alt0 - -#if defined (__ENABLE_UART_PL011_CTSRTS__) - r |= 0x00fc0000; -#endif - - mmio_write32(GPFSEL1, r); - - - mmio_write32(GPPUD, 0); // remove current pullup/pulldown configuration - - for(i=0; i<150; i++); - -#if defined (__ENABLE_UART_PL011_CTSRTS__) - mmio_write32(GPPUDCLK0, (1<<14)|(1<<15)|(1<<16)|(1<<17) ); -#else - mmio_write32(GPPUDCLK0, (1<<14)|(1<<15)); -#endif - - for(i=0; i<150; i++); - - mmio_write32(GPPUD, 0); // flush GPIO setup - - mmio_write32(GPPUDCLK0,0); // flush GPIO setup - - - mmio_write32(PL011_UART_ICR_REG, 0x7FF); // clear interrupts - mmio_write32(PL011_UART_IBRD_REG, 2); // 115200 baud - mmio_write32(PL011_UART_FBRD_REG, 0xB); - mmio_write32(PL011_UART_LCR_REG, 0x0); // flush transmit fifo - - for(i=0; i<150; i++); - -// mmio_write32(PL011_UART_LCR_REG, 0x72); // 8 bits, odd parity, 1 stop bit, enable FIFO - mmio_write32(PL011_UART_LCR_REG, 0x70); // 8 bits, no parity, 1 stop bit, enable FIFO - -#if defined (__ENABLE_UART_PL011_CTSRTS__) - mmio_write32(PL011_UART_CR_REG, 0xC301); // enable CTS, RTS, Tx, Rx -#else - mmio_write32(PL011_UART_CR_REG, 0x301); // enable Tx, Rx -#endif -} - -bool bcm2837_pl011uart_can_send(void){ - if( (mmio_read32(PL011_UART_FR_REG) & 0x20) ) - return false; - else - return true; -} - -bool bcm2837_pl011uart_can_recv(void){ - if ( ! (mmio_read32(PL011_UART_FR_REG) & 0x10) ) - return true; - else - return false; -} - - -/* UART character output function */ -void bcm2837_pl011uart_putc(u8 ch){ - - //wait until we can send - while( bcm2837_pl011uart_can_send() == false ); - mmio_write32(PL011_UART_DR_REG, ch); -} - -/* UART string output function */ -void bcm2837_pl011uart_puts(char *buffer){ - while (*buffer) - bcm2837_pl011uart_putc(*buffer++); -} - - -// UART character read function (non-blocking) -// return true if character read; false if no characters to read -bool bcm2837_pl011uart_getc(u8 *recv_ch) { - - //check if there is a byte in the FIFO buffer - if ( bcm2837_pl011uart_can_recv() ){ - - //receive FIFO is not-empty, so read the next character - *recv_ch=(u8)mmio_read32(PL011_UART_DR_REG); - - return true; - }else{ - return false; - } - -} - - -/* UART flush */ -void bcm2837_pl011uart_flush(void){ - while( !(mmio_read32(PL011_UART_FR_REG) & 0x80) ); -} - - diff --git a/uxmhf-rpi3/common/strlen.c b/uxmhf-rpi3/common/strlen.c deleted file mode 100644 index 1d4d47bcc5..0000000000 --- a/uxmhf-rpi3/common/strlen.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * From: FreeBSD sys/libkern/strlen.c - */ -/** - * Modified for XMHF. - */ - -#include -#include - -/*size_t strlen(str) - const char *str; -{ - register const char *s; - - for (s = str; *s; ++s); - return(s - str); -}*/ - -/*@ - requires \exists integer i; Length_of_str_is(s,i); - assigns \nothing; - //ensures \exists integer i; Length_of_str_is(s,i) && \result == i; - ensures \result == Length(s); - @*/ -int strlen(const char *s) { - const char *ss = s; - - /*@ - loop invariant \base_addr(s) == \base_addr(ss); - loop invariant s <= ss <= s+Length(s); - loop invariant \forall integer i; 0 <= i < (ss-s) ==> s[i] != 0; - loop assigns ss; - loop variant Length(s) - (ss-s); - @*/ - while (*ss) - ss++; - - //@ assert Length_of_str_is(s,ss-s); - return ss - s; -} diff --git a/uxmhf-rpi3/common/subr_prf.c b/uxmhf-rpi3/common/subr_prf.c deleted file mode 100644 index f520aeb0ac..0000000000 --- a/uxmhf-rpi3/common/subr_prf.c +++ /dev/null @@ -1,592 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1986, 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 - */ - -/* #include */ -/* __FBSDID("$FreeBSD: src/sys/kern/subr_prf.c,v 1.138.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $"); */ - -/** - * Modified for XMHF by - * Jim Newsome - * Amit Vasudevan (amitvasudevan@acm.org) - */ - -#include -//#include -#include -#include - -//#include -static __inline int imax(int a, int b) { return (a > b ? a : b); } - -/* - * Note that stdarg.h and the ANSI style va_start macro is used for both - * ANSI and traditional C compilers. - */ -/* #include */ -#include - -/* Max number conversion buffer length: a u_quad_t in base 2, plus NUL byte. */ -#define MAXNBUF (sizeof(intmax_t) * NBBY + 1) - -//#include "emhfc_callbacks.h" - - -/* This is actually used with radix [2..36] */ -char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -#define hex2ascii(hex) (hex2ascii_data[hex]) - -#define NBBY 8 - -struct snprintf_arg { - char *str; - size_t remain; -}; - -static char *ksprintn(char *nbuf, uintmax_t num, int base, int *len, int upper); -static void snprintf_func(int ch, void *arg); -static int -kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_list ap); - - -/*int _XDPRINTF_(const char *fmt, ...){ - va_list ap; - int retval; - - va_start(ap, fmt); - retval = vprintf(fmt, ap); - va_end(ap); - - return (retval); -} - -int vprintf(const char *fmt, va_list ap){ - int retval; - char buffer[2048]; - - retval = vsnprintf(&buffer, 2048, fmt, ap); - - xmhfc_puts(&buffer); - - return (retval); -}*/ - - -/* - * Scaled down version of sprintf(3). - */ -int -sprintf(char *buf, const char *cfmt, ...) -{ - int retval; - va_list ap; - - va_start(ap, cfmt); - retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap); - buf[retval] = '\0'; - va_end(ap); - return (retval); -} - -/* - * Scaled down version of vsprintf(3). - */ -int -vsprintf(char *buf, const char *cfmt, va_list ap) -{ - int retval; - - retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap); - buf[retval] = '\0'; - return (retval); -} - -/* - * Scaled down version of snprintf(3). - */ -int -snprintf(char *str, size_t size, const char *format, ...) -{ - int retval; - va_list ap; - - va_start(ap, format); - retval = vsnprintf(str, size, format, ap); - va_end(ap); - return(retval); -} - -/* - * Scaled down version of vsnprintf(3). - */ -int -vsnprintf(char *str, size_t size, const char *format, va_list ap) -{ - struct snprintf_arg info; - int retval; - - info.str = str; - info.remain = size; - retval = kvprintf(format, snprintf_func, &info, 10, ap); - if (info.remain >= 1) - *info.str++ = '\0'; - return (retval); -} - -/* - * Kernel version which takes radix argument vsnprintf(3). - */ -int -vsnrprintf(char *str, size_t size, int radix, const char *format, va_list ap) -{ - struct snprintf_arg info; - int retval; - - info.str = str; - info.remain = size; - retval = kvprintf(format, snprintf_func, &info, radix, ap); - if (info.remain >= 1) - *info.str++ = '\0'; - return (retval); -} - -static void -snprintf_func(int ch, void *arg) -{ - struct snprintf_arg *const info = arg; - - if (info->remain >= 2) { - *info->str++ = ch; - info->remain--; - } -} - -/* - * Put a NUL-terminated ASCII number (base <= 36) in a buffer in reverse - * order; return an optional length and a pointer to the last character - * written in the buffer (i.e., the first character of the string). - * The buffer pointed to by `nbuf' must have length >= MAXNBUF. - */ -static char * -ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) -{ - char *p, c; - - p = nbuf; - *p = '\0'; - do { - c = hex2ascii(num % base); - *++p = upper ? toupper(c) : c; - } while (num /= base); - if (lenp) - *lenp = p - nbuf; - return (p); -} - -/* - * Scaled down version of _XDPRINTF_(3). - * - * Two additional formats: - * - * The format %b is supported to decode error registers. - * Its usage is: - * - * _XDPRINTF_("reg=%b\n", regval, "*"); - * - * where is the output base expressed as a control character, e.g. - * \10 gives octal; \20 gives hex. Each arg is a sequence of characters, - * the first of which gives the bit number to be inspected (origin 1), and - * the next characters (up to a control character, i.e. a character <= 32), - * give the name of the register. Thus: - * - * kvprintf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n"); - * - * would produce output: - * - * reg=3 - * - * XXX: %D -- Hexdump, takes pointer and separator string: - * ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX - * ("%*D", len, ptr, " " -> XX XX XX XX ... - */ -static int -kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_list ap) -{ -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc,arg); else *d++ = cc; retval++; } - char nbuf[MAXNBUF]; - char *d; - const char *p, *percent, *q; - u_char *up; - int ch, n; - uintmax_t num; - int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot; - int cflag, hflag, jflag, tflag, zflag; - int dwidth, upper; - char padc; - int stop = 0, retval = 0; - - num = 0; - if (!func) - d = (char *) arg; - else - d = NULL; - - if (fmt == NULL) - fmt = "(fmt null)\n"; - - if (radix < 2 || radix > 36) - radix = 10; - - for (;;) { - padc = ' '; - width = 0; - while ((ch = (u_char)*fmt++) != '%' || stop) { - if (ch == '\0') - return (retval); - PCHAR(ch); - } - percent = fmt - 1; - qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; - sign = 0; dot = 0; dwidth = 0; upper = 0; - cflag = 0; hflag = 0; jflag = 0; tflag = 0; zflag = 0; -reswitch: switch (ch = (u_char)*fmt++) { - case '.': - dot = 1; - goto reswitch; - case '#': - sharpflag = 1; - goto reswitch; - case '+': - sign = 1; - goto reswitch; - case '-': - ladjust = 1; - goto reswitch; - case '%': - PCHAR(ch); - break; - case '*': - if (!dot) { - width = va_arg(ap, int); - if (width < 0) { - ladjust = !ladjust; - width = -width; - } - } else { - dwidth = va_arg(ap, int); - } - goto reswitch; - case '0': - if (!dot) { - padc = '0'; - goto reswitch; - } - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - for (n = 0;; ++fmt) { - n = n * 10 + ch - '0'; - ch = *fmt; - if (ch < '0' || ch > '9') - break; - } - if (dot) - dwidth = n; - else - width = n; - goto reswitch; - case 'b': - num = (u_int)va_arg(ap, int); - p = va_arg(ap, char *); - for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;) - PCHAR(*q--); - - if (num == 0) - break; - - for (tmp = 0; *p;) { - n = *p++; - if (num & (1 << (n - 1))) { - PCHAR(tmp ? ',' : '<'); - for (; (n = *p) > ' '; ++p) - PCHAR(n); - tmp = 1; - } else - for (; *p > ' '; ++p) - continue; - } - if (tmp) - PCHAR('>'); - break; - case 'c': - PCHAR(va_arg(ap, int)); - break; - case 'D': - up = va_arg(ap, u_char *); - p = va_arg(ap, char *); - if (!width) - width = 16; - while(width--) { - PCHAR(hex2ascii(*up >> 4)); - PCHAR(hex2ascii(*up & 0x0f)); - up++; - if (width) - for (q=p;*q;q++) - PCHAR(*q); - } - break; - case 'd': - case 'i': - base = 10; - sign = 1; - goto handle_sign; - case 'h': - if (hflag) { - hflag = 0; - cflag = 1; - } else - hflag = 1; - goto reswitch; - case 'j': - jflag = 1; - goto reswitch; - case 'l': - if (lflag) { - lflag = 0; - qflag = 1; - } else - lflag = 1; - goto reswitch; - case 'n': - if (jflag) - *(va_arg(ap, intmax_t *)) = retval; - else if (qflag) - *(va_arg(ap, quad_t *)) = retval; - else if (lflag) - *(va_arg(ap, long *)) = retval; - else if (zflag) - *(va_arg(ap, size_t *)) = retval; - else if (hflag) - *(va_arg(ap, short *)) = retval; - else if (cflag) - *(va_arg(ap, char *)) = retval; - else - *(va_arg(ap, int *)) = retval; - break; - case 'o': - base = 8; - goto handle_nosign; - case 'p': - base = 16; - sharpflag = (width == 0); - sign = 0; - num = (uintptr_t)va_arg(ap, void *); - goto number; - case 'q': - qflag = 1; - goto reswitch; - case 'r': - base = radix; - if (sign) - goto handle_sign; - goto handle_nosign; - case 's': - p = va_arg(ap, char *); - if (p == NULL) - p = "(null)"; - if (!dot) - n = strlen (p); - else - for (n = 0; n < dwidth && p[n]; n++) - continue; - - width -= n; - - if (!ladjust && width > 0) - while (width--) - PCHAR(padc); - while (n--) - PCHAR(*p++); - if (ladjust && width > 0) - while (width--) - PCHAR(padc); - break; - case 't': - tflag = 1; - goto reswitch; - case 'u': - base = 10; - goto handle_nosign; - case 'X': - upper = 1; - case 'x': - base = 16; - goto handle_nosign; - case 'y': - base = 16; - sign = 1; - goto handle_sign; - case 'z': - zflag = 1; - goto reswitch; -handle_nosign: - sign = 0; - if (jflag) - num = va_arg(ap, uintmax_t); - else if (qflag) - num = va_arg(ap, u_quad_t); - else if (tflag) - num = va_arg(ap, ptrdiff_t); - else if (lflag) - num = va_arg(ap, u_long); - else if (zflag) - num = va_arg(ap, size_t); - else if (hflag) - num = (u_short)va_arg(ap, int); - else if (cflag) - num = (u_char)va_arg(ap, int); - else - num = va_arg(ap, u_int); - goto number; -handle_sign: - if (jflag) - num = va_arg(ap, intmax_t); - else if (qflag) - num = va_arg(ap, quad_t); - else if (tflag) - num = va_arg(ap, ptrdiff_t); - else if (lflag) - num = va_arg(ap, long); - else if (zflag) - num = va_arg(ap, ssize_t); - else if (hflag) - num = (short)va_arg(ap, int); - else if (cflag) - num = (char)va_arg(ap, int); - else - num = va_arg(ap, int); -number: - if (sign && (intmax_t)num < 0) { - neg = 1; - num = -(intmax_t)num; - } - p = ksprintn(nbuf, num, base, &n, upper); - tmp = 0; - if (sharpflag && num != 0) { - if (base == 8) - tmp++; - else if (base == 16) - tmp += 2; - } - if (neg) - tmp++; - - if (!ladjust && padc == '0') - dwidth = width - tmp; - width -= tmp + imax(dwidth, n); - dwidth -= n; - if (!ladjust) - while (width-- > 0) - PCHAR(' '); - if (neg) - PCHAR('-'); - if (sharpflag && num != 0) { - if (base == 8) { - PCHAR('0'); - } else if (base == 16) { - PCHAR('0'); - PCHAR('x'); - } - } - while (dwidth-- > 0) - PCHAR('0'); - - while (*p) - PCHAR(*p--); - - if (ladjust) - while (width-- > 0) - PCHAR(' '); - - break; - default: - while (percent < fmt) - PCHAR(*percent++); - /* - * Since we ignore an formatting argument it is no - * longer safe to obey the remaining formatting - * arguments as the arguments will no longer match - * the format specs. - */ - stop = 1; - break; - } - } -#undef PCHAR -} - diff --git a/uxmhf-rpi3/common/whitelist.c b/uxmhf-rpi3/common/whitelist.c deleted file mode 100644 index 98562f56c4..0000000000 --- a/uxmhf-rpi3/common/whitelist.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * Matt McCormack (matthew.mccormack@live.com) - * - */ - -/* - code whitelisting (acl check for code calling uapps) - - author: amit vasudevan (amitvasudevan@acm.org) - matt mccormack (matthew.mccormack@live.com) -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include - - -// golden white-listing hash for libuhcall code -uint8_t whitelist_hash[] = { - 0x8f, 0xd1, 0x2d, 0x2a, 0xb8, 0x68, 0x0f, 0x67, 0x1f, 0x81, - 0xc8, 0xe3, 0x47, 0x69, 0x7d, 0x86, 0x05, 0x4d, 0xd9, 0xfd -}; - -#define WHITELIST_HASH_SIZE (sizeof(whitelist_hash)/sizeof(uint8_t)) -#define WHITELIST_COMPARE_BYTES 32 - -/* check white-listing hash with a memory regions specified by - * physical address and size - * return: true if ok, false if no - */ -bool uapp_check_whitelist(uint32_t paddr, uint32_t size){ - uint8_t computed_hash[WHITELIST_HASH_SIZE]; - unsigned long hash_size=WHITELIST_HASH_SIZE; - - if(sha1_memory((const unsigned char *)paddr, size, &computed_hash, &hash_size) == CRYPT_OK){ - - // debug printout of hash - #if 0 - int i; - _XDPRINTFSMP_("Hash follows: \n\n"); - for(i=0; i@], - [select core_startaddr (0x1000000)]), - , [with_core_startaddr=0x1000000]) -CORE_STARTADDR=$[]with_core_startaddr - -# core size -AC_SUBST([CORE_SIZE]) -AC_ARG_WITH([core_size], - AS_HELP_STRING([--with-core-size=@<:@SIZE@:>@], - [select core_size (0xC00000)]), - , [with_core_size=0xC00000]) -CORE_SIZE=$[]with_core_size - - -# boot partition start sector -AC_SUBST([BOOT_PARTITION_START]) -AC_ARG_WITH([boot_partition_start], - AS_HELP_STRING([--with-boot-partition-start=@<:@SECTORNUM@:>@], - [select boot_partition_start (8192)]), - , [with_boot_partition_start=8192]) -BOOT_PARTITION_START=$[]with_boot_partition_start - -# boot partition end sector -AC_SUBST([BOOT_PARTITION_END]) -AC_ARG_WITH([boot_partition_end], - AS_HELP_STRING([--with-boot-partition-end=@<:@SECTORNUM@:>@], - [select boot_partition_end (137215)]), - , [with_boot_partition_end=137215]) -BOOT_PARTITION_END=$[]with_boot_partition_end - -# selectively enable/disable secure boot -AC_SUBST([SECBOOT]) -AC_ARG_ENABLE([secboot], - AS_HELP_STRING([--enable-secboot@<:@=yes|no@:>@], - [enable Secure Boot]), - , [enable_secboot=no]) -AS_IF([test "x${enable_secboot}" != "xno"], - [SECBOOT=y], - [SECBOOT=n]) - -# selectively enable/disable DMA protection -AC_SUBST([DMAPROT]) -AC_ARG_ENABLE([dmaprot], - AS_HELP_STRING([--enable-dmaprot@<:@=yes|no@:>@], - [enable DMA Protection]), - , [enable_dmaprot=no]) -AS_IF([test "x${enable_dmaprot}" != "xno"], - [DMAPROT=y], - [DMAPROT=n]) - -# selectively enable/disable interrupt protection -AC_SUBST([INTPROT]) -AC_ARG_ENABLE([intprot], - AS_HELP_STRING([--enable-intprot@<:@=yes|no@:>@], - [enable Interrupt Protection]), - , [enable_intprot=no]) -AS_IF([test "x${enable_intprot}" != "xno"], - [INTPROT=y], - [INTPROT=n]) - -# selectively enable/disable FIQ reflection -AC_SUBST([FIQREFLECTION]) -AC_ARG_ENABLE([fiqreflection], - AS_HELP_STRING([--enable-fiqreflection@<:@=yes|no@:>@], - [enable FIQ interrupt Reflection]), - , [enable_fiqreflection=no]) -AS_IF([test "x${enable_fiqreflection}" != "xno"], - [FIQREFLECTION=y], - [FIQREFLECTION=n]) - -# selectively enable/disable HMAC functionality in hypervisor -AC_SUBST([ENABLE_UAPP_UHSIGN]) -AC_ARG_ENABLE([uapp_uhsign], - AS_HELP_STRING([--enable-uapp-uhsign@<:@=yes|no@:>@], - [enable signing uapp]), - , [enable_uapp_uhsign=no]) -AS_IF([test "x${enable_uapp_uhsign}" != "xno"], - [ENABLE_UAPP_UHSIGN=y], - [ENABLE_UAPP_UHSIGN=n]) - -# selectively enable/disable AES encryption functionality in hypervisor -AC_SUBST([ENABLE_UAPP_UAGENT]) -AC_ARG_ENABLE([uapp_uagent], - AS_HELP_STRING([--enable-uapp-uagent@<:@=yes|no@:>@], - [enable signing uapp]), - , [enable_uapp_uagent=no]) -AS_IF([test "x${enable_uapp_uagent}" != "xno"], - [ENABLE_UAPP_UAGENT=y], - [ENABLE_UAPP_UAGENT=n]) - - -# selectively enable/disable simple state DB functionality in hypervisor -AC_SUBST([ENABLE_UAPP_STATEDB]) -AC_ARG_ENABLE([uapp_stateDB], - AS_HELP_STRING([--enable-uapp-uhstateDB@<:@=yes|no@:>@], - [enable stateDB uapp]), - , [enable_uapp_stateDB=no]) -AS_IF([test "x${enable_uapp_stateDB}" != "xno"], - [ENABLE_UAPP_STATEDB=y], - [ENABLE_UAPP_STATEDB=n]) - -# selectively enable/disable UART para-virtualized driver backend in hypervisor -AC_SUBST([ENABLE_UAPP_PVDRIVER_UART]) -AC_ARG_ENABLE([uapp_pvdriver_uart], - AS_HELP_STRING([--enable-uapp-pvdriver-uart@<:@=yes|no@:>@], - [enable UART para-virtualized driver backend uapp]), - , [enable_uapp_pvdriver_uart=no]) -AS_IF([test "x${enable_uapp_pvdriver_uart}" != "xno"], - [ENABLE_UAPP_PVDRIVER_UART=y], - [ENABLE_UAPP_PVDRIVER_UART=n]) - - -# selectively enable/disable debugging via UART -AC_SUBST([ENABLE_DEBUG_UART]) -AC_ARG_ENABLE([debug_uart], - AS_HELP_STRING([--enable-debug-uart@<:@=yes|no@:>@], - [enable debug via UART, default is via mini UART]), - , [enable_debug_uart=no]) -AS_IF([test "x${enable_debug_uart}" != "xno"], - [ENABLE_DEBUG_UART=y], - [ENABLE_DEBUG_UART=n]) - - -# selectively enable/disable Mini UART support -AC_SUBST([ENABLE_UART_MINI]) - -AC_ARG_ENABLE([uart_mini], - AS_HELP_STRING([--enable-uart-mini@<:@=yes|no@:>@], - [enable Mini UART]), - , [enable_uart_mini=no]) -AS_IF([test "x${enable_uart_mini}" != "xno"], - [ENABLE_UART_MINI=y], - [ENABLE_UART_MINI=n]) - - - -# selectively enable/disable PL011 UART support -AC_SUBST([ENABLE_UART_PL011]) -AC_SUBST([RPI3CONFIG_ENABLE_UART_PL011]) - -AC_ARG_ENABLE([uart_pl011], - AS_HELP_STRING([--enable-uart-pl011@<:@=yes|no@:>@], - [enable PL011 UART]), - , [enable_uart_pl011=no]) -AS_IF([test "x${enable_uart_pl011}" != "xno"], - [ENABLE_UART_PL011=y], - [ENABLE_UART_PL011=n]) -AS_IF([test "x${enable_uart_pl011}" != "xno"], - [RPI3CONFIG_ENABLE_UART_PL011=dtoverlay=pi3-miniuart-bt], - [RPI3CONFIG_ENABLE_UART_PL011=]) - - -# selectively enable/disable PL011 UART hardware flow control -AC_SUBST([ENABLE_UART_PL011_CTSRTS]) - -AC_ARG_ENABLE([uart_pl011_ctsrts], - AS_HELP_STRING([--enable-uart-pl011-ctsrts@<:@=yes|no@:>@], - [enable PL011 UART hardware flow control (CTS/RTS)]), - , [enable_uart_pl011_ctsrts=no]) -AS_IF([test "x${enable_uart_pl011_ctsrts}" != "xno"], - [ENABLE_UART_PL011_CTSRTS=y], - [ENABLE_UART_PL011_CTSRTS=n]) - - -###### autoconf output files -AC_CONFIG_FILES( - [./include/config.h Makefile rpi3-config.txt] - ) - -AC_OUTPUT diff --git a/uxmhf-rpi3/core/Makefile b/uxmhf-rpi3/core/Makefile deleted file mode 100644 index 73608d54c0..0000000000 --- a/uxmhf-rpi3/core/Makefile +++ /dev/null @@ -1,150 +0,0 @@ -# -# uxmhf-rpi3 core Makefile -# -# author: amit vasudevan (amitvasudevan@acm.org) -# -# - -OPT_FILES := - -.PHONY: all -all: core.bin - - -entry.o : entry.s - $(TOOLPREFIX)gcc $(CFLAGS) entry.s -o entry.o - - -miniuart.o : ../common/miniuart.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/miniuart.c -o miniuart.o - -pl011uart.o : ../common/pl011uart.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/pl011uart.c -o pl011uart.o - -mailbox.o : ../common/mailbox.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/mailbox.c -o mailbox.o - - -strlen.o : ../common/strlen.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/strlen.c -o strlen.o - -subr_prf.o : ../common/subr_prf.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/subr_prf.c -o subr_prf.o - - -debug.o : ../common/debug.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/debug.c -o debug.o - -atags.o : ../common/atags.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/atags.c -o atags.o - -arm8-32.o : ../common/arm8-32.s - $(TOOLPREFIX)gcc $(CFLAGS) -D__ASSEMBLY__ ../common/arm8-32.s -o arm8-32.o - -ifeq ($(filter $(ENABLE_UAPP_UAGENT) $(ENABLE_UAPP_UHSIGN) $(ENABLE_UAPP_STATEDB),y),y) -whitelist.o : ../common/whitelist.c - $(TOOLPREFIX)gcc $(CFLAGS) ../common/whitelist.c -o whitelist.o -OPT_FILES += whitelist.o -endif - -hypvtablestubs.o : hypvtablestubs.s - $(TOOLPREFIX)gcc $(CFLAGS) hypvtablestubs.s -o hypvtablestubs.o - -hypvtable.o : hypvtable.c - $(TOOLPREFIX)gcc $(CFLAGS) hypvtable.c -o hypvtable.o - -mmu.o : mmu.c - $(TOOLPREFIX)gcc $(CFLAGS) mmu.c -o mmu.o - -hyppgtbl.o : hyppgtbl.c - $(TOOLPREFIX)gcc $(CFLAGS) hyppgtbl.c -o hyppgtbl.o - - -s2pgtbl.o : s2pgtbl.c - $(TOOLPREFIX)gcc $(CFLAGS) s2pgtbl.c -o s2pgtbl.o - -uapi_s2pgtbl.o : uapi_s2pgtbl.c - $(TOOLPREFIX)gcc $(CFLAGS) uapi_s2pgtbl.c -o uapi_s2pgtbl.o - -dmaprot.o : dmaprot.c - $(TOOLPREFIX)gcc $(CFLAGS) dmaprot.c -o dmaprot.o - -intprot.o : intprot.c - $(TOOLPREFIX)gcc $(CFLAGS) intprot.c -o intprot.o - -secboot.o : secboot.c - $(TOOLPREFIX)gcc $(CFLAGS) secboot.c -o secboot.o - - -bcm2837.o : bcm2837.c - $(TOOLPREFIX)gcc $(CFLAGS) bcm2837.c -o bcm2837.o - - -ctxtrace.o : ../uapps/uapp-ctxtrace/ctxtrace.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-ctxtrace/ctxtrace.c -o ctxtrace.o - -hyptimer.o : hyptimer.c - $(TOOLPREFIX)gcc $(CFLAGS) hyptimer.c -o hyptimer.o - -uapp-uhcalltest.o : ../uapps/uapp-uhcalltest/uapp-uhcalltest.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-uhcalltest/uapp-uhcalltest.c -o uapp-uhcalltest.o - -ifeq ($(ENABLE_UAPP_UHSIGN), y) -uapp-uhsign.o : ../uapps/uapp-uhsign/uapp-uhsign.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-uhsign/uapp-uhsign.c -o uapp-uhsign.o -OPT_FILES += uapp-uhsign.o -endif - -ifeq ($(ENABLE_UAPP_UAGENT), y) -uapp-uagent.o : ../uapps/uapp-uagent/uapp-uagent.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-uagent/uapp-uagent.c -o uapp-uagent.o -OPT_FILES += uapp-uagent.o -endif - -ifeq ($(ENABLE_UAPP_STATEDB), y) -uapp-uhstateDB.o : ../uapps/uapp-uhstateDB/uapp-uhstateDB.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-uhstateDB/uapp-uhstateDB.c -o uapp-uhstateDB.o -OPT_FILES += uapp-uhstateDB.o -endif - -ifeq ($(ENABLE_UAPP_PVDRIVER_UART), y) -uapp-pvdriver-uart.o : ../uapps/uapp-pvdriver-uart/uapp-pvdriver-uart.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-pvdriver-uart/uapp-pvdriver-uart.c -o uapp-pvdriver-uart.o -OPT_FILES += uapp-pvdriver-uart.o -endif - -uapp-utpmtest.o : ../uapps/uapp-utpmtest/uapp-utpmtest.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-utpmtest/uapp-utpmtest.c -o uapp-utpmtest.o - -uapp-pa5encfs.o : ../uapps/uapp-pa5encfs/uapp-pa5encfs.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-pa5encfs/uapp-pa5encfs.c -o uapp-pa5encfs.o - - -uapp-watchdogsup.o : ../uapps/uapp-watchdog/uapp-watchdogsup.s - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-watchdog/uapp-watchdogsup.s -o uapp-watchdogsup.o - -uapp-watchdog.o : ../uapps/uapp-watchdog/uapp-watchdog.c - $(TOOLPREFIX)gcc $(CFLAGS) ../uapps/uapp-watchdog/uapp-watchdog.c -o uapp-watchdog.o - - -ghcall.o : ghcall.c - $(TOOLPREFIX)gcc $(CFLAGS) ghcall.c -o ghcall.o - - -main.o : main.c - $(TOOLPREFIX)gcc $(CFLAGS) main.c -o main.o - -core.bin: entry.o miniuart.o pl011uart.o mailbox.o strlen.o subr_prf.o debug.o atags.o arm8-32.o hypvtablestubs.o hypvtable.o mmu.o hyppgtbl.o s2pgtbl.o uapi_s2pgtbl.o dmaprot.o intprot.o secboot.o bcm2837.o hyptimer.o ctxtrace.o uapp-uhcalltest.o uapp-utpmtest.o uapp-pa5encfs.o uapp-watchdogsup.o uapp-watchdog.o $(OPT_FILES) ghcall.o main.o - cp -f core.lscript core.lscript.c - echo $(OPT_FILES) - $(TOOLPREFIX)gcc -E -P $(CFLAGS_DEFS) core.lscript.c -o core.ls - $(TOOLPREFIX)ld entry.o miniuart.o pl011uart.o mailbox.o strlen.o subr_prf.o debug.o atags.o arm8-32.o hypvtablestubs.o hypvtable.o mmu.o hyppgtbl.o s2pgtbl.o uapi_s2pgtbl.o dmaprot.o intprot.o secboot.o bcm2837.o hyptimer.o ctxtrace.o uapp-uhcalltest.o uapp-utpmtest.o uapp-pa5encfs.o uapp-watchdogsup.o uapp-watchdog.o $(OPT_FILES) ghcall.o main.o -T core.ls -o core.elf $(LIBS) $(CCLIB) - $(TOOLPREFIX)objcopy core.elf -O binary core.bin - - -.PHONY: clean -clean: - rm -f *.o - rm -f *.elf - rm -f *.bin - rm -f core.lscript.c diff --git a/uxmhf-rpi3/core/bcm2837.c b/uxmhf-rpi3/core/bcm2837.c deleted file mode 100644 index 46c292f794..0000000000 --- a/uxmhf-rpi3/core/bcm2837.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - BCM2837 (pi3) specific functions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -extern void secondary_cpu_entry(void); -volatile u32 cpu_smpready[BCM2837_MAXCPUS] = {1, 0, 0, 0}; - -void bcm2837_platform_initialize(void){ - -} - - -void bcm2837_platform_smpinitialize(void){ - u32 i; - armlocalregisters_mailboxwrite_t *armlocalregisters_mailboxwrite; - armlocalregisters_mailboxreadclear_t *armlocalregisters_mailboxreadclear; - armlocalregisters_mailboxreadclear_t *armlocalregisters_mailboxreadclear_cpu0; - - u32 timeout=20; - - armlocalregisters_mailboxreadclear_cpu0 = (armlocalregisters_mailboxreadclear_t *)(ARMLOCALREGISTERS_MAILBOXREADCLEAR_BASE + (0 * sizeof(armlocalregisters_mailboxreadclear_t))); - - for(i=1; i < BCM2837_MAXCPUS; i++){ - //for(i=1; i < 2; i++){ - timeout=20; - armlocalregisters_mailboxwrite = (armlocalregisters_mailboxwrite_t *)(ARMLOCALREGISTERS_MAILBOXWRITE_BASE + (i * sizeof(armlocalregisters_mailboxwrite_t))); - armlocalregisters_mailboxreadclear = (armlocalregisters_mailboxreadclear_t *)(ARMLOCALREGISTERS_MAILBOXREADCLEAR_BASE + (i * sizeof(armlocalregisters_mailboxreadclear_t))); - - _XDPRINTF_("%s: cpu %u: armlocalregisters_mailboxwrite at 0x%08x\n", __func__, i, armlocalregisters_mailboxwrite); - _XDPRINTF_("%s: cpu %u: armlocalregisters_mailboxwrite->mailbox3write at 0x%08x\n", __func__, i, &armlocalregisters_mailboxwrite->mailbox3write); - - cpu_dsb(); - if( armlocalregisters_mailboxreadclear->mailbox3readclear != 0){ - _XDPRINTF_("%s: cpu %u: failed to respond. Halting!\n", __func__, i); - HALT(); - } - - //write cpu execution start address - armlocalregisters_mailboxwrite->mailbox3write = (u32)&secondary_cpu_entry; - - while (--timeout > 0) { - if (armlocalregisters_mailboxreadclear->mailbox3readclear == 0) break; - cpu_dmbish(); - } - - if (timeout==0){ - _XDPRINTF_("%s: cpu %u failed to start. Halting!\n", __func__, i); - HALT(); - } - - while(armlocalregisters_mailboxreadclear_cpu0->mailbox3readclear == 0){ - cpu_dmbish(); - cpu_dsb(); - } - - armlocalregisters_mailboxreadclear_cpu0->mailbox3readclear = 1; - - //while(!cpu_smpready[i]){ - // cpu_dmbish(); - // cpu_dsb(); - //} - - _XDPRINTF_("%s: cpu-%u started successfully\n", __func__, i); - } - -} - - - -u32 bcm2837_platform_waitforstartup(u32 cpuid){ - armlocalregisters_mailboxwrite_t *armlocalregisters_mailboxwrite; - armlocalregisters_mailboxreadclear_t *armlocalregisters_mailboxreadclear; - u32 cpu_startaddr=0; - u32 retval=0; - - //_XDPRINTFSMP_("%s[%u]: ENTER\n", __func__, cpuid); - - armlocalregisters_mailboxwrite = (armlocalregisters_mailboxwrite_t *)(ARMLOCALREGISTERS_MAILBOXWRITE_BASE + (cpuid * sizeof(armlocalregisters_mailboxwrite_t))); - armlocalregisters_mailboxreadclear = (armlocalregisters_mailboxreadclear_t *)(ARMLOCALREGISTERS_MAILBOXREADCLEAR_BASE + (cpuid * sizeof(armlocalregisters_mailboxreadclear_t))); - - - //_XDPRINTFSMP_("%s[%u]: Waiting on mailbox startup signal...\n", __func__, cpuid); - - while(1){ - cpu_startaddr=armlocalregisters_mailboxreadclear->mailbox3readclear; - if(cpu_startaddr != 0) break; - } - - //_XDPRINTFSMP_("%s[%u]: Got startup signal, address=0x%08x\n", __func__, cpuid, cpu_startaddr); - - armlocalregisters_mailboxreadclear->mailbox3readclear = cpu_startaddr; - - retval = cpu_startaddr; - cpu_startaddr=armlocalregisters_mailboxreadclear->mailbox3readclear; - //_XDPRINTFSMP_("%s[%u]: Cleared mailbox [val=0x%08x] and ready to go\n", __func__, cpuid, - // cpu_startaddr); - - return retval; -} diff --git a/uxmhf-rpi3/core/core.lscript b/uxmhf-rpi3/core/core.lscript deleted file mode 100644 index 4043bcb7ef..0000000000 --- a/uxmhf-rpi3/core/core.lscript +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - uxmhf-rpi3 image linker script - - author: amit vasudevan (amitvasudevan@acm.org) -*/ -#include - -ENTRY(entry) - -MEMORY -{ - ram (rwxai) : ORIGIN = UXMHF_CORE_START_ADDR, LENGTH = UXMHF_CORE_SIZE - unaccounted (rwxai) : ORIGIN = 0, LENGTH = 0 /* see section .unaccounted at end */ -} - -SECTIONS -{ - . = UXMHF_CORE_START_ADDR; - - .text : { - *(.text) - } > ram = 0x0000 - - .data : { - *(.rodata) - *(.data) - *(.bss) - . = ALIGN(0x4000); - *(.paligndata) - . = ALIGN(0x200000); - *(.palign2mdata) - } > ram = 0x0000 - - - .stack : { - *(.stack) - . = ALIGN(0x200000); - } > ram = 0x0000 - - /DISCARD/ : { - *(.ARM.attributes) - *(.comment) - *(.ARM.extab) - *(.ARM.exidx) - *(.debug_*) - } - - /* this is to cause the link to fail if there is - * anything we didn't explicitly place. - * when this does cause link to fail, temporarily comment - * this part out to see what sections end up in the output - * which are not handled above, and handle them. - */ - .unaccounted : { - *(*) - } >unaccounted - -} - diff --git a/uxmhf-rpi3/core/dmaprot.c b/uxmhf-rpi3/core/dmaprot.c deleted file mode 100644 index a298524453..0000000000 --- a/uxmhf-rpi3/core/dmaprot.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - Pi3 DMA protection implementation - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include - -__attribute__((section(".palign2mdata"))) __attribute__((align(PAGE_SIZE_2M))) dmac_cb_t dmac_cblist[BCM2837_DMA_NUMCHANNELS][BCM2837_DMA_MAXCBRECORDS]; - -//activate DMA protection mechanism -void dmaprot_activate(void){ - u64 attrs_dev = (LDESC_S2_MC_DEVnGnRE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_NO_ACCESS << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_NON_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - u64 attrs_dev_dwc = (LDESC_S2_MC_DEVnGnRE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_READ_ONLY << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_NON_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - - uapi_s2pgtbl_setprot(BCM2837_DMA0_REGS_BASE, attrs_dev); - sysreg_tlbiallis(); - uapi_s2pgtbl_setprot(BCM2837_DMA15_REGS_BASE, attrs_dev); - sysreg_tlbiallis(); - - //USB DMA controller - uapi_s2pgtbl_setprot(DWC_REGS_BASE, attrs_dev_dwc); - sysreg_tlbiallis(); - - - -} - - -u32 dmaprot_shadowcb(u32 dmac_channel, u32 cb_pa){ - u32 cb_syspa = dmapa_to_syspa(cb_pa); - volatile dmac_cb_t *dmacb; - volatile dmac_cb_t *dmacb_prev=0; - u32 i=0; - u32 syspa_src_addr; - u32 syspa_dst_addr; - - dmacb = (dmac_cb_t *)cb_syspa; - - ////uart_puts("dmaprot: ccb: dmacb="); - //debug_hexdumpu32((u32)dmacb); - - while(1){ - - ////uart_puts("dmaprot: ccb: ti="); - //debug_hexdumpu32(dmacb->ti); - ////uart_puts("dmaprot: ccb: src_addr="); - //debug_hexdumpu32(dmacb->src_addr); - ////uart_puts("dmaprot: ccb: dst_addr="); - //debug_hexdumpu32(dmacb->dst_addr); - ////uart_puts("dmaprot: ccb: len="); - //debug_hexdumpu32(dmacb->len); - ////uart_puts("dmaprot: ccb: next_cb_addr="); - //debug_hexdumpu32(dmacb->next_cb_addr); - - syspa_src_addr = dmapa_to_syspa(dmacb->src_addr); - syspa_dst_addr = dmapa_to_syspa(dmacb->dst_addr); - - if( (syspa_src_addr >= UXMHF_CORE_START_ADDR && - syspa_src_addr < UXMHF_CORE_END_ADDR) - ){ - ////uart_puts("CB src_addr using micro-hypervisor memory regions. Halting!\n"); - HALT(); - } - - if( (syspa_dst_addr >= UXMHF_CORE_START_ADDR && - syspa_dst_addr < UXMHF_CORE_END_ADDR) - ){ - ////uart_puts("CB dst_addr using micro-hypervisor memory regions. Halting!\n"); - HALT(); - } - - dmac_cblist[dmac_channel][i].ti = dmacb->ti; - dmac_cblist[dmac_channel][i].src_addr = dmacb->src_addr; - dmac_cblist[dmac_channel][i].dst_addr = dmacb->dst_addr; - dmac_cblist[dmac_channel][i].len = dmacb->len; - dmac_cblist[dmac_channel][i].stride = dmacb->stride; - dmac_cblist[dmac_channel][i].rsv_0 = dmacb->rsv_0; - dmac_cblist[dmac_channel][i].rsv_1 = dmacb->rsv_1; - - - - if(dmacb->next_cb_addr == 0){ - dmac_cblist[dmac_channel][i].next_cb_addr = 0; - i++; - break; - } - - if(dmacb->next_cb_addr == cb_pa){ - dmac_cblist[dmac_channel][i].next_cb_addr = syspa_to_dmapa((u32)&dmac_cblist[dmac_channel][0].ti); - i++; - break; - } - - if(dmapa_to_syspa(dmacb->next_cb_addr) == dmacb_prev){ - dmac_cblist[dmac_channel][i].next_cb_addr = syspa_to_dmapa((u32)&dmac_cblist[dmac_channel][i-1].ti); - i++; - break; - } - - dmacb_prev = dmacb; - dmacb = (dmac_cb_t *)dmapa_to_syspa(dmacb->next_cb_addr); - - if((i+1) >= BCM2837_DMA_MAXCBRECORDS){ - //uart_puts("dmaprot: ccb: i < max records. Halting!\n"); - HALT(); - } - dmac_cblist[dmac_channel][i].next_cb_addr = syspa_to_dmapa((u32)&dmac_cblist[dmac_channel][i+1].ti); - i++; - } - - //debug - /*//uart_puts("dumping shadow cb:\n"); - { - u32 count; - for(count=0; count < i; count++){ - //uart_puts("ti = "); - debug_hexdumpu32(dmac_cblist[dmac_channel][count].ti); - //uart_puts("src_addr = "); - debug_hexdumpu32(dmac_cblist[dmac_channel][count].src_addr); - //uart_puts("dst_addr = "); - debug_hexdumpu32(dmac_cblist[dmac_channel][count].dst_addr); - //uart_puts("len = "); - debug_hexdumpu32(dmac_cblist[dmac_channel][count].len); - //uart_puts("next_cb_addr = "); - debug_hexdumpu32(dmac_cblist[dmac_channel][count].next_cb_addr); - } - } - //uart_puts("dumping done; retval=\n"); - debug_hexdumpu32(syspa_to_dmapa((u32)&dmac_cblist[dmac_channel][0].ti)); - */ - - return syspa_to_dmapa((u32)&dmac_cblist[dmac_channel][0].ti); -} - -/* -void dmaprot_dump_cb(u32 cb_pa){ - u32 cb_syspa = dmapa_to_syspa(cb_pa); - volatile dmac_cb_t *dmacb; - - dmacb = (dmac_cb_t *)cb_syspa; - - //uart_puts("dmaprot_dump_cb="); - debug_hexdumpu32(cb_pa); - //uart_puts(" ti="); - debug_hexdumpu32(dmacb->ti); - //uart_puts(" src_addr="); - debug_hexdumpu32(dmacb->src_addr); - //uart_puts(" dst_addr="); - debug_hexdumpu32(dmacb->dst_addr); - //uart_puts(" len="); - debug_hexdumpu32(dmacb->len); - //uart_puts(" next_cb_addr="); - debug_hexdumpu32(dmacb->next_cb_addr); - //uart_puts("dmaprot_dump_end\n"); - -} -*/ - -/* -void dmaprot_channel_cs_access(u32 wnr, u32 dmac_channel, u32 *dmac_reg, u32 value){ - volatile u32 *dmac_cb_reg; - - u32 dmac_cb_reg_value; - - dmac_cb_reg = (u32 *)((u32)dmac_reg + 0x4); - - if(wnr){ //write - if(value & 0x1){ - //activating DMA, get current cb register value - dmac_cb_reg_value = *dmac_cb_reg; - - //uart_puts("dmaprot: DMA_ACTIVATE="); - debug_hexdumpu32(dmac_cb_reg_value); - }else{ - //uart_puts("dmaprot: DMA_DE-ACTIVATE\n"); - } - - cpu_dsb(); - cpu_isb(); //synchronize all memory accesses above - *dmac_reg = value; - - }else{ //read - _XDPRINTFSMP_("%s: not implemented. Halting!\n",__func__); - HALT(); - } - -} -*/ - -void dmaprot_channel_conblkad_access(u32 wnr, u32 dmac_channel, u32 *dmac_reg, u32 value){ - u32 shadow_value; - - if(wnr){ //write - //shadow cb - ////uart_puts("dmaprot: conblkad="); - //debug_hexdumpu32(value); - shadow_value=dmaprot_shadowcb(dmac_channel, value); - ////uart_puts("dmaprot: conblkad[shadow]="); - //debug_hexdumpu32(shadow_value); - - cpu_dsb(); - cpu_isb(); //synchronize all memory accesses above - *dmac_reg = shadow_value; - - }else{ //read - _XDPRINTFSMP_("%s: not implemented. Halting!\n",__func__); - HALT(); - } - -} - - -//handle DMA controller accesses -void dmaprot_handle_dmacontroller_access(info_intercept_data_abort_t *ida){ - volatile u32 *dmac_reg; - u32 dmac_reg_page; - u32 dmac_reg_off; - u32 dmac_channel; - - //we only support 32-bit dmac accesses; bail out if this is not the case - if(ida->sas != 0x2){ - _XDPRINTFSMP_("%s: invalid sas=%u. Halting!\n", __func__, ida->sas); - HALT(); - } - - //compute dmac register address and register page-base - dmac_reg = (u32 *)ida->pa; - dmac_reg_page = (u32)dmac_reg & 0xFFFFF000UL; - - //compute channel and register offset - if(dmac_reg_page == BCM2837_DMA15_REGS_BASE){ - dmac_channel = 15; - dmac_reg_off = (u32)dmac_reg & 0x000000FFUL; - }else{ - dmac_channel = ((u32)dmac_reg & 0x00000F00UL) >> 8; - if(dmac_channel == 15) //this is either int status or enable base register - dmac_channel = 16; //so set dmac_reg_channel to invalid value (16) - dmac_reg_off = (u32)dmac_reg & 0x000000FFUL; - } - - //act on either writes or reads - if(ida->wnr){ //dmac register write - - //compute value that is going to be written - u32 value = (u32)guest_regread(ida->r, ida->srt); - - switch(dmac_reg_off){ - //case 0x0: //CS register - //dmaprot_channel_cs_access(ida->wnr, dmac_channel, dmac_reg, value); - //break; - - case 0x4: //CONBLKAD register - dmaprot_channel_conblkad_access(ida->wnr, dmac_channel, dmac_reg, value); - break; - - - default: //just pass-through writes - cpu_dsb(); - cpu_isb(); //synchronize all memory accesses above - *dmac_reg = value; - break; - } - - }else{ //dmac register read - - switch(dmac_reg_off){ - default:{ //just pass-through reads - u32 value; - cpu_dsb(); - cpu_isb(); //synchronize all memory accesses above - value = (u32)*dmac_reg; - guest_regwrite(ida->r, ida->srt, value); - } - break; - } - - } - -} - - -//handle USB DMA controller accesses -void dmaprot_handle_usbdmac_access(info_intercept_data_abort_t *ida){ - u32 guest_regvalue; - - if(!ida->il){ //we only support 32-bit arm - _XDPRINTFSMP_("dmaprotusb: il=0, unhandled condition. Halting!\n"); - HALT(); - } - - if(!ida->wnr){ //we only get here on writes, bail out otherwise - _XDPRINTFSMP_("dmaprotusb: wnr=0, unhandled condition. Halting!\n"); - HALT(); - } - - //we only support 32-bit dmac accesses; bail out if this is not the case - if(ida->sas != 0x2){ - _XDPRINTFSMP_("dmaprotusb: access is not 32-bits, unhandled condition. Halting!\n"); - HALT(); - } - - //get guest register value - guest_regvalue = guest_regread(ida->r, ida->srt); - - mmio_write32(ida->pa, guest_regvalue); -} diff --git a/uxmhf-rpi3/core/entry.s b/uxmhf-rpi3/core/entry.s deleted file mode 100644 index 1cb6e401a7..0000000000 --- a/uxmhf-rpi3/core/entry.s +++ /dev/null @@ -1,145 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - entry stub - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -.section ".text" - -//r0, r1 and r2 are set by the boot-loader and need to -//be preserved -.globl entry -entry: - - mrc p15, #0, r3, c0, c0, #5 //read MPIDR - and r3, #3 //mask off the CPUID value - add r4, r3, #1 //r4 = index into cpu_stacks - - ldr sp, =cpu_stacks //load cpu_stacks base into stack-pointer - mov r5, #8192 - mul r6, r4, r5 //r6 is the offset to add based on index (r4) - add sp, sp, r6 //sp is the top-of-stack for this cpu - - bl main - -halt: - b halt - - - - -//r0,r1,r2 go through to the guest os -//r3 contains the starting address to execute the guestos -//clobbers r7,r9 -.globl chainload_os -chainload_os: - - mov r7, #0 - //mcr p15, 4, r7, c1, c1, 0 // HCR=0 - mcr p15, 4, r7, c1, c1, 2 // HCPTR=0 - //mcr p15, 4, r7, c1, c1, 3 // HSTR=0 - - //mcr p15, 4, r7, c1, c0, 0 // HSCTLR=0 - - mrc p15, 4, r7, c1, c1, 1 // HDCR - and r7, #0x1f // Preserve HPMN - mcr p15, 4, r7, c1, c1, 1 // HDCR - - - // make CNTP_* and CNTPCT accessible from guest - mrc p15, 0, r7, c0, c1, 1 // ID_PFR1 - lsr r7, #16 - and r7, #0xf - cmp r7, #1 - bne 1f - mrc p15, 4, r7, c14, c1, 0 // CNTHCTL - orr r7, r7, #3 // PL1PCEN | PL1PCTEN - mcr p15, 4, r7, c14, c1, 0 // CNTHCTL - mov r7, #0 - mcrr p15, 4, r7, r7, c14 // CNTVOFF - - //disable virtual timer - mrc p15, 0, r7, c14, c3, 1 // CNTV_CTL - bic r7, #1 // Clear ENABLE - mcr p15, 0, r7, c14, c3, 1 // CNTV_CTL - -1: - - mrs r9 , cpsr - eor r9, r9, #0x0000001a //HYP_MODE - tst r9, #0x0000001f //MODE_MASK - bic r9 , r9 , #0x0000001f //MODE_MASK - orr r9 , r9 , #(0x00000080 | 0x00000040 | 0x00000013) //PSR_I_BIT | PSR_F_BIT | SVC_MODE - orr r9, r9, #0x00000100 //PSR_A_BIT - msr spsr_cxsf, r9 - msr ELR_hyp, r3 //store address to begin execution in SVC mode in ELR_hyp - eret - - - -.globl secondary_cpu_entry -secondary_cpu_entry: - - mrc p15, #0, r0, c0, c0, #5 //read MPIDR - and r0, #3 //mask off the CPUID value - add r1, r0, #1 //r1 = index into cpu_stacks - - ldr sp, =cpu_stacks //load cpu_stacks base into stack-pointer - mov r2, #8192 - mul r3, r2, r1 //r3 is the offset to add based on index (r1) - add sp, sp, r3 //sp is the top-of-stack for this cpu - - bl secondary_main //r0 is the cpuid - -secondary_cpu_entry_halt: - b secondary_cpu_entry_halt - - - - - -.section ".stack", "aw" - - .balign 8 - .global cpu_stacks - cpu_stacks: .space (8192 * 4) - - .balign 8 - .global cpu_stacks_svc - cpu_stacks_svc: .space (8192 * 4) - - diff --git a/uxmhf-rpi3/core/ghcall.c b/uxmhf-rpi3/core/ghcall.c deleted file mode 100644 index 38902ce983..0000000000 --- a/uxmhf-rpi3/core/ghcall.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * uxmhf guest hypercall handler hub - * author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - - -////// -// externs -////// -extern bool appnpf_activated; -extern u32 appnpf_page_pa; - - -////// -// guest hypercall handler hub -////// -void guest_hypercall_handler(arm8_32_regs_t *r, u32 hsr){ - u32 hvc_iss; - u32 hvc_imm16; - - hvc_iss = ((hsr & HSR_ISS_MASK) >> HSR_ISS_SHIFT); - hvc_imm16 = hvc_iss & 0x0000FFFFUL; - - - if (hvc_imm16 == 0){ - //do nothing; null hypercall - - }else if (hvc_imm16 == 1){ - //hypercall hub interaction - /* - * r0 = hypercall function number - * r1 = physical address of the guest buffer - * r2 = size of the guest buffer - * note: r1+r2 cannot cross page-boundary - */ - if( uapp_uhcalltest_handlehcall(r->r0, r->r1, r->r2) ) - return; - - if( uapp_utpmtest_handlehcall(r->r0, r->r1, r->r2) ) - return; - - if( uapp_pa5encfs_handlehcall(r->r0, r->r1, r->r2) ) - return; - -#if defined (__ENABLE_UAPP_UHSIGN__) - if( uapp_uhsign_handlehcall(r->r0, r->r1, r->r2) ) - return; -#endif -#if defined (__ENABLE_UAPP_UAGENT__) - if( uapp_uagent_handlehcall(r->r0, r->r1, r->r2) ) - return; -#endif - -#if defined (__ENABLE_UAPP_PVDRIVER_UART__) - if( uapp_pvdriver_uart_handlehcall(r->r0, r->r1, r->r2) ) - return; -#endif - - _XDPRINTFSMP_("%s: hcall unhandled. Halting!\n", __func__); - HALT(); - - }else{ - _XDPRINTFSMP_("%s: unknown HVC instruction imm16=0x%08x. Halting!\n", __func__, - hvc_imm16); - HALT(); - } - -} - - - - -////// deprecated stuff below -#if 0 -void guest_hypercall_handler(arm8_32_regs_t *r, u32 hsr){ - u32 hvc_iss; - u32 hvc_imm16; - - hvc_iss = ((hsr & HSR_ISS_MASK) >> HSR_ISS_SHIFT); - hvc_imm16 = hvc_iss & 0x0000FFFFUL; - - - if (hvc_imm16 == 1){ - //do nothing; null hypercall - - }else if (hvc_imm16 == 2){ - u64 attrs_noaccess = (LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_BACK_CACHEABLE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_NO_ACCESS << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_INNER_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - _XDPRINTFSMP_("%s: setprot_noaccess r0=0x%08x\n", __func__, - r->r0); - - uapi_s2pgtbl_setprot(r->r0, attrs_noaccess); - sysreg_tlbiallis(); - - appnpf_page_pa = r->r0; - appnpf_activated=true; - - }else if (hvc_imm16 == 3){ - u64 attrs = (LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_BACK_CACHEABLE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_READ_WRITE << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_INNER_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - _XDPRINTFSMP_("%s: setprot_restore-access r0=0x%08x\n", __func__, - r->r0); - - uapi_s2pgtbl_setprot(r->r0, attrs); - sysreg_tlbiallis(); - - appnpf_page_pa = 0UL; - appnpf_activated=false; - - - }else{ - _XDPRINTFSMP_("%s: unknown HVC instruction imm16=0x%08x. Halting!\n", __func__, - hvc_imm16); - HALT(); - } - -} -#endif diff --git a/uxmhf-rpi3/core/hyppgtbl.c b/uxmhf-rpi3/core/hyppgtbl.c deleted file mode 100644 index 77d841289e..0000000000 --- a/uxmhf-rpi3/core/hyppgtbl.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 hypervisor (stage-1) page table translation functions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include -#include - -//G4.3 -//HYP mode _must_ use long descriptor format - -//G4.5.2 -//we will use a level-1 pointing to level-2 with 2MB pages -// - -//G6.2.69 ARMv8 -//HTCR needs to be setup especially T0SZ bit must be 0 to allow full 32-bit addressing - -//G6.2.71 ARMv8 -//HTTBR is the base address of the page-tables -//base address needs to be 32-byte aligned - -//G6.2.66 ARMv8 -//HSCTLR has to be set appropriately -//especially the bit 0 M bit enables the MMU -//AFE is 1 - -//G6.2.100 -//MAIR0 and MAIR1 together have 8 memory region attributes -//indexed by attrindx - -//G4.5.3 -//PXN and nG bits are res0 in HYP mode - - -void hyppgtbl_initialize_memoryattributes(void){ - u32 hmair0, hmair1; - - hmair0 = sysreg_read_hmair0(); - hmair1 = sysreg_read_hmair1(); - _XDPRINTF_("%s: before: hmair0=0x%08x, hmair1=0x%08x\n", __func__, hmair0, hmair1); - - hmair0 = hmair1 = (LDESC_S1_MAIR_HI_DEV | LDESC_S1_MAIR_LO_DEVnGnRnE) | - ((LDESC_S1_MAIR_HI_READALLOCATE_WRITEALLOCATE_OUTER_WRITE_BACK_NONTRANSIENT | LDESC_S1_MAIR_LO_READALLOCATE_WRITEALLOCATE_INNER_WRITE_BACK_NONTRANSIENT) << 8) | - ((LDESC_S1_MAIR_HI_OUTER_NON_CACHEABLE | LDESC_S1_MAIR_LO_INNER_NON_CACHEABLE) << 16) | - ((LDESC_S1_MAIR_HI_DEV | LDESC_S1_MAIR_LO_DEVnGnRE) << 24); - - sysreg_write_hmair0(hmair0); - sysreg_write_hmair1(hmair1); - - hmair0 = sysreg_read_hmair0(); - hmair1 = sysreg_read_hmair1(); - _XDPRINTF_("%s: after: hmair0=0x%08x, hmair1=0x%08x\n", __func__, hmair0, hmair1); -} - - - - -void hyppgtbl_initialize_translationcontrol(void){ - u32 htcr; - - htcr = sysreg_read_htcr(); - _XDPRINTF_("%s: HTCR before=0x%08x\n", __func__, htcr); - - htcr &= HTCR_IMPDEF_MASK; //clear out everything except implementation defined bits - htcr |= HTCR_RES1_MASK; //reserved 1 bits - htcr |= ((0x0 << HTCR_T0SZ_SHIFT) & HTCR_T0SZ_MASK); //T0SZ=0; 32 bits physical address - htcr |= ((MEM_WRITEBACK_READALLOCATE_WRITEALLOCATE << HTCR_IRGN0_SHIFT) & HTCR_IRGN0_MASK); //L1 cache attribute - htcr |= ((MEM_WRITEBACK_READALLOCATE_WRITEALLOCATE << HTCR_ORGN0_SHIFT) & HTCR_ORGN0_MASK); //L2 cache attribute - //htcr |= ((MEM_NON_CACHEABLE << HTCR_IRGN0_SHIFT) & HTCR_IRGN0_MASK); //L1 cache attribute - //htcr |= ((MEM_NON_CACHEABLE << HTCR_ORGN0_SHIFT) & HTCR_ORGN0_MASK); //L2 cache attribute - htcr |= ((MEM_INNER_SHAREABLE << HTCR_SH0_SHIFT) & HTCR_SH0_MASK); //shareability attribute - - sysreg_write_htcr(htcr); - - htcr = sysreg_read_htcr(); - _XDPRINTF_("%s: HTCR after=0x%08x\n", __func__, htcr); -} - -__attribute__((section(".paligndata"))) __attribute__((align(PAGE_SIZE_4K))) u64 hyp_l1_ldesc_table[L1_LDESC_TABLE_MAXENTRIES]; -__attribute__((section(".paligndata"))) __attribute__((align(PAGE_SIZE_4K))) u64 hyp_l2_ldesc_table[L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES]; - -extern dmac_cb_t dmac_cblist[BCM2837_DMA_NUMCHANNELS][BCM2837_DMA_MAXCBRECORDS]; - - -void hyppgtbl_populate_tables(void){ - u32 i; - u64 l1_attrs= (LDESC_S1_TABLEATTR_APTABLE_NONE << LDESC_S1_TABLEATTR_APTABLE_SHIFT); - //u64 l2_attrs = (LDESC_S1_AP_READWRITE << LDESC_S1_MEMATTR_AP_SHIFT) | - // (MEM_INNER_SHAREABLE << LDESC_S1_MEMATTR_SH_SHIFT) | - // LDESC_S1_MEMATTR_AF_MASK | - // (1 << LDESC_S1_MEMATTR_ATTRINDX_SHIFT); - - u64 l2_attrs = (LDESC_S1_AP_READWRITE << LDESC_S1_MEMATTR_AP_SHIFT) | - (MEM_INNER_SHAREABLE << LDESC_S1_MEMATTR_SH_SHIFT) | - LDESC_S1_MEMATTR_AF_MASK | - (1 << LDESC_S1_MEMATTR_ATTRINDX_SHIFT); - - u64 l2_attrs_nc = (LDESC_S1_AP_READWRITE << LDESC_S1_MEMATTR_AP_SHIFT) | - (MEM_INNER_SHAREABLE << LDESC_S1_MEMATTR_SH_SHIFT) | - LDESC_S1_MEMATTR_AF_MASK | - (2 << LDESC_S1_MEMATTR_ATTRINDX_SHIFT); - - - u64 l2_attrs_dev = (LDESC_S1_AP_READWRITE << LDESC_S1_MEMATTR_AP_SHIFT) | - (MEM_NON_SHAREABLE << LDESC_S1_MEMATTR_SH_SHIFT) | - LDESC_S1_MEMATTR_AF_MASK | - (3 << LDESC_S1_MEMATTR_ATTRINDX_SHIFT); - - - //populate l1 ldesc table - for(i=0; i < L1_LDESC_TABLE_MAXENTRIES; i++){ - if( i < L1_LDESC_TABLE_ENTRIES) - hyp_l1_ldesc_table[i] = ldesc_make_s1_l1e_table((u32)&hyp_l2_ldesc_table[i * L2_LDESC_TABLE_MAXENTRIES], l1_attrs); - //hyp_l1_ldesc_table[i] = ldesc_make_s1_l1e_block((i * PAGE_SIZE_1G), l2_attrs); - else - hyp_l1_ldesc_table[i] = ldesc_make_s1_l1e_invalid(); - } - - - //debug - _XDPRINTF_("%s: dumping l1 ldesc table...\n", __func__); - for(i=0; i < L1_LDESC_TABLE_ENTRIES; i++){ - _XDPRINTF_(" %u-> %016llx\n", i, hyp_l1_ldesc_table[i]); - } - _XDPRINTF_("%s: l1 ldesc table dump finished\n", __func__); - _XDPRINTF_("%s: dmac_cblist at 0x%08x\n", __func__, (u32)&dmac_cblist); - - //populate l2 ldesc table - for(i=0; i < (L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES); i++){ - if ( ((i * PAGE_SIZE_2M) >= UXMHF_CORE_START_ADDR) && - ((i * PAGE_SIZE_2M) < UXMHF_CORE_END_ADDR) ){ - //hypervisor memory region mapping - if ( (i * PAGE_SIZE_2M) == (u32)&dmac_cblist ){ - hyp_l2_ldesc_table[i] = ldesc_make_s1_l2e_block( (i * PAGE_SIZE_2M), l2_attrs_nc); - _XDPRINTF_("%s: mapped dmac_cblist at 0x%08x\n", __func__, (u32)&dmac_cblist); - }else{ - hyp_l2_ldesc_table[i] = ldesc_make_s1_l2e_block( (i * PAGE_SIZE_2M), l2_attrs); - } - - }else if ( (i * PAGE_SIZE_2M) >= BCM2837_PERIPHERALS_BASE ){ - hyp_l2_ldesc_table[i] = ldesc_make_s1_l2e_block( (i * PAGE_SIZE_2M), l2_attrs_dev); - - }else if ( ((i * PAGE_SIZE_2M) >= 0x3AC00000) && ((i * PAGE_SIZE_2M) < BCM2837_PERIPHERALS_BASE) ){ - //TBD: track guest MAIR - hyp_l2_ldesc_table[i] = ldesc_make_s1_l2e_block( (i * PAGE_SIZE_2M), l2_attrs_nc); - - }else{ - hyp_l2_ldesc_table[i] = ldesc_make_s1_l2e_block( (i * PAGE_SIZE_2M), l2_attrs); - } - } - - -} - - -void hyppgtbl_loadpgtblbase(void){ - u64 httbr; - - _XDPRINTF_("%s: hyp_l1_desc table at=0x%08x\n", __func__, (u32)&hyp_l1_ldesc_table); - - httbr = sysreg_read_httbr(); - _XDPRINTF_("%s: HTTBR before=0x%016llx\n", __func__, httbr); - - httbr = 0; - httbr |= ((u64)&hyp_l1_ldesc_table & HTTBR_BADDR_MASK); - sysreg_write_httbr(httbr); - - httbr = sysreg_read_httbr(); - _XDPRINTF_("%s: HTTBR after=0x%016llx\n", __func__, httbr); -} - - -void hyppgtbl_activate(void){ - u32 hsctlr; - _XDPRINTF_("%s: [ENTER]\n", __func__); - - hyppgtbl_initialize_memoryattributes(); - _XDPRINTF_("%s: initialized memory attributes\n", __func__); - - hyppgtbl_initialize_translationcontrol(); - _XDPRINTF_("%s: initialized translation control\n", __func__); - - hyppgtbl_loadpgtblbase(); - _XDPRINTF_("%s: loaded page-table base register\n", __func__); - - mmu_disableicache(); - _XDPRINTF_("%s: disabled icache\n", __func__); - - mmu_disabledcache(); - _XDPRINTF_("%s: disabled dcache\n", __func__); - - mmu_invalidatetlbs(); - _XDPRINTF_("%s: invalidated TLBs\n", __func__); - - mmu_invalidateicache(); - _XDPRINTF_("%s: invalidated icache\n", __func__); - - mmu_activatetranslation(); - _XDPRINTF_("%s: MMU translation activated\n", __func__); - - //mmu_enableicache(); - //_XDPRINTF_("%s: enabled icache\n", __func__); - - //mmu_enabledcache(); - //_XDPRINTF_("%s: enabled dcache\n", __func__); - - hsctlr = sysreg_read_hsctlr(); - _XDPRINTF_("%s: [EXIT] HSCTLR=0x%08x\n", __func__, hsctlr); -} diff --git a/uxmhf-rpi3/core/hyptimer.c b/uxmhf-rpi3/core/hyptimer.c deleted file mode 100644 index 4fbf8d7347..0000000000 --- a/uxmhf-rpi3/core/hyptimer.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 hypervisor timer module - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - - diff --git a/uxmhf-rpi3/core/hypvtable.c b/uxmhf-rpi3/core/hypvtable.c deleted file mode 100644 index 7ca6b22970..0000000000 --- a/uxmhf-rpi3/core/hypvtable.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 hypervisor vector table interface - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -////// -// externs -////// -extern u32 g_hypvtable[BCM2837_MAXCPUS][8]; - - -////// -// hypvtable_setentry -// initialize an entry in the vector table for given CPU -// return 0 on success; non-zero on fail -////// -u32 hypvtable_setentry(u32 cpuid, u32 entry_idx, u32 entry_addr){ - u32 vector_table_entry_base; - u32 entry_value; - - if(entry_idx > 7) - return 1; - - vector_table_entry_base =(u32)&g_hypvtable[cpuid]; - vector_table_entry_base += sizeof(u32) * entry_idx; - - if(entry_addr < vector_table_entry_base) - return 2; - - //formula to setup vector table value based on given 32-bit address - //1. addr - vtable_base + 0x4 - //2. divide 1 by 4 - //3. subtract 1 - //4. add to unsigned 0xEA000000 - entry_value = 0xEA000000 + (u32)(((entry_addr - vector_table_entry_base + 0x4) / 4) - 1); - - g_hypvtable[cpuid][entry_idx]=entry_value; -} - - -////// -// hypvtable_initialize -// initialize vector table for given CPU -////// -void hypvtable_initialize(u32 cpuid){ - u32 i; - - //debug - _XDPRINTFSMP_("%s[%u]: dumping (ghypvtable at 0x%08x) contents...\n", __func__, cpuid, (u32)&g_hypvtable[cpuid]); - for(i=0; i < 8; i++){ - _XDPRINTFSMP_("%s[%u]: 0x%08x\n", __func__, cpuid, g_hypvtable[cpuid][i]); - } - _XDPRINTFSMP_("%s[%u]: dumped ghypvtable\n", __func__, cpuid); - - //setup HVBAR for vectors - _XDPRINTFSMP_("%s[%u]: HVBAR[before]=0x%08x\n", __func__, cpuid, sysreg_read_hvbar()); - sysreg_write_hvbar((u32)&g_hypvtable[cpuid]); - _XDPRINTFSMP_("%s[%u]: HVBAR[after]=0x%08x\n", __func__, cpuid, sysreg_read_hvbar()); -} diff --git a/uxmhf-rpi3/core/hypvtablestubs.s b/uxmhf-rpi3/core/hypvtablestubs.s deleted file mode 100644 index 01c56e400f..0000000000 --- a/uxmhf-rpi3/core/hypvtablestubs.s +++ /dev/null @@ -1,273 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - HYP mode verctor table and stubs - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - - -.section ".text" -/* - G1.12.1 (Table G1-6 ARMv8) - HYP vector table format: - offsets: - 0x0: not used - 0x4: undefined instruction form HYP mode - 0x8: HVC in HYP mode - 0x0C: prefetch abort from HYP mode - 0x10: data abort from HYP mode - 0x14: HVC in non-HYP mode - 0x18: IRQ - 0x1C: FIQ -*/ - -/* need lower 5 bits (0-4) of the table address as 0, so use balign 32 */ - .balign 32 - .global g_hypvtable -g_hypvtable: - //cpu-0 - b hypvtable_reserved_handler0 - b hypvtable_reserved_handler0 - b hypvtable_reserved_handler0 - b hypvtable_reserved_handler0 - b hypvtable_reserved_handler0 - b hypvtable_hypsvc_handler0 - b hypvtable_reserved_handler0 - b hypvtable_reserved_handler0 - //cpu-1 - b hypvtable_reserved_handler1 - b hypvtable_reserved_handler1 - b hypvtable_reserved_handler1 - b hypvtable_reserved_handler1 - b hypvtable_reserved_handler1 - b hypvtable_hypsvc_handler1 - b hypvtable_reserved_handler1 - b hypvtable_reserved_handler1 - //cpu-2 - b hypvtable_reserved_handler2 - b hypvtable_reserved_handler2 - b hypvtable_reserved_handler2 - b hypvtable_reserved_handler2 - b hypvtable_reserved_handler2 - b hypvtable_hypsvc_handler2 - b hypvtable_reserved_handler2 - b hypvtable_reserved_handler2 - //cpu-3 - b hypvtable_reserved_handler3 - b hypvtable_reserved_handler3 - b hypvtable_reserved_handler3 - b hypvtable_reserved_handler3 - b hypvtable_reserved_handler3 - b hypvtable_hypsvc_handler3 - b hypvtable_reserved_handler3 - b hypvtable_reserved_handler3 - - - - .balign 32 - .global hypvtable_reserved_handler0 -hypvtable_reserved_handler0: - ldr sp, =hypvtable_rsvhandler_stack_top0 - bl hyp_rsvhandler -1: b 1b - - - .global hypvtable_reserved_handler1 -hypvtable_reserved_handler1: - ldr sp, =hypvtable_rsvhandler_stack_top1 - bl hyp_rsvhandler -1: b 1b - - .global hypvtable_reserved_handler2 -hypvtable_reserved_handler2: - ldr sp, =hypvtable_rsvhandler_stack_top2 - bl hyp_rsvhandler -1: b 1b - - .global hypvtable_reserved_handler3 -hypvtable_reserved_handler3: - ldr sp, =hypvtable_rsvhandler_stack_top3 - bl hyp_rsvhandler -1: b 1b - - - - - .global hypvtable_hypsvc_handler0 -hypvtable_hypsvc_handler0: - ldr sp, =hypvtable_hypsvc_stack_top0 - b hypvtable_hypsvc_handler_common - - .global hypvtable_hypsvc_handler1 -hypvtable_hypsvc_handler1: - ldr sp, =hypvtable_hypsvc_stack_top1 - b hypvtable_hypsvc_handler_common - - .global hypvtable_hypsvc_handler2 -hypvtable_hypsvc_handler2: - ldr sp, =hypvtable_hypsvc_stack_top2 - b hypvtable_hypsvc_handler_common - - .global hypvtable_hypsvc_handler3 -hypvtable_hypsvc_handler3: - ldr sp, =hypvtable_hypsvc_stack_top3 - b hypvtable_hypsvc_handler_common - - - - - - - -/* - G1.12.3 ARMv8 - exception return address is stored in ELR_hyp register and - points to the instruction *after* the HVC instruction (Table G1-9) -*/ - .global hypvtable_hypsvc_handler_common -hypvtable_hypsvc_handler_common: - // G1.9.2 (Figure G1-3) - // HYP mode uses LR_usr, i.e, does not have LR banking, so save - // since we are going to be using LR for C calling - - push {lr} - - - // save guest gprs - push {r12} - push {r11} - push {r10} - push {r9} - push {r8} - push {r7} - push {r6} - push {r5} - push {r4} - push {r3} - push {r2} - push {r1} - push {r0} - - - // invoke C handler - mov r0, sp - bl hypsvc_handler - - // restore all saved registers - pop {r0} - pop {r1} - pop {r2} - pop {r3} - pop {r4} - pop {r5} - pop {r6} - pop {r7} - pop {r8} - pop {r9} - pop {r10} - pop {r11} - pop {r12} - - pop {lr} - - // - // G1.13.1 ARMv8 - // exception returns from HYP mode is made via ERET instruction - // which basically returns to ELR_hyp and restores appropriate - // PE (processor execution) state - // - - eret - - - -.section ".stack" - .balign 8 - .global hypvtable_stack - stack: .space 8192 - .global hypvtable_stack_top - hypvtable_stack_top: - - .balign 8 - .global hypvtable_hypsvc_stack0 - hypvtable_hypsvc_stack0: .space 16384 - .global hypvtable_hypsvc_stack_top0 - hypvtable_hypsvc_stack_top0: - - .balign 8 - .global hypvtable_hypsvc_stack1 - hypvtable_hypsvc_stack1: .space 16384 - .global hypvtable_hypsvc_stack_top1 - hypvtable_hypsvc_stack_top1: - - .balign 8 - .global hypvtable_hypsvc_stack2 - hypvtable_hypsvc_stack2: .space 16384 - .global hypvtable_hypsvc_stack_top2 - hypvtable_hypsvc_stack_top2: - - .balign 8 - .global hypvtable_hypsvc_stack3 - hypvtable_hypsvc_stack3: .space 16384 - .global hypvtable_hypsvc_stack_top3 - hypvtable_hypsvc_stack_top3: - - .balign 8 - .global hypvtable_rsvhandler_stack0 - hypvtable_rsvhandler_stack0: .space 8192 - .global hypvtable_rsvhandler_stack_top0 - hypvtable_rsvhandler_stack_top0: - - .balign 8 - .global hypvtable_rsvhandler_stack1 - hypvtable_rsvhandler_stack1: .space 8192 - .global hypvtable_rsvhandler_stack_top1 - hypvtable_rsvhandler_stack_top1: - - .balign 8 - .global hypvtable_rsvhandler_stack2 - hypvtable_rsvhandler_stack2: .space 8192 - .global hypvtable_rsvhandler_stack_top2 - hypvtable_rsvhandler_stack_top2: - - .balign 8 - .global hypvtable_rsvhandler_stack3 - hypvtable_rsvhandler_stack3: .space 8192 - .global hypvtable_rsvhandler_stack_top3 - hypvtable_rsvhandler_stack_top3: - - - diff --git a/uxmhf-rpi3/core/intprot.c b/uxmhf-rpi3/core/intprot.c deleted file mode 100644 index b7472681fd..0000000000 --- a/uxmhf-rpi3/core/intprot.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - Pi3 root interrupt controller protection implementation - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include - -//activate interrupt protection mechanism -void intprot_activate(void){ - u64 attrs_dev_intc = (LDESC_S2_MC_DEVnGnRE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_READ_ONLY << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_NON_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - - uapi_s2pgtbl_setprot(ARMLOCALREGISTERS_BASE, attrs_dev_intc); - sysreg_tlbiallis(); -} - - - -//handle interrupt controller accesses -void intprot_handle_intcontroller_access(info_intercept_data_abort_t *ida){ - volatile u32 *intc_reg; - - //we only support 32-bit accesses; bail out if this is not the case - if(ida->sas != 0x2){ - _XDPRINTFSMP_("%s: invalid sas=%u. Halting!\n", __func__, ida->sas); - HALT(); - } - - //compute interrupt controller register address - intc_reg = (u32 *)ida->pa; - - //act on either writes or reads - if(ida->wnr){ //intc register write - - //compute value that is going to be written - u32 guest_value = (u32)guest_regread(ida->r, ida->srt); - - //ensure HYP timer FIQs are always on - if(intc_reg == LOCAL_TIMER_INT_CONTROL0){ - if ( !(guest_value & (1UL << 6)) ){ - _XDPRINTFSMP_("%s: FATAL: guest tried to reset HYP timer FIQ. Halting!\n", __func__); - HALT(); - } - } - - //just pass-through writes - //mmio_write32(intc_reg, guest_value); - cpu_dsb(); - cpu_isb(); //synchronize all memory accesses above - *intc_reg = guest_value; - - }else{ //intc register read - //we should never get here - _XDPRINTFSMP_("%s: invalid wnr=%u. Halting!\n", __func__, ida->wnr); - HALT(); - } - -} - diff --git a/uxmhf-rpi3/core/main.c b/uxmhf-rpi3/core/main.c deleted file mode 100644 index 60c69bb7a6..0000000000 --- a/uxmhf-rpi3/core/main.c +++ /dev/null @@ -1,670 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -////// -// externs -////// -extern u8 cpu_stacks[]; -extern void chainload_os(u32 r0, u32 id, struct atag *at, u32 address); -extern void cpumodeswitch_hyp2svc(u32 r0, u32 id, struct atag *at, u32 address, u32 cpuid); - - - - -////// -// appnpf hypapp related variables -////// -bool appnpf_activated=false; -u32 appnpf_page_pa=0UL; - - - -void hyp_rsvhandler(void){ - _XDPRINTF_("%s: unhandled exception\n", __func__); - _XDPRINTF_("%s: Halting!\n", __func__); - HALT(); -} - - - - - -void hyphvc_handler(void){ - _XDPRINTF_("%s: [IN]\n", __func__); - _XDPRINTF_("%s: Hello world from hypercall\n", __func__); - _XDPRINTF_("%s: [OUT]\n", __func__); -} - - -////// -// guest register and memory read/write helpers -////// - -void guest_regwrite(arm8_32_regs_t *r, u32 regnum, u32 value){ - if(regnum == 0) - r->r0 = value; - else if(regnum == 1) - r->r1 = value; - else if(regnum == 2) - r->r2 = value; - else if(regnum == 3) - r->r3 = value; - else if(regnum == 4) - r->r4 = value; - else if(regnum == 5) - r->r5 = value; - else if(regnum == 6) - r->r6 = value; - else if(regnum == 7) - r->r7 = value; - else if(regnum == 8) - r->r8 = value; - else if(regnum == 9) - r->r9 = value; - else if(regnum == 10) - r->r10 = value; - else if(regnum == 11) - r->r11 = value; - else if(regnum == 12) - r->r12 = value; - else{ - _XDPRINTFSMP_("%s: Invalid regnum=%u. Halting!\n", __func__, regnum); - HALT(); - } -} - - -u32 guest_regread(arm8_32_regs_t *r, u32 regnum){ - - if(regnum == 0) - return(r->r0); - else if (regnum == 1) - return(r->r1); - else if (regnum == 2) - return(r->r2); - else if (regnum == 3) - return(r->r3); - else if (regnum == 4) - return(r->r4); - else if (regnum == 5) - return(r->r5); - else if (regnum == 6) - return(r->r6); - else if (regnum == 7) - return(r->r7); - else if (regnum == 8) - return(r->r8); - else if (regnum == 9) - return(r->r9); - else if (regnum == 10) - return(r->r10); - else if (regnum == 11) - return(r->r11); - else if (regnum == 12) - return(r->r12); - else{ - _XDPRINTFSMP_("%s: Invalid regnum=%u. Halting!\n", __func__, regnum); - HALT(); - } - - return 0; //never reached -} - - - - -void guest_data_abort_handler(arm8_32_regs_t *r, u32 hsr){ - u32 elr_hyp; - u32 fault_va; - u32 fault_pa_page; - u32 fault_pa; - u32 fault_va_page_offset; - u32 fault_iss; - u32 fault_iss_isv; - u32 guest_regnum; - u32 fault_il; - info_intercept_data_abort_t ida; - - //get faulting iss - fault_iss = (hsr & HSR_ISS_MASK) >> HSR_ISS_SHIFT; - - //compute validity bit of additional information - fault_iss_isv = (fault_iss & 0x01000000UL) >> 24; - - //compute fault instruction length - fault_il = ((hsr & HSR_IL_MASK) >> HSR_IL_SHIFT); - - //fix return address - elr_hyp = sysreg_read_elrhyp(); - if(fault_il) - elr_hyp += sizeof(u32); - else - elr_hyp += sizeof(u16); - sysreg_write_elrhyp(elr_hyp); - - //get faulting va - fault_va= sysreg_read_hdfar(); - - //compute faulting va page_offset - fault_va_page_offset = fault_va & 0x00000FFFUL; - - //get faulting pa page - fault_pa_page = sysreg_read_hpfar(); - fault_pa_page = (fault_pa_page & 0xFFFFFFF0UL) << 8; - - //compute faulting pa - fault_pa = fault_pa_page | fault_va_page_offset; - - //fill out info_intercept_data_abort_t ida - ida.il = fault_il; - ida.sas = (fault_iss & 0x00C00000UL) >> 22; - ida.srt = (fault_iss & 0x000F0000UL) >> 16; - ida.wnr = (fault_iss & 0x00000040UL) >> 6; - ida.va = fault_va; - ida.pa = fault_pa; - ida.r = r; - - - if(!fault_iss_isv){ - _XDPRINTFSMP_("%s: s2pgtbl DATA ABORT: invalid isv. Halting!\n", __func__); - _XDPRINTFSMP_("%s: va=0x%08x, pa=0x%08x\n", __func__, ida.va, ida.pa); - HALT(); - } - - - //handle data abort fault by passing it to appropriate module - if ( fault_pa_page == ARMLOCALREGISTERS_BASE ){ - intprot_handle_intcontroller_access(&ida); - - }else if( fault_pa_page == BCM2837_EMMC_BASE){ - secboot_handle_sdio_access(&ida); - - }else if( fault_pa_page == BCM2837_SDHOST_BASE){ - secboot_handle_sdhost_access(&ida); - - }else if( (fault_pa_page == BCM2837_DMA0_REGS_BASE) || - (fault_pa_page == BCM2837_DMA15_REGS_BASE) ){ - dmaprot_handle_dmacontroller_access(&ida); - - - }else if ( fault_pa_page == DWC_REGS_BASE ){ - dmaprot_handle_usbdmac_access(&ida); - - }else if ( fault_pa_page == appnpf_page_pa && appnpf_activated){ - //appnpf trigger, just omit the access - - }else{ - _XDPRINTFSMP_("%s: unknown s2pgtbl DATA ABORT. Halting! (va=0x%08x, pa=0x%08x)\n", - __func__, ida.va, ida.pa); - HALT(); - } - - -} - - - -void guest_cp15_trap_handler(arm8_32_regs_t *r, u32 hsr){ - u32 trap_il; - u32 elr_hyp; - - //compute trapped instruction length - trap_il = ((hsr & HSR_IL_MASK) >> HSR_IL_SHIFT); - - //fix return address - elr_hyp = sysreg_read_elrhyp(); - if(trap_il) - elr_hyp += sizeof(u32); - else - elr_hyp += sizeof(u16); - sysreg_write_elrhyp(elr_hyp); - - - ctxtrace_cp15_trap_handler(r, hsr); -} - - - - -__attribute__(( section(".data") )) u32 hypsvc_handler_lock=1; - -void hypsvc_handler(arm8_32_regs_t *r){ - u32 hsr; - u32 hsr_ec; - //_XDPRINTFSMP_("%s: ENTER\n", __func__); - - //acquire lock - spin_lock(&hypsvc_handler_lock); - - //read hsr to determine the cause of the intercept - hsr = sysreg_read_hsr(); - hsr_ec = ((hsr & HSR_EC_MASK) >> HSR_EC_SHIFT); - ////uart_puts(" HSR= "); - ////debug_hexdumpu32(hsr); - - //switch ( ((hsr & HSR_EC_MASK) >> HSR_EC_SHIFT) ){ - if(hsr_ec == HSR_EC_HVC){ - guest_hypercall_handler(r, hsr); - - }else if (hsr_ec == HSR_EC_DATA_ABORT_ELCHANGE){ - guest_data_abort_handler(r, hsr); - - }else if (hsr_ec == HSR_EC_CP15_TRAP){ - guest_cp15_trap_handler(r, hsr); - - }else{ - _XDPRINTFSMP_("uXMHF-rpi3: core: UNHANDLED INTERCEPT HALTING! hsr=0x%08x\n", hsr); - HALT(); - } - - //_XDPRINTFSMP_("%s: EXIT\n", __func__); - - //release lock - spin_unlock(&hypsvc_handler_lock); -} - - -void main_svc(u32 r0, u32 id, struct atag *at){ - u32 cpsr; - - _XDPRINTF_("%s: now in SVC mode\n", __func__); - _XDPRINTF_("%s: r0=0x%08x, id=0x%08x, ATAGS=0x%08x\n", __func__, r0, id, at); - - _XDPRINTF_("%s: CPSR[mode]=0x%08x\n", __func__, (sysreg_read_cpsr() & 0xF)); - - _XDPRINTF_("%s: proceeding to test hypercall (HVC) in SVC mode...\n", __func__); - hypcall(); - _XDPRINTF_("%s: successful return after hypercall test\n", __func__); - - - //_XDPRINTF_("%s: chainloading OS kernel...\n", __func__); - //_XDPRINTF_("%s: r0=0x%08x, id=0x%08x, ATAGS=0x%08x\n", __func__, r0, id, at); - //chainload_os(r0, id, at); - - _XDPRINTF_("%s: should not be here. Halting!\n", __func__); - HALT(); -} - - -void core_fixresmemmap(u32 fdt_address){ - struct fdt_header *fdth = (struct fdt_header *)fdt_address; - struct fdt_reserve_entry *fdtrsvmmapentryp; - u32 newtotalsize, padding; - - //uart_puts("uxmhf-rpi3: core: core_fixresmemmap [IN]\n"); - - //uart_puts(" fdt_address=0x"); - //debug_hexdumpu32(fdt_address); - - //uart_puts(" totalsize=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->totalsize)); - - //uart_puts(" off_dt_struct=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->off_dt_struct)); - - //uart_puts(" size_dt_struct=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->size_dt_struct)); - - //uart_puts(" off_dt_strings=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->off_dt_strings)); - - //uart_puts(" size_dt_strings=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->size_dt_strings)); - - //uart_puts(" off_mem_rsvmap=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->off_mem_rsvmap)); - - //uart_puts(" version=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->version)); - - //uart_puts(" last_comp_version=0x"); - //debug_hexdumpu32(cpu_be2le_u32(fdth->last_comp_version)); - - //pad totalsize to a page-boundary - padding = PAGE_SIZE_4K - (cpu_be2le_u32(fdth->totalsize) % PAGE_SIZE_4K); - //uart_puts("padding=0x"); - //debug_hexdumpu32(padding); - - //take totalsize and compute var = size + 8 * 2 - newtotalsize = cpu_be2le_u32(fdth->totalsize); - newtotalsize += padding; - newtotalsize += (2 * sizeof(struct fdt_reserve_entry)); - - //put rsv_mem_off to size - fdth->off_mem_rsvmap = cpu_le2be_u32(cpu_be2le_u32(fdth->totalsize) + padding); - - //set totalsize to var - fdth->totalsize = cpu_le2be_u32(newtotalsize); - - //populate fdtrsvmmapentryp to rsv_mem_off - fdtrsvmmapentryp = (struct fdt_reserve_entry *)(fdt_address + cpu_be2le_u32(fdth->off_mem_rsvmap)); - - //uart_puts("fdtrsvmmapentryp=0x"); - //debug_hexdumpu32((u32)fdtrsvmmapentryp); - //uart_puts("sizeof(fdtrsvmmapentryp)=0x"); - //debug_hexdumpu32(sizeof(struct fdt_reserve_entry)); - - //write the guestos extent as first entry - fdtrsvmmapentryp->address = cpu_le2be_u64((u64)UXMHF_CORE_START_ADDR); - fdtrsvmmapentryp->size = cpu_le2be_u64((u64)UXMHF_CORE_SIZE); - //fdtrsvmmapentryp->address = 0ULL; - //fdtrsvmmapentryp->size = 0ULL; - - //terminate the list with 0sadd 16 bytes - fdtrsvmmapentryp++; - //uart_puts("fdtrsvmmapentryp=0x"); - //debug_hexdumpu32((u32)fdtrsvmmapentryp); - - fdtrsvmmapentryp->address = 0ULL; - fdtrsvmmapentryp->size = 0ULL; - - //debug - //uart_puts("uxmhf-rpi3: core: dumping reserved memmap...\n"); - fdtrsvmmapentryp = (struct fdt_reserve_entry *)(fdt_address + cpu_be2le_u32(fdth->off_mem_rsvmap)); - //uart_puts("fdtrsvmmapentryp=0x"); - //debug_hexdumpu32((u32)fdtrsvmmapentryp); - - - while(1){ - u64 addr = cpu_be2le_u64(fdtrsvmmapentryp->address); - u64 size = cpu_be2le_u64(fdtrsvmmapentryp->size); - if( addr == 0ULL && size == 0ULL){ - break; - } - //uart_puts(" address:0x"); - //debug_hexdumpu32(addr >> 32); - //debug_hexdumpu32((u32)addr); - //uart_puts(" size:0x"); - //debug_hexdumpu32(size >> 32); - //debug_hexdumpu32((u32)size); - fdtrsvmmapentryp++; - //uart_puts("fdtrsvmmapentryp=0x"); - //debug_hexdumpu32((u32)fdtrsvmmapentryp); - } - - //uart_puts("uxmhf-rpi3: core: dumped reserved memmap...\n"); - - //uart_puts("uxmhf-rpi3: core: core_fixresmemmap [OUT]\n"); -} - - - - - -////// -// boot cpu enters here -////// -void main(u32 r0, u32 id, struct atag *at, u32 cpuid){ - u32 hvbar, hcr, spsr_hyp; - u64 boardserial; - -#if defined (__ENABLE_UART_PL011__) || defined (__ENABLE_UART_MINI__) - //initialize uart - uart_init(); -#endif - - _XDPRINTF_("uberXMHF (Raspberry Pi 3) - Booting...\n", __func__, cpuid); - _XDPRINTF_("%s[%u]: ENTER: sp=0x%08x (cpu_stacks=0x%08x)\n", __func__, cpuid, - cpu_read_sp(), &cpu_stacks); - _XDPRINTF_("%s[%u]: r0=0x%08x, id=0x%08x, ATAGS=0x%08x\n", __func__, cpuid, r0, id, at); - - - //sanity check ATAGS pointer - if(!(at->size == FDT_MAGIC)){ - _XDPRINTF_("%s[%u]: Error: require ATAGS to be FDT blob. Halting!\n", __func__, cpuid); - HALT(); - } - _XDPRINTF_("%s[%u]: ATAGS pointer is a FDT blob so no worries\n", __func__, cpuid); - - //fix reserved memory map - core_fixresmemmap((u32)at); - - -#if 1 - boardserial = bcm2837_mailbox_get_board_serial(); - _XDPRINTF_("%s[%u]: board serial=0x%016llx\n", __func__, cpuid, boardserial); -#endif - - -#if 0 - uart_testrecv(); - HALT(); -#endif - -#if 0 - _XDPRINTF_("%s[%u]: Halting!\n", __func__, cpuid); - HALT(); -#endif - - - //initialize base hardware platform - bcm2837_platform_initialize(); - _XDPRINTF_("%s[%u]: initialized base hardware platform\n", __func__, cpuid); - - hyppgtbl_populate_tables(); - _XDPRINTF_("%s[%u]: page-tables populated\n", __func__, cpuid); - - hyppgtbl_activate(); - _XDPRINTF_("%s[%u]: hyp page-tables activated\n", __func__, cpuid); - - - //initialize CPU vector table - hypvtable_initialize(cpuid); - -#if defined (__FIQREFLECTION__) - - //enable FIQ mask override; this should land us in HYP mode FIQ handler when FIQs are triggered inside guest - hcr = sysreg_read_hcr(); - hcr |= (1UL << 3); - sysreg_write_hcr(hcr); - -#else - - //disable FIQ mask override; let guest process FIQs - hcr = sysreg_read_hcr(); - hcr &= ~(1UL << 3); - sysreg_write_hcr(hcr); - -#endif - - // populate stage-2 page tables - s2pgtbl_populate_tables(); - _XDPRINTF_("%s[%u]: stage-2 pts populated.\n", __func__, cpuid); - -#if defined (__DMAPROT__) - //activate DMA protection mechanism via stage-2 pts - dmaprot_activate(); - _XDPRINTF_("%s[%u]: DMA protection mechanism activated via stage-2 pts\n", __func__, cpuid); -#endif - -#if defined (__INTPROT__) - //activate interrupt protection mechanism via stage-2 pts - intprot_activate(); - _XDPRINTF_("%s[%u]: INTERRUPT protection mechanism activated via stage-2 pts\n", __func__, cpuid); -#endif - -#if defined (__SECBOOT__) - //activate secure boot protection mechanism - secboot_activate(); -#endif - - //dump hyp registers and load hvbar - _XDPRINTF_("%s[%u]: HCR=0x%08x\n", __func__, cpuid, sysreg_read_hcr()); - _XDPRINTF_("%s[%u]: HSTR=0x%08x\n", __func__, cpuid, sysreg_read_hstr()); - _XDPRINTF_("%s[%u]: HCPTR=0x%08x\n", __func__, cpuid, sysreg_read_hcptr()); - _XDPRINTF_("%s[%u]: HDCR=0x%08x\n", __func__, cpuid, sysreg_read_hdcr()); - - // initialize cpu support for second stage page table translations - s2pgtbl_initialize(); - _XDPRINTF_("%s[%u]: cpu ready for stage-2 pts...\n", __func__, cpuid); - - // load page table base - s2pgtbl_loadpgtblbase(); - _XDPRINTF_("%s[%u]: loaded stage-2 page-table base register\n", __func__, cpuid); - - // activate translation - s2pgtbl_activatetranslation(); - _XDPRINTF_("%s[%u]: activated stage-2 translation\n", __func__, cpuid); - - - ////// - // initialize uapps - - #if defined (__ENABLE_UAPP_PVDRIVER_UART__) - uapp_pvdriver_uart_initialize_uapp(cpuid); - #endif - - - ////// - - // boot secondary cores - _XDPRINTF_("%s[%u]: proceeding to initialize SMP...\n", __func__, cpuid); - bcm2837_platform_smpinitialize(); - _XDPRINTF_("%s[%u]: secondary cores booted, moving on...\n", __func__, cpuid); - - _XDPRINTF_("%s[%u]: booting guest in SVC mode\n", __func__, cpuid); - _XDPRINTF_("%s[%u]: r0=0x%08x, id=0x%08x, at=0x%08x\n", __func__, cpuid, r0, id, at); - - chainload_os(r0,id,at,0x8000); - - _XDPRINTF_("%s[%u]: Should not come here.Halting\n", __func__, cpuid); - HALT(); -} - - -////// -// secondary cores enter here after they are booted up -////// -void secondary_main(u32 cpuid){ - u32 start_address; - armlocalregisters_mailboxwrite_t *armlocalregisters_mailboxwrite; - - - _XDPRINTF_("%s[%u]: ENTER: sp=0x%08x (cpu_stacks=0x%08x)\n", __func__, cpuid, - cpu_read_sp(), &cpu_stacks); - - armlocalregisters_mailboxwrite = (armlocalregisters_mailboxwrite_t *)(ARMLOCALREGISTERS_MAILBOXWRITE_BASE + (0 * sizeof(armlocalregisters_mailboxwrite_t))); - - hyppgtbl_activate(); - _XDPRINTF_("%s[%u]: hyp page-tables activated\n", __func__, cpuid); - - //dump hyp registers and load hvbar - _XDPRINTF_("%s[%u]: HCR=0x%08x\n", __func__, cpuid, sysreg_read_hcr()); - _XDPRINTF_("%s[%u]: HSTR=0x%08x\n", __func__, cpuid, sysreg_read_hstr()); - _XDPRINTF_("%s[%u]: HCPTR=0x%08x\n", __func__, cpuid, sysreg_read_hcptr()); - _XDPRINTF_("%s[%u]: HDCR=0x%08x\n", __func__, cpuid, sysreg_read_hdcr()); - - //setup vector table for CPU - hypvtable_initialize(cpuid); - - // initialize cpu support for second stage page table translations - s2pgtbl_initialize(); - _XDPRINTF_("%s[%u]: cpu ready for stage-2 pts...\n", __func__, cpuid); - - // load page table base - s2pgtbl_loadpgtblbase(); - _XDPRINTF_("%s[%u]: loaded stage-2 page-table base register\n", __func__, cpuid); - - // activate translation - s2pgtbl_activatetranslation(); - _XDPRINTF_("%s[%u]: activated stage-2 translation\n", __func__, cpuid); - - - _XDPRINTF_("%s[%u]: Signalling SMP readiness and entering SMP boot wait loop...\n", __func__, cpuid); - armlocalregisters_mailboxwrite->mailbox3write = 1; - cpu_dsb(); - - start_address=bcm2837_platform_waitforstartup(cpuid); - - _XDPRINTFSMP_("%s[%u]: Got startup signal, address=0x%08x\n", __func__, cpuid, start_address); - - chainload_os(0, 0, 0, start_address); - - _XDPRINTFSMP_("%s[%u]: Should never be here. Halting!\n", __func__, cpuid); - HALT(); -} - - -#if defined (__ENABLE_UART_PL011__) || defined (__ENABLE_UART_MINI__) -////// -// test functions -////// -/* UART receive test function */ -void uart_testrecv(void){ - unsigned int i; - unsigned int pl011_uart_rxff; - unsigned int num_count; - unsigned char ch; - - unsigned int pl011_uart_rts; - unsigned int pl011_uart_cts; - - num_count=0; - pl011_uart_rts = !(mmio_read32(PL011_UART_CR_REG) & 0x800) >> 11; - pl011_uart_cts = !(mmio_read32(PL011_UART_FR_REG) & 0x1); - _XDPRINTF_("%s: RTS=%u, CTS=%u\n", __func__, pl011_uart_rts, pl011_uart_cts); - - //wait a little for reception to begin hitting the UART - for(i=0; i < 12*1024*1024; i++); - _XDPRINTF_("%s: going into read loop...\n", __func__); - - pl011_uart_rxff = (mmio_read32(PL011_UART_FR_REG) & 0x40) >> 6; - - if(pl011_uart_rxff){ - _XDPRINTF_("%s: RX FULL!!\n", __func__); - pl011_uart_rts = !(mmio_read32(PL011_UART_CR_REG) & 0x800) >> 11; - pl011_uart_cts = !(mmio_read32(PL011_UART_FR_REG) & 0x1); - _XDPRINTF_("%s: RTS=%u, CTS=%u\n", __func__, pl011_uart_rts, pl011_uart_cts); - } - - while(uart_getc(&ch)){ - _XDPRINTF_("%c|0x%02x\n", ch, ch); - num_count++; - } - - _XDPRINTF_("%s: Total chars received=%u\n", __func__, num_count); -} - -#endif diff --git a/uxmhf-rpi3/core/mmu.c b/uxmhf-rpi3/core/mmu.c deleted file mode 100644 index 99c8d14132..0000000000 --- a/uxmhf-rpi3/core/mmu.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 MMU functions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -void mmu_invalidatetlbs(void){ - //invalidate all TLB - sysreg_tlbiallh(); -} - -void mmu_invalidateicache(void){ - //invalidate instruction caches - sysreg_iciallu(); -} - -//enable instruction caching -void mmu_enableicache(void){ - u32 hsctlr; - - hsctlr = sysreg_read_hsctlr(); - hsctlr |= (1 << 12); //enable instruction caching - sysreg_write_hsctlr(hsctlr); -} - -//enable data caching -void mmu_enabledcache(void){ - u32 hsctlr; - - hsctlr = sysreg_read_hsctlr(); - hsctlr |= (1 << 2); //enable data caching - sysreg_write_hsctlr(hsctlr); -} - -//disable instruction caching -void mmu_disableicache(void){ - u32 hsctlr; - - hsctlr = sysreg_read_hsctlr(); - hsctlr &= ~(1 << 12); //disable instruction caching - sysreg_write_hsctlr(hsctlr); -} - -//disable data caching -void mmu_disabledcache(void){ - u32 hsctlr; - - hsctlr = sysreg_read_hsctlr(); - hsctlr &= ~(1 << 2); //disable data caching - sysreg_write_hsctlr(hsctlr); -} - - -//activate MMU translation -void mmu_activatetranslation(void){ - u32 hsctlr; - - hsctlr = sysreg_read_hsctlr(); - _XDPRINTF_("%s: HSCTLR before=0x%08x\n", __func__, hsctlr); - - hsctlr |= HSCTLR_M_MASK; - hsctlr |= (1 << 2); //enable data caching - hsctlr |= (1 << 12); //enable instruction caching - - sysreg_write_hsctlr(hsctlr); - - hsctlr = sysreg_read_hsctlr(); - _XDPRINTF_("%s: HSCTLR after=0x%08x\n", __func__, hsctlr); -} - diff --git a/uxmhf-rpi3/core/s2pgtbl.c b/uxmhf-rpi3/core/s2pgtbl.c deleted file mode 100644 index 9d81f898f4..0000000000 --- a/uxmhf-rpi3/core/s2pgtbl.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 stage-2 page table translation functions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include - -/* setup CPU to support stage-2 table translation */ -void s2pgtbl_initialize(void){ - u32 vtcr, hdcr, hcptr, hstr; - - vtcr = sysreg_read_vtcr(); - //uart_puts("VTCR before= "); - //debug_hexdumpu32(vtcr); - - vtcr = 0; - vtcr |= VTCR_RES1_MASK; //reserved 1 bits - //vtcr |= ((0x8 << VTCR_T0SZ_SHIFT) & VTCR_T0SZ_MASK); //T0SZ=-8; 40 bits physical address - //vtcr |= ((1 << VTCR_S_SHIFT) & VTCR_S_MASK); //S=1 - vtcr |= ((0x0 << VTCR_T0SZ_SHIFT) & VTCR_T0SZ_MASK); //T0SZ=0; 32 bits physical address - vtcr |= ((0 << VTCR_S_SHIFT) & VTCR_S_MASK); //S=0 - vtcr |= ((1 << VTCR_SL0_SHIFT) & VTCR_SL0_MASK); //SL0=1; 3-level page table - vtcr |= ((MEM_WRITEBACK_READALLOCATE_WRITEALLOCATE << VTCR_IRGN0_SHIFT) & VTCR_IRGN0_MASK); //L1 cache attribute - vtcr |= ((MEM_WRITEBACK_READALLOCATE_WRITEALLOCATE << VTCR_ORGN0_SHIFT) & VTCR_ORGN0_MASK); //L2 cache attribute - vtcr |= ((MEM_INNER_SHAREABLE << VTCR_SH0_SHIFT) & VTCR_SH0_MASK); //shareability attribute - - sysreg_write_vtcr(vtcr); - - vtcr = sysreg_read_vtcr(); - //uart_puts("VTCR after= "); - //debug_hexdumpu32(vtcr); - - hdcr = sysreg_read_hdcr(); - //uart_puts("HDCR before= "); - //debug_hexdumpu32(hdcr); - - hdcr &= HDCR_HPMN_MASK; - sysreg_write_hdcr(hdcr); - - hdcr = sysreg_read_hdcr(); - //uart_puts("HDCR after= "); - //debug_hexdumpu32(hdcr); - - hcptr = sysreg_read_hcptr(); - //uart_puts("HCPTR before= "); - //debug_hexdumpu32(hcptr); - - hcptr = 0; - hcptr |= HCPTR_RES1_MASK; - sysreg_write_hcptr(hcptr); - - hcptr = sysreg_read_hcptr(); - //uart_puts("HCPTR after= "); - //debug_hexdumpu32(hcptr); - - hstr = sysreg_read_hstr(); - //uart_puts("HSTR before= "); - //debug_hexdumpu32(hstr); - - sysreg_write_hstr(0); - - hstr = sysreg_read_hstr(); - //uart_puts("HSTR after= "); - //debug_hexdumpu32(hstr); - -} - -// -// we need the l1 ldesc table to be aligned to 5-VTCR.T0SZ since we use a 3-level -// page table. Since we set VTCR.T0SZ=0 (32-bit physical addressing) we need to -// align at 2**5 which is 32 byte -// c.f. G6.2.162 ARMv8 -// -__attribute__((section(".paligndata"))) __attribute__((align(PAGE_SIZE_4K))) u64 l1_ldesc_table[L1_LDESC_TABLE_MAXENTRIES]; - -__attribute__((section(".paligndata"))) __attribute__((align(PAGE_SIZE_4K))) u64 l2_ldesc_table[L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES]; -__attribute__((section(".paligndata"))) __attribute__((align(PAGE_SIZE_4K))) u64 l3_ldesc_table[L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES * L3_LDESC_TABLE_MAXENTRIES]; - - - - - -void s2pgtbl_populate_tables(void){ - u32 i; - u64 attrs; - //u64 roattrs; - u64 attrs_dev; - u64 attrs_noaccess; - - attrs = (LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_BACK_CACHEABLE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_READ_WRITE << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_INNER_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - //attrs = (LDESC_S2_MC_OUTER_NON_CACHEABLE_INNER_NON_CACHEABLE << LDESC_S2_MEMATTR_MC_SHIFT) | - // (LDESC_S2_S2AP_READ_WRITE << LDESC_S2_MEMATTR_S2AP_SHIFT) | - // (MEM_INNER_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - // LDESC_S2_MEMATTR_AF_MASK; - - - attrs_dev = (LDESC_S2_MC_DEVnGnRE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_READ_WRITE << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_NON_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - attrs_noaccess = (LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_BACK_CACHEABLE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_NO_ACCESS << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_INNER_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - - - - //roattrs = (LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_BACK_CACHEABLE << LDESC_S2_MEMATTR_MC_SHIFT) | - // (LDESC_S2_S2AP_READ_ONLY << LDESC_S2_MEMATTR_S2AP_SHIFT) | - // (MEM_OUTER_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - // LDESC_S2_MEMATTR_AF_MASK; - - - //debug - //uart_puts(" attrs=\n"); - //debug_hexdumpu32(attrs >> 32); - //debug_hexdumpu32((u32)attrs); - ////uart_puts(" roattrs=\n"); - ////debug_hexdumpu32(roattrs >> 32); - ////debug_hexdumpu32((u32)roattrs); - - - //populate l1 ldesc table - for(i=0; i < L1_LDESC_TABLE_MAXENTRIES; i++){ - if( i < L1_LDESC_TABLE_ENTRIES) - l1_ldesc_table[i] = ldesc_make_s2_l1e_table((u32)&l2_ldesc_table[i * L2_LDESC_TABLE_MAXENTRIES]); - //l1_ldesc_table[i] = ldesc_make_s2_l1e_block( (i * PAGE_SIZE_1G), attrs); - else - l1_ldesc_table[i] = ldesc_make_s2_l1e_invalid(); - } - - //debug - //uart_puts("L1 LDESC table dump follows:\n"); - for(i=0; i < L1_LDESC_TABLE_ENTRIES; i++){ - //debug_hexdumpu32(l1_ldesc_table[i] >> 32); - //debug_hexdumpu32((u32)l1_ldesc_table[i]); - } - - - //populate l2 ldesc table - for(i=0; i < (L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES); i++){ - l2_ldesc_table[i] = ldesc_make_s2_l2e_table((u32)&l3_ldesc_table[i * L3_LDESC_TABLE_MAXENTRIES]); - //l2_ldesc_table[i] = ldesc_make_s2_l2e_block( (i * PAGE_SIZE_2M), attrs); - } - - - //populate l3 ldesc table - for(i=0; i < (L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES * L3_LDESC_TABLE_MAXENTRIES); i++){ - //if( (i * PAGE_SIZE_4K) == GUESTOS_TESTPAGE_ADDR) - // l3_ldesc_table[i] = ldesc_make_s2_l3e_page((i * PAGE_SIZE_4K), roattrs); - //else - // l3_ldesc_table[i] = ldesc_make_s2_l3e_page((i * PAGE_SIZE_4K), attrs); - if ( (i * PAGE_SIZE_4K) >= BCM2837_PERIPHERALS_BASE ) - l3_ldesc_table[i] = ldesc_make_s2_l3e_page((i * PAGE_SIZE_4K), attrs_dev); - else if ( ((i * PAGE_SIZE_4K) >= UXMHF_CORE_START_ADDR) && - ((i * PAGE_SIZE_4K) < UXMHF_CORE_END_ADDR) ) - l3_ldesc_table[i] = ldesc_make_s2_l3e_page((i * PAGE_SIZE_4K), attrs_noaccess); - else - l3_ldesc_table[i] = ldesc_make_s2_l3e_page((i * PAGE_SIZE_4K), attrs); - } - -} - - -void s2pgtbl_loadpgtblbase(void){ - u64 vttbr; - - _XDPRINTFSMP_("%s: L1 DESC table at=0x%08x\n", __func__, (u32)&l1_ldesc_table); - - vttbr = sysreg_read_vttbr(); - _XDPRINTFSMP_("%s: VTTBR before=0x%016llx\n", __func__, vttbr); - - ////uart_puts("VTTBR before="); - ////debug_hexdumpu32(vttbr >> 32); - ////debug_hexdumpu32((u32)vttbr); - - vttbr = 0; - vttbr |= ((u64)&l1_ldesc_table & VTTBR_BADDR_MASK); - vttbr |= (((u64)0x2 << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK); - sysreg_write_vttbr(vttbr); - - - vttbr = sysreg_read_vttbr(); - _XDPRINTFSMP_("%s: VTTBR after=0x%016llx\n", __func__, vttbr); - - - ////uart_puts("VTTBR after="); - ////debug_hexdumpu32(vttbr >> 32); - ////debug_hexdumpu32((u32)vttbr); - -} - -void s2pgtbl_activatetranslation(void){ - u32 hcr; - - hcr = sysreg_read_hcr(); - //uart_puts("HCR before="); - //debug_hexdumpu32(hcr); - - hcr |= HCR_VM_MASK; - sysreg_write_hcr(hcr); - - hcr = sysreg_read_hcr(); - //uart_puts("HCR after="); - //debug_hexdumpu32(hcr); - -} diff --git a/uxmhf-rpi3/core/secboot.c b/uxmhf-rpi3/core/secboot.c deleted file mode 100644 index 397f3b0429..0000000000 --- a/uxmhf-rpi3/core/secboot.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - Pi3 secure boot implementation - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include -#include - -#define SDCMD_WRITE_CMD 0x80 -#define SDCMD_READ_CMD 0x40 -#define SDCMD_CMD_MASK 0x3f - - -//activate secure boot protection mechanism -void secboot_activate(void){ - u64 attrs_dev_ro = (LDESC_S2_MC_DEVnGnRE << LDESC_S2_MEMATTR_MC_SHIFT) | - (LDESC_S2_S2AP_READ_ONLY << LDESC_S2_MEMATTR_S2AP_SHIFT) | - (MEM_NON_SHAREABLE << LDESC_S2_MEMATTR_SH_SHIFT) | - LDESC_S2_MEMATTR_AF_MASK; - - - uapi_s2pgtbl_setprot(BCM2837_EMMC_BASE, attrs_dev_ro); - sysreg_tlbiallis(); - - uapi_s2pgtbl_setprot(BCM2837_SDHOST_BASE, attrs_dev_ro); - sysreg_tlbiallis(); - -} - - - -//handle sdio accesses -void secboot_handle_sdio_access(info_intercept_data_abort_t *ida){ - volatile u32 *sdio_reg; - - //we only support 32-bit accesses; bail out if this is not the case - if(ida->sas != 0x2){ - _XDPRINTFSMP_("%s: invalid sas=%u. Halting!\n", __func__, ida->sas); - HALT(); - } - - //compute sdio register address - sdio_reg = (u32 *)ida->pa; - - //act on either writes or reads - if(ida->wnr){ //intc register write - - //compute value that is going to be written - u32 guest_value = (u32)guest_regread(ida->r, ida->srt); - - if(sdio_reg == (BCM2837_EMMC_BASE + 0x0c)){ - //_XDPRINTFSMP_("%s: CMD=0x%08x\n", __func__, guest_value); - u32 cmdop = (guest_value & 0x3F000000UL) >> 24; - if(cmdop == 24 || cmdop == 25){ - //WRITE block commands - u32 arg = mmio_read32(BCM2837_EMMC_BASE + 0x08); - _XDPRINTFSMP_("%s: cmdop=%u(0x%08x), CMD=0x%08x; arg=%u. Halting!\n", - __func__, cmdop, cmdop, guest_value, arg); - HALT(); - } - - } - - //just pass-through writes - mmio_write32(sdio_reg, guest_value); - //cpu_dsb(); - //cpu_isb(); //synchronize all memory accesses above - //*sdio_reg = guest_value; - - }else{ //sdio register read - //we should never get here - _XDPRINTFSMP_("%s: invalid wnr=%u. Halting!\n", __func__, ida->wnr); - HALT(); - } - -} - - - -//handle sdhost controller accesses -void secboot_handle_sdhost_access(info_intercept_data_abort_t *ida){ - volatile u32 *sdhost_reg; - - //we only support 32-bit accesses; bail out if this is not the case - if(ida->sas != 0x2){ - _XDPRINTFSMP_("%s: invalid sas=%u. Halting!\n", __func__, ida->sas); - HALT(); - } - - //compute sdhost register address - sdhost_reg = (u32 *)ida->pa; - - //act on either writes or reads - if(ida->wnr){ //intc register write - - //compute value that is going to be written - u32 guest_value = (u32)guest_regread(ida->r, ida->srt); - - if(sdhost_reg == (BCM2837_SDHOST_BASE + 0x0)){ - //SDCMD register write - if( guest_value & SDCMD_WRITE_CMD){ - u32 cmdop = guest_value & SDCMD_CMD_MASK; - if(cmdop == 24 || cmdop == 25){ - //WRITE block commands - u32 arg = mmio_read32(BCM2837_SDHOST_BASE + 0x04); - if(arg >= UXMHF_BOOT_PARTITION_START && arg <= UXMHF_BOOT_PARTITION_END){ - _XDPRINTFSMP_("%s: cmdop=%u(0x%08x), SDCMD=0x%08x; arg=%u. Halting!\n", - __func__, cmdop, cmdop, guest_value, arg); - HALT(); - } - } - } - //_XDPRINTFSMP_("%s: CMD=0x%08x\n", __func__, guest_value); - } - - //just pass-through writes - mmio_write32(sdhost_reg, guest_value); - //cpu_dsb(); - //cpu_isb(); //synchronize all memory accesses above - //*sdhost_reg = guest_value; - - }else{ //sdhost register read - //we should never get here - _XDPRINTFSMP_("%s: invalid wnr=%u. Halting!\n", __func__, ida->wnr); - HALT(); - } - -} - - diff --git a/uxmhf-rpi3/core/uapi_s2pgtbl.c b/uxmhf-rpi3/core/uapi_s2pgtbl.c deleted file mode 100644 index 0d1be53d6f..0000000000 --- a/uxmhf-rpi3/core/uapi_s2pgtbl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 stage-2 page table translation uapi - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include - -extern u64 l3_ldesc_table[L1_LDESC_TABLE_ENTRIES * L2_LDESC_TABLE_MAXENTRIES * L3_LDESC_TABLE_MAXENTRIES]; - -void uapi_s2pgtbl_setprot(u32 address, u64 protection){ - u32 index; - - if ( !((address >= UXMHF_CORE_START_ADDR) && - (address < UXMHF_CORE_END_ADDR)) ){ - index = address/PAGE_SIZE_4K; - l3_ldesc_table[index] = ldesc_make_s2_l3e_page(address, protection); - } - -} - -u64 uapi_s2pgtbl_getprot(u32 address){ - u32 index; - u64 result=0; - - if ( !((address >= UXMHF_CORE_START_ADDR) && - (address < UXMHF_CORE_END_ADDR)) ){ - index = address/PAGE_SIZE_4K; - result = ldesc_get_s2_l3e_page_attrs(l3_ldesc_table[index]); - }else{ - result=0; - } - - return result; -} - - diff --git a/uxmhf-rpi3/docker/Dockerfile b/uxmhf-rpi3/docker/Dockerfile deleted file mode 100644 index 313689d2ca..0000000000 --- a/uxmhf-rpi3/docker/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && \ - apt-get install -yqq build-essential autoconf autotools-dev git bc - -RUN git clone https://github.com/raspberrypi/tools - -ENV PATH=/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/:${PATH} - -RUN git clone https://github.com/raspberrypi/linux.git --depth 1 --branch rpi-4.4.y --single-branch && \ - cd linux && export KERNEL=kernel7 && \ - make ARCH=arm CROSS_COMPILE=/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- bcm2709_defconfig && \ - make -j 4 ARCH=arm CROSS_COMPILE=/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- zImage modules dtbs && \ - mkdir -p /uxmhf-rpi3-staging/mod_install && \ - make -j 4 ARCH=arm CROSS_COMPILE=/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- INSTALL_MOD_PATH=/uxmhf-rpi3-staging/mod_install/ modules_install && \ - ./scripts/mkknlimg arch/arm/boot/zImage /uxmhf-rpi3-staging/$KERNEL.img && \ - mkdir -p /uxmhf-rpi3-staging/overlays && \ - cp ./arch/arm/boot/dts/overlays/*.dtb* /uxmhf-rpi3-staging/overlays/. && \ - cp ./arch/arm/boot/dts/overlays/README /uxmhf-rpi3-staging/overlays/. && \ - mkdir -p /uxmhf-rpi3-staging/boot && \ - cp ./arch/arm/boot/dts/*.dtb /uxmhf-rpi3-staging/boot/. && cd .. - -RUN git clone https://github.com/hypcode/uberxmhf.git && \ - cd uberxmhf/uxmhf-rpi3 && ./bsconfigure.sh && ./configure && \ - make clean && make OSKRNLIMG=/uxmhf-rpi3-staging/kernel7.img && \ - cp uxmhf-rpi3.img /uxmhf-rpi3-staging/. && \ - cp rpi3-config.txt /uxmhf-rpi3-staging/config.txt - -RUN cd /uberxmhf/uxmhf-rpi3/rgapps/linux/rgapp-uhcallkmod && \ - ./build.sh /linux /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/ && \ - cp ./uhcallkmod.ko /uxmhf-rpi3-staging/. - -RUN cd /uberxmhf/uxmhf-rpi3/rgapps/linux/ && make -w all && cd rgapp-uhcalltest && \ - make -w all && cp ./uhcalltest /uxmhf-rpi3-staging/. - -COPY transfer.sh / - -RUN /bin/bash diff --git a/uxmhf-rpi3/docker/transfer.sh b/uxmhf-rpi3/docker/transfer.sh deleted file mode 100755 index 33bc770842..0000000000 --- a/uxmhf-rpi3/docker/transfer.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -mkdir -p ~/mnt/pi-boot -mkdir -p ~/mnt/pi-root -mount /dev/sdb1 ~/mnt/pi-boot -mount /dev/sdb2 ~/mnt/pi-root -cp uxmhf-rpi3-staging/uhcalltest ~/mnt/pi-root/home/pi/. -cp uxmhf-rpi3-staging/uhcallkmod.ko ~/mnt/pi-root/home/pi/. -cp uxmhf-rpi3-staging/uxmhf-rpi3.img ~/mnt/pi-boot/. -cp uxmhf-rpi3-staging/config.txt ~/mnt/pi-boot/. -sed -i 's/$/ loglevel=8 memblock=debug dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0/' ~/mnt/pi-boot/cmdline.txt -cp uxmhf-rpi3-staging/boot/* ~/mnt/pi-boot/. -mkdir -p ~/mnt/pi-boot/overlays -cp -R uxmhf-rpi3-staging/overlays/* ~/mnt/pi-boot/overlays. -cp uxmhf-rpi3-staging/kernel7.img ~/mnt/pi-boot/. -mkdir -p ~/mnt/pi-root/lib/firmware -cp -R uxmhf-rpi3-staging/mod_install/lib/firmware/* ~/mnt/pi-root/lib/firmware/. -mkdir -p ~/mnt/pi-root/lib/modules/4.4.50-v7+ -cp -R uxmhf-rpi3-staging/mod_install/lib/modules/4.4.50-v7+/* ~/mnt/pi-root/lib/modules/4.4.50-v7+/. -sed -i '/^\/dev\/mmcblk0p1/s/^/#/' ~/mnt/pi-root/etc/fstab - -umount ~/mnt/pi-boot -umount ~/mnt/pi-root diff --git a/uxmhf-rpi3/include/arm8-32.h b/uxmhf-rpi3/include/arm8-32.h deleted file mode 100644 index 921da6b21b..0000000000 --- a/uxmhf-rpi3/include/arm8-32.h +++ /dev/null @@ -1,579 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ARM 8 32-bit (aarch32) architecture definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __ARM8_32_H__ -#define __ARM8_32_H__ - -// -// memory shareability types -// -#define MEM_NON_SHAREABLE 0x0 -#define MEM_OUTER_SHAREABLE 0x2 -#define MEM_INNER_SHAREABLE 0x3 - -// -// memory cacheability types -// -#define MEM_NON_CACHEABLE 0x0 -#define MEM_WRITEBACK_READALLOCATE_WRITEALLOCATE 0x1 -#define MEM_WRITETHROUGH_READALLOCATE_NOWRITEALLOCATE 0x2 -#define MEM_WRITEBACK_READALLOCATE_NOWRITEALLOCATE 0x3 - - -// -// VTCR (virtualization translation control register) bit definitions -// G6.2.161 ARMv8 -// -#define VTCR_RES1_MASK 0x80000000 -#define VTCR_SH0_MASK 0x00003000 -#define VTCR_SH0_SHIFT 12 -#define VTCR_ORGN0_MASK 0x00000C00 -#define VTCR_ORGN0_SHIFT 10 -#define VTCR_IRGN0_MASK 0x00000300 -#define VTCR_IRGN0_SHIFT 8 -#define VTCR_SL0_MASK 0x000000C0 -#define VTCR_SL0_SHIFT 6 -#define VTCR_S_MASK 0x00000010 -#define VTCR_S_SHIFT 4 -#define VTCR_T0SZ_MASK 0x0000000F -#define VTCR_T0SZ_SHIFT 0 - -// -// HDCR (hyp debug control register) bit definitions -// 4.5.38 Cortex-A53 TRM -// -#define HDCR_TDRA_MASK 0x00000800 -#define HDCR_TDRA_SHIFT 11 -#define HDCR_TDOSA_MASK 0x00000400 -#define HDCR_TDOSA_SHIFT 10 -#define HDCR_TDA_MASK 0x00000200 -#define HDCR_TDA_SHIFT 9 -#define HDCR_TDE_MASK 0x00000100 -#define HDCR_TDE_SHIFT 8 -#define HDCR_HPME_MASK 0x00000080 -#define HDCR_HPME_SHIFT 7 -#define HDCR_TPM_MASK 0x00000060 -#define HDCR_TPM_SHIFT 6 -#define HDCR_TPMCR_MASK 0x00000020 -#define HDCR_TPMCR_SHIFT 5 -#define HDCR_HPMN_MASK 0x0000001f -#define HDCR_HPMN_SHIFT 0 - - -// -// HCPTR (hyp architectural feature trap register) bit definitions -// G6.2.57 ARMv8 -// -#define HCPTR_RES1_MASK 0x000033ff -#define HCPTR_TTA_MASK 0x00100000 -#define HCPTR_TTA_SHIFT 20 -#define HCPTR_TASE_MASK 0x00008000 -#define HCPTR_TASE_SHIFT 15 -#define HCPTR_TCP11_MASK 0x00000800 -#define HCPTR_TCP11_SHIFT 11 -#define HCPTR_TCP10_MASK 0x00000600 -#define HCPTR_TCP10_SHIFT 10 - - -// -// HSCTLR (hyp system control register) bit definitions -// G6.2.66 ARMv8 -// -#define HSCTLR_M_MASK 0x00000001UL -#define HSCTLR_M_SHIFT 0 - - - -// -// stage-1 long descriptor table attribute bit definitions for -// TABLE descriptors -// G4.5.3 ARMv8 -// -#define LDESC_S1_TABLEATTR_NSTABLE_MASK 0x8000000000000000ULL -#define LDESC_S1_TABLEATTR_NSTABLE_SHIFT 63 -#define LDESC_S1_TABLEATTR_APTABLE_MASK 0x6000000000000000ULL -#define LDESC_S1_TABLEATTR_APTABLE_SHIFT 61 -#define LDESC_S1_TABLEATTR_XNTABLE_MASK 0x1000000000000000ULL -#define LDESC_S1_TABLEATTR_XNTABLE_SHIFT 60 -#define LDESC_S1_TABLEATTR_PXNTABLE_MASK 0x0800000000000000ULL -#define LDESC_S1_TABLEATTR_PXNTABLE_SHIFT 59 - -// -// stage-1 long descriptor table, table attribute APTABLE bit definitions for -// TABLE descriptors -// G4.6.1 ARMv8 -// -#define LDESC_S1_TABLEATTR_APTABLE_NONE 0x0 -#define LDESC_S1_TABLEATTR_APTABLE_NOACCESSPL0 0x1 -#define LDESC_S1_TABLEATTR_APTABLE_NOWRITEACCESSEXCP 0x2 -#define LDESC_S1_TABLEATTR_APTABLE_NOACCESSPL0_NOWRITEACCESSEXCP 0x3 - -// -// stage-1 ldesc memory attribute bit definitions for -// BLOCK and PAGE descriptors -// G4.5.3 ARMv8 -// -#define LDESC_S1_MEMATTR_XN_MASK 0x0040000000000000ULL -#define LDESC_S1_MEMATTR_XN_SHIFT 54 -#define LDESC_S1_MEMATTR_PXN_MASK 0x0020000000000000ULL -#define LDESC_S1_MEMATTR_PXN_SHIFT 53 -#define LDESC_S1_MEMATTR_C_MASK 0x0010000000000000ULL -#define LDESC_S1_MEMATTR_C_SHIFT 52 -#define LDESC_S1_MEMATTR_nG_MASK 0x0000000000000600ULL -#define LDESC_S1_MEMATTR_nG_SHIFT 11 -#define LDESC_S1_MEMATTR_AF_MASK 0x0000000000000400ULL -#define LDESC_S1_MEMATTR_AF_SHIFT 10 -#define LDESC_S1_MEMATTR_SH_MASK 0x0000000000000300ULL -#define LDESC_S1_MEMATTR_SH_SHIFT 8 -#define LDESC_S1_MEMATTR_AP_MASK 0x00000000000000C0ULL -#define LDESC_S1_MEMATTR_AP_SHIFT 6 -#define LDESC_S1_MEMATTR_NS_MASK 0x0000000000000020ULL -#define LDESC_S1_MEMATTR_NS_SHIFT 5 -#define LDESC_S1_MEMATTR_ATTRINDX_MASK 0x000000000000001CULL -#define LDESC_S1_MEMATTR_ATTRINDX_SHIFT 2 - -// -// stage-1 ldesc memory access permission definitions for -// BLOCK and PAGE descriptors -// G4.6.1 ARMv8 -// -#define LDESC_S1_AP_READWRITE_PL1 0x0 //invalid in HYP mode -#define LDESC_S1_AP_READWRITE 0x1 -#define LDESC_S1_AP_READONLY_PL1 0x2 //invalid in HYP mode -#define LDESC_S1_AP_READONLY 0x3 - - -// -// stage-1 ldesc memory attribute indirection register bit definitions for -// BLOCK and PAGE descriptors -// G6.2.100 ARMv8 -// -#define LDESC_S1_MAIR_LO_DEVnGnRnE 0b0000 -#define LDESC_S1_MAIR_LO_DEVnGnRE 0b0100 -#define LDESC_S1_MAIR_LO_DEVnGRE 0b1000 -#define LDESC_S1_MAIR_LO_DEVGRE 0b1100 - -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITENOALLOCATE_INNER_WRITE_THROUGH_TRANSIENT 0b0000 -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITEALLOCATE_INNER_WRITE_THROUGH_TRANSIENT 0b0001 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITENOALLOCATE_INNER_WRITE_THROUGH_TRANSIENT 0b0010 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITEALLOCATE_INNER_WRITE_THROUGH_TRANSIENT 0b0011 -#define LDESC_S1_MAIR_LO_INNER_NON_CACHEABLE 0b0100 -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITEALLOCATE_INNER_WRITE_BACK_TRANSIENT 0b0101 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITENOALLOCATE_INNER_WRITE_BACK_TRANSIENT 0b0110 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITEALLOCATE_INNER_WRITE_BACK_TRANSIENT 0b0111 -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITENOALLOCATE_INNER_WRITE_THROUGH_NONTRANSIENT 0b1000 -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITEALLOCATE_INNER_WRITE_THROUGH_NONTRANSIENT 0b1001 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITENOALLOCATE_INNER_WRITE_THROUGH_NONTRANSIENT 0b1010 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITEALLOCATE_INNER_WRITE_THROUGH_NONTRANSIENT 0b1011 -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITENOALLOCATE_INNER_WRITE_BACK_NONTRANSIENT 0b1100 -#define LDESC_S1_MAIR_LO_READNOALLOCATE_WRITEALLOCATE_INNER_WRITE_BACK_NONTRANSIENT 0b1101 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITENOALLOCATE_INNER_WRITE_BACK_NONTRANSIENT 0b1110 -#define LDESC_S1_MAIR_LO_READALLOCATE_WRITEALLOCATE_INNER_WRITE_BACK_NONTRANSIENT 0b1111 - - -#define LDESC_S1_MAIR_HI_DEV 0b00000000 -#define LDESC_S1_MAIR_HI_READNOALLOCATE_WRITEALLOCATE_OUTER_WRITE_THROUGH_TRANSIENT 0b00010000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITENOALLOCATE_OUTER_WRITE_THROUGH_TRANSIENT 0b00100000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITEALLOCATE_OUTER_WRITE_THROUGH_TRANSIENT 0b00110000 -#define LDESC_S1_MAIR_HI_OUTER_NON_CACHEABLE 0b01000000 -#define LDESC_S1_MAIR_HI_READNOALLOCATE_WRITEALLOCATE_OUTER_WRITE_BACK_TRANSIENT 0b01010000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITENOALLOCATE_OUTER_WRITE_BACK_TRANSIENT 0b01100000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITEALLOCATE_OUTER_WRITE_BACK_TRANSIENT 0b01110000 -#define LDESC_S1_MAIR_HI_READNOALLOCATE_WRITENOALLOCATE_OUTER_WRITE_THROUGH_NONTRANSIENT 0b10000000 -#define LDESC_S1_MAIR_HI_READNOALLOCATE_WRITEALLOCATE_OUTER_WRITE_THROUGH_NONTRANSIENT 0b10010000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITENOALLOCATE_OUTER_WRITE_THROUGH_NONTRANSIENT 0b10100000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITEALLOCATE_OUTER_WRITE_THROUGH_NONTRANSIENT 0b10110000 -#define LDESC_S1_MAIR_HI_READNOALLOCATE_WRITENOALLOCATE_OUTER_WRITE_BACK_NONTRANSIENT 0b11000000 -#define LDESC_S1_MAIR_HI_READNOALLOCATE_WRITEALLOCATE_OUTER_WRITE_BACK_NONTRANSIENT 0b11010000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITENOALLOCATE_OUTER_WRITE_BACK_NONTRANSIENT 0b11100000 -#define LDESC_S1_MAIR_HI_READALLOCATE_WRITEALLOCATE_OUTER_WRITE_BACK_NONTRANSIENT 0b11110000 - - -// -// stage-1 long descriptor translation table format descriptor macros -// G4.5.2 ARMv8 -// -#define ldesc_make_s1_l1e_invalid() 0x0ULL - -#define ldesc_make_s1_l1e_table(addr, attrs) \ - ((addr & 0x000000FFFFFFF000ULL) | attrs | 0x3ULL) - -#define ldesc_make_s1_l1e_block(addr, attrs) \ - ((addr & 0x000000FFC0000000ULL) | attrs | 0x1ULL) - -#define ldesc_make_s1_l2e_invalid() 0x0ULL - -#define ldesc_make_s1_l2e_block(addr, attrs) \ - ((addr & 0x000000FFFFE00000ULL) | attrs | 0x1ULL) - -#define ldesc_make_s1_l2e_table(addr) \ - ((addr & 0x000000FFFFFFF000ULL) | 0x3ULL) - - - - -// -// stage-2 long descriptor memory attribute bit definitions for -// BLOCK and PAGE descriptors -// G4.5.3 ARMv8 -// -#define LDESC_S2_MEMATTR_XN_MASK 0x0040000000000000ULL -#define LDESC_S2_MEMATTR_XN_SHIFT 54 -#define LDESC_S2_MEMATTR_C_MASK 0x0010000000000000ULL -#define LDESC_S2_MEMATTR_C_SHIFT 52 -#define LDESC_S2_MEMATTR_AF_MASK 0x0000000000000400ULL -#define LDESC_S2_MEMATTR_AF_SHIFT 10 -#define LDESC_S2_MEMATTR_SH_MASK 0x0000000000000300ULL -#define LDESC_S2_MEMATTR_SH_SHIFT 8 -#define LDESC_S2_MEMATTR_S2AP_MASK 0x00000000000000C0ULL -#define LDESC_S2_MEMATTR_S2AP_SHIFT 6 -#define LDESC_S2_MEMATTR_MC_MASK 0x000000000000003CULL -#define LDESC_S2_MEMATTR_MC_SHIFT 2 - - -// -// stage-2 long descriptor memory access permission definitions for -// BLOCK and PAGE descriptors -// G4.6.5 ARMv8 -// -#define LDESC_S2_S2AP_NO_ACCESS 0x0 -#define LDESC_S2_S2AP_READ_ONLY 0x1 -#define LDESC_S2_S2AP_WRITE_ONLY 0x2 -#define LDESC_S2_S2AP_READ_WRITE 0x3 - - -// -// stage-2 long descriptor memory cacheability definitions for -// BLOCK and PAGE descriptors -// G4.7.5 ARMv8 -// -#define LDESC_S2_MC_DEVnGnRnE 0x0 -#define LDESC_S2_MC_DEVnGnRE 0x1 -#define LDESC_S2_MC_DEVnGRE 0x2 -#define LDESC_S2_MC_DEVGRE 0x3 -#define LDESC_S2_MC_OUTER_NON_CACHEABLE_RESERVED 0x4 -#define LDESC_S2_MC_OUTER_NON_CACHEABLE_INNER_NON_CACHEABLE 0x5 -#define LDESC_S2_MC_OUTER_NON_CACHEABLE_INNER_WRITE_THROUGH_CACHEABLE 0x6 -#define LDESC_S2_MC_OUTER_NON_CACHEABLE_INNER_WRITE_BACK_CACHEABLE 0x7 -#define LDESC_S2_MC_OUTER_WRITE_THROUGH_CACHEABLE_RESERVED 0x8 -#define LDESC_S2_MC_OUTER_WRITE_THROUGH_CACHEABLE_INNER_NON_CACHEABLE 0x9 -#define LDESC_S2_MC_OUTER_WRITE_THROUGH_CACHEABLE_INNER_WRITE_THROUGH_CACHEABLE 0xa -#define LDESC_S2_MC_OUTER_WRITE_THROUGH_CACHEABLE_INNER_WRITE_BACK_CACHEABLE 0xb -#define LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_RESERVED 0xc -#define LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_NON_CACHEABLE 0xd -#define LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_THROUGH_CACHEABLE 0xe -#define LDESC_S2_MC_OUTER_WRITE_BACK_CACHEABLE_INNER_WRITE_BACK_CACHEABLE 0xf - - -// -// stage-2 long descriptor translation table format descriptor macros -// G4.5.2 ARMv8 -// -#define ldesc_make_s2_l1e_invalid() 0x0ULL - -#define ldesc_make_s2_l1e_table(addr) \ - ((addr & 0x000000FFFFFFF000ULL) | 0x3ULL) - -#define ldesc_make_s2_l1e_block(addr, attrs) \ - ((addr & 0x000000FFC0000000ULL) | attrs | 0x1ULL) - -#define ldesc_make_s2_l2e_invalid() 0x0ULL - -#define ldesc_make_s2_l2e_block(addr, attrs) \ - ((addr & 0x000000FFFFE00000ULL) | attrs | 0x1ULL) - -#define ldesc_make_s2_l2e_table(addr) \ - ((addr & 0x000000FFFFFFF000ULL) | 0x3ULL) - -#define ldesc_make_s2_l3e_invalid() 0x0ULL - -#define ldesc_make_s2_l3e_resinvalid() 0x1ULL - -#define ldesc_make_s2_l3e_page(addr, attrs) \ - ((addr & 0x000000FFFFFFF000ULL) | attrs | 0x3ULL) - - -#define ldesc_get_s2_l3e_page_attrs(entry) \ - ((entry & 0xFFF0000000000FF3ULL)) - - - -#define L1_LDESC_TABLE_MAXENTRIES 1024 -#define L1_LDESC_TABLE_ENTRIES 3 -#define L2_LDESC_TABLE_MAXENTRIES 512 -#define L3_LDESC_TABLE_MAXENTRIES 512 - -#define PAGE_SIZE_4K 4096 -#define PAGE_SIZE_2M 0x00200000UL -#define PAGE_SIZE_1G 0x40000000UL - -// -// VTTBR (virtualization translation table base register) bit definitions -// G6.2.162 ARMv8 -// -#define VTTBR_VMID_MASK 0x00FF000000000000ULL -#define VTTBR_VMID_SHIFT 48 -#define VTTBR_BADDR_MASK 0x0000FFFFFFFFFFFFULL -#define VTTBR_BADDR_SHIFT 0 - - -// -// HTTBR (Hyp translation table base register) bit definitions -// G6.2.71 ARMv8 -// -#define HTTBR_BADDR_MASK 0x0000FFFFFFFFFFFFULL -#define HTTBR_BADDR_SHIFT 0 - - -// -// HTCR (hyp translation control register) bit definitions -// G6.2.69 ARMv8 -// -#define HTCR_RES1_MASK 0x80800000UL -#define HTCR_IMPDEF_MASK 0x60000000UL -#define HTCR_SH0_MASK 0x00003000UL -#define HTCR_SH0_SHIFT 12 -#define HTCR_ORGN0_MASK 0x00000C00UL -#define HTCR_ORGN0_SHIFT 10 -#define HTCR_IRGN0_MASK 0x00000300UL -#define HTCR_IRGN0_SHIFT 8 -#define HTCR_T0SZ_MASK 0x00000007UL -#define HTCR_T0SZ_SHIFT 0 - - -// -// HCR (hyp configuration register) bit definitions -// G6.2.58 ARMv8 -// -#define HCR_VM_MASK 0x00000001UL -#define HCR_VM_SHIFT 0 - - -// -// HSR (hyp syndrome register) bit definitions -// G6.2.67 ARMv8 -// -#define HSR_EC_MASK 0xFC000000UL -#define HSR_EC_SHIFT 26 -#define HSR_IL_MASK 0x02000000UL -#define HSR_IL_SHIFT 25 -#define HSR_ISS_MASK 0x1FFFFFFFUL -#define HSR_ISS_SHIFT 0 - -// -// HSR (hyp syndrome register) EC values -// G6.2.67 ARMv8 -// -#define HSR_EC_CP15_TRAP 0x3 -#define HSR_EC_HVC 0x12 -#define HSR_EC_PREFETCH_ABORT_ELCHANGE 0x20 -#define HSR_EC_PREFETCH_ABORT_NOELCHANGE 0x21 -#define HSR_EC_DATA_ABORT_ELCHANGE 0x24 -#define HSR_EC_DATA_ABORT_NOELCHANGE 0x25 - - - -#ifndef __ASSEMBLY__ - - -typedef struct { - u32 r0; - u32 r1; - u32 r2; - u32 r3; - u32 r4; - u32 r5; - u32 r6; - u32 r7; - u32 r8; - u32 r9; - u32 r10; - u32 r11; - u32 r12; - //u32 r13; - //u32 r14; -} arm8_32_regs_t; - -static inline u32 cpu_bswap_u32(u32 val){ - val = ((val << 8) & 0xFF00FF00 ) | ((val >> 8) & 0xFF00FF ); - return (val << 16) | (val >> 16); -} - -static inline u64 cpu_bswap_u64(u64 val){ - val = ((val << 8) & 0xFF00FF00FF00FF00ULL ) | ((val >> 8) & 0x00FF00FF00FF00FFULL ); - val = ((val << 16) & 0xFFFF0000FFFF0000ULL ) | ((val >> 16) & 0x0000FFFF0000FFFFULL ); - return (val << 32) | (val >> 32); -} - - -#define cpu_be2le_u32(be_val_u32) cpu_bswap_u32(be_val_u32) -#define cpu_be2le_u64(be_val_u64) cpu_bswap_u64(be_val_u64) -#define cpu_le2be_u32(le_val_u32) cpu_bswap_u32(le_val_u32) -#define cpu_le2be_u64(le_val_u64) cpu_bswap_u64(le_val_u64) - - - -extern u32 mmio_read32 (u32 address); -extern void mmio_write32 (u32 address, u32 value); - -extern u32 sysreg_read_scr(void); - -extern u32 sysreg_read_cpsr(void); -extern void sysreg_write_cpsr(u32 value); - -extern u32 sysreg_read_hvbar(void); -extern void sysreg_write_hvbar(u32 value); - -extern u32 sysreg_read_hcr(void); -extern void sysreg_write_hcr(u32 value); - -extern u32 sysreg_read_spsr_hyp(void); - -extern u32 sysreg_read_hsctlr(void); -extern void sysreg_write_hsctlr(u32 value); - -extern void hypcall(void); - -extern void svccall(void); - -extern u32 sysreg_read_sctlr(void); -extern void sysreg_write_sctlr(u32 value); - - -extern u32 sysreg_read_vbar(void); -extern void sysreg_write_vbar(u32 value); - -extern u32 sysreg_read_vtcr(void); -extern void sysreg_write_vtcr(u32 value); - -extern u32 sysreg_read_hdcr(void); -extern void sysreg_write_hdcr(u32 value); - -extern u32 sysreg_read_hcptr(void); -extern void sysreg_write_hcptr(u32 value); - -extern u32 sysreg_read_hstr(void); -extern void sysreg_write_hstr(u32 value); - -extern u64 sysreg_read_vttbr(void); -extern void sysreg_write_vttbr(u64 value); - -extern u32 sysreg_read_hsr(void); - -extern u32 sysreg_read_elrhyp(void); -extern void sysreg_write_elrhyp(u32 value); - -extern u32 sysreg_read_mair0(void); -extern void sysreg_write_mair0(u32 value); - -extern u32 sysreg_read_mair1(void); -extern void sysreg_write_mair1(u32 value); - -extern u32 sysreg_read_hmair0(void); -extern void sysreg_write_hmair0(u32 value); - -extern u32 sysreg_read_hmair1(void); -extern void sysreg_write_hmair1(u32 value); - - -extern void sysreg_tlbiallh(void); -extern void sysreg_iciallu(void); -extern void sysreg_tlbiipas2is(u32 ipa); -extern void sysreg_tlbiallis(void); - -extern u64 sysreg_read_httbr(void); -extern void sysreg_write_httbr(u64 value); - -extern u32 sysreg_read_htcr(void); -extern void sysreg_write_htcr(u32 value); - -extern u32 sysreg_read_actlr(void); -extern void sysreg_write_actlr(u32 value); - -extern u32 sysreg_read_dacr(void); -extern void sysreg_write_dacr(u32 value); - -extern u32 sysreg_read_hdfar(void); -extern u32 sysreg_read_hpfar(void); - -extern void cpu_isb(void); -extern void cpu_dsb(void); -extern void cpu_dmbish(void); -extern u32 cpu_read_sp(void); - - -extern u32 sysreg_read_idisar4(void); - - -extern void sysreg_ats12nsour(u32 value); -extern void sysreg_ats1cpr(u32 value); -extern u32 sysreg_read_par(void); - -void spin_lock(u32 *lock); -void spin_unlock(u32 *lock); - - -////// -// pl0,1 system register access functions -// chiefly used for emulation/pass-thru -////// -u32 sysreg_read_ttbcr(void); -void sysreg_write_ttbcr(u32 value); -u32 sysreg_read_ttbr0(void); -void sysreg_write_ttbr0(u32 value); -u32 sysreg_read_ttbr1(void); -void sysreg_write_ttbr1(u32 value); - - -////// -// generic timer system register access functions -////// -extern u64 sysreg_read_cntpct(void); -int sysreg_read_cnthp_tval(void); -void sysreg_write_cnthp_tval(int value); -u32 sysreg_read_cnthp_ctl(void); -void sysreg_write_cnthp_ctl(u32 value); - - - -#endif // __ASSEMBLY__ - -#endif //__ARM8_32_H__ -; diff --git a/uxmhf-rpi3/include/atags.h b/uxmhf-rpi3/include/atags.h deleted file mode 100644 index 2daf8706e8..0000000000 --- a/uxmhf-rpi3/include/atags.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - ATAGS (ARM bootloader tags) definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __ATAGS_H__ -#define __ATAGS_H__ - -// tag id's -// see http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#appendix_tag_reference - -#define ATAG_NONE 0x00000000 -#define ATAG_CORE 0x54410001 -#define ATAG_MEM 0x54410002 -#define ATAG_RAMDISK 0x54410004 -#define ATAG_INITRD2 0x54420005 -#define ATAG_SERIAL 0x54410006 -#define ATAG_REVISION 0x54410007 -#define ATAG_CMDLINE 0x54410009 - -#ifndef __ASSEMBLY__ - -/* structures for each atag */ -struct atag_header { - u32 size; /* length of tag in words including this header */ - u32 tag; /* tag type */ -}__attribute__((packed)); - -struct atag_core { - u32 flags; - u32 pagesize; - u32 rootdev; -}__attribute__((packed)); - -struct atag_mem { - u32 size; - u32 start; -}__attribute__((packed)); - -struct atag_ramdisk { - u32 flags; - u32 size; - u32 start; -}__attribute__((packed)); - -struct atag_initrd2 { - u32 start; - u32 size; -}__attribute__((packed)); - -struct atag_serialnr { - u32 low; - u32 high; -}__attribute__((packed)); - -struct atag_revision { - u32 rev; -}__attribute__((packed)); - -struct atag_cmdline { - u8 cmdline[1]; -} __attribute__((packed)); - -struct atag { - //struct atag_header hdr; - u32 size; - u32 tag; - union { - struct atag_core core; - struct atag_mem mem; - struct atag_ramdisk ramdisk; - struct atag_initrd2 initrd2; - struct atag_serialnr serialnr; - struct atag_revision revision; - struct atag_cmdline cmdline; - } u; -} __attribute__((packed)); - - -#define atag_next(t) ((struct atag *)(((u32)t) + ((t)->size)*4)) -#define atag_size(type) ((sizeof(struct atag_header) + sizeof(struct type)) >> 2) - -#endif // __ASSEMBLY__ - - - -#endif //__ATAGS_H__ diff --git a/uxmhf-rpi3/include/bcm2837.h b/uxmhf-rpi3/include/bcm2837.h deleted file mode 100644 index 8c79784cca..0000000000 --- a/uxmhf-rpi3/include/bcm2837.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 (raspberry pi 3) definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __BCM2837_H__ -#define __BCM2837_H__ - -#define BCM2837_PERIPHERALS_BASE 0x3f000000 -#define ARMLOCALREGISTERS_BASE 0x40000000 -#define BCM2837_MAXCPUS 4 - -#define BCM2837_VIDEOCORE_GPU_MAILBOX_BASE (BCM2837_PERIPHERALS_BASE+0x0000B880) - - -// ARM and VideoCore GPU interface Mailbox -#define MAILBOX_READ_REG (BCM2837_VIDEOCORE_GPU_MAILBOX_BASE+0x0) -#define MAILBOX_POLL_REG (BCM2837_VIDEOCORE_GPU_MAILBOX_BASE+0x10) -#define MAILBOX_SENDER_REG (BCM2837_VIDEOCORE_GPU_MAILBOX_BASE+0x14) -#define MAILBOX_STATUS_REG (BCM2837_VIDEOCORE_GPU_MAILBOX_BASE+0x18) -#define MAILBOX_CONFIG_REG (BCM2837_VIDEOCORE_GPU_MAILBOX_BASE+0x1C) -#define MAILBOX_WRITE_REG (BCM2837_VIDEOCORE_GPU_MAILBOX_BASE+0x20) -#define MAILBOX_RESPONSE 0x80000000 -#define MAILBOX_FULL 0x80000000 -#define MAILBOX_EMPTY 0x40000000 -#define MAILBOX_MAXBUFSIZE 36 - - -////// -// ARM core local peripherals -////// -#define ARMLOCALREGISTERS_MAILBOXWRITE_BASE (ARMLOCALREGISTERS_BASE + 0x80) -#define ARMLOCALREGISTERS_MAILBOXREADCLEAR_BASE (ARMLOCALREGISTERS_BASE + 0xC0) - -#define LOCAL_TIMER_INT_CONTROL0 (ARMLOCALREGISTERS_BASE + 0x40) - - -//GPIO registers -#define GPIO_BASE (BCM2837_PERIPHERALS_BASE+0x00200000) -#define GPFSEL1 (BCM2837_PERIPHERALS_BASE+0x00200004) -#define GPPUD (BCM2837_PERIPHERALS_BASE+0x00200094) -#define GPPUDCLK0 (BCM2837_PERIPHERALS_BASE+0x00200098) - -//Auxillary registers control -#define AUX_ENABLES (BCM2837_PERIPHERALS_BASE+0x00215004) - -//Auxillary registers -- Mini UART -#define AUX_MU_IO_REG (BCM2837_PERIPHERALS_BASE+0x00215040) -#define AUX_MU_IER_REG (BCM2837_PERIPHERALS_BASE+0x00215044) -#define AUX_MU_IIR_REG (BCM2837_PERIPHERALS_BASE+0x00215048) -#define AUX_MU_LCR_REG (BCM2837_PERIPHERALS_BASE+0x0021504C) -#define AUX_MU_MCR_REG (BCM2837_PERIPHERALS_BASE+0x00215050) -#define AUX_MU_LSR_REG (BCM2837_PERIPHERALS_BASE+0x00215054) -#define AUX_MU_MSR_REG (BCM2837_PERIPHERALS_BASE+0x00215058) -#define AUX_MU_SCRATCH (BCM2837_PERIPHERALS_BASE+0x0021505C) -#define AUX_MU_CNTL_REG (BCM2837_PERIPHERALS_BASE+0x00215060) -#define AUX_MU_STAT_REG (BCM2837_PERIPHERALS_BASE+0x00215064) -#define AUX_MU_BAUD_REG (BCM2837_PERIPHERALS_BASE+0x00215068) - - - -// PL011 UART registers -#define PL011_UART_DR_REG (BCM2837_PERIPHERALS_BASE+0x00201000) //data -#define PL011_UART_RSRECR_REG (BCM2837_PERIPHERALS_BASE+0x00201004) //receive status -#define PL011_UART_FR_REG (BCM2837_PERIPHERALS_BASE+0x00201018) //flag -#define PL011_UART_IBRD_REG (BCM2837_PERIPHERALS_BASE+0x00201024) //integer baud rate divisior -#define PL011_UART_FBRD_REG (BCM2837_PERIPHERALS_BASE+0x00201028) //fractional baud rate divisior -#define PL011_UART_LCR_REG (BCM2837_PERIPHERALS_BASE+0x0020102c) //line control -#define PL011_UART_CR_REG (BCM2837_PERIPHERALS_BASE+0x00201030) //control register -#define PL011_UART_IFLS_REG (BCM2837_PERIPHERALS_BASE+0x00201034) //interrupt FIFO level select -#define PL011_UART_IMSC_REG (BCM2837_PERIPHERALS_BASE+0x00201038) //interrupt mask set/clear -#define PL011_UART_RIS_REG (BCM2837_PERIPHERALS_BASE+0x0020103c) //raw interrupt status -#define PL011_UART_MIS_REG (BCM2837_PERIPHERALS_BASE+0x00201040) //masked interrupt status -#define PL011_UART_ICR_REG (BCM2837_PERIPHERALS_BASE+0x00201044) //interrupt clear -#define PL011_UART_DMACR_REG (BCM2837_PERIPHERALS_BASE+0x00201048) //dma control - - - - - - - - - - - -//DMA controller -#define BCM2837_DMA0_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007000) -#define BCM2837_DMA1_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007100) -#define BCM2837_DMA2_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007200) -#define BCM2837_DMA3_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007300) -#define BCM2837_DMA4_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007400) -#define BCM2837_DMA5_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007500) -#define BCM2837_DMA6_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007600) -#define BCM2837_DMA7_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007700) -#define BCM2837_DMA8_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007800) -#define BCM2837_DMA9_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007900) -#define BCM2837_DMA10_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007a00) -#define BCM2837_DMA11_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007b00) -#define BCM2837_DMA12_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007c00) -#define BCM2837_DMA13_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007d00) -#define BCM2837_DMA14_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007e00) -#define BCM2837_DMA15_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00e05000) -#define BCM2837_DMA_INT_STATUS_BASE (BCM2837_PERIPHERALS_BASE + 0x00007fe0) -#define BCM2837_DMA_ENABLE_BASE (BCM2837_PERIPHERALS_BASE + 0x00007ff0) - -#define BCM2837_DMA_NUMCHANNELS 16 -#define BCM2837_DMA_MAXCBRECORDS 4096 - - -//USB controller -#define DWC_REGS_BASE (BCM2837_PERIPHERALS_BASE + 0x00980000) -#define DWC_NUM_CHANNELS 8 - -#define DWC_CHANNEL0_BASE (DWC_REGS_BASE + 0x500) -#define DWC_CHANNEL1_BASE (DWC_REGS_BASE + 0x520) -#define DWC_CHANNEL2_BASE (DWC_REGS_BASE + 0x540) -#define DWC_CHANNEL3_BASE (DWC_REGS_BASE + 0x560) -#define DWC_CHANNEL4_BASE (DWC_REGS_BASE + 0x580) -#define DWC_CHANNEL5_BASE (DWC_REGS_BASE + 0x5A0) -#define DWC_CHANNEL6_BASE (DWC_REGS_BASE + 0x5C0) -#define DWC_CHANNEL7_BASE (DWC_REGS_BASE + 0x5E0) - -#define DWC_CHANNEL_REG_CHARACTERISTICS 0x0 -#define DWC_CHANNEL_REG_SPLITCONTROL 0x4 -#define DWC_CHANNEL_REG_INTERRUPTS 0x8 -#define DWC_CHANNEL_REG_INTERRUPTMASK 0xC -#define DWC_CHANNEL_REG_TRANSFER 0x10 -#define DWC_CHANNEL_REG_DMAADDRESS 0x14 -#define DWC_CHANNEL_REG_RESERVED1 0x18 -#define DWC_CHANNEL_REG_RESERVED2 0x1C - - -//SD/MMC controller -#define BCM2837_EMMC_BASE (BCM2837_PERIPHERALS_BASE + 0x00300000) -#define BCM2837_SDHOST_BASE (BCM2837_PERIPHERALS_BASE + 0x00202000) - - -#ifndef __ASSEMBLY__ - -typedef struct { - u32 mailbox0write; - u32 mailbox1write; - u32 mailbox2write; - u32 mailbox3write; -} armlocalregisters_mailboxwrite_t __attribute__((packed)); - - -typedef struct { - u32 mailbox0readclear; - u32 mailbox1readclear; - u32 mailbox2readclear; - u32 mailbox3readclear; -} armlocalregisters_mailboxreadclear_t __attribute__((packed)); - - -#endif // __ASSEMBLY__ - -#endif //__BCM2837_H__ diff --git a/uxmhf-rpi3/include/config.h b/uxmhf-rpi3/include/config.h deleted file mode 100644 index 821d68f777..0000000000 --- a/uxmhf-rpi3/include/config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - configuration - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - - -// configure script parameters - -#define UXMHF_CORE_START_ADDR 0x1000000 -#define UXMHF_CORE_SIZE 0xC00000 - -#define UXMHF_BOOT_PARTITION_START 8192 -#define UXMHF_BOOT_PARTITION_END 137215 - - -// computed parameters from above -#define UXMHF_CORE_END_ADDR ( 0x1000000 + 0xC00000 ) - - -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#ifndef __ASSEMBLY__ - - -#endif // __ASSEMBLY__ - - -#endif //__CONFIG_H__ diff --git a/uxmhf-rpi3/include/config.h.in b/uxmhf-rpi3/include/config.h.in deleted file mode 100644 index d164b03418..0000000000 --- a/uxmhf-rpi3/include/config.h.in +++ /dev/null @@ -1,30 +0,0 @@ -/* - configuration - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - - -// configure script parameters - -#define UXMHF_CORE_START_ADDR @CORE_STARTADDR@ -#define UXMHF_CORE_SIZE @CORE_SIZE@ - -#define UXMHF_BOOT_PARTITION_START @BOOT_PARTITION_START@ -#define UXMHF_BOOT_PARTITION_END @BOOT_PARTITION_END@ - - -// computed parameters from above -#define UXMHF_CORE_END_ADDR ( @CORE_STARTADDR@ + @CORE_SIZE@ ) - - -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#ifndef __ASSEMBLY__ - - -#endif // __ASSEMBLY__ - - -#endif //__CONFIG_H__ diff --git a/uxmhf-rpi3/include/ctxtrace.h b/uxmhf-rpi3/include/ctxtrace.h deleted file mode 100644 index a54919a5f0..0000000000 --- a/uxmhf-rpi3/include/ctxtrace.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - guest context switch tracer application - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __CTXTRACE_H__ -#define __CTXTRACE_H__ - - -#ifndef __ASSEMBLY__ - - -#endif // __ASSEMBLY__ - - - -#endif //__CTXTRACE_H__ diff --git a/uxmhf-rpi3/include/debug.h b/uxmhf-rpi3/include/debug.h deleted file mode 100644 index a24fca0589..0000000000 --- a/uxmhf-rpi3/include/debug.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - debug module definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __DEBUG_H__ -#define __DEBUG_H__ - -#ifndef __ASSEMBLY__ - - -#if defined (__DEBUG_UART__) - - - -extern __attribute__(( section(".data") )) u32 xdprintfsmp_lock; - -static inline void _XDPRINTF_(const char *fmt, ...){ - va_list ap; - int retval; - char buffer[1024]; - - va_start(ap, fmt); - retval = vsnprintf(&buffer, 1024, fmt, ap); - //spin_lock(&libxmhfdebug_lock); - uart_puts(&buffer); - uart_flush(); - //spin_unlock(&libxmhfdebug_lock); - va_end(ap); -} - - -static inline void _XDPRINTFSMP_(const char *fmt, ...){ - va_list ap; - int retval; - char buffer[1024]; - - va_start(ap, fmt); - retval = vsnprintf(&buffer, 1024, fmt, ap); - spin_lock(&xdprintfsmp_lock); - uart_puts(&buffer); - uart_flush(); - spin_unlock(&xdprintfsmp_lock); - va_end(ap); -} - -#else - -#define _XDPRINTF_(format, args...) -#define _XDPRINTFSMP_(format, args...) - -#endif // defined - - - - -void debug_hexdumpu32(u32 value); - -#define HALT() while(1); - -#endif // __ASSEMBLY__ - - - - - -#endif //__DEBUG_H__ diff --git a/uxmhf-rpi3/include/dmaprot.h b/uxmhf-rpi3/include/dmaprot.h deleted file mode 100644 index 65a8df399b..0000000000 --- a/uxmhf-rpi3/include/dmaprot.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - DMA protection module definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __DMAPROT_H__ -#define __DMAPROT_H__ - - -#ifndef __ASSEMBLY__ - -#define dmapa_to_syspa(x) (x & 0x3FFFFFFFUL) -#define syspa_to_dmapa(x) (x | 0xC0000000UL) - -typedef struct { - arm8_32_regs_t *r; - u32 va; - u32 pa; - u32 sas; - u32 srt; - u32 wnr; - u32 il; -} info_intercept_data_abort_t; - - -typedef struct { - u32 ti; - u32 src_addr; - u32 dst_addr; - u32 len; - u32 stride; - u32 next_cb_addr; - u32 rsv_0; - u32 rsv_1; -} dmac_cb_t; - - -void dmaprot_activate(void); - -void dmaprot_handle_dmacontroller_access(info_intercept_data_abort_t *ida); - -void dmaprot_handle_usbdmac_access(info_intercept_data_abort_t *ida); - - -#endif // __ASSEMBLY__ - - - -#endif //__DMAPROT_H__ diff --git a/uxmhf-rpi3/include/fdt.h b/uxmhf-rpi3/include/fdt.h deleted file mode 100644 index cbf8f026b7..0000000000 --- a/uxmhf-rpi3/include/fdt.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - flattened device tree blob definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __FDT_H__ -#define __FDT_H__ - -#define FDT_MAGIC 0xedfe0dd0 - -#ifndef __ASSEMBLY__ - -// DT spec. v0.1 - -struct fdt_header { - u32 magic; - u32 totalsize; - u32 off_dt_struct; - u32 off_dt_strings; - u32 off_mem_rsvmap; - u32 version; - u32 last_comp_version; - u32 boot_cpuid_phys; - u32 size_dt_strings; - u32 size_dt_struct; -} __attribute__((packed)); - -struct fdt_reserve_entry { - u64 address; - u64 size; -} __attribute__((packed)); - -#endif // __ASSEMBLY__ - - -#endif //__FDT_H__ diff --git a/uxmhf-rpi3/include/guestos.h b/uxmhf-rpi3/include/guestos.h deleted file mode 100644 index 503eb0f460..0000000000 --- a/uxmhf-rpi3/include/guestos.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - dummy guest OS definitions - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __GUESTOS_H__ -#define __GUESTOS_H__ - -#define GUESTOS_RWMEM_ADDR_START 0x30800000 -#define GUESTOS_RWMEM_ADDR_END 0x30801000 -#define GUESTOS_TESTPAGE_ADDR 0x30801000 -#define GUESTOS_TESTPAGE_SIZE 0x00001000 - -#ifndef __ASSEMBLY__ - - -#endif // __ASSEMBLY__ - - - -#endif //__GUESTOS_H__ diff --git a/uxmhf-rpi3/include/mailbox.h b/uxmhf-rpi3/include/mailbox.h deleted file mode 100644 index 2e9c6d091a..0000000000 --- a/uxmhf-rpi3/include/mailbox.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 mailbox support - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __MAILBOX_H__ -#define __MAILBOX_H__ - -#define MAILBOX_REQUEST 0 - -//channels -#define MAILBOX_CHANNEL_POWER 0 -#define MAILBOX_CHANNEL_FB 1 -#define MAILBOX_CHANNEL_VUART 2 -#define MAILBOX_CHANNEL_VCHIQ 3 -#define MAILBOX_CHANNEL_LEDS 4 -#define MAILBOX_CHANNEL_BTNS 5 -#define MAILBOX_CHANNEL_TOUCH 6 -#define MAILBOX_CHANNEL_COUNT 7 -#define MAILBOX_CHANNEL_PROP 8 - -// tags -#define MAILBOX_TAG_GETSERIAL 0x10004 -#define MAILBOX_TAG_SETCLKRATE 0x38002 -#define MAILBOX_TAG_LAST 0 - -#ifndef __ASSEMBLY__ - -// make a mailbox call -// return: 0 if failure, non-zero on success -int bcm2837_mailbox_call(unsigned char channel, unsigned char *buffer, unsigned int buffer_size); - - -// mailbox return serial number -// return 0 on failure -u64 bcm2837_mailbox_get_board_serial(void); - - -#endif // __ASSEMBLY__ - - - -#endif //__MAILBOX_H__ diff --git a/uxmhf-rpi3/include/miniuart.h b/uxmhf-rpi3/include/miniuart.h deleted file mode 100644 index 89b47861fc..0000000000 --- a/uxmhf-rpi3/include/miniuart.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 mini uart support - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __MINIUART_H__ -#define __MINIUART_H__ - - - -#ifndef __ASSEMBLY__ - -void bcm2837_miniuart_init(void); -bool bcm2837_miniuart_can_send(void); -bool bcm2837_miniuart_can_recv(void); -void bcm2837_miniuart_putc(u8 ch); -void bcm2837_miniuart_puts(char *buffer); -bool bcm2837_miniuart_getc(u8 *recv_ch); -void bcm2837_miniuart_flush(void); - - -#endif // __ASSEMBLY__ - - - -#endif //__MINIUART_H__ diff --git a/uxmhf-rpi3/include/pa5encfs.h b/uxmhf-rpi3/include/pa5encfs.h deleted file mode 100644 index 33645e9d14..0000000000 --- a/uxmhf-rpi3/include/pa5encfs.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - pa5-encfs encrypted filesystem test application - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __PA5ENCFS_H__ -#define __PA5ENCFS_H__ - -#define UAPP_PA5ENCFS_FUNCTION_START 0x30 -#define UAPP_PA5ENCFS_FUNCTION_ENCRYPT 0x31 -#define UAPP_PA5ENCFS_FUNCTION_DECRYPT 0x32 -#define UAPP_PA5ENCFS_FUNCTION_DONE 0x33 - - -#define BLOCKSIZE 1024 -#define FAILURE 0 -#define SUCCESS 1 - -#define ENCRYPT 1 -#define DECRYPT 0 -#define PASS_THROUGH (-1) - - -#ifndef __ASSEMBLY__ - -typedef struct { - unsigned char inbuf[BLOCKSIZE]; - int inlen; - unsigned char outbuf[BLOCKSIZE]; - int outlen; - int writelen; - int result; -}pa5encfs_param_t; - - -#endif // __ASSEMBLY__ - - - -#endif //__PA5ENCFS_H__ diff --git a/uxmhf-rpi3/include/pl011uart.h b/uxmhf-rpi3/include/pl011uart.h deleted file mode 100644 index 8ffb3bd56b..0000000000 --- a/uxmhf-rpi3/include/pl011uart.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - broadcom 2837 pl011 uart support - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __PL011UART_H__ -#define __PL011UART_H__ - - - -#ifndef __ASSEMBLY__ - -#if defined (__ENABLE_UART_PL011_CTSRTS__) -void bcm2837_pl011uart_init_hwflowcontrol(void); -#endif - -void bcm2837_pl011uart_init(void); -bool bcm2837_pl011uart_can_send(void); -bool bcm2837_pl011uart_can_recv(void); -void bcm2837_pl011uart_putc(u8 ch); -void bcm2837_pl011uart_puts(char *buffer); -bool bcm2837_pl011uart_getc(u8 *recv_ch); -void bcm2837_pl011uart_flush(void); - - -#endif // __ASSEMBLY__ - - - -#endif //__PL011UART_H__ diff --git a/uxmhf-rpi3/include/types.h b/uxmhf-rpi3/include/types.h deleted file mode 100644 index 54f419e3ea..0000000000 --- a/uxmhf-rpi3/include/types.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - base types - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __TYPES_H__ -#define __TYPES_H__ - -#include -#include -#include -#include -#include -#include - - -#ifndef __ASSEMBLY__ - -typedef unsigned int u32; -typedef unsigned char u8; -typedef unsigned long long u64; - -#endif // __ASSEMBLY__ - - - - - -#endif //__TYPES_H__ diff --git a/uxmhf-rpi3/include/uagent.h b/uxmhf-rpi3/include/uagent.h deleted file mode 100644 index aa8052db1c..0000000000 --- a/uxmhf-rpi3/include/uagent.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __UAGENT_H__ -#define __UAGENT_H__ - -#define UAPP_UAGENT_FUNCTION_SIGN 0x67 -#define MAX_SIZE 1600 - -#ifndef __ASSEMBLY__ - -typedef struct { - uint8_t pkt_data[MAX_SIZE]; - uint32_t pkt_size; - uint32_t vaddr; - uint32_t op; -}uagent_param_t; - - -#endif // __ASSEMBLY__ - -#endif // __UAGENT_H__ diff --git a/uxmhf-rpi3/include/uapp-pvdriver-uart.h b/uxmhf-rpi3/include/uapp-pvdriver-uart.h deleted file mode 100644 index 870ff9dc3b..0000000000 --- a/uxmhf-rpi3/include/uapp-pvdriver-uart.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - UART para-virtualized driver uberapp backend - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __UAPP_PVDRIVER_UART_H__ -#define __UAPP_PVDRIVER_UART_H__ - -#define UAPP_PVDRIVER_UART_UHCALL 0xE0 - -#define UAPP_PVDRIVER_UART_UHCALL_INIT 1 -#define UAPP_PVDRIVER_UART_UHCALL_SEND 2 -#define UAPP_PVDRIVER_UART_UHCALL_RECV 3 -#define UAPP_PVDRIVER_UART_UHCALL_CAN_SEND 4 -#define UAPP_PVDRIVER_UART_UHCALL_CAN_RECV 5 -#define UAPP_PVDRIVER_UART_UHCALL_FLUSH 6 - - -#ifndef __ASSEMBLY__ - - -void uapp_pvdriver_uart_init(void); -void uapp_pvdriver_uart_send(u8 *buffer, u32 buf_len); -int uapp_pvdriver_uart_recv(u8 *buffer, u32 max_len, u32 *len_read); -int uapp_pvdriver_uart_can_send(void); -int uapp_pvdriver_uart_can_recv(void); -void uapp_pvdriver_uart_flush(void); - - -typedef struct { - uint8_t uhcall_fn; - uint32_t iparam_1; - uint32_t iparam_2; - uint32_t iparam_3; - uint32_t iparam_4; - uint32_t oparam_1; - uint32_t oparam_2; - uint32_t status; -}uapp_pvdriver_uart_param_t; - - - -#endif // __ASSEMBLY__ - - - -#endif //__UAPP_PVDRIVER_UART_H__ diff --git a/uxmhf-rpi3/include/uart.h b/uxmhf-rpi3/include/uart.h deleted file mode 100644 index 66632b7b4d..0000000000 --- a/uxmhf-rpi3/include/uart.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - generic uart interface - will end up using either minuart or pl011 uart based on build configuration - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __UART_H__ -#define __UART_H__ - -#if defined (__ENABLE_UART_PL011__) - #include -#elif defined (__ENABLE_UART_MINI__) - #include -#else - // -#endif - - -#ifndef __ASSEMBLY__ - -#if defined (__ENABLE_UART_PL011__) - - #define uart_init bcm2837_pl011uart_init - #define uart_can_send bcm2837_pl011uart_can_send - #define uart_can_recv bcm2837_pl011uart_can_recv - #define uart_putc bcm2837_pl011uart_putc - #define uart_puts bcm2837_pl011uart_puts - #define uart_getc bcm2837_pl011uart_getc - #define uart_flush bcm2837_pl011uart_flush - -#elif defined (__ENABLE_UART_MINI__) - #define uart_init bcm2837_miniuart_init - #define uart_can_send bcm2837_miniuart_can_send - #define uart_can_recv bcm2837_miniuart_can_recv - #define uart_putc bcm2837_miniuart_putc - #define uart_puts bcm2837_miniuart_puts - #define uart_getc bcm2837_miniuart_getc - #define uart_flush bcm2837_miniuart_flush - -#else - - #define uart_init(x) - #define uart_can_send(x) - #define uart_can_recv(x) - #define uart_putc(x) - #define uart_puts(x) - #define uart_getc(x) - #define uart_flush(x) - -#endif - - -#endif // __ASSEMBLY__ - - - -#endif //__UART_H__ diff --git a/uxmhf-rpi3/include/uhcalltest.h b/uxmhf-rpi3/include/uhcalltest.h deleted file mode 100644 index 23695cfd9d..0000000000 --- a/uxmhf-rpi3/include/uhcalltest.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - hypercall test application - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __UHCALLTEST_H__ -#define __UHCALLTEST_H__ - -#define UAPP_UHCALLTEST_FUNCTION_TEST 10 - -#ifndef __ASSEMBLY__ - -typedef struct { - uint8_t in[16]; - uint8_t out[16]; -}uhcalltest_param_t; - -#endif // __ASSEMBLY__ - - - -#endif //__UHCALLTEST_H__ diff --git a/uxmhf-rpi3/include/uhsign.h b/uxmhf-rpi3/include/uhsign.h deleted file mode 100644 index 736ffdd861..0000000000 --- a/uxmhf-rpi3/include/uhsign.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __UHSIGN_H__ -#define __UHSIGN_H__ - -#include -#include - -#define UAPP_UHSIGN_FUNCTION_SIGN 0x69 -#define HMAC_DIGEST_SIZE 32 - -#ifndef __ASSEMBLY__ - -typedef struct { - uint8_t pkt[1600]; - uint32_t pkt_size; - uint8_t digest[HMAC_DIGEST_SIZE]; - uint32_t vaddr; -}uhsign_param_t; - - -#endif // __ASSEMBLY__ - -#endif // __UHSIGN_H__ diff --git a/uxmhf-rpi3/include/uhstateDB.h b/uxmhf-rpi3/include/uhstateDB.h deleted file mode 100644 index 2a1006e9f4..0000000000 --- a/uxmhf-rpi3/include/uhstateDB.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __UHSTATEDB_H__ -#define __UHSTATEDB_H__ - -#define UAPP_UHSTATEDB_FUNCTION_INIT 0x60 -#define UAPP_UHSTATEDB_FUNCTION_GET 0x61 -#define UAPP_UHSTATEDB_FUNCTION_NEXT 0x62 - -#define MAX_STATES 10 - -#ifndef __ASSEMBLY__ - -typedef struct { - uint32_t maxArray[MAX_STATES]; - uint32_t numStates; - uint32_t vaddr; - uint32_t deviceID; - int32_t stateVal; -}uhstatedb_param_t; - - -#endif // __ASSEMBLY__ - -#endif // __UHSTATEDB_H__ diff --git a/uxmhf-rpi3/include/utpmtest.h b/uxmhf-rpi3/include/utpmtest.h deleted file mode 100644 index 14e752bbc1..0000000000 --- a/uxmhf-rpi3/include/utpmtest.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - micro-tpm test application - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __UTPMTEST_H__ -#define __UTPMTEST_H__ - -#define UAPP_UTPM_FUNCTION_INIT_MASTER_ENTROPY 0x10 -#define UAPP_UTPM_FUNCTION_INIT_INSTANCE 0x11 -#define UAPP_UTPM_FUNCTION_PCRREAD 0x12 -#define UAPP_UTPM_FUNCTION_EXTEND 0x13 -#define UAPP_UTPM_FUNCTION_SEAL 0x14 -#define UAPP_UTPM_FUNCTION_UNSEAL 0x15 - - -#ifndef __ASSEMBLY__ - -typedef struct { - uint32_t magic; - uint8_t g_aeskey[TPM_AES_KEY_LEN_BYTES]; - uint8_t g_hmackey[TPM_HMAC_KEY_LEN]; - uint8_t g_rsakey[4]; //TODO: fix this to RSA key len when implemented - - utpm_master_state_t utpm; - - TPM_DIGEST pcr0; - uint32_t pcr_num; - - TPM_DIGEST measurement; - - - TPM_PCR_INFO tpmPcrInfo; - char seal_inbuf[16]; - uint32_t seal_inbuf_len; - char seal_outbuf[128]; - uint32_t seal_outbuf_len; - - char seal_outbuf2[128]; - uint32_t seal_outbuf2_len; - TPM_COMPOSITE_HASH digestAtCreation; - - - TPM_RESULT result; -} utpmtest_param_t; - - - -#endif // __ASSEMBLY__ - - - -#endif //__UTPMTEST_H__ diff --git a/uxmhf-rpi3/include/whitelist.h b/uxmhf-rpi3/include/whitelist.h deleted file mode 100644 index d7b53f941c..0000000000 --- a/uxmhf-rpi3/include/whitelist.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * Matt McCormack (matthew.mccormack@live.com) - * - */ - -/* - access control via code white-listing - - author: amit vasudevan (amitvasudevan@acm.org) - matt mccormack (matthew.mccormack@live.com) -*/ - -#ifndef __WHITELIST_H__ -#define __WHITELIST_H__ - - - -#ifndef __ASSEMBLY__ - -void uapp_checkacl(uint32_t va); - - -#endif // __ASSEMBLY__ - - - -#endif //__WHITELIST_H__ diff --git a/uxmhf-rpi3/libs/libutpm/Makefile b/uxmhf-rpi3/libs/libutpm/Makefile deleted file mode 100644 index bb47acb4a9..0000000000 --- a/uxmhf-rpi3/libs/libutpm/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) - -#include $(srcdir)/../../../common.mk - -C_SOURCES := $(wildcard $(srcdir)/*.c) -C_SOURCES := $(patsubst $(srcdir)/%, %, $(C_SOURCES)) - -OBJECTS = $(patsubst %.c, %.o, $(C_SOURCES)) - -LIBUTPM_OBJECTS_DIR = _objs_libutpm -THE_ARCHIVE = libutpm.a - -# targets -.PHONY: verify -verify: - -.PHONY: all -all: $(THE_ARCHIVE) - -$(THE_ARCHIVE): $(OBJECTS) - cd $(LIBUTPM_OBJECTS_DIR) && $(AR) -rcs $(THE_ARCHIVE) $(OBJECTS) - $(CP) $(LIBUTPM_OBJECTS_DIR)/$(THE_ARCHIVE) . - -%.o: %.c - mkdir -p $(LIBUTPM_OBJECTS_DIR) - @echo Building "$@" from "$<" - $(CCERT) -c $(CCERT_FLAGS) -o $(LIBUTPM_OBJECTS_DIR)/$@ $< - - -.PHONY: clean -clean: - $(RM) -rf $(LIBUTPM_OBJECTS_DIR) - diff --git a/uxmhf-rpi3/libs/libutpm/README b/uxmhf-rpi3/libs/libutpm/README deleted file mode 100644 index 02f62b5e3d..0000000000 --- a/uxmhf-rpi3/libs/libutpm/README +++ /dev/null @@ -1,2 +0,0 @@ -micro-tpm library -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/libs/libutpm/include/utpm.h b/uxmhf-rpi3/libs/libutpm/include/utpm.h deleted file mode 100644 index d6cbd57558..0000000000 --- a/uxmhf-rpi3/libs/libutpm/include/utpm.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * modified for uxmhf-rpi3 by amit vasudevan (amitvasudevan@acm.org) - */ - - -/** - * Common type and structure definitions across TrustVisor's internal - * Micro-TPM implementation, tee-sdk's svcapi, and any PAL writer who - * uses any of the relevant Micro-TPM operations. - */ - -#ifndef __UTPM_H__ -#define __UTPM_H__ - -/** - * FIXME: Once libemhfcrypto exists, it may be reasonable to depend on - * rsa.h in here. For now, it's not. - */ -//#include - -/* Intentionally not including basic types such as uintXX_t, since the - * headers that provide these may vary across hypervisor-internal - * environments and test userspace builds. Whatever code consumes - * this header is expected to have included the appropriate basic - * types already. */ - -/* FIXME: A lot of these values are also defined in the public header - * files for a TSS. We should consider leveraging those and changing - * the names here of the ones where we break compatibility. */ - -/* constant value for TPM chip */ -#define TPM_RSA_KEY_LEN 256 /* RSA key size is 2048 bit */ -#define TPM_HASH_SIZE 20 - -#define MAX_PCR_SEL_NUM 4 -#define MAX_PCR_SEL_SIZE (4+4*MAX_PCR_SEL_NUM) -#define MAX_PCR_DATA_SIZE (MAX_PCR_SEL_NUM*20) - -#define MAX_PCR_COMPOSITE_SIZE 256 -#define MAX_TPM_SEAL_DATA_SIZE 1124 //1K of data + 100 bytes of meta-data added by seal - -#define MAX_TPM_EXTEND_DATA_LEN 4096 -#define MAX_TPM_RAND_DATA_LEN 4096 - -#define TPM_QUOTE_SIZE ( 8 + MAX_PCR_SEL_SIZE + MAX_PCR_DATA_SIZE + TPM_NONCE_SIZE + TPM_RSA_KEY_LEN ) - -#define TPM_CONFOUNDER_SIZE 20 - -/* Return codes for uTPM operations. */ -#define UTPM_SUCCESS 0 -#define UTPM_ERR_BAD_PARAM 1 -#define UTPM_ERR_PCR_OUT_OF_RANGE 2 -#define UTPM_ERR_INSUFFICIENT_ENTROPY 3 -#define UTPM_ERR 4 - -/* MicroTPM related definitions */ -#define TPM_PCR_SIZE 20 -#define TPM_AES_KEY_LEN 128 /* key size is 128 bit */ -#define TPM_AES_KEY_LEN_BYTES (TPM_AES_KEY_LEN/8) -#define TPM_HMAC_KEY_LEN 20 - -/* max len of sealed data */ -#define MAX_SEALDATA_LEN 2048 -#define SEALDATA_HEADER_LEN 48 - -/* TODO: create an enum with meaningful errors that can be passed back - * to PAL authors. */ -typedef uint32_t TPM_RESULT; - -#define TPM_PCR_NUM 8 - -struct tdTPM_PCR_SELECTION { - uint16_t sizeOfSelect; /* The size in bytes of the pcrSelect structure */ - uint8_t pcrSelect[TPM_PCR_NUM/8]; /* This SHALL be a bit map that indicates if a PCR - is active or not */ -} __attribute__((packed)); - -typedef struct tdTPM_PCR_SELECTION TPM_PCR_SELECTION; - -#define TPM_MAX_QUOTE_LEN ( \ - sizeof(TPM_PCR_SELECTION) + sizeof(uint32_t) \ - + TPM_PCR_NUM*TPM_HASH_SIZE /* max size of TPM_PCR_COMPOSITE */ \ - + sizeof(uint32_t) /* sigSize */ \ - + TPM_RSA_KEY_LEN) /* sig */ - - - -typedef struct tdTPM_DIGEST{ - uint8_t value[TPM_HASH_SIZE]; -} TPM_DIGEST; - -typedef TPM_DIGEST TPM_COMPOSITE_HASH; - -typedef struct tdTPM_PCR_INFO { - TPM_PCR_SELECTION pcrSelection; /* This SHALL be the selection of PCRs to which the - data or key is bound. */ - TPM_COMPOSITE_HASH digestAtRelease; /* This SHALL be the digest of the PCR indices and - PCR values to verify when revealing Sealed Data - or using a key that was wrapped to PCRs. NOTE: - This is passed in by the host, and used as - authorization to use the key */ - TPM_COMPOSITE_HASH digestAtCreation; /* This SHALL be the composite digest value of the - PCR values, at the time when the sealing is - performed. NOTE: This is generated at key - creation, but is just informative to the host, - not used for authorization */ -} TPM_PCR_INFO; - -#define ALIGN_UP(n, boundary) (((n)+((boundary)-1))&(~((boundary)-1))) - -#define TPM_NONCE_SIZE 20 -typedef struct tdTPM_NONCE{ - uint8_t nonce[TPM_NONCE_SIZE]; -} TPM_NONCE; - -/* structure for storage */ /* XXX inconsistent with hardware TPM */ -typedef struct tdTPM_SEALED_DATA{ - /*TPM_HMAC hmac;*/ /* NOT SURE HMAC */ - uint32_t dataSize; - uint8_t* data; /*data to be sealed*/ -} TPM_SEALED_DATA; - -typedef struct tdTPM_STRUCT_VER{ - uint8_t major; /* 0x01 */ - uint8_t minor; /* 0x01 */ - uint8_t revMajor; /* 0x00 */ - uint8_t revMinor; /* 0x00 */ -} TPM_STRUCT_VER; - -typedef struct tdTPM_QUOTE_INFO{ - TPM_STRUCT_VER version; /* must be 1.1.0.0 based on TPM part2 structure */ - uint8_t fixed[4]; /* this always be the string 'QUOT'*/ - TPM_COMPOSITE_HASH digestValue; - TPM_NONCE externalData; -} TPM_QUOTE_INFO; - -/** - * Everything below is specific to the internals of a MicroTPM - * implementation, and as such is _not_ required by your average PAL - * author or tee-sdk's svcapi. - * - * TODO: Refactor this file into something more sensible. - */ - -typedef struct tdTPM_STORED_DATA{ /* XXX inconsistent with hardware TPM */ - uint32_t sealInfoSize; - TPM_PCR_INFO sealInfo; /* structure of TPM_PCR_INFO */ - uint32_t encDataSize; - uint8_t* encData; /* encrypted TPM_SEALED_DATA structure containg the confidential part of data*/ -} TPM_STORED_DATA; - -typedef struct utpm_master_state { - TPM_DIGEST pcr_bank[TPM_PCR_NUM]; -} __attribute__ ((packed)) utpm_master_state_t; - - -// utpm common functions -unsigned int utpm_seal_output_size(unsigned int inlen, bool usingPcrs); -bool utpm_pcr_is_selected(TPM_PCR_SELECTION *tpmsel, uint32_t i); -void utpm_pcr_select_i(TPM_PCR_SELECTION *tpmsel, uint32_t i); - - - - - -/* TPM functions */ -TPM_RESULT utpm_pcrread(TPM_DIGEST* pcr_value, - utpm_master_state_t *utpm, uint32_t pcr_num); -TPM_RESULT utpm_extend(TPM_DIGEST *measurement, utpm_master_state_t *utpm, uint32_t pcr_num); - -TPM_RESULT utpm_seal(utpm_master_state_t *utpm, - TPM_PCR_INFO *tpmPcrInfo, - uint8_t* input, uint32_t inlen, - uint8_t* output, uint32_t* outlen); -TPM_RESULT utpm_unseal(utpm_master_state_t *utpm, uint8_t* input, uint32_t inlen, uint8_t* output, uint32_t* outlen, TPM_COMPOSITE_HASH *digestAtCreation); - -TPM_RESULT utpm_quote(TPM_NONCE* externalnonce, TPM_PCR_SELECTION* tpmsel, /* hypercall inputs */ - uint8_t* output, uint32_t* outlen, /* hypercall outputs */ - uint8_t* pcrComp, uint32_t* pcrCompLen, - utpm_master_state_t *utpm); /* TrustVisor inputs */ - -/** - * Keeping these around solely for the Apache SSL web server demo - */ -TPM_RESULT utpm_seal_deprecated(uint8_t* pcrAtRelease, uint8_t* input, uint32_t inlen, uint8_t* output, uint32_t* outlen); -TPM_RESULT utpm_unseal_deprecated(utpm_master_state_t *utpm, uint8_t* input, uint32_t inlen, uint8_t* output, uint32_t* outlen); -TPM_RESULT utpm_quote_deprecated(uint8_t* externalnonce, uint8_t* output, uint32_t* outlen, - utpm_master_state_t *utpm, uint8_t* tpmsel, uint32_t tpmsel_len); - - -TPM_RESULT utpm_rand(uint8_t* buffer, uint32_t *numbytes); - -/* return public key in PKCS #1 v2.1 (ASN.1 DER) */ -TPM_RESULT utpm_id_getpub(uint8_t *N, uint32_t *len); - -void utpm_init_instance(utpm_master_state_t *utpm); - -/** - * FIXME: Once libemhfcrypto exists, it may be reasonable to depend on - * rsa.h in here. For now, it's not. - */ -TPM_RESULT utpm_init_master_entropy(uint8_t *aeskey, - uint8_t *hmackey, - void /*rsa_context*/ *rsa); - -#endif /* __UTPM_H__ */ diff --git a/uxmhf-rpi3/libs/libutpm/utpm-common.c b/uxmhf-rpi3/libs/libutpm/utpm-common.c deleted file mode 100644 index b4cb795734..0000000000 --- a/uxmhf-rpi3/libs/libutpm/utpm-common.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * utpm common functions - * adapted from trustvisor utpm by amit vasudevan (amitvasudevan@acm.org - */ - -//#include -//#include -//#include -//#include -//#include - -#include -#include - -void utpm_pcr_select_i(TPM_PCR_SELECTION *tpmsel, uint32_t i) { - /* TODO: fail loudly if any of these conditions do not hold */ - if(NULL == tpmsel) return; - if(i >= TPM_PCR_NUM) return; - /*if(i/8 >= tpmsel->sizeOfSelect) return; */ /* deprecated in favor of - * auto-growing, as in the - * next line. */ - - if(tpmsel->sizeOfSelect < i/8+1) { tpmsel->sizeOfSelect = i/8+1; } /* XXX not future-proof */ - /* Set the bit corresponding to PCR i */ - tpmsel->pcrSelect[i/8] |= (1 << (i%8)); -} - -bool utpm_pcr_is_selected(TPM_PCR_SELECTION *tpmsel, uint32_t i) { - /* TODO: fail loudly if any of these conditions do not hold */ - if(NULL == tpmsel) return false; - if(i >= TPM_PCR_NUM) return false; - if(i/8 >= tpmsel->sizeOfSelect) return false; - - return (tpmsel->pcrSelect[i/8] & (1 << (i%8))); -} - - -/** - * Return the amount of space overhead (in bytes) expected when - * 'inlen' bytes of plaintext are sealed to the PCRs specified in - * 'tpmsel'. - * - * NOTE: This _must_ remain consistent with the logic in utpm_seal(). - * - * TODO: Refactor utpm_seal() to have a size-only operating mode - * (i.e., when certain input parameters are NULL). It will be - * reasonable to change this function into a wrapper to call - * utpm_seal() with NULL buffers once that refactoring is complete. - */ - -unsigned int utpm_seal_output_size(unsigned int inlen, - bool usingPcrs) -{ - unsigned int pad, size = 0; - - /** - * 6 Contributors: - * 0. IV for symmetric encryption - * 1. TPM_PCR_SELECTION (two cases: 0 PCRs, 1+ PCRs) - * 2. input_len - * 3. input itself - * 4. pad out to symmetric encryption block size - * 5. SHA1-HMAC - */ - - /* 0 */ - size += TPM_AES_KEY_LEN_BYTES; - /* 1 */ - size += usingPcrs ? sizeof(TPM_PCR_INFO) : sizeof(uint16_t); - /* 2 */ - size += sizeof(uint32_t); - /* 3 */ - size += inlen; - /* 4 */ - pad = ALIGN_UP(size, TPM_AES_KEY_LEN_BYTES) - size; - size += pad; - /* 5 */ - size += TPM_HASH_SIZE; - - return size; -} - - -/* If no destination buffer is provided then just set the number of - * bytes that would be consumed.*/ -uint32_t utpm_internal_memcpy_TPM_PCR_SELECTION( - TPM_PCR_SELECTION *pcrSelection, uint8_t *dest, uint32_t *bytes_consumed) -{ - if(!pcrSelection || !bytes_consumed) return 1; - - *bytes_consumed = sizeof(pcrSelection->sizeOfSelect) + pcrSelection->sizeOfSelect; - - if(dest) { - memcpy(dest, pcrSelection, *bytes_consumed); - } - - return 0; /* success */ -} - - - - -/* If no destination buffer is provided then just set the number of - * bytes that would be consumed.*/ -uint32_t utpm_internal_memcpy_TPM_PCR_INFO( - TPM_PCR_INFO *pcrInfo, /* in */ - uint8_t *dest, /* out */ - uint32_t *bytes_consumed) /* out */ -{ - uint32_t rv; - - if(!pcrInfo || !bytes_consumed) { return 1; } - - rv = utpm_internal_memcpy_TPM_PCR_SELECTION(&pcrInfo->pcrSelection, dest, bytes_consumed); - if(0 != rv) { return rv; } - - - if(pcrInfo->pcrSelection.sizeOfSelect > 0) { - /* If no destination buffer, then just return the required - * size in bytes_consumed. */ - if(NULL == dest) { - *bytes_consumed += 2*TPM_HASH_SIZE; - return 0; - } - /* If we're still here, copy two TPM_COMPOSITE_HASH values to dest. */ - else { - memcpy(dest + *bytes_consumed, pcrInfo->digestAtRelease.value, TPM_HASH_SIZE); - *bytes_consumed += TPM_HASH_SIZE; - - memcpy(dest + *bytes_consumed, pcrInfo->digestAtCreation.value, TPM_HASH_SIZE); - *bytes_consumed += TPM_HASH_SIZE; - } - } - return 0; -} - - - -/* FIXME: place this somewhere appropriate */ -uint32_t utpm_ntohl(uint32_t in) { - uint8_t *s = (uint8_t *)∈ - return (uint32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); -} - - - -/** - * Create the current TPM_PCR_COMPOSITE for uTPM PCR values - * specified by TPM_PCR_SELECTION. - * - */ -//static uint32_t utpm_internal_allocate_and_populate_current_TpmPcrComposite( -// utpm_master_state_t *utpm, -// TPM_PCR_SELECTION *tpmsel, -// uint8_t **tpm_pcr_composite, -// uint32_t *space_needed_for_composite -// ) -uint32_t utpm_internal_allocate_and_populate_current_TpmPcrComposite( - utpm_master_state_t *utpm, - TPM_PCR_SELECTION *tpmsel, - uint8_t *tpm_pcr_composite, - uint32_t *space_needed_for_composite - ) -{ - uint32_t rv = 0; - uint32_t i; - uint32_t num_pcrs_to_include = 0; - uint8_t *p = NULL; - - if(!utpm || !tpmsel || !tpm_pcr_composite || !space_needed_for_composite) return 1; - - //dprintf(LOG_TRACE, "[TV:UTPM] %s: tpmsel->sizeOfSelect %d\n", - // __FUNCTION__, tpmsel->sizeOfSelect); - //print_hex(" tpmsel->pcrSelect: ", tpmsel->pcrSelect, tpmsel->sizeOfSelect); - for(i=0; isizeOfSelect) + tpmsel->sizeOfSelect + /* TPM_PCR_COMPOSITE.select */ - sizeof(uint32_t) + /* TPM_PCR_COMPOSITE.valueSize */ - num_pcrs_to_include * TPM_HASH_SIZE; /* TPM_PCR_COMPOSITE.pcrValue[] */ - - if ( (*space_needed_for_composite) > MAX_PCR_COMPOSITE_SIZE ) - return 1; - - //dprintf(LOG_TRACE, " sizeof(tpmsel->sizeOfSelect) + tpmsel->sizeOfSelect = %d\n", - // sizeof(tpmsel->sizeOfSelect) + tpmsel->sizeOfSelect); - //dprintf(LOG_TRACE, " sizeof(uint32_t) = %d\n", - // sizeof(uint32_t)); - //dprintf(LOG_TRACE, " num_pcrs_to_include * TPM_HASH_SIZE = %d\n", - // num_pcrs_to_include * TPM_HASH_SIZE); - //dprintf(LOG_TRACE, " ---------------------------------------------------------\n"); - //dprintf(LOG_TRACE, " *space_needed_for_composite = %d\n", - // *space_needed_for_composite); - - //if(NULL == (*tpm_pcr_composite = malloc(*space_needed_for_composite))) { - // dprintf(LOG_ERROR, "[TV:UTPM] malloc(%d) failed!\n", *space_needed_for_composite); - // return 1; - //} - - /** Populate TPM_COMPOSITE buffer **/ - //p = *tpm_pcr_composite; - p = tpm_pcr_composite; - - /* 1. TPM_PCR_COMPOSITE.select */ - memcpy(p, tpmsel, sizeof(tpmsel->sizeOfSelect) + tpmsel->sizeOfSelect); - p += sizeof(tpmsel->sizeOfSelect) + tpmsel->sizeOfSelect; - /* 2. TPM_PCR_COMPOSITE.valueSize (big endian # of bytes (not # of PCRs)) */ - *((uint32_t*)p) = utpm_ntohl(num_pcrs_to_include*TPM_HASH_SIZE); - p += sizeof(uint32_t); - /* 3. TPM_PCR_COMPOSITE.pcrValue[] */ - for(i=0; ipcr_bank[i].value, TPM_HASH_SIZE); - //dprintf(LOG_TRACE, " PCR-%d: ", i); - //print_hex(NULL, p, TPM_HASH_SIZE); - p += TPM_HASH_SIZE; - } - } - - /* TODO: Assert */ - //if((uint32_t)p-(uint32_t)(*tpm_pcr_composite) != *space_needed_for_composite) { - if((uint32_t)p-(uint32_t)(tpm_pcr_composite) != *space_needed_for_composite) { - - //dprintf(LOG_ERROR, "[TV:UTPM] ERROR! (uint32_t)p-(uint32_t)*tpm_pcr_composite " - // "!= space_needed_for_composite\n"); - rv = 1; /* FIXME: Indicate internal error */ - goto out; - } - - //print_hex(" TPM_PCR_COMPOSITE: ", *tpm_pcr_composite, *space_needed_for_composite); - out: - return rv; - -} - - - - -/** - * TPM_PCR_COMPOSITE is created by reading the current value of the - * PCRs mentioned in TPM_PCR_SELECTION. - * - * It does not make sense to call this function if the - * TPM_PCR_SELECTION does not select anything. - */ -TPM_RESULT utpm_internal_digest_current_TpmPcrComposite( - utpm_master_state_t *utpm, - TPM_PCR_SELECTION *pcrSelection, - TPM_COMPOSITE_HASH *digest) -{ - uint32_t space_needed_for_composite = 0; - uint8_t buf_tpm_pcr_composite[MAX_PCR_COMPOSITE_SIZE]; - uint8_t *tpm_pcr_composite = &buf_tpm_pcr_composite; - uint32_t rv = 0; - - if(!utpm || !pcrSelection || !digest) { return 1; } - - if(pcrSelection->sizeOfSelect < 1) { return 1; } - - rv = utpm_internal_allocate_and_populate_current_TpmPcrComposite( - utpm, - pcrSelection, - tpm_pcr_composite, - &space_needed_for_composite); - - if(0 != rv) { return 1; } - - //sha1_buffer(tpm_pcr_composite, space_needed_for_composite, digest->value); - sha1_memory(tpm_pcr_composite, space_needed_for_composite, digest->value, TPM_HASH_SIZE); - - //if(tpm_pcr_composite) { free(tpm_pcr_composite); tpm_pcr_composite = NULL; } - - return rv; -} - - -/** - * Best effort to populate an array of *len random-bytes. Returns 0 - * on success, otherwise returns the number of bytes that were - * actually available (and updates *len). - */ -int utpm_rand_bytes(uint8_t *out, unsigned int *len) { - int rv=1; - - //TBD: plug in random number generation - - /* even here we do not want to tolerate failure to initialize */ - //EU_VERIFY( g_master_prng_init_completed); - - //EU_VERIFY( out); - //EU_VERIFY( len); - //EU_VERIFY( *len >= 1); - - /* at the present time this will either give all requested bytes - * or fail completely. no support for partial returns, though - * that may one day be desirable. */ - //EU_VERIFYN( reseed_ctr_drbg_using_tpm_entropy_if_needed()); - - //EU_CHKN( rv = nist_ctr_drbg_generate(&g_drbg, out, *len, NULL, 0)); - - //eu_trace("Successfully generated %d pseudo-random bytes", *len); - - rv=0; - out: - return rv; -} - diff --git a/uxmhf-rpi3/libs/libutpm/utpm.c b/uxmhf-rpi3/libs/libutpm/utpm.c deleted file mode 100644 index e33b64049a..0000000000 --- a/uxmhf-rpi3/libs/libutpm/utpm.c +++ /dev/null @@ -1,530 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * utpm interface - * adapted from trustvisor utpm by amit vasudevan (amitvasudevan@acm.org - */ - -//#include -//#include -//#include -//#include -//#include - -#include -#include -#include -#include -#include - -#include - -////// -// global data variables -////// -// keys for software TPM seal, unseal and quote operations -__attribute__((section(".data"))) uint8_t g_aeskey[TPM_AES_KEY_LEN_BYTES]; -__attribute__((section(".data"))) uint8_t g_hmackey[TPM_HMAC_KEY_LEN]; -//rsa_key g_rsa_key; - - - -////// -// interface functions -////// - - -////// initialize master entropy -/** - * This function is expected to only be called once during the life of - * anything that uses this uTPM implementation. This function will - * need significant modification if we ever decide to support - * arbitrarily many signing keys for uTPM instances. - */ -TPM_RESULT utpm_init_master_entropy(uint8_t *aeskey, - uint8_t *hmackey, - void /*rsa_context*/ *rsa) { - if(!aeskey || !hmackey || !rsa) { - return UTPM_ERR_INSUFFICIENT_ENTROPY; - - } - - memcpy(g_aeskey, aeskey, TPM_AES_KEY_LEN_BYTES); - memcpy(g_hmackey, hmackey, TPM_HMAC_KEY_LEN); - //memcpy(&g_rsa_key, rsa, sizeof(g_rsa_key)); - - /* ensure libtomcrypto's math descriptor is initialized */ - //if (!ltc_mp.name) { - // ltc_mp = ltm_desc; - //} - - return UTPM_SUCCESS; -} - - -////// initialize instance -void utpm_init_instance(utpm_master_state_t *utpm) { - if(NULL == utpm) return; - - memset(utpm->pcr_bank, 0, TPM_PCR_SIZE*TPM_PCR_NUM); - -} - -////// PCR read -/* software tpm pcr read */ -TPM_RESULT utpm_pcrread(TPM_DIGEST* pcr_value /* output */, - utpm_master_state_t *utpm, uint32_t pcr_num) /* inputs */ -{ - if(!pcr_value || !utpm) { return UTPM_ERR_BAD_PARAM; } - if(pcr_num >= TPM_PCR_NUM) { return UTPM_ERR_PCR_OUT_OF_RANGE; } - - memcpy(pcr_value->value, utpm->pcr_bank[pcr_num].value, TPM_PCR_SIZE); - return UTPM_SUCCESS; -} - - - -////// PCR extend -/* software tpm pcr extend */ -TPM_RESULT utpm_extend(TPM_DIGEST *measurement, utpm_master_state_t *utpm, uint32_t pcr_num) -{ - unsigned long outlen; - int rv; - - if(!measurement || !utpm) { return UTPM_ERR_BAD_PARAM; } - if(pcr_num >= TPM_PCR_NUM) { return UTPM_ERR_PCR_OUT_OF_RANGE; } - - //_XDPRINTF_("utpm_extend: extending PCR %d\n", pcr_num); - - //print_hex("utpm_extend: PCR before: ", utpm->pcr_bank[pcr_num].value, TPM_HASH_SIZE); - //print_hex("utpm_extend: measurement: ", measurement->value, TPM_HASH_SIZE); - - /* pcr = H( pcr || measurement) */ - outlen = sizeof(utpm->pcr_bank[pcr_num].value); - rv = sha1_memory_multi( utpm->pcr_bank[pcr_num].value, &outlen, - utpm->pcr_bank[pcr_num].value, TPM_HASH_SIZE, - measurement->value, TPM_HASH_SIZE, - NULL, NULL); - if (rv) { - //abort(); - return UTPM_ERR; - } - - //print_hex("utpm_extend: PCR after: ", utpm->pcr_bank[pcr_num].value, TPM_HASH_SIZE); - - return UTPM_SUCCESS; -} - - -////// PCR SEAL -TPM_RESULT utpm_seal(utpm_master_state_t *utpm, - TPM_PCR_INFO *tpmPcrInfo, - uint8_t* input, uint32_t inlen, - uint8_t* output, uint32_t* outlen) -{ - - uint32_t rv = 0; - uint32_t outlen_beforepad; - uint8_t* p; - uint8_t *iv; - uint32_t bytes_consumed_by_pcrInfo; - symmetric_CBC cbc_ctx; - TPM_PCR_INFO tpmPcrInfo_internal; - uint8_t buf_plaintext[MAX_TPM_SEAL_DATA_SIZE]; - uint8_t *plaintext = &buf_plaintext; - uint32_t bytes_of_entropy = 0; - unsigned long hmac_sha1_out_len; - - if(!utpm || !tpmPcrInfo || !input || !output || !outlen) { - //dprintf(LOG_ERROR, "[TV] utpm_seal ERROR: !utpm || !tpmPcrInfo || !input || !output || !outlen\n"); - return 1; - } - - //dprintf(LOG_TRACE, "[TV:utpm_seal] inlen %u, outlen (junk expected) %u, tpmPcrInfo %p\n", inlen, *outlen, tpmPcrInfo); - //print_hex(" [TV:utpm_seal] tpmPcrInfo: ", (uint8_t*)tpmPcrInfo, sizeof(TPM_PCR_INFO)); - //print_hex(" [TV:utpm_seal] input: ", input, inlen); - //print_hex(" [TV:utpm_seal] g_hmackey: ", g_hmackey, TPM_HASH_SIZE); /* XXX SECURITY */ - //print_hex(" [TV:utpm_seal] g_aeskey: ", g_aeskey, TPM_AES_KEY_LEN_BYTES); /* XXX SECURITY */ - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - /** - * Part 1: Populate digestAtCreation (only for tpmPcrInfo that selects 1+ PCRs). - */ - if(0 != tpmPcrInfo->pcrSelection.sizeOfSelect) { - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - /* The caller does not provide the DigestAtCreation component of - * the tpmPcrInfo input parameter, so we must populate this - * component of the TPM_PCR_INFO structure ourselves, - * internally. */ - /* 1. make our own TPM_PCR_INFO and copy caller-specified values */ - rv = utpm_internal_memcpy_TPM_PCR_INFO(tpmPcrInfo, - NULL, - &bytes_consumed_by_pcrInfo); - if(0 != rv) { return 1; } - if(bytes_consumed_by_pcrInfo != sizeof(TPM_PCR_INFO)) { - //dprintf(LOG_ERROR, "[TV:UTPM] bytes_consumed_by_pcrInfo (%d) != sizeof(TPM_PCR_INFO) (%d)\n", - // bytes_consumed_by_pcrInfo, sizeof(TPM_PCR_INFO)); - return 1; - } - rv = utpm_internal_memcpy_TPM_PCR_INFO(tpmPcrInfo, - (uint8_t*)&tpmPcrInfo_internal, - &bytes_consumed_by_pcrInfo); - if(0 != rv) { return 1; } - - /* 2. overwrite digestAtCreation based on current PCR contents */ - rv = utpm_internal_digest_current_TpmPcrComposite( - utpm, - &tpmPcrInfo_internal.pcrSelection, - &tpmPcrInfo_internal.digestAtCreation); - if(0 != rv) { return 1; } - } else { - tpmPcrInfo_internal.pcrSelection.sizeOfSelect = 0; - } - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - - /** - * Part 2: Do the actual encryption - */ - if ( (inlen+100) > MAX_TPM_SEAL_DATA_SIZE) - return 1; - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - //plaintext = malloc(inlen + 100); /* XXX figure out actual required size */ - //// It's probably TPM_AES_KEY_LEN_BYTES + TPM_HASH_SIZE + sizeof(TPM_PCR_INFO) - //if(NULL == plaintext) { - // dprintf(LOG_ERROR, "ERROR: malloc FAILED\n"); - // return 1; - //} - - - p = iv = plaintext; - - /* 0. get IV */ - bytes_of_entropy = TPM_AES_KEY_LEN_BYTES; - utpm_rand_bytes(iv, &bytes_of_entropy); - if(TPM_AES_KEY_LEN_BYTES != bytes_of_entropy) { - //dprintf(LOG_ERROR, "ERROR: rand_bytes FAILED\n"); - return UTPM_ERR_INSUFFICIENT_ENTROPY; - } - memcpy(output, iv, TPM_AES_KEY_LEN_BYTES); /* Copy IV directly to output */ - p += TPM_AES_KEY_LEN_BYTES; /* IV */ - - //print_hex(" iv: ", iv, TPM_AES_KEY_LEN_BYTES); - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - - /* output = IV || AES-CBC(TPM_PCR_INFO (or 0x0000 if none selected) || input_len || input || PADDING) || HMAC( entire ciphertext including IV ) */ - /* 1a. TPM_PCR_SELECTION with 0 PCRs selected */ - if(0 == tpmPcrInfo_internal.pcrSelection.sizeOfSelect) { /* no PCRs selected */ - memcpy(p, &tpmPcrInfo_internal.pcrSelection.sizeOfSelect, - sizeof(tpmPcrInfo_internal.pcrSelection.sizeOfSelect)); - //print_hex(" tpmPcrInfo_internal.pcrSelection.sizeOfSelect: ", p, - // sizeof(tpmPcrInfo_internal.pcrSelection.sizeOfSelect)); - p += sizeof(tpmPcrInfo_internal.pcrSelection.sizeOfSelect); - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - } - /* 1b. TPM_PCR_SELECTION with 1 or more PCRs selected */ - else { - rv = utpm_internal_memcpy_TPM_PCR_INFO(&tpmPcrInfo_internal, p, &bytes_consumed_by_pcrInfo); - if(0 != rv) { return 1; } - //print_hex(" tpmPcrInfo_internal: ", - // (uint8_t*)&tpmPcrInfo_internal, - // bytes_consumed_by_pcrInfo); - p += bytes_consumed_by_pcrInfo; - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - } - - - - /* 2. input_len */ - *((uint32_t *)p) = inlen; - //print_hex(" inlen: ", p, sizeof(uint32_t)); - p += sizeof(uint32_t); - - - /* 3. actual input data */ - memcpy(p, input, inlen); - //print_hex(" input: ", p, inlen); - p += inlen; - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - /* 4. add padding */ - outlen_beforepad = (uint32_t)p - (uint32_t)plaintext; - if ((outlen_beforepad & 0xF) != 0) { - *outlen = (outlen_beforepad + TPM_AES_KEY_LEN_BYTES) & (~0xF); - } else { - *outlen = outlen_beforepad; - } - memset(p, 0, *outlen-outlen_beforepad); - - //_XDPRINTFSMP_("%s: %u outlen_beforepad=%u, *outlen=%u\n", __func__, __LINE__, - // outlen_beforepad, *outlen); - - //print_hex("padding: ", p, *outlen - outlen_beforepad); - p += *outlen - outlen_beforepad; - - - /* encrypt (1-4) data using g_aeskey in AES-CBC mode */ - if ( rijndael_cbc_start( iv, g_aeskey, TPM_AES_KEY_LEN_BYTES, 0, &cbc_ctx)) { - //abort(); - return 1; - } - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - //print_hex(" plaintext (including IV) just prior to AES encrypt: ", plaintext, *outlen); - if (rijndael_cbc_encrypt( plaintext + TPM_AES_KEY_LEN_BYTES, /* skip IV */ - output + TPM_AES_KEY_LEN_BYTES, /* don't clobber IV */ - *outlen - TPM_AES_KEY_LEN_BYTES, - &cbc_ctx)) { - //abort(); - return 1; - } - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - - if (rijndael_cbc_done( &cbc_ctx)) { - //abort(); - return 1; - } - - //print_hex(" freshly encrypted ciphertext: ", output, *outlen); - - //_XDPRINTFSMP_("%s: %u: *outlen=%u\n", __func__, __LINE__, *outlen); - - /* 5. compute and append hmac */ - //HMAC_SHA1(g_hmackey, TPM_HASH_SIZE, output, *outlen, output + *outlen); - hmac_sha1_out_len = 20; - if( hmac_sha1_memory(g_hmackey, TPM_HASH_SIZE, output, *outlen, output + *outlen, &hmac_sha1_out_len) ) - return 1; - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - //print_hex("hmac: ", output + *outlen, TPM_HASH_SIZE); - *outlen += TPM_HASH_SIZE; /* hmac */ - - - //dprintf(LOG_TRACE, "*outlen = %d\n", *outlen); - //print_hex("ciphertext from utpm_seal: ", output, *outlen); - - /* Sanity checking output size */ - if(*outlen != utpm_seal_output_size(inlen, false)) { - //dprintf(LOG_ERROR, "\n\nERROR!!! *outlen(%d) != utpm_seal_output_size(%d)\n\n", *outlen, - // utpm_seal_output_size(inlen, false)); - return 1; - } - - //_XDPRINTFSMP_("%s: %u\n", __func__, __LINE__); - - //if(plaintext) { free(plaintext); plaintext = NULL; iv = NULL; } - - return rv; -} - - - -////// PCR UNSEAL -TPM_RESULT utpm_unseal(utpm_master_state_t *utpm, - uint8_t* input, uint32_t inlen, - uint8_t* output, uint32_t* outlen, - TPM_COMPOSITE_HASH *digestAtCreation) /* out */ -{ - uint8_t hmacCalculated[TPM_HASH_SIZE]; - uint32_t rv; - symmetric_CBC cbc_ctx; - unsigned long hmac_sha1_out_len; - - if(!utpm || !input || !output || !outlen || !digestAtCreation) { return 1; } - - /** - * Recall from utpm_seal(): - * output = IV || AES-CBC(TPM_PCR_INFO || input_len || input || PADDING) || HMAC( entire ciphertext including IV ) - */ - - /** - * Step 1: Verify HMAC. This ensures the sealed ciphertext has - * not been modified and that it was sealed on this particular - * instance of TrustVisor. - */ - - /* Ciphertext (input) length should be a multiple of the AES block size + HMAC size */ - if(0 != (inlen - TPM_HASH_SIZE) % TPM_AES_KEY_LEN_BYTES) { - //dprintf(LOG_ERROR, "Unseal Input **Length FAILURE**: 0 != (inlen - TPM_HASH_SIZE) %% TPM_AES_KEY_LEN_BYTES\n"); - //dprintf(LOG_ERROR, "inlen %d, TPM_HASH_SIZE %d, TPM_AES_KEY_LEN_BYTES %d\n", - // inlen, TPM_HASH_SIZE, TPM_AES_KEY_LEN_BYTES); - return 1; - } - - /* HMAC should be the last TPM_HASH_SIZE bytes of the - * input. Calculate its expected value based on the first (inlen - - * TPM_HASH_SIZE) bytes of the input and compare against provided - * value. */ - //HMAC_SHA1(g_hmackey, TPM_HASH_SIZE, input, inlen - TPM_HASH_SIZE, hmacCalculated); - hmac_sha1_out_len = 20; - if( hmac_sha1_memory(g_hmackey, TPM_HASH_SIZE, input, inlen - TPM_HASH_SIZE, hmacCalculated, &hmac_sha1_out_len) ) - return 1; - - if(memcmp(hmacCalculated, input + inlen - TPM_HASH_SIZE, TPM_HASH_SIZE)) { - //dprintf(LOG_ERROR, "Unseal HMAC **INTEGRITY FAILURE**: memcmp(hmacCalculated, input + inlen - TPM_HASH_SIZE, TPM_HASH_SIZE)\n"); - //print_hex(" hmacCalculated: ", hmacCalculated, TPM_HASH_SIZE); - //print_hex(" input + inlen - TPM_HASH_SIZE:" , input + inlen - TPM_HASH_SIZE, TPM_HASH_SIZE); - return 1; - } - - - /** - * Step 2. Decrypt data. I cannot think of a reason why this - * could ever fail if the above HMAC check was successful. - */ - - *outlen = inlen - - TPM_AES_KEY_LEN_BYTES /* iv */ - - TPM_HASH_SIZE; /* hmac */ - - if (rijndael_cbc_start( - input, /* iv is at beginning of input */ - g_aeskey, TPM_AES_KEY_LEN_BYTES, - 0, - &cbc_ctx)) { - //abort(); - return 1; - } - if (rijndael_cbc_decrypt( input+TPM_AES_KEY_LEN_BYTES, /* offset to ciphertext just beyond iv */ - output, - *outlen, - &cbc_ctx)) { - //abort(); - return 1; - } - if (rijndael_cbc_done( &cbc_ctx)) { - //abort(); - return 1; - } - - //print_hex(" Unsealed plaintext: ", output, *outlen); - - - /** - * Step 3. Verify that PCR values match. - */ - - /* 1. Determine which PCRs were included */ - /* 2. Create the TPM_PCR_COMPOSITE for those PCRs with their current values */ - /* 3. Compare the COMPOSITE_HASH with the one in the ciphertext. */ - - /* plaintext contains [ TPM_PCR_INFO | plaintextLen | plaintext ] */ - { /* Separate logic for PCR checking since eventually it will - * likely be library functionality (TODO). */ - uint8_t *p = output; - TPM_PCR_INFO unsealedPcrInfo; - uint32_t bytes_consumed_by_pcrInfo; - uint32_t space_needed_for_composite = 0; - uint8_t buf_currentPcrComposite[MAX_PCR_COMPOSITE_SIZE]; - uint8_t *currentPcrComposite = &buf_currentPcrComposite; - TPM_COMPOSITE_HASH digestRightNow; - - - /* 1. TPM_PCR_INFO */ - rv = utpm_internal_memcpy_TPM_PCR_INFO((TPM_PCR_INFO*)p, (uint8_t*)&unsealedPcrInfo, &bytes_consumed_by_pcrInfo); - if(0 != rv) return rv; - p += bytes_consumed_by_pcrInfo; - //print_hex(" unsealedPcrInfo: ", (uint8_t*)&unsealedPcrInfo, bytes_consumed_by_pcrInfo); - - - /* 1a. Handle the simple case where no PCRs are involved */ - if(bytes_consumed_by_pcrInfo <= sizeof(unsealedPcrInfo.pcrSelection.sizeOfSelect)) { - //dprintf(LOG_TRACE, " No PCRs selected. No checking required.\n"); - memset(digestAtCreation->value, 0, TPM_HASH_SIZE); - } - /* 1b. Verify that required PCR values match */ - else { - - //print_hex(" unsealedPcrInfo.digestAtRelease: ", (uint8_t*)&unsealedPcrInfo.digestAtRelease, TPM_HASH_SIZE); - - /* 2. Create current PCR Composite digest, for use in compairing against digestAtRelease */ - rv = utpm_internal_allocate_and_populate_current_TpmPcrComposite( - utpm, - &unsealedPcrInfo.pcrSelection, - currentPcrComposite, - &space_needed_for_composite); - if(rv != 0) { - //dprintf(LOG_ERROR, "utpm_internal_allocate_and_populate_current_TpmPcrComposite FAILED\n"); - return 1; - } - //print_hex(" current PcrComposite: ", currentPcrComposite, space_needed_for_composite); - - - /* 3. Composite hash */ - //sha1_buffer(currentPcrComposite, space_needed_for_composite, digestRightNow.value); - sha1_memory(currentPcrComposite, space_needed_for_composite, digestRightNow.value, TPM_HASH_SIZE); - - //print_hex(" digestRightNow: ", digestRightNow.value, TPM_HASH_SIZE); - - if(0 != memcmp(digestRightNow.value, unsealedPcrInfo.digestAtRelease.value, TPM_HASH_SIZE)) { - //dprintf(LOG_ERROR, "0 != memcmp(digestRightNow.value, unsealedPcrInfo.digestAtRelease.value, TPM_HASH_SIZE)\n"); - rv = 1; - goto out; - } - - //dprintf(LOG_TRACE, "[TV:UTPM_UNSEAL] digestAtRelase MATCH; Unseal ALLOWED!\n"); - - memcpy(digestAtCreation->value, unsealedPcrInfo.digestAtCreation.value, TPM_HASH_SIZE); - } - /* 4. Reshuffle output buffer and strip padding so that only - * the user's plaintext is returned. Buffer's contents: [ - * plaintextLen | plainText | padding ] */ - - *outlen = *((uint32_t*)p); - p += sizeof(uint32_t); - memcpy(output, p, *outlen); - - out: - //if(currentPcrComposite) { free(currentPcrComposite); currentPcrComposite = NULL; } - (void)0; - - } /* END Separate logic for PCR checking. */ - - return rv; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/Makefile b/uxmhf-rpi3/libs/libxmhfc/Makefile deleted file mode 100644 index 47ad6b5139..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) - -#include $(srcdir)/../../../common.mk - -C_SOURCES := $(wildcard $(srcdir)/*.c) -C_SOURCES := $(patsubst $(srcdir)/%, %, $(C_SOURCES)) - -OBJECTS = $(patsubst %.c, %.o, $(C_SOURCES)) - -LIBXMHFC_OBJECTS_DIR = _objs_libxmhfc -THE_ARCHIVE = libxmhfc.a - -# targets -.PHONY: verify -verify: - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/memcmp.c - frama-c -wp -wp-rte -wp-prover alt-ergo,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/memcpy.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/memset.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/memmove.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/strchr.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/strcmp.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/strlen.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/strncmp.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/strncpy.c - frama-c -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/strnlen.c - -.PHONY: all -all: $(THE_ARCHIVE) - -$(THE_ARCHIVE): $(OBJECTS) - cd $(LIBXMHFC_OBJECTS_DIR) && $(AR) -rcs $(THE_ARCHIVE) $(OBJECTS) - $(CP) $(LIBXMHFC_OBJECTS_DIR)/$(THE_ARCHIVE) . - -%.o: %.c - mkdir -p $(LIBXMHFC_OBJECTS_DIR) - @echo Building "$@" from "$<" - $(CCERT) -c $(CCERT_FLAGS) -o $(LIBXMHFC_OBJECTS_DIR)/$@ $< - - -.PHONY: clean -clean: - $(RM) -rf $(LIBXMHFC_OBJECTS_DIR) - diff --git a/uxmhf-rpi3/libs/libxmhfc/README b/uxmhf-rpi3/libs/libxmhfc/README deleted file mode 100644 index afed1e2262..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/README +++ /dev/null @@ -1,8 +0,0 @@ -This directory contains an extremely stripped down libc. -Primarily, it contains the mem*() and str*() functions -that are part of string.h. - -The intention is to provide basic libc computational support -for XMHF and hypapps. - -Code and headers were based on FreeBSD 9. diff --git a/uxmhf-rpi3/libs/libxmhfc/include/assert.h b/uxmhf-rpi3/libs/libxmhfc/include/assert.h deleted file mode 100644 index f5b691c04f..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/assert.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#ifndef __ASSERT_H__ -#define __ASSERT_H__ - -#ifndef __XMHF_VERIFICATION__ -#define assert(x) ((void)0) -#endif - -#endif /* __ASSERT_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/ctype.h b/uxmhf-rpi3/libs/libxmhfc/include/ctype.h deleted file mode 100644 index 9aee4e0347..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/ctype.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1982, 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/ctype.h 199583 2009-11-20 15:27:52Z jhb $ - */ - -/** - * Modified for XMHF. - */ - -#ifndef __CTYPE_H__ -#define __CTYPE_H__ - -#define isspace(c) ((c) == ' ' || ((c) >= '\t' && (c) <= '\r')) -#define isascii(c) (((c) & ~0x7f) == 0) -#define isupper(c) ((c) >= 'A' && (c) <= 'Z') -#define islower(c) ((c) >= 'a' && (c) <= 'z') -#define isalpha(c) (isupper(c) || islower(c)) -#define isdigit(c) ((c) >= '0' && (c) <= '9') -#define isxdigit(c) (isdigit(c) \ - || ((c) >= 'A' && (c) <= 'F') \ - || ((c) >= 'a' && (c) <= 'f')) -#define isprint(c) ((c) >= ' ' && (c) <= '~') - -#define toupper(c) ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z'))) -#define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z'))) - -#endif // __CTYPE_H__ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/limits.h b/uxmhf-rpi3/libs/libxmhfc/include/limits.h deleted file mode 100644 index 4ae7f21db9..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/limits.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/limits.h 219757 2011-03-18 22:35:48Z jilles $ - */ - -/** - * Modified for XMHF. - */ - -#ifndef __LIMITS_H__ -#define __LIMITS_H__ - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - * These numbers are for the default configuration of gcc. They work for - * some other compilers as well, but this should not be depended on. - */ - -#define __CHAR_BIT 8 /* number of bits in a char */ - -#define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ - -#define __UCHAR_MAX 0xff /* max value for an unsigned char */ - -#define __USHRT_MAX 0xffff /* max value for an unsigned short */ -#define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ - -#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ -#define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ - -#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ -#define __LONG_MAX 0x7fffffffL /* max value for a long */ -#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ - - /* max value for an unsigned long long */ -#define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ - -#define __SSIZE_MAX __INT_MAX /* max value for a ssize_t */ - -#define __SIZE_T_MAX __UINT_MAX /* max value for a size_t */ - -#define __OFF_MAX __LLONG_MAX /* max value for an off_t */ -#define __OFF_MIN __LLONG_MIN /* min value for an off_t */ - -/* Quads and long longs are the same size. Ensure they stay in sync. */ -#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ -#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ -#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ - -#define __LONG_BIT 32 -#define __WORD_BIT 32 - - - - -#define CHAR_BIT __CHAR_BIT /* number of bits in a char */ - -#define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */ -#define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */ - -#define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */ - -#ifdef __CHAR_UNSIGNED__ -#define CHAR_MAX UCHAR_MAX /* max value for a char */ -#define CHAR_MIN 0 /* min value for a char */ -#else -#define CHAR_MAX SCHAR_MAX -#define CHAR_MIN SCHAR_MIN -#endif - -#define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */ -#define SHRT_MAX __SHRT_MAX /* max value for a short */ -#define SHRT_MIN __SHRT_MIN /* min value for a short */ - -#define UINT_MAX __UINT_MAX /* max value for an unsigned int */ -#define INT_MAX __INT_MAX /* max value for an int */ -#define INT_MIN __INT_MIN /* min value for an int */ - -#define ULONG_MAX __ULONG_MAX /* max for an unsigned long */ -#define LONG_MAX __LONG_MAX /* max for a long */ -#define LONG_MIN __LONG_MIN /* min for a long */ - -#define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */ -#define LLONG_MAX __LLONG_MAX /* max for a long long */ -#define LLONG_MIN __LLONG_MIN /* min for a long long */ - -#define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */ -#define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */ -#define OFF_MAX __OFF_MAX /* max value for an off_t */ -#define OFF_MIN __OFF_MIN /* min value for an off_t */ - -#define LONG_BIT __LONG_BIT -#define WORD_BIT __WORD_BIT - - -#endif /* __LIMITS_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/stdarg.h b/uxmhf-rpi3/libs/libxmhfc/include/stdarg.h deleted file mode 100644 index 5de24b1c44..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/stdarg.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -//stdarg.h - variable length arguments -//author: amit vasudevan (amitvasudevan@acm.org) -//based on guidelines in -//http://pubs.opengroup.org/onlinepubs/007904875/basedefs/stdarg.h.html - -#ifndef __STDARG_H__ -#define __STDARG_H__ - -#ifndef __ASSEMBLY__ - - -#ifndef _VA_LIST -typedef __builtin_va_list va_list; -#define _VA_LIST -#endif -#define va_start(ap, param) __builtin_va_start(ap, param) -#define va_end(ap) __builtin_va_end(ap) -#define va_arg(ap, type) __builtin_va_arg(ap, type) - -/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode - * or -ansi is not specified, since it was not part of C90. - */ -#define __va_copy(d,s) __builtin_va_copy(d,s) - -#if __STDC_VERSION__ >= 199900L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__) -#define va_copy(dest, src) __builtin_va_copy(dest, src) -#endif - - -#endif //#ifndef __ASSEMBLY__ - -#endif /* __STDARG_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/stdbool.h b/uxmhf-rpi3/libs/libxmhfc/include/stdbool.h deleted file mode 100644 index 8b20b95d6f..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/stdbool.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* Implemented based on - * http://pubs.opengroup.org/onlinepubs/007904875/basedefs/stdbool.h.html */ -#ifndef __STDBOOL_H__ -#define __STDBOOL_H__ - -typedef int boolean_t; -typedef boolean_t bool; -#define true 1 -#define false 0 -#define __bool_true_false_are_defined - -#endif /* __STDBOOL_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/stddef.h b/uxmhf-rpi3/libs/libxmhfc/include/stddef.h deleted file mode 100644 index 8b2e36b5a7..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/stddef.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - /** - * Modified for XMHF. - */ - -#ifndef __STDDEF_H__ -#define __STDDEF_H__ - -#include - -#ifndef NULL - -#if !defined(__cplusplus) -#define NULL ((void *)0) -#else -#define NULL 0 -#endif /* !__cplusplus */ - -#endif - - -typedef __ptrdiff_t ptrdiff_t; - -#if defined (__clang__) - #define offsetof(type, field) __builtin_offsetof(type, field) -#else - #define offsetof(type,field) (int)&(((type *)0)->field) -#endif - -#endif // __STDDEF_H__ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/stdint.h b/uxmhf-rpi3/libs/libxmhfc/include/stdint.h deleted file mode 100644 index 7e89920209..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/stdint.h +++ /dev/null @@ -1,343 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/** - * Modified for XMHF. - */ - -#ifndef _SYS_STDINT_H_ -#define _SYS_STDINT_H_ - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; - -/* LONGLONG */ -typedef long long __int64_t; -/* LONGLONG */ -typedef unsigned long long __uint64_t; - -/* - * Standard type definitions. - */ -typedef unsigned long __clock_t; /* clock()... */ -typedef unsigned int __cpumask_t; -typedef __int32_t __critical_t; -typedef long double __double_t; -typedef long double __float_t; -typedef __int32_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int32_t __intptr_t; -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ -typedef __int32_t __register_t; -typedef __int32_t __segsz_t; /* segment size (in pages) */ -typedef __uint32_t __size_t; /* sizeof() */ -typedef __int32_t __ssize_t; /* byte count or error */ -typedef __int32_t __time_t; /* time()... */ -typedef __uint32_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint32_t __uintptr_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; -typedef __uint32_t __u_register_t; - -typedef __uint32_t off_t; - - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) (c) -#define INT16_C(c) (c) -#define INT32_C(c) (c) -#define INT64_C(c) (c ## LL) - -#define UINT8_C(c) (c) -#define UINT16_C(c) (c) -#define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## ULL) - -#define INTMAX_C(c) (c ## LL) -#define UINTMAX_C(c) (c ## ULL) - -#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -/* - * ISO/IEC 9899:1999 - * 7.18.2.1 Limits of exact-width integer types - */ -/* Minimum values of exact-width signed integer types. */ -#define INT8_MIN (-0x7f-1) -#define INT16_MIN (-0x7fff-1) -#define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffLL-1) - -/* Maximum values of exact-width signed integer types. */ -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffLL - -/* Maximum values of exact-width unsigned integer types. */ -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffULL - -/* - * ISO/IEC 9899:1999 - * 7.18.2.2 Limits of minimum-width integer types - */ -/* Minimum values of minimum-width signed integer types. */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -/* Maximum values of minimum-width signed integer types. */ -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -/* Maximum values of minimum-width unsigned integer types. */ -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.3 Limits of fastest minimum-width integer types - */ -/* Minimum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MIN INT32_MIN -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -/* Maximum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MAX INT32_MAX -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -/* Maximum values of fastest minimum-width unsigned integer types. */ -#define UINT_FAST8_MAX UINT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.4 Limits of integer types capable of holding object pointers - */ -#define INTPTR_MIN INT32_MIN -#define INTPTR_MAX INT32_MAX -#define UINTPTR_MAX UINT32_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.5 Limits of greatest-width integer types - */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.3 Limits of other integer types - */ -/* Limits of ptrdiff_t. */ -#define PTRDIFF_MIN INT32_MIN -#define PTRDIFF_MAX INT32_MAX - -/* Limit of size_t. */ -#define SIZE_MAX UINT32_MAX - -#ifndef WCHAR_MIN /* Limits of wchar_t. */ -#define WCHAR_MIN INT32_MIN -#define WCHAR_MAX INT32_MAX -#endif - -/* Limits of wint_t. */ -#define WINT_MIN INT32_MIN -#define WINT_MAX INT32_MAX - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - - -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef unsigned short ushort; /* Sys V compatibility */ -typedef unsigned int uint; /* Sys V compatibility */ - - -#ifndef _INT8_T_DECLARED -typedef __int8_t int8_t; -#define _INT8_T_DECLARED -#endif - -#ifndef _INT16_T_DECLARED -typedef __int16_t int16_t; -#define _INT16_T_DECLARED -#endif - -#ifndef _INT32_T_DECLARED -typedef __int32_t int32_t; -#define _INT32_T_DECLARED -#endif - -#ifndef _INT64_T_DECLARED -typedef __int64_t int64_t; -#define _INT64_T_DECLARED -#endif - -#ifndef _UINT8_T_DECLARED -typedef __uint8_t uint8_t; -#define _UINT8_T_DECLARED -#endif - -#ifndef _UINT16_T_DECLARED -typedef __uint16_t uint16_t; -#define _UINT16_T_DECLARED -#endif - -#ifndef _UINT32_T_DECLARED -typedef __uint32_t uint32_t; -#define _UINT32_T_DECLARED -#endif - -#ifndef _UINT64_T_DECLARED -typedef __uint64_t uint64_t; -#define _UINT64_T_DECLARED -#endif - -#ifndef _INTPTR_T_DECLARED -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -#define _INTPTR_T_DECLARED -#endif - -#ifndef _SIZE_T_DECLARED -typedef __size_t size_t; -#define _SIZE_T_DECLARED -#endif - -#ifndef _SSIZE_T_DECLARED -typedef __ssize_t ssize_t; -#define _SSIZE_T_DECLARED -#endif - - -typedef __int_least8_t int_least8_t; -typedef __int_least16_t int_least16_t; -typedef __int_least32_t int_least32_t; -typedef __int_least64_t int_least64_t; - -typedef __uint_least8_t uint_least8_t; -typedef __uint_least16_t uint_least16_t; -typedef __uint_least32_t uint_least32_t; -typedef __uint_least64_t uint_least64_t; - -typedef __int_fast8_t int_fast8_t; -typedef __int_fast16_t int_fast16_t; -typedef __int_fast32_t int_fast32_t; -typedef __int_fast64_t int_fast64_t; - -typedef __uint_fast8_t uint_fast8_t; -typedef __uint_fast16_t uint_fast16_t; -typedef __uint_fast32_t uint_fast32_t; -typedef __uint_fast64_t uint_fast64_t; - -typedef __intmax_t intmax_t; -typedef __uintmax_t uintmax_t; - -#ifndef _INTPTR_T_DECLARED -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -#define _INTPTR_T_DECLARED -#endif - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int64_t s64; -typedef int32_t s32; -typedef int16_t s16; -typedef int8_t s8; - -typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ -typedef __uint16_t u_int16_t; -typedef __uint32_t u_int32_t; -typedef __uint64_t u_int64_t; - -typedef __uint64_t u_quad_t; /* quads (deprecated) */ -typedef __int64_t quad_t; -typedef quad_t * qaddr_t; - -typedef char * caddr_t; /* core address */ -typedef const char * c_caddr_t; /* core address, pointer to const */ -typedef volatile char *v_caddr_t; /* core address, pointer to volatile */ - - - - - -#endif /* !_SYS_STDINT_H_ */ diff --git a/uxmhf-rpi3/libs/libxmhfc/include/string.h b/uxmhf-rpi3/libs/libxmhfc/include/string.h deleted file mode 100644 index 6f47c4a04b..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/include/string.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/** - * libc string functions for use in a stand-alone environment - */ -#ifndef __STRING_H__ -#define __STRING_H__ - -#include -#include -#include -#include - -#ifndef __ASSEMBLY__ - - -/*@ - predicate Length_of_str_is{L}(char *s, integer n) = - n >= 0 && \valid(s+(0..n)) && s[n] == 0 && - \forall integer k ; (0 <= k < n) ==> (s[k] != 0) ; - axiomatic Length - { - logic integer Length{L}(char *s) reads s[..]; - axiom string_length{L}: - \forall integer n, char *s ; Length_of_str_is(s, n) ==> Length(s) == n ; - } -@*/ - - - - -/*@ - requires n >= 0; - requires \valid(((char*)s1)+(0..n-1)); - requires \valid(((char*)s2)+(0..n-1)); - requires \separated(((char*)s1)+(0..n-1), ((char*)s2)+(0..n-1)); - assigns \nothing; - //behavior eq: - // assumes n >= 0; - // assumes \forall integer i; 0 <= i < n ==> ((unsigned char*)s1)[i] == ((unsigned char*)s2)[i]; - // ensures \result == 0; - //behavior not_eq: - // assumes n > 0; - // assumes \exists integer i; 0 <= i < n && ((unsigned char*)s1)[i] != ((unsigned char*)s2)[i]; - // ensures \result != 0; - //complete behaviors; - //disjoint behaviors; -@*/ -int memcmp(const void *s1, const void *s2, size_t n); - - -/*@ - requires \separated(((unsigned char*)src)+(0..n-1), ((unsigned char*)dst)+(0..n-1)); - requires n >= 0; - requires \valid(((unsigned char*)dst)+(0..n-1)); - requires \valid(((unsigned char*)src)+(0..n-1)); - assigns ((unsigned char*)dst)[0..n-1]; - assigns \result \from dst; - ensures \forall integer i; 0 <= i < n ==> ((unsigned char*)dst)[i] == ((unsigned char*)src)[i]; - ensures \result == dst; - */ -unsigned char *memcpy(unsigned char *dst, const unsigned char *src, size_t n); - - - -/*@ - requires n >= 0; - requires \valid(((char*)dst)+(0..n-1)); - requires \valid(((char*)src)+(0..n-1)); - // this function does not requires \separate. refer to manpages - assigns ((char*)dst)[0..n-1]; - //ensures \forall integer i; 0 <= i < n ==> ((char*)dst)[i] == \old(((char*)src)[i]); - //ensures \result == dst; -@*/ -void *memmove(void *dst, const void *src, size_t n); - -/*@ - requires n >= 0; - requires \valid(((unsigned char*)dst)+(0..n-1)); - assigns ((unsigned char*)dst)[0..n-1]; - assigns \result \from dst; - ensures \forall integer i; 0 <= i < n ==> (dst[i] == (unsigned char)c); - ensures \result == dst; -@*/ -unsigned char *memset(unsigned char* dst, int c, size_t n); - - -/*@ - requires \exists integer i; Length_of_str_is(s,i); - requires -128 <= c <= 127; - assigns \nothing; -@*/ -char *strchr(const char *s, int c); - - -/*@ - requires \exists integer i; Length_of_str_is(s1,i); - requires \exists integer i; Length_of_str_is(s2,i); - requires \separated(s1+(0..Length(s1)), s2+(0..Length(s2))); - assigns \nothing; - behavior eq: - assumes \exists integer i; Length_of_str_is(s1,i) && Length_of_str_is(s2,i) && - \forall integer j; 0 <= j <= i ==> s1[j] == s2[j]; - ensures \result == 0; - behavior not_eq_i_j: - assumes \exists integer i,j; i != j && Length_of_str_is(s1,i) && Length_of_str_is(s2,j); - ensures \result != 0; - behavior not_eq: - assumes \exists integer i; Length_of_str_is(s1,i) && Length_of_str_is(s2,i) && - \exists integer j; 0 <= j <= i && s1[j] != s2[j]; - ensures \result != 0; - complete behaviors; - disjoint behaviors; -@*/ -int strcmp(const char *s1, const char *s2); - -/*@ - requires \exists integer i; Length_of_str_is(s,i); - assigns \nothing; - //ensures \exists integer i; Length_of_str_is(s,i) && \result == i; - ensures \result == Length(s); - @*/ -int strlen(const char *s); - -/*@ - requires n >= 0; - requires \valid(s1+(0..n-1)); - requires \valid(s2+(0..n-1)); - requires \separated(s1+(0..n-1), s2+(0..n-1)); - assigns \nothing; - - //behavior normal_n_eq: - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s1,i) && Length_of_str_is(s2,i) - // && (\forall integer k; 0 <= k < i ==> s1[k] == s2[k]); - // ensures \result == 0; - //behavior normal_n_not_eq: - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s1,i) && Length_of_str_is(s2,i) - // && (\exists integer k; 0 <= k <= i && s1[k] != s2[k]); - // ensures \result != 0; - //behavior larger_n_eq: - // assumes \forall integer i; 0 <= i < n ==> s1[i] != 0; - // assumes \forall integer i; 0 <= i < n ==> s2[i] != 0; - // assumes \forall integer i; 0 <= i < n ==> s1[i] == s2[i]; - // ensures \result == 0; - //behavior larger_n_not_eq: - // assumes \forall integer i; 0 <= i < n ==> s1[i] != 0; - // assumes \forall integer i; 0 <= i < n ==> s2[i] != 0; - // assumes \exists integer i; 0 <= i < n && s1[i] != s2[i]; - // ensures \result != 0; - //behavior s1_s2_smaller: - // assumes \exists integer i, j; 0 <= i < n && 0 <= j < n - // && i != j && Length_of_str_is(s1, i) && Length_of_str_is(s2, j); - // ensures \result != 0; - //behavior s1_smaller: - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s1, i); - // assumes \forall integer i; 0 <= i < n ==> s2[i] != 0; - // ensures \result != 0; - //behavior s2_smaller: - // assumes \forall integer i; 0 <= i < n ==> s1[i] != 0; - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s2, i); - // ensures \result != 0; - //behavior zero: - // assumes n == 0; - // ensures \result == 0; - //complete behaviors; - //disjoint behaviors; -@*/ -int strncmp(const char *s1, const char *s2, size_t n); - -/*@ - requires n >= 0; - requires \exists integer i; Length_of_str_is(src, i); - requires \valid(dst+(0..n-1)); - requires \valid(((char*)src)+(0..n-1)); - requires \separated(src+(0..n-1), dst+(0..n-1)); - assigns dst[0..n-1]; - ensures \result == dst; -@*/ -char *strncpy(char *dst, const char *src, size_t n); - -/*@ - requires maxlen >= 0; - requires \valid(s+(0..maxlen-1)); - assigns \nothing; - behavior bigger: - assumes \forall integer i; 0 <= i < maxlen ==> s[i] != 0; - ensures \result == maxlen; - - behavior smaller: - assumes \exists integer i; 0 <= i < maxlen && s[i] == 0; - ensures \result <= maxlen; - complete behaviors; - disjoint behaviors; -*/ -size_t strnlen(const char *s, size_t maxlen); - - - -#endif /* __ASSEMBLY__ */ - -#endif /* __STRING_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfc/libubersparkc.mk b/uxmhf-rpi3/libs/libxmhfc/libubersparkc.mk deleted file mode 100644 index 2add5911b1..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/libubersparkc.mk +++ /dev/null @@ -1,49 +0,0 @@ -###### -# libubersparkc Makefile -# author: amit vasudevan (amitvasudevan@acm.org) -###### - -###### archive name -ARCHIVE = libubersparkc.a - -###### compute source directory where this Makefile resides -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) - -###### populate sources and objects -C_SOURCES := $(wildcard $(srcdir)/*.c) -C_SOURCES := $(patsubst $(srcdir)/%, %, $(C_SOURCES)) -OBJECTS = $(patsubst %.c, %.o, $(C_SOURCES)) - -###### targets -.PHONY: verify -verify: - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/memcmp.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/memcpy.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/memset.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/memmove.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/strchr.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/strcmp.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/strlen.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/strncmp.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/strncpy.c - $(FRAMAC) -wp -wp-rte -wp-prover alt-ergo,z3,cvc3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/strnlen.c - -.PHONY: build -build: $(ARCHIVE) - -$(ARCHIVE): $(OBJECTS) - $(AR) -rcs $(ARCHIVE) $(OBJECTS) - -%.o: %.c - @echo Building "$@" from "$<" - $(CCERT) -c $(CCERT_CFLAGS) -o $@ $< - - -.PHONY: clean -clean: - $(RM) $(OBJECTS) - $(RM) $(ARCHIVE) - - - diff --git a/uxmhf-rpi3/libs/libxmhfc/memcmp.c b/uxmhf-rpi3/libs/libxmhfc/memcmp.c deleted file mode 100644 index 46c70f143a..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/memcmp.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include - -#if 0 -int -memcmp(const void *s1, const void *s2, size_t n) -{ - if (n != 0) { - const unsigned char *p1 = s1, *p2 = s2; - - do { - if (*p1++ != *p2++) - return (*--p1 - *--p2); - } while (--n != 0); - } - return (0); -} -#endif // 0 - - -/*@ - requires n >= 0; - requires \valid(((char*)s1)+(0..n-1)); - requires \valid(((char*)s2)+(0..n-1)); - requires \separated(((char*)s1)+(0..n-1), ((char*)s2)+(0..n-1)); - assigns \nothing; - //behavior eq: - // assumes n >= 0; - // assumes \forall integer i; 0 <= i < n ==> ((unsigned char*)s1)[i] == ((unsigned char*)s2)[i]; - // ensures \result == 0; - //behavior not_eq: - // assumes n > 0; - // assumes \exists integer i; 0 <= i < n && ((unsigned char*)s1)[i] != ((unsigned char*)s2)[i]; - // ensures \result != 0; - //complete behaviors; - //disjoint behaviors; -@*/ -int memcmp(const void *s1, const void *s2, size_t n) -{ - const char *c1 = s1, *c2 = s2; - int d = 0; - - - /*@ - loop invariant N_RANGE: 0 <= n <= \at(n, Pre); - //loop invariant C1_RANGE: (unsigned char*)s1 <= c1 < (unsigned char*)s1+n; - //loop invariant C2_RANGE: (unsigned char*)s2 <= c2 <= (unsigned char*)s2+\at(n, Pre); - //loop invariant COMPARE: \forall integer i; 0 <= i < (\at(n, Pre) - n) ==> ((unsigned char*)s1)[i] == ((unsigned char*)s2)[i]; - //loop invariant D_ZERO: d == 0; - loop invariant c1 == ((char*)s1)+(\at(n, Pre) - n); - loop invariant c2 == ((char*)s2)+(\at(n, Pre) - n); - loop invariant (char*)s2 <= c2 <= (char*)s2+\at(n,Pre); - loop invariant (char*)s1 <= c1 <= (char*)s1+\at(n,Pre); - loop assigns n, d, c1, c2; - loop variant n; - @*/ - while (/*n--*/ n) { - d = (int)*c1++ - (int)*c2++; - if (d) - break; - - n--; //inserted code - } - - return d; -} - - - diff --git a/uxmhf-rpi3/libs/libxmhfc/memcpy.c b/uxmhf-rpi3/libs/libxmhfc/memcpy.c deleted file mode 100644 index 32101ea395..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/memcpy.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include - - -/*void *memcpy(void * to, const void * from, u32 n) -{ - size_t i; - for(i=0; i= 0; - requires \valid(((unsigned char*)dst)+(0..n-1)); - requires \valid(((unsigned char*)src)+(0..n-1)); - assigns ((unsigned char*)dst)[0..n-1]; - ensures \forall integer i; 0 <= i < n ==> ((unsigned char*)dst)[i] == ((unsigned char*)src)[i]; - ensures \result == dst; - */ -unsigned char *memcpy(unsigned char *dst, const unsigned char *src, size_t n) -{ - const unsigned char *p = src; - unsigned char *q = dst; - - /*@ - loop invariant 0 <= n <= \at(n,Pre); - loop invariant p == ((unsigned char*)src)+(\at(n, Pre) - n); - loop invariant q == ((unsigned char*)dst)+(\at(n, Pre) - n); - loop invariant (unsigned char*)dst <= q <= (unsigned char*)dst+\at(n,Pre); - loop invariant (unsigned char*)src <= p <= (unsigned char*)src+\at(n,Pre); - loop invariant \forall integer i; 0 <= i < (\at(n, Pre) - n) ==> ((unsigned char*)dst)[i] == ((unsigned char*)src)[i]; - loop assigns n, q, p, ((unsigned char*)dst)[0..(\at(n,Pre)- n - 1)]; - loop variant n; - */ - while (n) { - *q++ = *p++; - n--; - } - - return dst; -} - diff --git a/uxmhf-rpi3/libs/libxmhfc/memmove.c b/uxmhf-rpi3/libs/libxmhfc/memmove.c deleted file mode 100644 index 0b486add34..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/memmove.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include - -/* -void *memmove(void *dst_void, const void *src_void, u32 length){ - char *dst = dst_void; - const char *src = src_void; - - if (src < dst && dst < src + length){ - // Have to copy backwards - src += length; - dst += length; - while (length--){ - *--dst = *--src; - } - }else{ - while (length--){ - *dst++ = *src++; - } - } - - return dst_void; -}*/ - - -/*@ - requires n >= 0; - requires \valid(((char*)dst)+(0..n-1)); - requires \valid(((char*)src)+(0..n-1)); - // this function does not requires \separate. refer to manpages - assigns ((char*)dst)[0..n-1]; - //ensures \forall integer i; 0 <= i < n ==> ((char*)dst)[i] == \old(((char*)src)[i]); - //ensures \result == dst; -@*/ -void *memmove(void *dst, const void *src, size_t n) -{ - const char *p = src; - char *q = dst; - - if (q < p) { - /*@ - //loop invariant \base_addr(p) == \base_addr(src); - //loop invariant \base_addr(q) == \base_addr(dst); - //loop invariant q < p; - loop invariant 0 <= n <= \at(n, Pre); - loop invariant p == ((char*)src)+(\at(n, Pre) - n); - loop invariant q == ((char*)dst)+(\at(n, Pre) - n); - loop invariant (char*)src <= p <= (char*)src+\at(n, Pre); - loop invariant (char*)dst <= q <= (char*)dst+\at(n, Pre); - //loop invariant \forall integer i; 0 <= i < (\at(n, Pre) - n) ==> ((char*)dst)[i] == \at(((char*)src)[i], Pre); - //loop invariant \forall integer i; (\at(n, Pre) - n) <= i < \at(n, Pre) ==> ((char*)dst)[i] == \at(((char*)dst)[i], Pre); - loop assigns p, q, n, ((char*)dst)[0..(\at(n, Pre) - n -1)]; - loop variant n; - @*/ - while (n) { - *q++ = *p++; - n--; - } - } else { - p += n; - q += n; - - /*@ - //loop invariant \base_addr(p) == \base_addr(src); - //loop invariant \base_addr(q) == \base_addr(dst); - loop invariant 0 <= n <= \at(n, Pre); - loop invariant p == ((char*)src) + n; - loop invariant q == ((char*)dst) + n; - loop invariant (char*)src <= p <= (char*)src+\at(n, Pre); - loop invariant (char*)dst <= q <= (char*)dst+\at(n, Pre); - //loop invariant \forall integer i; n <= i < \at(n, Pre) ==> ((char*)dst)[i] == \at(((char*)src)[i], Pre); - //loop invariant \forall integer i; 0 <= i < n ==> ((char*)dst)[i] == \at(((char*)dst)[i], Pre); - loop assigns p, q, n, ((char*)dst)[n..(\at(n, Pre)-1)]; - loop variant n; - @*/ - while (n) { - *--q = *--p; - n--; - } - } - - return dst; -} - diff --git a/uxmhf-rpi3/libs/libxmhfc/memset.c b/uxmhf-rpi3/libs/libxmhfc/memset.c deleted file mode 100644 index 693c72d8d9..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/memset.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include - -/*@ - requires n >= 0; - requires \valid(((unsigned char*)dst)+(0..n-1)); - assigns ((unsigned char*)dst)[0..n-1]; - ensures \forall integer i; 0 <= i < n ==> (dst[i] == (unsigned char)c); - ensures \result == dst; -@*/ -unsigned char *memset(unsigned char* dst, int c, size_t n) -{ - size_t i; - - /*@ - loop invariant 0 <= i <= n; - loop invariant \forall integer x; 0 <= x < i ==> (dst[x] == (unsigned char)c); - loop assigns i; - loop assigns dst[0..(n-1)]; - loop variant n-i; - @*/ - for(i=0; i < n; i++){ - dst[i]=(unsigned char)c; - } - - return dst; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/strchr.c b/uxmhf-rpi3/libs/libxmhfc/strchr.c deleted file mode 100644 index a89d5ca5da..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/strchr.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * From: FreeBSD sys/libkern/strchr.c - */ -/** - * Modified for XMHF. - */ - -#include -#include -/* -char * -strchr(const char *p, int ch) -{ - union { - const char *cp; - char *p; - } u; - - u.cp = p; - for (;; ++u.p) { - if (*u.p == ch) - return(u.p); - if (*u.p == '\0') - return(NULL); - } -} -*/ - - - -/*@ - requires \exists integer i; Length_of_str_is(s,i); - requires -128 <= c <= 127; - assigns \nothing; -@*/ -char *strchr(const char *s, int c) -{ - /*@ - loop invariant \base_addr(s) == \base_addr(\at(s, Pre)); - loop invariant \at(s,Pre) <= s <= (\at(s,Pre) + Length(\at(s,Pre))); - loop invariant s == \at(s,Pre) + (s - \at(s,Pre)); - loop assigns s; - loop variant Length(\at(s,Pre)) - (s - \at(s,Pre)); - */ - while (*s != (char)c) { - if (!*s) - return NULL; - s++; - } - - //@ assert \base_addr(\at(s, Pre)) == \base_addr(\at(s, Here)); - //@ assert \at(s, Pre) <= \at(s, Here) <= \at(s, Pre) + Length(\at(s, Pre)); - return (char *)s; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/strcmp.c b/uxmhf-rpi3/libs/libxmhfc/strcmp.c deleted file mode 100644 index cb93e3231f..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/strcmp.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * From: FreeBSD sys/libkern/strcmp.c - */ -/** - * Modified for XMHF. - */ - -#include -#include -/* - * Compare strings. - */ -/*int strcmp(s1, s2) - register const char *s1, *s2; -{ - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); -}*/ - - -/*@ - requires \exists integer i; Length_of_str_is(s1,i); - requires \exists integer i; Length_of_str_is(s2,i); - requires \separated(s1+(0..Length(s1)), s2+(0..Length(s2))); - assigns \nothing; - behavior eq: - assumes \exists integer i; Length_of_str_is(s1,i) && Length_of_str_is(s2,i) && - \forall integer j; 0 <= j <= i ==> s1[j] == s2[j]; - ensures \result == 0; - behavior not_eq_i_j: - assumes \exists integer i,j; i != j && Length_of_str_is(s1,i) && Length_of_str_is(s2,j); - ensures \result != 0; - behavior not_eq: - assumes \exists integer i; Length_of_str_is(s1,i) && Length_of_str_is(s2,i) && - \exists integer j; 0 <= j <= i && s1[j] != s2[j]; - ensures \result != 0; - complete behaviors; - disjoint behaviors; -@*/ -int strcmp(const char *s1, const char *s2) { - const char *c1 = (const char *)s1; - const char *c2 = (const char *)s2; - char ch; - int d = 0; - - /*@ - loop invariant \base_addr(c1) == \base_addr(s1); - loop invariant \base_addr(c2) == \base_addr(s2); - loop invariant s1 <= c1 <= s1 + Length(s1); - loop invariant s2 <= c2 <= s2 + Length(s2); - loop invariant c1 == s1+(c2-s2); - loop invariant c2 == s2+(c1-s1); - loop invariant \forall integer i; 0 <= i < (c1-s1) ==> s1[i] == s2[i]; - loop assigns ch, c1, c2, d; - loop variant Length(s1) - (c1-s1); - @*/ - while (1) { - d = (int)(ch = *c1++) - (int)*c2++; - if (d || !ch) - break; - } - return d; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/strlen.c b/uxmhf-rpi3/libs/libxmhfc/strlen.c deleted file mode 100644 index 1d4d47bcc5..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/strlen.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * From: FreeBSD sys/libkern/strlen.c - */ -/** - * Modified for XMHF. - */ - -#include -#include - -/*size_t strlen(str) - const char *str; -{ - register const char *s; - - for (s = str; *s; ++s); - return(s - str); -}*/ - -/*@ - requires \exists integer i; Length_of_str_is(s,i); - assigns \nothing; - //ensures \exists integer i; Length_of_str_is(s,i) && \result == i; - ensures \result == Length(s); - @*/ -int strlen(const char *s) { - const char *ss = s; - - /*@ - loop invariant \base_addr(s) == \base_addr(ss); - loop invariant s <= ss <= s+Length(s); - loop invariant \forall integer i; 0 <= i < (ss-s) ==> s[i] != 0; - loop assigns ss; - loop variant Length(s) - (ss-s); - @*/ - while (*ss) - ss++; - - //@ assert Length_of_str_is(s,ss-s); - return ss - s; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/strncmp.c b/uxmhf-rpi3/libs/libxmhfc/strncmp.c deleted file mode 100644 index 8e8826b5e5..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/strncmp.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* $OpenBSD: strncmp.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */ - -/* - * Copyright (c) 1989 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * From: OpenBSD sys/libkern/strcmp.c - */ - -#include -#include -/*int -strncmp(const char *s1, const char *s2, size_t n) -{ - if (n == 0) - return (0); - do { - if (*s1 != *s2++) - return (*(const unsigned char *)s1 - *(const unsigned char *)--s2); - if (*s1++ == 0) - break; - } while (--n != 0); - return (0); -}*/ - - -/*@ - requires n >= 0; - requires \valid(s1+(0..n-1)); - requires \valid(s2+(0..n-1)); - requires \separated(s1+(0..n-1), s2+(0..n-1)); - assigns \nothing; - - //behavior normal_n_eq: - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s1,i) && Length_of_str_is(s2,i) - // && (\forall integer k; 0 <= k < i ==> s1[k] == s2[k]); - // ensures \result == 0; - //behavior normal_n_not_eq: - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s1,i) && Length_of_str_is(s2,i) - // && (\exists integer k; 0 <= k <= i && s1[k] != s2[k]); - // ensures \result != 0; - //behavior larger_n_eq: - // assumes \forall integer i; 0 <= i < n ==> s1[i] != 0; - // assumes \forall integer i; 0 <= i < n ==> s2[i] != 0; - // assumes \forall integer i; 0 <= i < n ==> s1[i] == s2[i]; - // ensures \result == 0; - //behavior larger_n_not_eq: - // assumes \forall integer i; 0 <= i < n ==> s1[i] != 0; - // assumes \forall integer i; 0 <= i < n ==> s2[i] != 0; - // assumes \exists integer i; 0 <= i < n && s1[i] != s2[i]; - // ensures \result != 0; - //behavior s1_s2_smaller: - // assumes \exists integer i, j; 0 <= i < n && 0 <= j < n - // && i != j && Length_of_str_is(s1, i) && Length_of_str_is(s2, j); - // ensures \result != 0; - //behavior s1_smaller: - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s1, i); - // assumes \forall integer i; 0 <= i < n ==> s2[i] != 0; - // ensures \result != 0; - //behavior s2_smaller: - // assumes \forall integer i; 0 <= i < n ==> s1[i] != 0; - // assumes \exists integer i; 0 <= i < n && Length_of_str_is(s2, i); - // ensures \result != 0; - //behavior zero: - // assumes n == 0; - // ensures \result == 0; - //complete behaviors; - //disjoint behaviors; -@*/ -int strncmp(const char *s1, const char *s2, size_t n) -{ - const char *c1 = (const char *)s1; - const char *c2 = (const char *)s2; - char ch; - int d = 0; - - /*@ - loop invariant \base_addr(c1) == \base_addr(s1); - loop invariant \base_addr(c2) == \base_addr(s2); - loop invariant 0 <= n <= \at(n, Pre); - //loop invariant \forall integer i; 0 <= i < (\at(n,Pre) - n) ==> s1[i] == s2[i]; - loop invariant s1 <= c1 <= s1+\at(n, Pre); - loop invariant s2 <= c2 <= s2+\at(n, Pre); - loop invariant c1 == s1 + (\at(n, Pre) - n); - loop invariant c2 == s2 + (\at(n, Pre) - n); - loop invariant d == 0; - loop assigns n, c1, c2, ch, d; - loop variant n; - @*/ - while (n) { - d = (int)(ch = *c1++) - (int)*c2++; - if (d || !ch) - break; - - n--; - } - - return d; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/strncpy.c b/uxmhf-rpi3/libs/libxmhfc/strncpy.c deleted file mode 100644 index 7438309d01..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/strncpy.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * From: FreeBSD sys/libkern/strncpy.c - */ -/** - * Modified for XMHF. - */ - -#include -#include - -/*@ - requires n >= 0; - requires \exists integer i; Length_of_str_is(src, i); - requires \valid(dst+(0..n-1)); - requires \valid(((char*)src)+(0..n-1)); - requires \separated(src+(0..n-1), dst+(0..n-1)); - assigns dst[0..n-1]; - ensures \result == dst; -@*/ -char *strncpy(char *dst, const char *src, size_t n) -{ - char *q = dst; - const char *p = src; - char ch; - size_t i; - - /*@ - loop invariant 0 <= n <= \at(n,Pre); - loop invariant \at(n, Here) != \at(n, Pre) ==> ch != 0; - loop invariant p == ((char*)src)+(\at(n, Pre) - n); - loop invariant q == ((char*)dst)+(\at(n, Pre) - n); - loop invariant (char*)dst <= q <= (char*)dst+\at(n,Pre); - loop invariant (char*)src <= p <= (char*)src+\at(n,Pre); - loop assigns n, q, ch, p, ((char*)dst)[0..(\at(n,Pre)- n - 1)]; - loop variant n; - @*/ - while (n) { - ch = *p; - *q = ch; - if (!ch) - break; - q++; - p++; - n--; - } - - //memset(q, 0, n); - /*@ - loop invariant 0 <= i <= n; - loop assigns i; - loop assigns q[0..(n-1)]; - loop variant n-i; - @*/ - for(i=0; i < n; i++){ - q[i]=(char)0; - } - - return dst; -} diff --git a/uxmhf-rpi3/libs/libxmhfc/strnlen.c b/uxmhf-rpi3/libs/libxmhfc/strnlen.c deleted file mode 100644 index f24ee8ea41..0000000000 --- a/uxmhf-rpi3/libs/libxmhfc/strnlen.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include - -/* -u32 strnlen(const char * s, u32 count){ - const char *sc; - - for (sc = s; count-- && *sc != '\0'; ++sc); - return (u32)(sc - s); -}*/ - -/*@ - requires maxlen >= 0; - requires \valid(s+(0..maxlen-1)); - assigns \nothing; - behavior bigger: - assumes \forall integer i; 0 <= i < maxlen ==> s[i] != 0; - ensures \result == maxlen; - - behavior smaller: - assumes \exists integer i; 0 <= i < maxlen && s[i] == 0; - ensures \result <= maxlen; - complete behaviors; - disjoint behaviors; -*/ -size_t strnlen(const char *s, size_t maxlen) -{ - const char *ss = s; - - /* Important: the maxlen test must precede the reference through ss; - since the byte beyond the maximum may segfault */ - - /*@ - loop invariant 0 <= maxlen <= \at(maxlen,Pre); - loop invariant \forall integer i; 0 <= i < (\at(maxlen, Pre) - maxlen) ==> s[i] != 0; - loop invariant ss == s+(\at(maxlen, Pre) - maxlen); - loop invariant s <= ss <= s+\at(maxlen, Pre); - loop assigns maxlen, ss; - loop variant maxlen; - */ - while ((maxlen > 0) && *ss) { - ss++; - maxlen--; - } - return ss - s; -} - diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/Makefile b/uxmhf-rpi3/libs/libxmhfcrypto/Makefile deleted file mode 100644 index a8633de5e7..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) $(srcdir)/hashes/sha1 -vpath %.c $(srcdir) $(srcdir)/hashes/sha2 -vpath %.c $(srcdir) $(srcdir)/ciphers/aes -vpath %.c $(srcdir) $(srcdir)/mac/hmac-sha1 -vpath %.c $(srcdir) $(srcdir)/mac/hmac-sha2 - - -C_SOURCES := hashes/sha1/sha1.c -C_SOURCES += hashes/sha2/sha256.c -C_SOURCES += ciphers/aes/aes.c -C_SOURCES += ciphers/aes/aes_tab.c -C_SOURCES += ciphers/aes/aes_cbc.c -C_SOURCES += mac/hmac-sha1/hmac-sha1.c -C_SOURCES += mac/hmac-sha2/hmac-sha256.c - -O_SOURCES := $(C_SOURCES) -O_SOURCES := $(patsubst hashes/sha1/%, %, $(O_SOURCES)) -O_SOURCES := $(patsubst hashes/sha2/%, %, $(O_SOURCES)) -O_SOURCES := $(patsubst ciphers/aes/%, %, $(O_SOURCES)) -O_SOURCES := $(patsubst mac/hmac-sha1/%, %, $(O_SOURCES)) -O_SOURCES := $(patsubst mac/hmac-sha2/%, %, $(O_SOURCES)) - -OBJECTS = $(patsubst %.c, %.o, $(O_SOURCES)) - -LIBXMHFCRYPTO_OBJECTS_DIR = _objs_libxmhfcrypto -THE_ARCHIVE = libxmhfcrypto.a - -# targets -.PHONY: verify -verify: - frama-c -main sha1 -lib-entry -wp -wp-model +cint -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) $(srcdir)/hashes/sha1/sha1.c - - -.PHONY: all -all: $(THE_ARCHIVE) - -$(THE_ARCHIVE): $(OBJECTS) - cd $(LIBXMHFCRYPTO_OBJECTS_DIR) && $(AR) -rcs $(THE_ARCHIVE) $(OBJECTS) - $(CP) $(LIBXMHFCRYPTO_OBJECTS_DIR)/$(THE_ARCHIVE) . - -%.o: %.c - mkdir -p $(LIBXMHFCRYPTO_OBJECTS_DIR) - @echo Building "$@" from "$<" - $(CCERT) -c $(CCERT_FLAGS) -o $(LIBXMHFCRYPTO_OBJECTS_DIR)/$@ $< - -.PHONY: clean -clean: - $(RM) -rf $(LIBXMHFCRYPTO_OBJECTS_DIR) - - diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes.c b/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes.c deleted file mode 100644 index 39cce8e878..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes.c +++ /dev/null @@ -1,617 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* AES implementation by Tom St Denis - * - * Derived from the Public Domain source code by - ---- - * rijndael-alg-fst.c - * - * @version 3.0 (December 2000) - * - * Optimised ANSI C code for the Rijndael cipher (now AES) - * - * @author Vincent Rijmen - * @author Antoon Bosselaers - * @author Paulo Barreto ---- - */ -/** - @file aes.c - Implementation of AES -*/ - -#include -#include -#include - -/* -#define LTC_RIJNDAEL -//undef ENCRYPT_ONLY -#define __LTC_AES_TAB_C__ -//undef LTC_SMALL_CODE -//undef _MSC_VER -//undef LTC_CLEAN_STACK -#define LTC_TEST -*/ - -#define SETUP rijndael_setup -#define ECB_ENC rijndael_ecb_encrypt -#define ECB_DEC rijndael_ecb_decrypt -#define ECB_DONE rijndael_done -#define ECB_TEST rijndael_test -#define ECB_KS rijndael_keysize - -const struct ltc_cipher_descriptor rijndael_desc = -{ - "rijndael", - 6, - 16, 32, 16, 10 -}; - -/* -const struct ltc_cipher_descriptor aes_desc = -{ - "aes", - 6, - 16, 32, 16, 10, - SETUP, ECB_ENC, ECB_DEC, ECB_TEST, ECB_DONE, ECB_KS, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; -*/ - -//#define __LTC_AES_TAB_C__ -//#include "aes_tab.c" - -static u32 setup_mix(u32 temp) -{ - return (Te4_3[byte(temp, 2)]) ^ - (Te4_2[byte(temp, 1)]) ^ - (Te4_1[byte(temp, 0)]) ^ - (Te4_0[byte(temp, 3)]); -} - - - /** - Initialize the AES (Rijndael) block cipher - @param key The symmetric key you wish to pass - @param keylen The key length in bytes - @param num_rounds The number of rounds desired (0 for default) - @param skey The key in as scheduled by this function. - @return CRYPT_OK if successful - */ -int SETUP(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) -{ - int i; - u32 temp, *rk; - u32 *rrk; - - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(skey != NULL); - - if (keylen != 16 && keylen != 24 && keylen != 32) { - return CRYPT_INVALID_KEYSIZE; - } - - if (num_rounds != 0 && num_rounds != (10 + ((keylen/8)-2)*2)) { - return CRYPT_INVALID_ROUNDS; - } - - skey->rijndael.Nr = 10 + ((keylen/8)-2)*2; - - /* setup the forward key */ - i = 0; - rk = skey->rijndael.eK; - LOAD32H(rk[0], key ); - LOAD32H(rk[1], key + 4); - LOAD32H(rk[2], key + 8); - LOAD32H(rk[3], key + 12); - if (keylen == 16) { - for (;;) { - temp = rk[3]; - rk[4] = rk[0] ^ setup_mix(temp) ^ rcon[i]; - rk[5] = rk[1] ^ rk[4]; - rk[6] = rk[2] ^ rk[5]; - rk[7] = rk[3] ^ rk[6]; - if (++i == 10) { - break; - } - rk += 4; - } - } else if (keylen == 24) { - LOAD32H(rk[4], key + 16); - LOAD32H(rk[5], key + 20); - for (;;) { - temp = rk[5]; - rk[ 6] = rk[ 0] ^ setup_mix(temp) ^ rcon[i]; - rk[ 7] = rk[ 1] ^ rk[ 6]; - rk[ 8] = rk[ 2] ^ rk[ 7]; - rk[ 9] = rk[ 3] ^ rk[ 8]; - if (++i == 8) { - break; - } - rk[10] = rk[ 4] ^ rk[ 9]; - rk[11] = rk[ 5] ^ rk[10]; - rk += 6; - } - } else if (keylen == 32) { - LOAD32H(rk[4], key + 16); - LOAD32H(rk[5], key + 20); - LOAD32H(rk[6], key + 24); - LOAD32H(rk[7], key + 28); - for (;;) { - temp = rk[7]; - rk[ 8] = rk[ 0] ^ setup_mix(temp) ^ rcon[i]; - rk[ 9] = rk[ 1] ^ rk[ 8]; - rk[10] = rk[ 2] ^ rk[ 9]; - rk[11] = rk[ 3] ^ rk[10]; - if (++i == 7) { - break; - } - temp = rk[11]; - rk[12] = rk[ 4] ^ setup_mix(RORc(temp, 8)); - rk[13] = rk[ 5] ^ rk[12]; - rk[14] = rk[ 6] ^ rk[13]; - rk[15] = rk[ 7] ^ rk[14]; - rk += 8; - } - } else { - /* this can't happen */ - /* coverity[dead_error_line] */ - return CRYPT_ERROR; - } - - /* setup the inverse key now */ - rk = skey->rijndael.dK; - rrk = skey->rijndael.eK + (28 + keylen) - 4; - - /* apply the inverse MixColumn transform to all round keys but the first and the last: */ - /* copy first */ - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk = *rrk; - rk -= 3; rrk -= 3; - - for (i = 1; i < skey->rijndael.Nr; i++) { - rrk -= 4; - rk += 4; - temp = rrk[0]; - rk[0] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - temp = rrk[1]; - rk[1] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - temp = rrk[2]; - rk[2] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - temp = rrk[3]; - rk[3] = - Tks0[byte(temp, 3)] ^ - Tks1[byte(temp, 2)] ^ - Tks2[byte(temp, 1)] ^ - Tks3[byte(temp, 0)]; - - } - - /* copy last */ - rrk -= 4; - rk += 4; - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk++ = *rrk++; - *rk = *rrk; - - return CRYPT_OK; -} - -/** - Encrypts a block of text with AES - @param pt The input plaintext (16 bytes) - @param ct The output ciphertext (16 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -int ECB_ENC(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) -{ - u32 s0, s1, s2, s3, t0, t1, t2, t3, *rk; - int Nr, r; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - Nr = skey->rijndael.Nr; - rk = skey->rijndael.eK; - - /* - * map byte array block to cipher state - * and add initial round key: - */ - LOAD32H(s0, pt ); s0 ^= rk[0]; - LOAD32H(s1, pt + 4); s1 ^= rk[1]; - LOAD32H(s2, pt + 8); s2 ^= rk[2]; - LOAD32H(s3, pt + 12); s3 ^= rk[3]; - - - /* - * Nr - 1 full rounds: - */ - r = Nr >> 1; - for (;;) { - t0 = - Te0(byte(s0, 3)) ^ - Te1(byte(s1, 2)) ^ - Te2(byte(s2, 1)) ^ - Te3(byte(s3, 0)) ^ - rk[4]; - t1 = - Te0(byte(s1, 3)) ^ - Te1(byte(s2, 2)) ^ - Te2(byte(s3, 1)) ^ - Te3(byte(s0, 0)) ^ - rk[5]; - t2 = - Te0(byte(s2, 3)) ^ - Te1(byte(s3, 2)) ^ - Te2(byte(s0, 1)) ^ - Te3(byte(s1, 0)) ^ - rk[6]; - t3 = - Te0(byte(s3, 3)) ^ - Te1(byte(s0, 2)) ^ - Te2(byte(s1, 1)) ^ - Te3(byte(s2, 0)) ^ - rk[7]; - - rk += 8; - if (--r == 0) { - break; - } - - s0 = - Te0(byte(t0, 3)) ^ - Te1(byte(t1, 2)) ^ - Te2(byte(t2, 1)) ^ - Te3(byte(t3, 0)) ^ - rk[0]; - s1 = - Te0(byte(t1, 3)) ^ - Te1(byte(t2, 2)) ^ - Te2(byte(t3, 1)) ^ - Te3(byte(t0, 0)) ^ - rk[1]; - s2 = - Te0(byte(t2, 3)) ^ - Te1(byte(t3, 2)) ^ - Te2(byte(t0, 1)) ^ - Te3(byte(t1, 0)) ^ - rk[2]; - s3 = - Te0(byte(t3, 3)) ^ - Te1(byte(t0, 2)) ^ - Te2(byte(t1, 1)) ^ - Te3(byte(t2, 0)) ^ - rk[3]; - } - - - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Te4_3[byte(t0, 3)]) ^ - (Te4_2[byte(t1, 2)]) ^ - (Te4_1[byte(t2, 1)]) ^ - (Te4_0[byte(t3, 0)]) ^ - rk[0]; - STORE32H(s0, ct); - s1 = - (Te4_3[byte(t1, 3)]) ^ - (Te4_2[byte(t2, 2)]) ^ - (Te4_1[byte(t3, 1)]) ^ - (Te4_0[byte(t0, 0)]) ^ - rk[1]; - STORE32H(s1, ct+4); - s2 = - (Te4_3[byte(t2, 3)]) ^ - (Te4_2[byte(t3, 2)]) ^ - (Te4_1[byte(t0, 1)]) ^ - (Te4_0[byte(t1, 0)]) ^ - rk[2]; - STORE32H(s2, ct+8); - s3 = - (Te4_3[byte(t3, 3)]) ^ - (Te4_2[byte(t0, 2)]) ^ - (Te4_1[byte(t1, 1)]) ^ - (Te4_0[byte(t2, 0)]) ^ - rk[3]; - STORE32H(s3, ct+12); - - return CRYPT_OK; -} - - -/** - Decrypts a block of text with AES - @param ct The input ciphertext (16 bytes) - @param pt The output plaintext (16 bytes) - @param skey The key as scheduled - @return CRYPT_OK if successful -*/ -int ECB_DEC(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) -{ - u32 s0, s1, s2, s3, t0, t1, t2, t3, *rk; - int Nr, r; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(skey != NULL); - - Nr = skey->rijndael.Nr; - rk = skey->rijndael.dK; - - /* - * map byte array block to cipher state - * and add initial round key: - */ - LOAD32H(s0, ct ); s0 ^= rk[0]; - LOAD32H(s1, ct + 4); s1 ^= rk[1]; - LOAD32H(s2, ct + 8); s2 ^= rk[2]; - LOAD32H(s3, ct + 12); s3 ^= rk[3]; - - - /* - * Nr - 1 full rounds: - */ - r = Nr >> 1; - for (;;) { - - t0 = - Td0(byte(s0, 3)) ^ - Td1(byte(s3, 2)) ^ - Td2(byte(s2, 1)) ^ - Td3(byte(s1, 0)) ^ - rk[4]; - t1 = - Td0(byte(s1, 3)) ^ - Td1(byte(s0, 2)) ^ - Td2(byte(s3, 1)) ^ - Td3(byte(s2, 0)) ^ - rk[5]; - t2 = - Td0(byte(s2, 3)) ^ - Td1(byte(s1, 2)) ^ - Td2(byte(s0, 1)) ^ - Td3(byte(s3, 0)) ^ - rk[6]; - t3 = - Td0(byte(s3, 3)) ^ - Td1(byte(s2, 2)) ^ - Td2(byte(s1, 1)) ^ - Td3(byte(s0, 0)) ^ - rk[7]; - - rk += 8; - if (--r == 0) { - break; - } - - - s0 = - Td0(byte(t0, 3)) ^ - Td1(byte(t3, 2)) ^ - Td2(byte(t2, 1)) ^ - Td3(byte(t1, 0)) ^ - rk[0]; - s1 = - Td0(byte(t1, 3)) ^ - Td1(byte(t0, 2)) ^ - Td2(byte(t3, 1)) ^ - Td3(byte(t2, 0)) ^ - rk[1]; - s2 = - Td0(byte(t2, 3)) ^ - Td1(byte(t1, 2)) ^ - Td2(byte(t0, 1)) ^ - Td3(byte(t3, 0)) ^ - rk[2]; - s3 = - Td0(byte(t3, 3)) ^ - Td1(byte(t2, 2)) ^ - Td2(byte(t1, 1)) ^ - Td3(byte(t0, 0)) ^ - rk[3]; - } - - /* - * apply last round and - * map cipher state to byte array block: - */ - s0 = - (Td4[byte(t0, 3)] & 0xff000000) ^ - (Td4[byte(t3, 2)] & 0x00ff0000) ^ - (Td4[byte(t2, 1)] & 0x0000ff00) ^ - (Td4[byte(t1, 0)] & 0x000000ff) ^ - rk[0]; - STORE32H(s0, pt); - s1 = - (Td4[byte(t1, 3)] & 0xff000000) ^ - (Td4[byte(t0, 2)] & 0x00ff0000) ^ - (Td4[byte(t3, 1)] & 0x0000ff00) ^ - (Td4[byte(t2, 0)] & 0x000000ff) ^ - rk[1]; - STORE32H(s1, pt+4); - s2 = - (Td4[byte(t2, 3)] & 0xff000000) ^ - (Td4[byte(t1, 2)] & 0x00ff0000) ^ - (Td4[byte(t0, 1)] & 0x0000ff00) ^ - (Td4[byte(t3, 0)] & 0x000000ff) ^ - rk[2]; - STORE32H(s2, pt+8); - s3 = - (Td4[byte(t3, 3)] & 0xff000000) ^ - (Td4[byte(t2, 2)] & 0x00ff0000) ^ - (Td4[byte(t1, 1)] & 0x0000ff00) ^ - (Td4[byte(t0, 0)] & 0x000000ff) ^ - rk[3]; - STORE32H(s3, pt+12); - - return CRYPT_OK; -} - - - -/** - Performs a self-test of the AES block cipher - @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled -*/ -int ECB_TEST(void) -{ - int err; - static const struct { - int keylen; - unsigned char key[32], pt[16], ct[16]; - } tests[] = { - { 16, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, - 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a } - }, { - 24, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, - 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 } - }, { - 32, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, - { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, - { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, - 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 } - } - }; - - symmetric_key key; - unsigned char tmp[2][16]; - int i, y; - - for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { - memset(&key, 0, sizeof(key)); - if ((err = rijndael_setup(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { - return err; - } - - rijndael_ecb_encrypt(tests[i].pt, tmp[0], &key); - rijndael_ecb_decrypt(tmp[0], tmp[1], &key); - if (XMEMCMP(tmp[0], tests[i].ct, 16) || XMEMCMP(tmp[1], tests[i].pt, 16)) { - return CRYPT_FAIL_TESTVECTOR; - } - - /* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */ - for (y = 0; y < 16; y++) tmp[0][y] = 0; - for (y = 0; y < 1000; y++) rijndael_ecb_encrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 1000; y++) rijndael_ecb_decrypt(tmp[0], tmp[0], &key); - for (y = 0; y < 16; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; - } - return CRYPT_OK; -} - - - -/** Terminate the context - @param skey The scheduled key -*/ -void ECB_DONE(symmetric_key *skey) -{ - (void)skey; -} - - -/** - Gets suitable key size - @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. - @return CRYPT_OK if the input key size is acceptable. -*/ -int ECB_KS(int *keysize) -{ - LTC_ARGCHK(keysize != NULL); - - if (*keysize < 16) - return CRYPT_INVALID_KEYSIZE; - if (*keysize < 24) { - *keysize = 16; - return CRYPT_OK; - } else if (*keysize < 32) { - *keysize = 24; - return CRYPT_OK; - } else { - *keysize = 32; - return CRYPT_OK; - } -} - - diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes_cbc.c b/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes_cbc.c deleted file mode 100644 index e9159024f6..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes_cbc.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ - -/* - aes_cbc.c - aes cbc mode functions - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include - -/** - Initialize a CBC context - @param cipher The index of the cipher desired - @param IV The initial vector - @param key The secret key - @param keylen The length of the secret key (octets) - @param num_rounds Number of rounds in the cipher desired (0 for default) - @param cbc The CBC state to initialize - @return CRYPT_OK if successful -*/ -//int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, -// int keylen, int num_rounds, symmetric_CBC *cbc) -int rijndael_cbc_start(const unsigned char *IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CBC *cbc) -{ - int x, err; - - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(cbc != NULL); - - /* bad param? */ - //if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { - // return err; - //} - - /* setup cipher */ - //if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &cbc->key)) != CRYPT_OK) { - // return err; - // } - if ((err = rijndael_setup(key, keylen, num_rounds, &cbc->key)) != CRYPT_OK) { - return err; - } - - /* copy IV */ - //cbc->blocklen = cipher_descriptor[cipher].block_length; - cbc->blocklen = rijndael_desc.block_length; - //cbc->cipher = cipher; - for (x = 0; x < cbc->blocklen; x++) { - cbc->IV[x] = IV[x]; - } - return CRYPT_OK; -} - - -/** - Set an initial vector - @param IV The initial vector - @param len The length of the vector (in octets) - @param cbc The CBC state - @return CRYPT_OK if successful -*/ -int rijndael_cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(cbc != NULL); - if (len != (unsigned long)cbc->blocklen) { - return CRYPT_INVALID_ARG; - } - XMEMCPY(cbc->IV, IV, len); - return CRYPT_OK; -} - - -/** - Get the current initial vector - @param IV [out] The destination of the initial vector - @param len [in/out] The max size and resulting size of the initial vector - @param cbc The CBC state - @return CRYPT_OK if successful -*/ -int rijndael_cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc) -{ - LTC_ARGCHK(IV != NULL); - LTC_ARGCHK(len != NULL); - LTC_ARGCHK(cbc != NULL); - if ((unsigned long)cbc->blocklen > *len) { - *len = cbc->blocklen; - return CRYPT_BUFFER_OVERFLOW; - } - XMEMCPY(IV, cbc->IV, cbc->blocklen); - *len = cbc->blocklen; - - return CRYPT_OK; -} - -#define LTC_FAST - -/** - CBC encrypt - @param pt Plaintext - @param ct [out] Ciphertext - @param len The number of bytes to process (must be multiple of block length) - @param cbc CBC state - @return CRYPT_OK if successful -*/ -int rijndael_cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc) -{ - int x, err; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cbc != NULL); - - //if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { - // return err; - // } - - /* is blocklen valid? */ - if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV)) { - return CRYPT_INVALID_ARG; - } - - if (len % cbc->blocklen) { - return CRYPT_INVALID_ARG; - } - - if (cbc->blocklen % sizeof(LTC_FAST_TYPE)) { - return CRYPT_INVALID_ARG; - } - - //if (cipher_descriptor[cbc->cipher].accel_cbc_encrypt != NULL) { - // return cipher_descriptor[cbc->cipher].accel_cbc_encrypt(pt, ct, len / cbc->blocklen, cbc->IV, &cbc->key); - //} else { - while (len) { - /* xor IV against plaintext */ - for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { - *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)cbc->IV + x)) ^= *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pt + x)); - } - - /* encrypt */ - if ((err = rijndael_ecb_encrypt(cbc->IV, ct, &cbc->key)) != CRYPT_OK) { - return err; - } - - /* store IV [ciphertext] for a future block */ - for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { - *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)cbc->IV + x)) = *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)ct + x)); - } - - ct += cbc->blocklen; - pt += cbc->blocklen; - len -= cbc->blocklen; - } - //} - return CRYPT_OK; -} - - -/** Terminate the chain - @param cbc The CBC chain to terminate - @return CRYPT_OK on success -*/ -int rijndael_cbc_done(symmetric_CBC *cbc) -{ - LTC_ARGCHK(cbc != NULL); - - //int err; - //if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { - // return err; - //} - //cipher_descriptor[cbc->cipher].done(&cbc->key); - rijndael_done(&cbc->key); - - return CRYPT_OK; -} - - -/** - CBC decrypt - @param ct Ciphertext - @param pt [out] Plaintext - @param len The number of bytes to process (must be multiple of block length) - @param cbc CBC state - @return CRYPT_OK if successful -*/ -int rijndael_cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc) -{ - int x, err; - unsigned char tmp[16]; - LTC_FAST_TYPE tmpy; - - LTC_ARGCHK(pt != NULL); - LTC_ARGCHK(ct != NULL); - LTC_ARGCHK(cbc != NULL); - - //if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { - // return err; - // } - - /* is blocklen valid? */ - if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV) || cbc->blocklen > (int)sizeof(tmp)) { - return CRYPT_INVALID_ARG; - } - - if (len % cbc->blocklen) { - return CRYPT_INVALID_ARG; - } - - if (cbc->blocklen % sizeof(LTC_FAST_TYPE)) { - return CRYPT_INVALID_ARG; - } - - //if (cipher_descriptor[cbc->cipher].accel_cbc_decrypt != NULL) { - // return cipher_descriptor[cbc->cipher].accel_cbc_decrypt(ct, pt, len / cbc->blocklen, cbc->IV, &cbc->key); - //} else { - while (len) { - /* decrypt */ - if ((err = rijndael_ecb_decrypt(ct, tmp, &cbc->key)) != CRYPT_OK) { - return err; - } - - /* xor IV against plaintext */ - for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { - tmpy = *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)cbc->IV + x)) ^ *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)tmp + x)); - *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)cbc->IV + x)) = *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)ct + x)); - *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pt + x)) = tmpy; - } - - ct += cbc->blocklen; - pt += cbc->blocklen; - len -= cbc->blocklen; - } - //} - return CRYPT_OK; -} diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes_tab.c b/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes_tab.c deleted file mode 100644 index cb09dde9c5..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/ciphers/aes/aes_tab.c +++ /dev/null @@ -1,1038 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org - */ -/* The precomputed tables for AES */ -/* -Te0[x] = S [x].[02, 01, 01, 03]; -Te1[x] = S [x].[03, 02, 01, 01]; -Te2[x] = S [x].[01, 03, 02, 01]; -Te3[x] = S [x].[01, 01, 03, 02]; -Te4[x] = S [x].[01, 01, 01, 01]; - -Td0[x] = Si[x].[0e, 09, 0d, 0b]; -Td1[x] = Si[x].[0b, 0e, 09, 0d]; -Td2[x] = Si[x].[0d, 0b, 0e, 09]; -Td3[x] = Si[x].[09, 0d, 0b, 0e]; -Td4[x] = Si[x].[01, 01, 01, 01]; -*/ - - -#include -#include -#include - - -/** - @file aes_tab.c - AES tables -*/ -const u32 TE0[256] = { - 0xc66363a5UL, 0xf87c7c84UL, 0xee777799UL, 0xf67b7b8dUL, - 0xfff2f20dUL, 0xd66b6bbdUL, 0xde6f6fb1UL, 0x91c5c554UL, - 0x60303050UL, 0x02010103UL, 0xce6767a9UL, 0x562b2b7dUL, - 0xe7fefe19UL, 0xb5d7d762UL, 0x4dababe6UL, 0xec76769aUL, - 0x8fcaca45UL, 0x1f82829dUL, 0x89c9c940UL, 0xfa7d7d87UL, - 0xeffafa15UL, 0xb25959ebUL, 0x8e4747c9UL, 0xfbf0f00bUL, - 0x41adadecUL, 0xb3d4d467UL, 0x5fa2a2fdUL, 0x45afafeaUL, - 0x239c9cbfUL, 0x53a4a4f7UL, 0xe4727296UL, 0x9bc0c05bUL, - 0x75b7b7c2UL, 0xe1fdfd1cUL, 0x3d9393aeUL, 0x4c26266aUL, - 0x6c36365aUL, 0x7e3f3f41UL, 0xf5f7f702UL, 0x83cccc4fUL, - 0x6834345cUL, 0x51a5a5f4UL, 0xd1e5e534UL, 0xf9f1f108UL, - 0xe2717193UL, 0xabd8d873UL, 0x62313153UL, 0x2a15153fUL, - 0x0804040cUL, 0x95c7c752UL, 0x46232365UL, 0x9dc3c35eUL, - 0x30181828UL, 0x379696a1UL, 0x0a05050fUL, 0x2f9a9ab5UL, - 0x0e070709UL, 0x24121236UL, 0x1b80809bUL, 0xdfe2e23dUL, - 0xcdebeb26UL, 0x4e272769UL, 0x7fb2b2cdUL, 0xea75759fUL, - 0x1209091bUL, 0x1d83839eUL, 0x582c2c74UL, 0x341a1a2eUL, - 0x361b1b2dUL, 0xdc6e6eb2UL, 0xb45a5aeeUL, 0x5ba0a0fbUL, - 0xa45252f6UL, 0x763b3b4dUL, 0xb7d6d661UL, 0x7db3b3ceUL, - 0x5229297bUL, 0xdde3e33eUL, 0x5e2f2f71UL, 0x13848497UL, - 0xa65353f5UL, 0xb9d1d168UL, 0x00000000UL, 0xc1eded2cUL, - 0x40202060UL, 0xe3fcfc1fUL, 0x79b1b1c8UL, 0xb65b5bedUL, - 0xd46a6abeUL, 0x8dcbcb46UL, 0x67bebed9UL, 0x7239394bUL, - 0x944a4adeUL, 0x984c4cd4UL, 0xb05858e8UL, 0x85cfcf4aUL, - 0xbbd0d06bUL, 0xc5efef2aUL, 0x4faaaae5UL, 0xedfbfb16UL, - 0x864343c5UL, 0x9a4d4dd7UL, 0x66333355UL, 0x11858594UL, - 0x8a4545cfUL, 0xe9f9f910UL, 0x04020206UL, 0xfe7f7f81UL, - 0xa05050f0UL, 0x783c3c44UL, 0x259f9fbaUL, 0x4ba8a8e3UL, - 0xa25151f3UL, 0x5da3a3feUL, 0x804040c0UL, 0x058f8f8aUL, - 0x3f9292adUL, 0x219d9dbcUL, 0x70383848UL, 0xf1f5f504UL, - 0x63bcbcdfUL, 0x77b6b6c1UL, 0xafdada75UL, 0x42212163UL, - 0x20101030UL, 0xe5ffff1aUL, 0xfdf3f30eUL, 0xbfd2d26dUL, - 0x81cdcd4cUL, 0x180c0c14UL, 0x26131335UL, 0xc3ecec2fUL, - 0xbe5f5fe1UL, 0x359797a2UL, 0x884444ccUL, 0x2e171739UL, - 0x93c4c457UL, 0x55a7a7f2UL, 0xfc7e7e82UL, 0x7a3d3d47UL, - 0xc86464acUL, 0xba5d5de7UL, 0x3219192bUL, 0xe6737395UL, - 0xc06060a0UL, 0x19818198UL, 0x9e4f4fd1UL, 0xa3dcdc7fUL, - 0x44222266UL, 0x542a2a7eUL, 0x3b9090abUL, 0x0b888883UL, - 0x8c4646caUL, 0xc7eeee29UL, 0x6bb8b8d3UL, 0x2814143cUL, - 0xa7dede79UL, 0xbc5e5ee2UL, 0x160b0b1dUL, 0xaddbdb76UL, - 0xdbe0e03bUL, 0x64323256UL, 0x743a3a4eUL, 0x140a0a1eUL, - 0x924949dbUL, 0x0c06060aUL, 0x4824246cUL, 0xb85c5ce4UL, - 0x9fc2c25dUL, 0xbdd3d36eUL, 0x43acacefUL, 0xc46262a6UL, - 0x399191a8UL, 0x319595a4UL, 0xd3e4e437UL, 0xf279798bUL, - 0xd5e7e732UL, 0x8bc8c843UL, 0x6e373759UL, 0xda6d6db7UL, - 0x018d8d8cUL, 0xb1d5d564UL, 0x9c4e4ed2UL, 0x49a9a9e0UL, - 0xd86c6cb4UL, 0xac5656faUL, 0xf3f4f407UL, 0xcfeaea25UL, - 0xca6565afUL, 0xf47a7a8eUL, 0x47aeaee9UL, 0x10080818UL, - 0x6fbabad5UL, 0xf0787888UL, 0x4a25256fUL, 0x5c2e2e72UL, - 0x381c1c24UL, 0x57a6a6f1UL, 0x73b4b4c7UL, 0x97c6c651UL, - 0xcbe8e823UL, 0xa1dddd7cUL, 0xe874749cUL, 0x3e1f1f21UL, - 0x964b4bddUL, 0x61bdbddcUL, 0x0d8b8b86UL, 0x0f8a8a85UL, - 0xe0707090UL, 0x7c3e3e42UL, 0x71b5b5c4UL, 0xcc6666aaUL, - 0x904848d8UL, 0x06030305UL, 0xf7f6f601UL, 0x1c0e0e12UL, - 0xc26161a3UL, 0x6a35355fUL, 0xae5757f9UL, 0x69b9b9d0UL, - 0x17868691UL, 0x99c1c158UL, 0x3a1d1d27UL, 0x279e9eb9UL, - 0xd9e1e138UL, 0xebf8f813UL, 0x2b9898b3UL, 0x22111133UL, - 0xd26969bbUL, 0xa9d9d970UL, 0x078e8e89UL, 0x339494a7UL, - 0x2d9b9bb6UL, 0x3c1e1e22UL, 0x15878792UL, 0xc9e9e920UL, - 0x87cece49UL, 0xaa5555ffUL, 0x50282878UL, 0xa5dfdf7aUL, - 0x038c8c8fUL, 0x59a1a1f8UL, 0x09898980UL, 0x1a0d0d17UL, - 0x65bfbfdaUL, 0xd7e6e631UL, 0x844242c6UL, 0xd06868b8UL, - 0x824141c3UL, 0x299999b0UL, 0x5a2d2d77UL, 0x1e0f0f11UL, - 0x7bb0b0cbUL, 0xa85454fcUL, 0x6dbbbbd6UL, 0x2c16163aUL, -}; - -const u32 Te4[256] = { - 0x63636363UL, 0x7c7c7c7cUL, 0x77777777UL, 0x7b7b7b7bUL, - 0xf2f2f2f2UL, 0x6b6b6b6bUL, 0x6f6f6f6fUL, 0xc5c5c5c5UL, - 0x30303030UL, 0x01010101UL, 0x67676767UL, 0x2b2b2b2bUL, - 0xfefefefeUL, 0xd7d7d7d7UL, 0xababababUL, 0x76767676UL, - 0xcacacacaUL, 0x82828282UL, 0xc9c9c9c9UL, 0x7d7d7d7dUL, - 0xfafafafaUL, 0x59595959UL, 0x47474747UL, 0xf0f0f0f0UL, - 0xadadadadUL, 0xd4d4d4d4UL, 0xa2a2a2a2UL, 0xafafafafUL, - 0x9c9c9c9cUL, 0xa4a4a4a4UL, 0x72727272UL, 0xc0c0c0c0UL, - 0xb7b7b7b7UL, 0xfdfdfdfdUL, 0x93939393UL, 0x26262626UL, - 0x36363636UL, 0x3f3f3f3fUL, 0xf7f7f7f7UL, 0xccccccccUL, - 0x34343434UL, 0xa5a5a5a5UL, 0xe5e5e5e5UL, 0xf1f1f1f1UL, - 0x71717171UL, 0xd8d8d8d8UL, 0x31313131UL, 0x15151515UL, - 0x04040404UL, 0xc7c7c7c7UL, 0x23232323UL, 0xc3c3c3c3UL, - 0x18181818UL, 0x96969696UL, 0x05050505UL, 0x9a9a9a9aUL, - 0x07070707UL, 0x12121212UL, 0x80808080UL, 0xe2e2e2e2UL, - 0xebebebebUL, 0x27272727UL, 0xb2b2b2b2UL, 0x75757575UL, - 0x09090909UL, 0x83838383UL, 0x2c2c2c2cUL, 0x1a1a1a1aUL, - 0x1b1b1b1bUL, 0x6e6e6e6eUL, 0x5a5a5a5aUL, 0xa0a0a0a0UL, - 0x52525252UL, 0x3b3b3b3bUL, 0xd6d6d6d6UL, 0xb3b3b3b3UL, - 0x29292929UL, 0xe3e3e3e3UL, 0x2f2f2f2fUL, 0x84848484UL, - 0x53535353UL, 0xd1d1d1d1UL, 0x00000000UL, 0xededededUL, - 0x20202020UL, 0xfcfcfcfcUL, 0xb1b1b1b1UL, 0x5b5b5b5bUL, - 0x6a6a6a6aUL, 0xcbcbcbcbUL, 0xbebebebeUL, 0x39393939UL, - 0x4a4a4a4aUL, 0x4c4c4c4cUL, 0x58585858UL, 0xcfcfcfcfUL, - 0xd0d0d0d0UL, 0xefefefefUL, 0xaaaaaaaaUL, 0xfbfbfbfbUL, - 0x43434343UL, 0x4d4d4d4dUL, 0x33333333UL, 0x85858585UL, - 0x45454545UL, 0xf9f9f9f9UL, 0x02020202UL, 0x7f7f7f7fUL, - 0x50505050UL, 0x3c3c3c3cUL, 0x9f9f9f9fUL, 0xa8a8a8a8UL, - 0x51515151UL, 0xa3a3a3a3UL, 0x40404040UL, 0x8f8f8f8fUL, - 0x92929292UL, 0x9d9d9d9dUL, 0x38383838UL, 0xf5f5f5f5UL, - 0xbcbcbcbcUL, 0xb6b6b6b6UL, 0xdadadadaUL, 0x21212121UL, - 0x10101010UL, 0xffffffffUL, 0xf3f3f3f3UL, 0xd2d2d2d2UL, - 0xcdcdcdcdUL, 0x0c0c0c0cUL, 0x13131313UL, 0xececececUL, - 0x5f5f5f5fUL, 0x97979797UL, 0x44444444UL, 0x17171717UL, - 0xc4c4c4c4UL, 0xa7a7a7a7UL, 0x7e7e7e7eUL, 0x3d3d3d3dUL, - 0x64646464UL, 0x5d5d5d5dUL, 0x19191919UL, 0x73737373UL, - 0x60606060UL, 0x81818181UL, 0x4f4f4f4fUL, 0xdcdcdcdcUL, - 0x22222222UL, 0x2a2a2a2aUL, 0x90909090UL, 0x88888888UL, - 0x46464646UL, 0xeeeeeeeeUL, 0xb8b8b8b8UL, 0x14141414UL, - 0xdedededeUL, 0x5e5e5e5eUL, 0x0b0b0b0bUL, 0xdbdbdbdbUL, - 0xe0e0e0e0UL, 0x32323232UL, 0x3a3a3a3aUL, 0x0a0a0a0aUL, - 0x49494949UL, 0x06060606UL, 0x24242424UL, 0x5c5c5c5cUL, - 0xc2c2c2c2UL, 0xd3d3d3d3UL, 0xacacacacUL, 0x62626262UL, - 0x91919191UL, 0x95959595UL, 0xe4e4e4e4UL, 0x79797979UL, - 0xe7e7e7e7UL, 0xc8c8c8c8UL, 0x37373737UL, 0x6d6d6d6dUL, - 0x8d8d8d8dUL, 0xd5d5d5d5UL, 0x4e4e4e4eUL, 0xa9a9a9a9UL, - 0x6c6c6c6cUL, 0x56565656UL, 0xf4f4f4f4UL, 0xeaeaeaeaUL, - 0x65656565UL, 0x7a7a7a7aUL, 0xaeaeaeaeUL, 0x08080808UL, - 0xbabababaUL, 0x78787878UL, 0x25252525UL, 0x2e2e2e2eUL, - 0x1c1c1c1cUL, 0xa6a6a6a6UL, 0xb4b4b4b4UL, 0xc6c6c6c6UL, - 0xe8e8e8e8UL, 0xddddddddUL, 0x74747474UL, 0x1f1f1f1fUL, - 0x4b4b4b4bUL, 0xbdbdbdbdUL, 0x8b8b8b8bUL, 0x8a8a8a8aUL, - 0x70707070UL, 0x3e3e3e3eUL, 0xb5b5b5b5UL, 0x66666666UL, - 0x48484848UL, 0x03030303UL, 0xf6f6f6f6UL, 0x0e0e0e0eUL, - 0x61616161UL, 0x35353535UL, 0x57575757UL, 0xb9b9b9b9UL, - 0x86868686UL, 0xc1c1c1c1UL, 0x1d1d1d1dUL, 0x9e9e9e9eUL, - 0xe1e1e1e1UL, 0xf8f8f8f8UL, 0x98989898UL, 0x11111111UL, - 0x69696969UL, 0xd9d9d9d9UL, 0x8e8e8e8eUL, 0x94949494UL, - 0x9b9b9b9bUL, 0x1e1e1e1eUL, 0x87878787UL, 0xe9e9e9e9UL, - 0xcecececeUL, 0x55555555UL, 0x28282828UL, 0xdfdfdfdfUL, - 0x8c8c8c8cUL, 0xa1a1a1a1UL, 0x89898989UL, 0x0d0d0d0dUL, - 0xbfbfbfbfUL, 0xe6e6e6e6UL, 0x42424242UL, 0x68686868UL, - 0x41414141UL, 0x99999999UL, 0x2d2d2d2dUL, 0x0f0f0f0fUL, - 0xb0b0b0b0UL, 0x54545454UL, 0xbbbbbbbbUL, 0x16161616UL, -}; - - -const u32 TD0[256] = { - 0x51f4a750UL, 0x7e416553UL, 0x1a17a4c3UL, 0x3a275e96UL, - 0x3bab6bcbUL, 0x1f9d45f1UL, 0xacfa58abUL, 0x4be30393UL, - 0x2030fa55UL, 0xad766df6UL, 0x88cc7691UL, 0xf5024c25UL, - 0x4fe5d7fcUL, 0xc52acbd7UL, 0x26354480UL, 0xb562a38fUL, - 0xdeb15a49UL, 0x25ba1b67UL, 0x45ea0e98UL, 0x5dfec0e1UL, - 0xc32f7502UL, 0x814cf012UL, 0x8d4697a3UL, 0x6bd3f9c6UL, - 0x038f5fe7UL, 0x15929c95UL, 0xbf6d7aebUL, 0x955259daUL, - 0xd4be832dUL, 0x587421d3UL, 0x49e06929UL, 0x8ec9c844UL, - 0x75c2896aUL, 0xf48e7978UL, 0x99583e6bUL, 0x27b971ddUL, - 0xbee14fb6UL, 0xf088ad17UL, 0xc920ac66UL, 0x7dce3ab4UL, - 0x63df4a18UL, 0xe51a3182UL, 0x97513360UL, 0x62537f45UL, - 0xb16477e0UL, 0xbb6bae84UL, 0xfe81a01cUL, 0xf9082b94UL, - 0x70486858UL, 0x8f45fd19UL, 0x94de6c87UL, 0x527bf8b7UL, - 0xab73d323UL, 0x724b02e2UL, 0xe31f8f57UL, 0x6655ab2aUL, - 0xb2eb2807UL, 0x2fb5c203UL, 0x86c57b9aUL, 0xd33708a5UL, - 0x302887f2UL, 0x23bfa5b2UL, 0x02036abaUL, 0xed16825cUL, - 0x8acf1c2bUL, 0xa779b492UL, 0xf307f2f0UL, 0x4e69e2a1UL, - 0x65daf4cdUL, 0x0605bed5UL, 0xd134621fUL, 0xc4a6fe8aUL, - 0x342e539dUL, 0xa2f355a0UL, 0x058ae132UL, 0xa4f6eb75UL, - 0x0b83ec39UL, 0x4060efaaUL, 0x5e719f06UL, 0xbd6e1051UL, - 0x3e218af9UL, 0x96dd063dUL, 0xdd3e05aeUL, 0x4de6bd46UL, - 0x91548db5UL, 0x71c45d05UL, 0x0406d46fUL, 0x605015ffUL, - 0x1998fb24UL, 0xd6bde997UL, 0x894043ccUL, 0x67d99e77UL, - 0xb0e842bdUL, 0x07898b88UL, 0xe7195b38UL, 0x79c8eedbUL, - 0xa17c0a47UL, 0x7c420fe9UL, 0xf8841ec9UL, 0x00000000UL, - 0x09808683UL, 0x322bed48UL, 0x1e1170acUL, 0x6c5a724eUL, - 0xfd0efffbUL, 0x0f853856UL, 0x3daed51eUL, 0x362d3927UL, - 0x0a0fd964UL, 0x685ca621UL, 0x9b5b54d1UL, 0x24362e3aUL, - 0x0c0a67b1UL, 0x9357e70fUL, 0xb4ee96d2UL, 0x1b9b919eUL, - 0x80c0c54fUL, 0x61dc20a2UL, 0x5a774b69UL, 0x1c121a16UL, - 0xe293ba0aUL, 0xc0a02ae5UL, 0x3c22e043UL, 0x121b171dUL, - 0x0e090d0bUL, 0xf28bc7adUL, 0x2db6a8b9UL, 0x141ea9c8UL, - 0x57f11985UL, 0xaf75074cUL, 0xee99ddbbUL, 0xa37f60fdUL, - 0xf701269fUL, 0x5c72f5bcUL, 0x44663bc5UL, 0x5bfb7e34UL, - 0x8b432976UL, 0xcb23c6dcUL, 0xb6edfc68UL, 0xb8e4f163UL, - 0xd731dccaUL, 0x42638510UL, 0x13972240UL, 0x84c61120UL, - 0x854a247dUL, 0xd2bb3df8UL, 0xaef93211UL, 0xc729a16dUL, - 0x1d9e2f4bUL, 0xdcb230f3UL, 0x0d8652ecUL, 0x77c1e3d0UL, - 0x2bb3166cUL, 0xa970b999UL, 0x119448faUL, 0x47e96422UL, - 0xa8fc8cc4UL, 0xa0f03f1aUL, 0x567d2cd8UL, 0x223390efUL, - 0x87494ec7UL, 0xd938d1c1UL, 0x8ccaa2feUL, 0x98d40b36UL, - 0xa6f581cfUL, 0xa57ade28UL, 0xdab78e26UL, 0x3fadbfa4UL, - 0x2c3a9de4UL, 0x5078920dUL, 0x6a5fcc9bUL, 0x547e4662UL, - 0xf68d13c2UL, 0x90d8b8e8UL, 0x2e39f75eUL, 0x82c3aff5UL, - 0x9f5d80beUL, 0x69d0937cUL, 0x6fd52da9UL, 0xcf2512b3UL, - 0xc8ac993bUL, 0x10187da7UL, 0xe89c636eUL, 0xdb3bbb7bUL, - 0xcd267809UL, 0x6e5918f4UL, 0xec9ab701UL, 0x834f9aa8UL, - 0xe6956e65UL, 0xaaffe67eUL, 0x21bccf08UL, 0xef15e8e6UL, - 0xbae79bd9UL, 0x4a6f36ceUL, 0xea9f09d4UL, 0x29b07cd6UL, - 0x31a4b2afUL, 0x2a3f2331UL, 0xc6a59430UL, 0x35a266c0UL, - 0x744ebc37UL, 0xfc82caa6UL, 0xe090d0b0UL, 0x33a7d815UL, - 0xf104984aUL, 0x41ecdaf7UL, 0x7fcd500eUL, 0x1791f62fUL, - 0x764dd68dUL, 0x43efb04dUL, 0xccaa4d54UL, 0xe49604dfUL, - 0x9ed1b5e3UL, 0x4c6a881bUL, 0xc12c1fb8UL, 0x4665517fUL, - 0x9d5eea04UL, 0x018c355dUL, 0xfa877473UL, 0xfb0b412eUL, - 0xb3671d5aUL, 0x92dbd252UL, 0xe9105633UL, 0x6dd64713UL, - 0x9ad7618cUL, 0x37a10c7aUL, 0x59f8148eUL, 0xeb133c89UL, - 0xcea927eeUL, 0xb761c935UL, 0xe11ce5edUL, 0x7a47b13cUL, - 0x9cd2df59UL, 0x55f2733fUL, 0x1814ce79UL, 0x73c737bfUL, - 0x53f7cdeaUL, 0x5ffdaa5bUL, 0xdf3d6f14UL, 0x7844db86UL, - 0xcaaff381UL, 0xb968c43eUL, 0x3824342cUL, 0xc2a3405fUL, - 0x161dc372UL, 0xbce2250cUL, 0x283c498bUL, 0xff0d9541UL, - 0x39a80171UL, 0x080cb3deUL, 0xd8b4e49cUL, 0x6456c190UL, - 0x7bcb8461UL, 0xd532b670UL, 0x486c5c74UL, 0xd0b85742UL, -}; - -const u32 Td4[256] = { - 0x52525252UL, 0x09090909UL, 0x6a6a6a6aUL, 0xd5d5d5d5UL, - 0x30303030UL, 0x36363636UL, 0xa5a5a5a5UL, 0x38383838UL, - 0xbfbfbfbfUL, 0x40404040UL, 0xa3a3a3a3UL, 0x9e9e9e9eUL, - 0x81818181UL, 0xf3f3f3f3UL, 0xd7d7d7d7UL, 0xfbfbfbfbUL, - 0x7c7c7c7cUL, 0xe3e3e3e3UL, 0x39393939UL, 0x82828282UL, - 0x9b9b9b9bUL, 0x2f2f2f2fUL, 0xffffffffUL, 0x87878787UL, - 0x34343434UL, 0x8e8e8e8eUL, 0x43434343UL, 0x44444444UL, - 0xc4c4c4c4UL, 0xdedededeUL, 0xe9e9e9e9UL, 0xcbcbcbcbUL, - 0x54545454UL, 0x7b7b7b7bUL, 0x94949494UL, 0x32323232UL, - 0xa6a6a6a6UL, 0xc2c2c2c2UL, 0x23232323UL, 0x3d3d3d3dUL, - 0xeeeeeeeeUL, 0x4c4c4c4cUL, 0x95959595UL, 0x0b0b0b0bUL, - 0x42424242UL, 0xfafafafaUL, 0xc3c3c3c3UL, 0x4e4e4e4eUL, - 0x08080808UL, 0x2e2e2e2eUL, 0xa1a1a1a1UL, 0x66666666UL, - 0x28282828UL, 0xd9d9d9d9UL, 0x24242424UL, 0xb2b2b2b2UL, - 0x76767676UL, 0x5b5b5b5bUL, 0xa2a2a2a2UL, 0x49494949UL, - 0x6d6d6d6dUL, 0x8b8b8b8bUL, 0xd1d1d1d1UL, 0x25252525UL, - 0x72727272UL, 0xf8f8f8f8UL, 0xf6f6f6f6UL, 0x64646464UL, - 0x86868686UL, 0x68686868UL, 0x98989898UL, 0x16161616UL, - 0xd4d4d4d4UL, 0xa4a4a4a4UL, 0x5c5c5c5cUL, 0xccccccccUL, - 0x5d5d5d5dUL, 0x65656565UL, 0xb6b6b6b6UL, 0x92929292UL, - 0x6c6c6c6cUL, 0x70707070UL, 0x48484848UL, 0x50505050UL, - 0xfdfdfdfdUL, 0xededededUL, 0xb9b9b9b9UL, 0xdadadadaUL, - 0x5e5e5e5eUL, 0x15151515UL, 0x46464646UL, 0x57575757UL, - 0xa7a7a7a7UL, 0x8d8d8d8dUL, 0x9d9d9d9dUL, 0x84848484UL, - 0x90909090UL, 0xd8d8d8d8UL, 0xababababUL, 0x00000000UL, - 0x8c8c8c8cUL, 0xbcbcbcbcUL, 0xd3d3d3d3UL, 0x0a0a0a0aUL, - 0xf7f7f7f7UL, 0xe4e4e4e4UL, 0x58585858UL, 0x05050505UL, - 0xb8b8b8b8UL, 0xb3b3b3b3UL, 0x45454545UL, 0x06060606UL, - 0xd0d0d0d0UL, 0x2c2c2c2cUL, 0x1e1e1e1eUL, 0x8f8f8f8fUL, - 0xcacacacaUL, 0x3f3f3f3fUL, 0x0f0f0f0fUL, 0x02020202UL, - 0xc1c1c1c1UL, 0xafafafafUL, 0xbdbdbdbdUL, 0x03030303UL, - 0x01010101UL, 0x13131313UL, 0x8a8a8a8aUL, 0x6b6b6b6bUL, - 0x3a3a3a3aUL, 0x91919191UL, 0x11111111UL, 0x41414141UL, - 0x4f4f4f4fUL, 0x67676767UL, 0xdcdcdcdcUL, 0xeaeaeaeaUL, - 0x97979797UL, 0xf2f2f2f2UL, 0xcfcfcfcfUL, 0xcecececeUL, - 0xf0f0f0f0UL, 0xb4b4b4b4UL, 0xe6e6e6e6UL, 0x73737373UL, - 0x96969696UL, 0xacacacacUL, 0x74747474UL, 0x22222222UL, - 0xe7e7e7e7UL, 0xadadadadUL, 0x35353535UL, 0x85858585UL, - 0xe2e2e2e2UL, 0xf9f9f9f9UL, 0x37373737UL, 0xe8e8e8e8UL, - 0x1c1c1c1cUL, 0x75757575UL, 0xdfdfdfdfUL, 0x6e6e6e6eUL, - 0x47474747UL, 0xf1f1f1f1UL, 0x1a1a1a1aUL, 0x71717171UL, - 0x1d1d1d1dUL, 0x29292929UL, 0xc5c5c5c5UL, 0x89898989UL, - 0x6f6f6f6fUL, 0xb7b7b7b7UL, 0x62626262UL, 0x0e0e0e0eUL, - 0xaaaaaaaaUL, 0x18181818UL, 0xbebebebeUL, 0x1b1b1b1bUL, - 0xfcfcfcfcUL, 0x56565656UL, 0x3e3e3e3eUL, 0x4b4b4b4bUL, - 0xc6c6c6c6UL, 0xd2d2d2d2UL, 0x79797979UL, 0x20202020UL, - 0x9a9a9a9aUL, 0xdbdbdbdbUL, 0xc0c0c0c0UL, 0xfefefefeUL, - 0x78787878UL, 0xcdcdcdcdUL, 0x5a5a5a5aUL, 0xf4f4f4f4UL, - 0x1f1f1f1fUL, 0xddddddddUL, 0xa8a8a8a8UL, 0x33333333UL, - 0x88888888UL, 0x07070707UL, 0xc7c7c7c7UL, 0x31313131UL, - 0xb1b1b1b1UL, 0x12121212UL, 0x10101010UL, 0x59595959UL, - 0x27272727UL, 0x80808080UL, 0xececececUL, 0x5f5f5f5fUL, - 0x60606060UL, 0x51515151UL, 0x7f7f7f7fUL, 0xa9a9a9a9UL, - 0x19191919UL, 0xb5b5b5b5UL, 0x4a4a4a4aUL, 0x0d0d0d0dUL, - 0x2d2d2d2dUL, 0xe5e5e5e5UL, 0x7a7a7a7aUL, 0x9f9f9f9fUL, - 0x93939393UL, 0xc9c9c9c9UL, 0x9c9c9c9cUL, 0xefefefefUL, - 0xa0a0a0a0UL, 0xe0e0e0e0UL, 0x3b3b3b3bUL, 0x4d4d4d4dUL, - 0xaeaeaeaeUL, 0x2a2a2a2aUL, 0xf5f5f5f5UL, 0xb0b0b0b0UL, - 0xc8c8c8c8UL, 0xebebebebUL, 0xbbbbbbbbUL, 0x3c3c3c3cUL, - 0x83838383UL, 0x53535353UL, 0x99999999UL, 0x61616161UL, - 0x17171717UL, 0x2b2b2b2bUL, 0x04040404UL, 0x7e7e7e7eUL, - 0xbabababaUL, 0x77777777UL, 0xd6d6d6d6UL, 0x26262626UL, - 0xe1e1e1e1UL, 0x69696969UL, 0x14141414UL, 0x63636363UL, - 0x55555555UL, 0x21212121UL, 0x0c0c0c0cUL, 0x7d7d7d7dUL, -}; - - - -#define Te0(x) TE0[x] -#define Te1(x) TE1[x] -#define Te2(x) TE2[x] -#define Te3(x) TE3[x] - -#define Td0(x) TD0[x] -#define Td1(x) TD1[x] -#define Td2(x) TD2[x] -#define Td3(x) TD3[x] - -const u32 TE1[256] = { - 0xa5c66363UL, 0x84f87c7cUL, 0x99ee7777UL, 0x8df67b7bUL, - 0x0dfff2f2UL, 0xbdd66b6bUL, 0xb1de6f6fUL, 0x5491c5c5UL, - 0x50603030UL, 0x03020101UL, 0xa9ce6767UL, 0x7d562b2bUL, - 0x19e7fefeUL, 0x62b5d7d7UL, 0xe64dababUL, 0x9aec7676UL, - 0x458fcacaUL, 0x9d1f8282UL, 0x4089c9c9UL, 0x87fa7d7dUL, - 0x15effafaUL, 0xebb25959UL, 0xc98e4747UL, 0x0bfbf0f0UL, - 0xec41adadUL, 0x67b3d4d4UL, 0xfd5fa2a2UL, 0xea45afafUL, - 0xbf239c9cUL, 0xf753a4a4UL, 0x96e47272UL, 0x5b9bc0c0UL, - 0xc275b7b7UL, 0x1ce1fdfdUL, 0xae3d9393UL, 0x6a4c2626UL, - 0x5a6c3636UL, 0x417e3f3fUL, 0x02f5f7f7UL, 0x4f83ccccUL, - 0x5c683434UL, 0xf451a5a5UL, 0x34d1e5e5UL, 0x08f9f1f1UL, - 0x93e27171UL, 0x73abd8d8UL, 0x53623131UL, 0x3f2a1515UL, - 0x0c080404UL, 0x5295c7c7UL, 0x65462323UL, 0x5e9dc3c3UL, - 0x28301818UL, 0xa1379696UL, 0x0f0a0505UL, 0xb52f9a9aUL, - 0x090e0707UL, 0x36241212UL, 0x9b1b8080UL, 0x3ddfe2e2UL, - 0x26cdebebUL, 0x694e2727UL, 0xcd7fb2b2UL, 0x9fea7575UL, - 0x1b120909UL, 0x9e1d8383UL, 0x74582c2cUL, 0x2e341a1aUL, - 0x2d361b1bUL, 0xb2dc6e6eUL, 0xeeb45a5aUL, 0xfb5ba0a0UL, - 0xf6a45252UL, 0x4d763b3bUL, 0x61b7d6d6UL, 0xce7db3b3UL, - 0x7b522929UL, 0x3edde3e3UL, 0x715e2f2fUL, 0x97138484UL, - 0xf5a65353UL, 0x68b9d1d1UL, 0x00000000UL, 0x2cc1ededUL, - 0x60402020UL, 0x1fe3fcfcUL, 0xc879b1b1UL, 0xedb65b5bUL, - 0xbed46a6aUL, 0x468dcbcbUL, 0xd967bebeUL, 0x4b723939UL, - 0xde944a4aUL, 0xd4984c4cUL, 0xe8b05858UL, 0x4a85cfcfUL, - 0x6bbbd0d0UL, 0x2ac5efefUL, 0xe54faaaaUL, 0x16edfbfbUL, - 0xc5864343UL, 0xd79a4d4dUL, 0x55663333UL, 0x94118585UL, - 0xcf8a4545UL, 0x10e9f9f9UL, 0x06040202UL, 0x81fe7f7fUL, - 0xf0a05050UL, 0x44783c3cUL, 0xba259f9fUL, 0xe34ba8a8UL, - 0xf3a25151UL, 0xfe5da3a3UL, 0xc0804040UL, 0x8a058f8fUL, - 0xad3f9292UL, 0xbc219d9dUL, 0x48703838UL, 0x04f1f5f5UL, - 0xdf63bcbcUL, 0xc177b6b6UL, 0x75afdadaUL, 0x63422121UL, - 0x30201010UL, 0x1ae5ffffUL, 0x0efdf3f3UL, 0x6dbfd2d2UL, - 0x4c81cdcdUL, 0x14180c0cUL, 0x35261313UL, 0x2fc3ececUL, - 0xe1be5f5fUL, 0xa2359797UL, 0xcc884444UL, 0x392e1717UL, - 0x5793c4c4UL, 0xf255a7a7UL, 0x82fc7e7eUL, 0x477a3d3dUL, - 0xacc86464UL, 0xe7ba5d5dUL, 0x2b321919UL, 0x95e67373UL, - 0xa0c06060UL, 0x98198181UL, 0xd19e4f4fUL, 0x7fa3dcdcUL, - 0x66442222UL, 0x7e542a2aUL, 0xab3b9090UL, 0x830b8888UL, - 0xca8c4646UL, 0x29c7eeeeUL, 0xd36bb8b8UL, 0x3c281414UL, - 0x79a7dedeUL, 0xe2bc5e5eUL, 0x1d160b0bUL, 0x76addbdbUL, - 0x3bdbe0e0UL, 0x56643232UL, 0x4e743a3aUL, 0x1e140a0aUL, - 0xdb924949UL, 0x0a0c0606UL, 0x6c482424UL, 0xe4b85c5cUL, - 0x5d9fc2c2UL, 0x6ebdd3d3UL, 0xef43acacUL, 0xa6c46262UL, - 0xa8399191UL, 0xa4319595UL, 0x37d3e4e4UL, 0x8bf27979UL, - 0x32d5e7e7UL, 0x438bc8c8UL, 0x596e3737UL, 0xb7da6d6dUL, - 0x8c018d8dUL, 0x64b1d5d5UL, 0xd29c4e4eUL, 0xe049a9a9UL, - 0xb4d86c6cUL, 0xfaac5656UL, 0x07f3f4f4UL, 0x25cfeaeaUL, - 0xafca6565UL, 0x8ef47a7aUL, 0xe947aeaeUL, 0x18100808UL, - 0xd56fbabaUL, 0x88f07878UL, 0x6f4a2525UL, 0x725c2e2eUL, - 0x24381c1cUL, 0xf157a6a6UL, 0xc773b4b4UL, 0x5197c6c6UL, - 0x23cbe8e8UL, 0x7ca1ddddUL, 0x9ce87474UL, 0x213e1f1fUL, - 0xdd964b4bUL, 0xdc61bdbdUL, 0x860d8b8bUL, 0x850f8a8aUL, - 0x90e07070UL, 0x427c3e3eUL, 0xc471b5b5UL, 0xaacc6666UL, - 0xd8904848UL, 0x05060303UL, 0x01f7f6f6UL, 0x121c0e0eUL, - 0xa3c26161UL, 0x5f6a3535UL, 0xf9ae5757UL, 0xd069b9b9UL, - 0x91178686UL, 0x5899c1c1UL, 0x273a1d1dUL, 0xb9279e9eUL, - 0x38d9e1e1UL, 0x13ebf8f8UL, 0xb32b9898UL, 0x33221111UL, - 0xbbd26969UL, 0x70a9d9d9UL, 0x89078e8eUL, 0xa7339494UL, - 0xb62d9b9bUL, 0x223c1e1eUL, 0x92158787UL, 0x20c9e9e9UL, - 0x4987ceceUL, 0xffaa5555UL, 0x78502828UL, 0x7aa5dfdfUL, - 0x8f038c8cUL, 0xf859a1a1UL, 0x80098989UL, 0x171a0d0dUL, - 0xda65bfbfUL, 0x31d7e6e6UL, 0xc6844242UL, 0xb8d06868UL, - 0xc3824141UL, 0xb0299999UL, 0x775a2d2dUL, 0x111e0f0fUL, - 0xcb7bb0b0UL, 0xfca85454UL, 0xd66dbbbbUL, 0x3a2c1616UL, -}; -const u32 TE2[256] = { - 0x63a5c663UL, 0x7c84f87cUL, 0x7799ee77UL, 0x7b8df67bUL, - 0xf20dfff2UL, 0x6bbdd66bUL, 0x6fb1de6fUL, 0xc55491c5UL, - 0x30506030UL, 0x01030201UL, 0x67a9ce67UL, 0x2b7d562bUL, - 0xfe19e7feUL, 0xd762b5d7UL, 0xabe64dabUL, 0x769aec76UL, - 0xca458fcaUL, 0x829d1f82UL, 0xc94089c9UL, 0x7d87fa7dUL, - 0xfa15effaUL, 0x59ebb259UL, 0x47c98e47UL, 0xf00bfbf0UL, - 0xadec41adUL, 0xd467b3d4UL, 0xa2fd5fa2UL, 0xafea45afUL, - 0x9cbf239cUL, 0xa4f753a4UL, 0x7296e472UL, 0xc05b9bc0UL, - 0xb7c275b7UL, 0xfd1ce1fdUL, 0x93ae3d93UL, 0x266a4c26UL, - 0x365a6c36UL, 0x3f417e3fUL, 0xf702f5f7UL, 0xcc4f83ccUL, - 0x345c6834UL, 0xa5f451a5UL, 0xe534d1e5UL, 0xf108f9f1UL, - 0x7193e271UL, 0xd873abd8UL, 0x31536231UL, 0x153f2a15UL, - 0x040c0804UL, 0xc75295c7UL, 0x23654623UL, 0xc35e9dc3UL, - 0x18283018UL, 0x96a13796UL, 0x050f0a05UL, 0x9ab52f9aUL, - 0x07090e07UL, 0x12362412UL, 0x809b1b80UL, 0xe23ddfe2UL, - 0xeb26cdebUL, 0x27694e27UL, 0xb2cd7fb2UL, 0x759fea75UL, - 0x091b1209UL, 0x839e1d83UL, 0x2c74582cUL, 0x1a2e341aUL, - 0x1b2d361bUL, 0x6eb2dc6eUL, 0x5aeeb45aUL, 0xa0fb5ba0UL, - 0x52f6a452UL, 0x3b4d763bUL, 0xd661b7d6UL, 0xb3ce7db3UL, - 0x297b5229UL, 0xe33edde3UL, 0x2f715e2fUL, 0x84971384UL, - 0x53f5a653UL, 0xd168b9d1UL, 0x00000000UL, 0xed2cc1edUL, - 0x20604020UL, 0xfc1fe3fcUL, 0xb1c879b1UL, 0x5bedb65bUL, - 0x6abed46aUL, 0xcb468dcbUL, 0xbed967beUL, 0x394b7239UL, - 0x4ade944aUL, 0x4cd4984cUL, 0x58e8b058UL, 0xcf4a85cfUL, - 0xd06bbbd0UL, 0xef2ac5efUL, 0xaae54faaUL, 0xfb16edfbUL, - 0x43c58643UL, 0x4dd79a4dUL, 0x33556633UL, 0x85941185UL, - 0x45cf8a45UL, 0xf910e9f9UL, 0x02060402UL, 0x7f81fe7fUL, - 0x50f0a050UL, 0x3c44783cUL, 0x9fba259fUL, 0xa8e34ba8UL, - 0x51f3a251UL, 0xa3fe5da3UL, 0x40c08040UL, 0x8f8a058fUL, - 0x92ad3f92UL, 0x9dbc219dUL, 0x38487038UL, 0xf504f1f5UL, - 0xbcdf63bcUL, 0xb6c177b6UL, 0xda75afdaUL, 0x21634221UL, - 0x10302010UL, 0xff1ae5ffUL, 0xf30efdf3UL, 0xd26dbfd2UL, - 0xcd4c81cdUL, 0x0c14180cUL, 0x13352613UL, 0xec2fc3ecUL, - 0x5fe1be5fUL, 0x97a23597UL, 0x44cc8844UL, 0x17392e17UL, - 0xc45793c4UL, 0xa7f255a7UL, 0x7e82fc7eUL, 0x3d477a3dUL, - 0x64acc864UL, 0x5de7ba5dUL, 0x192b3219UL, 0x7395e673UL, - 0x60a0c060UL, 0x81981981UL, 0x4fd19e4fUL, 0xdc7fa3dcUL, - 0x22664422UL, 0x2a7e542aUL, 0x90ab3b90UL, 0x88830b88UL, - 0x46ca8c46UL, 0xee29c7eeUL, 0xb8d36bb8UL, 0x143c2814UL, - 0xde79a7deUL, 0x5ee2bc5eUL, 0x0b1d160bUL, 0xdb76addbUL, - 0xe03bdbe0UL, 0x32566432UL, 0x3a4e743aUL, 0x0a1e140aUL, - 0x49db9249UL, 0x060a0c06UL, 0x246c4824UL, 0x5ce4b85cUL, - 0xc25d9fc2UL, 0xd36ebdd3UL, 0xacef43acUL, 0x62a6c462UL, - 0x91a83991UL, 0x95a43195UL, 0xe437d3e4UL, 0x798bf279UL, - 0xe732d5e7UL, 0xc8438bc8UL, 0x37596e37UL, 0x6db7da6dUL, - 0x8d8c018dUL, 0xd564b1d5UL, 0x4ed29c4eUL, 0xa9e049a9UL, - 0x6cb4d86cUL, 0x56faac56UL, 0xf407f3f4UL, 0xea25cfeaUL, - 0x65afca65UL, 0x7a8ef47aUL, 0xaee947aeUL, 0x08181008UL, - 0xbad56fbaUL, 0x7888f078UL, 0x256f4a25UL, 0x2e725c2eUL, - 0x1c24381cUL, 0xa6f157a6UL, 0xb4c773b4UL, 0xc65197c6UL, - 0xe823cbe8UL, 0xdd7ca1ddUL, 0x749ce874UL, 0x1f213e1fUL, - 0x4bdd964bUL, 0xbddc61bdUL, 0x8b860d8bUL, 0x8a850f8aUL, - 0x7090e070UL, 0x3e427c3eUL, 0xb5c471b5UL, 0x66aacc66UL, - 0x48d89048UL, 0x03050603UL, 0xf601f7f6UL, 0x0e121c0eUL, - 0x61a3c261UL, 0x355f6a35UL, 0x57f9ae57UL, 0xb9d069b9UL, - 0x86911786UL, 0xc15899c1UL, 0x1d273a1dUL, 0x9eb9279eUL, - 0xe138d9e1UL, 0xf813ebf8UL, 0x98b32b98UL, 0x11332211UL, - 0x69bbd269UL, 0xd970a9d9UL, 0x8e89078eUL, 0x94a73394UL, - 0x9bb62d9bUL, 0x1e223c1eUL, 0x87921587UL, 0xe920c9e9UL, - 0xce4987ceUL, 0x55ffaa55UL, 0x28785028UL, 0xdf7aa5dfUL, - 0x8c8f038cUL, 0xa1f859a1UL, 0x89800989UL, 0x0d171a0dUL, - 0xbfda65bfUL, 0xe631d7e6UL, 0x42c68442UL, 0x68b8d068UL, - 0x41c38241UL, 0x99b02999UL, 0x2d775a2dUL, 0x0f111e0fUL, - 0xb0cb7bb0UL, 0x54fca854UL, 0xbbd66dbbUL, 0x163a2c16UL, -}; -const u32 TE3[256] = { - - 0x6363a5c6UL, 0x7c7c84f8UL, 0x777799eeUL, 0x7b7b8df6UL, - 0xf2f20dffUL, 0x6b6bbdd6UL, 0x6f6fb1deUL, 0xc5c55491UL, - 0x30305060UL, 0x01010302UL, 0x6767a9ceUL, 0x2b2b7d56UL, - 0xfefe19e7UL, 0xd7d762b5UL, 0xababe64dUL, 0x76769aecUL, - 0xcaca458fUL, 0x82829d1fUL, 0xc9c94089UL, 0x7d7d87faUL, - 0xfafa15efUL, 0x5959ebb2UL, 0x4747c98eUL, 0xf0f00bfbUL, - 0xadadec41UL, 0xd4d467b3UL, 0xa2a2fd5fUL, 0xafafea45UL, - 0x9c9cbf23UL, 0xa4a4f753UL, 0x727296e4UL, 0xc0c05b9bUL, - 0xb7b7c275UL, 0xfdfd1ce1UL, 0x9393ae3dUL, 0x26266a4cUL, - 0x36365a6cUL, 0x3f3f417eUL, 0xf7f702f5UL, 0xcccc4f83UL, - 0x34345c68UL, 0xa5a5f451UL, 0xe5e534d1UL, 0xf1f108f9UL, - 0x717193e2UL, 0xd8d873abUL, 0x31315362UL, 0x15153f2aUL, - 0x04040c08UL, 0xc7c75295UL, 0x23236546UL, 0xc3c35e9dUL, - 0x18182830UL, 0x9696a137UL, 0x05050f0aUL, 0x9a9ab52fUL, - 0x0707090eUL, 0x12123624UL, 0x80809b1bUL, 0xe2e23ddfUL, - 0xebeb26cdUL, 0x2727694eUL, 0xb2b2cd7fUL, 0x75759feaUL, - 0x09091b12UL, 0x83839e1dUL, 0x2c2c7458UL, 0x1a1a2e34UL, - 0x1b1b2d36UL, 0x6e6eb2dcUL, 0x5a5aeeb4UL, 0xa0a0fb5bUL, - 0x5252f6a4UL, 0x3b3b4d76UL, 0xd6d661b7UL, 0xb3b3ce7dUL, - 0x29297b52UL, 0xe3e33eddUL, 0x2f2f715eUL, 0x84849713UL, - 0x5353f5a6UL, 0xd1d168b9UL, 0x00000000UL, 0xeded2cc1UL, - 0x20206040UL, 0xfcfc1fe3UL, 0xb1b1c879UL, 0x5b5bedb6UL, - 0x6a6abed4UL, 0xcbcb468dUL, 0xbebed967UL, 0x39394b72UL, - 0x4a4ade94UL, 0x4c4cd498UL, 0x5858e8b0UL, 0xcfcf4a85UL, - 0xd0d06bbbUL, 0xefef2ac5UL, 0xaaaae54fUL, 0xfbfb16edUL, - 0x4343c586UL, 0x4d4dd79aUL, 0x33335566UL, 0x85859411UL, - 0x4545cf8aUL, 0xf9f910e9UL, 0x02020604UL, 0x7f7f81feUL, - 0x5050f0a0UL, 0x3c3c4478UL, 0x9f9fba25UL, 0xa8a8e34bUL, - 0x5151f3a2UL, 0xa3a3fe5dUL, 0x4040c080UL, 0x8f8f8a05UL, - 0x9292ad3fUL, 0x9d9dbc21UL, 0x38384870UL, 0xf5f504f1UL, - 0xbcbcdf63UL, 0xb6b6c177UL, 0xdada75afUL, 0x21216342UL, - 0x10103020UL, 0xffff1ae5UL, 0xf3f30efdUL, 0xd2d26dbfUL, - 0xcdcd4c81UL, 0x0c0c1418UL, 0x13133526UL, 0xecec2fc3UL, - 0x5f5fe1beUL, 0x9797a235UL, 0x4444cc88UL, 0x1717392eUL, - 0xc4c45793UL, 0xa7a7f255UL, 0x7e7e82fcUL, 0x3d3d477aUL, - 0x6464acc8UL, 0x5d5de7baUL, 0x19192b32UL, 0x737395e6UL, - 0x6060a0c0UL, 0x81819819UL, 0x4f4fd19eUL, 0xdcdc7fa3UL, - 0x22226644UL, 0x2a2a7e54UL, 0x9090ab3bUL, 0x8888830bUL, - 0x4646ca8cUL, 0xeeee29c7UL, 0xb8b8d36bUL, 0x14143c28UL, - 0xdede79a7UL, 0x5e5ee2bcUL, 0x0b0b1d16UL, 0xdbdb76adUL, - 0xe0e03bdbUL, 0x32325664UL, 0x3a3a4e74UL, 0x0a0a1e14UL, - 0x4949db92UL, 0x06060a0cUL, 0x24246c48UL, 0x5c5ce4b8UL, - 0xc2c25d9fUL, 0xd3d36ebdUL, 0xacacef43UL, 0x6262a6c4UL, - 0x9191a839UL, 0x9595a431UL, 0xe4e437d3UL, 0x79798bf2UL, - 0xe7e732d5UL, 0xc8c8438bUL, 0x3737596eUL, 0x6d6db7daUL, - 0x8d8d8c01UL, 0xd5d564b1UL, 0x4e4ed29cUL, 0xa9a9e049UL, - 0x6c6cb4d8UL, 0x5656faacUL, 0xf4f407f3UL, 0xeaea25cfUL, - 0x6565afcaUL, 0x7a7a8ef4UL, 0xaeaee947UL, 0x08081810UL, - 0xbabad56fUL, 0x787888f0UL, 0x25256f4aUL, 0x2e2e725cUL, - 0x1c1c2438UL, 0xa6a6f157UL, 0xb4b4c773UL, 0xc6c65197UL, - 0xe8e823cbUL, 0xdddd7ca1UL, 0x74749ce8UL, 0x1f1f213eUL, - 0x4b4bdd96UL, 0xbdbddc61UL, 0x8b8b860dUL, 0x8a8a850fUL, - 0x707090e0UL, 0x3e3e427cUL, 0xb5b5c471UL, 0x6666aaccUL, - 0x4848d890UL, 0x03030506UL, 0xf6f601f7UL, 0x0e0e121cUL, - 0x6161a3c2UL, 0x35355f6aUL, 0x5757f9aeUL, 0xb9b9d069UL, - 0x86869117UL, 0xc1c15899UL, 0x1d1d273aUL, 0x9e9eb927UL, - 0xe1e138d9UL, 0xf8f813ebUL, 0x9898b32bUL, 0x11113322UL, - 0x6969bbd2UL, 0xd9d970a9UL, 0x8e8e8907UL, 0x9494a733UL, - 0x9b9bb62dUL, 0x1e1e223cUL, 0x87879215UL, 0xe9e920c9UL, - 0xcece4987UL, 0x5555ffaaUL, 0x28287850UL, 0xdfdf7aa5UL, - 0x8c8c8f03UL, 0xa1a1f859UL, 0x89898009UL, 0x0d0d171aUL, - 0xbfbfda65UL, 0xe6e631d7UL, 0x4242c684UL, 0x6868b8d0UL, - 0x4141c382UL, 0x9999b029UL, 0x2d2d775aUL, 0x0f0f111eUL, - 0xb0b0cb7bUL, 0x5454fca8UL, 0xbbbbd66dUL, 0x16163a2cUL, -}; - -const u32 Te4_0[] = { -0x00000063UL, 0x0000007cUL, 0x00000077UL, 0x0000007bUL, 0x000000f2UL, 0x0000006bUL, 0x0000006fUL, 0x000000c5UL, -0x00000030UL, 0x00000001UL, 0x00000067UL, 0x0000002bUL, 0x000000feUL, 0x000000d7UL, 0x000000abUL, 0x00000076UL, -0x000000caUL, 0x00000082UL, 0x000000c9UL, 0x0000007dUL, 0x000000faUL, 0x00000059UL, 0x00000047UL, 0x000000f0UL, -0x000000adUL, 0x000000d4UL, 0x000000a2UL, 0x000000afUL, 0x0000009cUL, 0x000000a4UL, 0x00000072UL, 0x000000c0UL, -0x000000b7UL, 0x000000fdUL, 0x00000093UL, 0x00000026UL, 0x00000036UL, 0x0000003fUL, 0x000000f7UL, 0x000000ccUL, -0x00000034UL, 0x000000a5UL, 0x000000e5UL, 0x000000f1UL, 0x00000071UL, 0x000000d8UL, 0x00000031UL, 0x00000015UL, -0x00000004UL, 0x000000c7UL, 0x00000023UL, 0x000000c3UL, 0x00000018UL, 0x00000096UL, 0x00000005UL, 0x0000009aUL, -0x00000007UL, 0x00000012UL, 0x00000080UL, 0x000000e2UL, 0x000000ebUL, 0x00000027UL, 0x000000b2UL, 0x00000075UL, -0x00000009UL, 0x00000083UL, 0x0000002cUL, 0x0000001aUL, 0x0000001bUL, 0x0000006eUL, 0x0000005aUL, 0x000000a0UL, -0x00000052UL, 0x0000003bUL, 0x000000d6UL, 0x000000b3UL, 0x00000029UL, 0x000000e3UL, 0x0000002fUL, 0x00000084UL, -0x00000053UL, 0x000000d1UL, 0x00000000UL, 0x000000edUL, 0x00000020UL, 0x000000fcUL, 0x000000b1UL, 0x0000005bUL, -0x0000006aUL, 0x000000cbUL, 0x000000beUL, 0x00000039UL, 0x0000004aUL, 0x0000004cUL, 0x00000058UL, 0x000000cfUL, -0x000000d0UL, 0x000000efUL, 0x000000aaUL, 0x000000fbUL, 0x00000043UL, 0x0000004dUL, 0x00000033UL, 0x00000085UL, -0x00000045UL, 0x000000f9UL, 0x00000002UL, 0x0000007fUL, 0x00000050UL, 0x0000003cUL, 0x0000009fUL, 0x000000a8UL, -0x00000051UL, 0x000000a3UL, 0x00000040UL, 0x0000008fUL, 0x00000092UL, 0x0000009dUL, 0x00000038UL, 0x000000f5UL, -0x000000bcUL, 0x000000b6UL, 0x000000daUL, 0x00000021UL, 0x00000010UL, 0x000000ffUL, 0x000000f3UL, 0x000000d2UL, -0x000000cdUL, 0x0000000cUL, 0x00000013UL, 0x000000ecUL, 0x0000005fUL, 0x00000097UL, 0x00000044UL, 0x00000017UL, -0x000000c4UL, 0x000000a7UL, 0x0000007eUL, 0x0000003dUL, 0x00000064UL, 0x0000005dUL, 0x00000019UL, 0x00000073UL, -0x00000060UL, 0x00000081UL, 0x0000004fUL, 0x000000dcUL, 0x00000022UL, 0x0000002aUL, 0x00000090UL, 0x00000088UL, -0x00000046UL, 0x000000eeUL, 0x000000b8UL, 0x00000014UL, 0x000000deUL, 0x0000005eUL, 0x0000000bUL, 0x000000dbUL, -0x000000e0UL, 0x00000032UL, 0x0000003aUL, 0x0000000aUL, 0x00000049UL, 0x00000006UL, 0x00000024UL, 0x0000005cUL, -0x000000c2UL, 0x000000d3UL, 0x000000acUL, 0x00000062UL, 0x00000091UL, 0x00000095UL, 0x000000e4UL, 0x00000079UL, -0x000000e7UL, 0x000000c8UL, 0x00000037UL, 0x0000006dUL, 0x0000008dUL, 0x000000d5UL, 0x0000004eUL, 0x000000a9UL, -0x0000006cUL, 0x00000056UL, 0x000000f4UL, 0x000000eaUL, 0x00000065UL, 0x0000007aUL, 0x000000aeUL, 0x00000008UL, -0x000000baUL, 0x00000078UL, 0x00000025UL, 0x0000002eUL, 0x0000001cUL, 0x000000a6UL, 0x000000b4UL, 0x000000c6UL, -0x000000e8UL, 0x000000ddUL, 0x00000074UL, 0x0000001fUL, 0x0000004bUL, 0x000000bdUL, 0x0000008bUL, 0x0000008aUL, -0x00000070UL, 0x0000003eUL, 0x000000b5UL, 0x00000066UL, 0x00000048UL, 0x00000003UL, 0x000000f6UL, 0x0000000eUL, -0x00000061UL, 0x00000035UL, 0x00000057UL, 0x000000b9UL, 0x00000086UL, 0x000000c1UL, 0x0000001dUL, 0x0000009eUL, -0x000000e1UL, 0x000000f8UL, 0x00000098UL, 0x00000011UL, 0x00000069UL, 0x000000d9UL, 0x0000008eUL, 0x00000094UL, -0x0000009bUL, 0x0000001eUL, 0x00000087UL, 0x000000e9UL, 0x000000ceUL, 0x00000055UL, 0x00000028UL, 0x000000dfUL, -0x0000008cUL, 0x000000a1UL, 0x00000089UL, 0x0000000dUL, 0x000000bfUL, 0x000000e6UL, 0x00000042UL, 0x00000068UL, -0x00000041UL, 0x00000099UL, 0x0000002dUL, 0x0000000fUL, 0x000000b0UL, 0x00000054UL, 0x000000bbUL, 0x00000016UL -}; - -const u32 Te4_1[] = { -0x00006300UL, 0x00007c00UL, 0x00007700UL, 0x00007b00UL, 0x0000f200UL, 0x00006b00UL, 0x00006f00UL, 0x0000c500UL, -0x00003000UL, 0x00000100UL, 0x00006700UL, 0x00002b00UL, 0x0000fe00UL, 0x0000d700UL, 0x0000ab00UL, 0x00007600UL, -0x0000ca00UL, 0x00008200UL, 0x0000c900UL, 0x00007d00UL, 0x0000fa00UL, 0x00005900UL, 0x00004700UL, 0x0000f000UL, -0x0000ad00UL, 0x0000d400UL, 0x0000a200UL, 0x0000af00UL, 0x00009c00UL, 0x0000a400UL, 0x00007200UL, 0x0000c000UL, -0x0000b700UL, 0x0000fd00UL, 0x00009300UL, 0x00002600UL, 0x00003600UL, 0x00003f00UL, 0x0000f700UL, 0x0000cc00UL, -0x00003400UL, 0x0000a500UL, 0x0000e500UL, 0x0000f100UL, 0x00007100UL, 0x0000d800UL, 0x00003100UL, 0x00001500UL, -0x00000400UL, 0x0000c700UL, 0x00002300UL, 0x0000c300UL, 0x00001800UL, 0x00009600UL, 0x00000500UL, 0x00009a00UL, -0x00000700UL, 0x00001200UL, 0x00008000UL, 0x0000e200UL, 0x0000eb00UL, 0x00002700UL, 0x0000b200UL, 0x00007500UL, -0x00000900UL, 0x00008300UL, 0x00002c00UL, 0x00001a00UL, 0x00001b00UL, 0x00006e00UL, 0x00005a00UL, 0x0000a000UL, -0x00005200UL, 0x00003b00UL, 0x0000d600UL, 0x0000b300UL, 0x00002900UL, 0x0000e300UL, 0x00002f00UL, 0x00008400UL, -0x00005300UL, 0x0000d100UL, 0x00000000UL, 0x0000ed00UL, 0x00002000UL, 0x0000fc00UL, 0x0000b100UL, 0x00005b00UL, -0x00006a00UL, 0x0000cb00UL, 0x0000be00UL, 0x00003900UL, 0x00004a00UL, 0x00004c00UL, 0x00005800UL, 0x0000cf00UL, -0x0000d000UL, 0x0000ef00UL, 0x0000aa00UL, 0x0000fb00UL, 0x00004300UL, 0x00004d00UL, 0x00003300UL, 0x00008500UL, -0x00004500UL, 0x0000f900UL, 0x00000200UL, 0x00007f00UL, 0x00005000UL, 0x00003c00UL, 0x00009f00UL, 0x0000a800UL, -0x00005100UL, 0x0000a300UL, 0x00004000UL, 0x00008f00UL, 0x00009200UL, 0x00009d00UL, 0x00003800UL, 0x0000f500UL, -0x0000bc00UL, 0x0000b600UL, 0x0000da00UL, 0x00002100UL, 0x00001000UL, 0x0000ff00UL, 0x0000f300UL, 0x0000d200UL, -0x0000cd00UL, 0x00000c00UL, 0x00001300UL, 0x0000ec00UL, 0x00005f00UL, 0x00009700UL, 0x00004400UL, 0x00001700UL, -0x0000c400UL, 0x0000a700UL, 0x00007e00UL, 0x00003d00UL, 0x00006400UL, 0x00005d00UL, 0x00001900UL, 0x00007300UL, -0x00006000UL, 0x00008100UL, 0x00004f00UL, 0x0000dc00UL, 0x00002200UL, 0x00002a00UL, 0x00009000UL, 0x00008800UL, -0x00004600UL, 0x0000ee00UL, 0x0000b800UL, 0x00001400UL, 0x0000de00UL, 0x00005e00UL, 0x00000b00UL, 0x0000db00UL, -0x0000e000UL, 0x00003200UL, 0x00003a00UL, 0x00000a00UL, 0x00004900UL, 0x00000600UL, 0x00002400UL, 0x00005c00UL, -0x0000c200UL, 0x0000d300UL, 0x0000ac00UL, 0x00006200UL, 0x00009100UL, 0x00009500UL, 0x0000e400UL, 0x00007900UL, -0x0000e700UL, 0x0000c800UL, 0x00003700UL, 0x00006d00UL, 0x00008d00UL, 0x0000d500UL, 0x00004e00UL, 0x0000a900UL, -0x00006c00UL, 0x00005600UL, 0x0000f400UL, 0x0000ea00UL, 0x00006500UL, 0x00007a00UL, 0x0000ae00UL, 0x00000800UL, -0x0000ba00UL, 0x00007800UL, 0x00002500UL, 0x00002e00UL, 0x00001c00UL, 0x0000a600UL, 0x0000b400UL, 0x0000c600UL, -0x0000e800UL, 0x0000dd00UL, 0x00007400UL, 0x00001f00UL, 0x00004b00UL, 0x0000bd00UL, 0x00008b00UL, 0x00008a00UL, -0x00007000UL, 0x00003e00UL, 0x0000b500UL, 0x00006600UL, 0x00004800UL, 0x00000300UL, 0x0000f600UL, 0x00000e00UL, -0x00006100UL, 0x00003500UL, 0x00005700UL, 0x0000b900UL, 0x00008600UL, 0x0000c100UL, 0x00001d00UL, 0x00009e00UL, -0x0000e100UL, 0x0000f800UL, 0x00009800UL, 0x00001100UL, 0x00006900UL, 0x0000d900UL, 0x00008e00UL, 0x00009400UL, -0x00009b00UL, 0x00001e00UL, 0x00008700UL, 0x0000e900UL, 0x0000ce00UL, 0x00005500UL, 0x00002800UL, 0x0000df00UL, -0x00008c00UL, 0x0000a100UL, 0x00008900UL, 0x00000d00UL, 0x0000bf00UL, 0x0000e600UL, 0x00004200UL, 0x00006800UL, -0x00004100UL, 0x00009900UL, 0x00002d00UL, 0x00000f00UL, 0x0000b000UL, 0x00005400UL, 0x0000bb00UL, 0x00001600UL -}; - -const u32 Te4_2[] = { -0x00630000UL, 0x007c0000UL, 0x00770000UL, 0x007b0000UL, 0x00f20000UL, 0x006b0000UL, 0x006f0000UL, 0x00c50000UL, -0x00300000UL, 0x00010000UL, 0x00670000UL, 0x002b0000UL, 0x00fe0000UL, 0x00d70000UL, 0x00ab0000UL, 0x00760000UL, -0x00ca0000UL, 0x00820000UL, 0x00c90000UL, 0x007d0000UL, 0x00fa0000UL, 0x00590000UL, 0x00470000UL, 0x00f00000UL, -0x00ad0000UL, 0x00d40000UL, 0x00a20000UL, 0x00af0000UL, 0x009c0000UL, 0x00a40000UL, 0x00720000UL, 0x00c00000UL, -0x00b70000UL, 0x00fd0000UL, 0x00930000UL, 0x00260000UL, 0x00360000UL, 0x003f0000UL, 0x00f70000UL, 0x00cc0000UL, -0x00340000UL, 0x00a50000UL, 0x00e50000UL, 0x00f10000UL, 0x00710000UL, 0x00d80000UL, 0x00310000UL, 0x00150000UL, -0x00040000UL, 0x00c70000UL, 0x00230000UL, 0x00c30000UL, 0x00180000UL, 0x00960000UL, 0x00050000UL, 0x009a0000UL, -0x00070000UL, 0x00120000UL, 0x00800000UL, 0x00e20000UL, 0x00eb0000UL, 0x00270000UL, 0x00b20000UL, 0x00750000UL, -0x00090000UL, 0x00830000UL, 0x002c0000UL, 0x001a0000UL, 0x001b0000UL, 0x006e0000UL, 0x005a0000UL, 0x00a00000UL, -0x00520000UL, 0x003b0000UL, 0x00d60000UL, 0x00b30000UL, 0x00290000UL, 0x00e30000UL, 0x002f0000UL, 0x00840000UL, -0x00530000UL, 0x00d10000UL, 0x00000000UL, 0x00ed0000UL, 0x00200000UL, 0x00fc0000UL, 0x00b10000UL, 0x005b0000UL, -0x006a0000UL, 0x00cb0000UL, 0x00be0000UL, 0x00390000UL, 0x004a0000UL, 0x004c0000UL, 0x00580000UL, 0x00cf0000UL, -0x00d00000UL, 0x00ef0000UL, 0x00aa0000UL, 0x00fb0000UL, 0x00430000UL, 0x004d0000UL, 0x00330000UL, 0x00850000UL, -0x00450000UL, 0x00f90000UL, 0x00020000UL, 0x007f0000UL, 0x00500000UL, 0x003c0000UL, 0x009f0000UL, 0x00a80000UL, -0x00510000UL, 0x00a30000UL, 0x00400000UL, 0x008f0000UL, 0x00920000UL, 0x009d0000UL, 0x00380000UL, 0x00f50000UL, -0x00bc0000UL, 0x00b60000UL, 0x00da0000UL, 0x00210000UL, 0x00100000UL, 0x00ff0000UL, 0x00f30000UL, 0x00d20000UL, -0x00cd0000UL, 0x000c0000UL, 0x00130000UL, 0x00ec0000UL, 0x005f0000UL, 0x00970000UL, 0x00440000UL, 0x00170000UL, -0x00c40000UL, 0x00a70000UL, 0x007e0000UL, 0x003d0000UL, 0x00640000UL, 0x005d0000UL, 0x00190000UL, 0x00730000UL, -0x00600000UL, 0x00810000UL, 0x004f0000UL, 0x00dc0000UL, 0x00220000UL, 0x002a0000UL, 0x00900000UL, 0x00880000UL, -0x00460000UL, 0x00ee0000UL, 0x00b80000UL, 0x00140000UL, 0x00de0000UL, 0x005e0000UL, 0x000b0000UL, 0x00db0000UL, -0x00e00000UL, 0x00320000UL, 0x003a0000UL, 0x000a0000UL, 0x00490000UL, 0x00060000UL, 0x00240000UL, 0x005c0000UL, -0x00c20000UL, 0x00d30000UL, 0x00ac0000UL, 0x00620000UL, 0x00910000UL, 0x00950000UL, 0x00e40000UL, 0x00790000UL, -0x00e70000UL, 0x00c80000UL, 0x00370000UL, 0x006d0000UL, 0x008d0000UL, 0x00d50000UL, 0x004e0000UL, 0x00a90000UL, -0x006c0000UL, 0x00560000UL, 0x00f40000UL, 0x00ea0000UL, 0x00650000UL, 0x007a0000UL, 0x00ae0000UL, 0x00080000UL, -0x00ba0000UL, 0x00780000UL, 0x00250000UL, 0x002e0000UL, 0x001c0000UL, 0x00a60000UL, 0x00b40000UL, 0x00c60000UL, -0x00e80000UL, 0x00dd0000UL, 0x00740000UL, 0x001f0000UL, 0x004b0000UL, 0x00bd0000UL, 0x008b0000UL, 0x008a0000UL, -0x00700000UL, 0x003e0000UL, 0x00b50000UL, 0x00660000UL, 0x00480000UL, 0x00030000UL, 0x00f60000UL, 0x000e0000UL, -0x00610000UL, 0x00350000UL, 0x00570000UL, 0x00b90000UL, 0x00860000UL, 0x00c10000UL, 0x001d0000UL, 0x009e0000UL, -0x00e10000UL, 0x00f80000UL, 0x00980000UL, 0x00110000UL, 0x00690000UL, 0x00d90000UL, 0x008e0000UL, 0x00940000UL, -0x009b0000UL, 0x001e0000UL, 0x00870000UL, 0x00e90000UL, 0x00ce0000UL, 0x00550000UL, 0x00280000UL, 0x00df0000UL, -0x008c0000UL, 0x00a10000UL, 0x00890000UL, 0x000d0000UL, 0x00bf0000UL, 0x00e60000UL, 0x00420000UL, 0x00680000UL, -0x00410000UL, 0x00990000UL, 0x002d0000UL, 0x000f0000UL, 0x00b00000UL, 0x00540000UL, 0x00bb0000UL, 0x00160000UL -}; - -const u32 Te4_3[] = { -0x63000000UL, 0x7c000000UL, 0x77000000UL, 0x7b000000UL, 0xf2000000UL, 0x6b000000UL, 0x6f000000UL, 0xc5000000UL, -0x30000000UL, 0x01000000UL, 0x67000000UL, 0x2b000000UL, 0xfe000000UL, 0xd7000000UL, 0xab000000UL, 0x76000000UL, -0xca000000UL, 0x82000000UL, 0xc9000000UL, 0x7d000000UL, 0xfa000000UL, 0x59000000UL, 0x47000000UL, 0xf0000000UL, -0xad000000UL, 0xd4000000UL, 0xa2000000UL, 0xaf000000UL, 0x9c000000UL, 0xa4000000UL, 0x72000000UL, 0xc0000000UL, -0xb7000000UL, 0xfd000000UL, 0x93000000UL, 0x26000000UL, 0x36000000UL, 0x3f000000UL, 0xf7000000UL, 0xcc000000UL, -0x34000000UL, 0xa5000000UL, 0xe5000000UL, 0xf1000000UL, 0x71000000UL, 0xd8000000UL, 0x31000000UL, 0x15000000UL, -0x04000000UL, 0xc7000000UL, 0x23000000UL, 0xc3000000UL, 0x18000000UL, 0x96000000UL, 0x05000000UL, 0x9a000000UL, -0x07000000UL, 0x12000000UL, 0x80000000UL, 0xe2000000UL, 0xeb000000UL, 0x27000000UL, 0xb2000000UL, 0x75000000UL, -0x09000000UL, 0x83000000UL, 0x2c000000UL, 0x1a000000UL, 0x1b000000UL, 0x6e000000UL, 0x5a000000UL, 0xa0000000UL, -0x52000000UL, 0x3b000000UL, 0xd6000000UL, 0xb3000000UL, 0x29000000UL, 0xe3000000UL, 0x2f000000UL, 0x84000000UL, -0x53000000UL, 0xd1000000UL, 0x00000000UL, 0xed000000UL, 0x20000000UL, 0xfc000000UL, 0xb1000000UL, 0x5b000000UL, -0x6a000000UL, 0xcb000000UL, 0xbe000000UL, 0x39000000UL, 0x4a000000UL, 0x4c000000UL, 0x58000000UL, 0xcf000000UL, -0xd0000000UL, 0xef000000UL, 0xaa000000UL, 0xfb000000UL, 0x43000000UL, 0x4d000000UL, 0x33000000UL, 0x85000000UL, -0x45000000UL, 0xf9000000UL, 0x02000000UL, 0x7f000000UL, 0x50000000UL, 0x3c000000UL, 0x9f000000UL, 0xa8000000UL, -0x51000000UL, 0xa3000000UL, 0x40000000UL, 0x8f000000UL, 0x92000000UL, 0x9d000000UL, 0x38000000UL, 0xf5000000UL, -0xbc000000UL, 0xb6000000UL, 0xda000000UL, 0x21000000UL, 0x10000000UL, 0xff000000UL, 0xf3000000UL, 0xd2000000UL, -0xcd000000UL, 0x0c000000UL, 0x13000000UL, 0xec000000UL, 0x5f000000UL, 0x97000000UL, 0x44000000UL, 0x17000000UL, -0xc4000000UL, 0xa7000000UL, 0x7e000000UL, 0x3d000000UL, 0x64000000UL, 0x5d000000UL, 0x19000000UL, 0x73000000UL, -0x60000000UL, 0x81000000UL, 0x4f000000UL, 0xdc000000UL, 0x22000000UL, 0x2a000000UL, 0x90000000UL, 0x88000000UL, -0x46000000UL, 0xee000000UL, 0xb8000000UL, 0x14000000UL, 0xde000000UL, 0x5e000000UL, 0x0b000000UL, 0xdb000000UL, -0xe0000000UL, 0x32000000UL, 0x3a000000UL, 0x0a000000UL, 0x49000000UL, 0x06000000UL, 0x24000000UL, 0x5c000000UL, -0xc2000000UL, 0xd3000000UL, 0xac000000UL, 0x62000000UL, 0x91000000UL, 0x95000000UL, 0xe4000000UL, 0x79000000UL, -0xe7000000UL, 0xc8000000UL, 0x37000000UL, 0x6d000000UL, 0x8d000000UL, 0xd5000000UL, 0x4e000000UL, 0xa9000000UL, -0x6c000000UL, 0x56000000UL, 0xf4000000UL, 0xea000000UL, 0x65000000UL, 0x7a000000UL, 0xae000000UL, 0x08000000UL, -0xba000000UL, 0x78000000UL, 0x25000000UL, 0x2e000000UL, 0x1c000000UL, 0xa6000000UL, 0xb4000000UL, 0xc6000000UL, -0xe8000000UL, 0xdd000000UL, 0x74000000UL, 0x1f000000UL, 0x4b000000UL, 0xbd000000UL, 0x8b000000UL, 0x8a000000UL, -0x70000000UL, 0x3e000000UL, 0xb5000000UL, 0x66000000UL, 0x48000000UL, 0x03000000UL, 0xf6000000UL, 0x0e000000UL, -0x61000000UL, 0x35000000UL, 0x57000000UL, 0xb9000000UL, 0x86000000UL, 0xc1000000UL, 0x1d000000UL, 0x9e000000UL, -0xe1000000UL, 0xf8000000UL, 0x98000000UL, 0x11000000UL, 0x69000000UL, 0xd9000000UL, 0x8e000000UL, 0x94000000UL, -0x9b000000UL, 0x1e000000UL, 0x87000000UL, 0xe9000000UL, 0xce000000UL, 0x55000000UL, 0x28000000UL, 0xdf000000UL, -0x8c000000UL, 0xa1000000UL, 0x89000000UL, 0x0d000000UL, 0xbf000000UL, 0xe6000000UL, 0x42000000UL, 0x68000000UL, -0x41000000UL, 0x99000000UL, 0x2d000000UL, 0x0f000000UL, 0xb0000000UL, 0x54000000UL, 0xbb000000UL, 0x16000000UL -}; - - -const u32 TD1[256] = { - 0x5051f4a7UL, 0x537e4165UL, 0xc31a17a4UL, 0x963a275eUL, - 0xcb3bab6bUL, 0xf11f9d45UL, 0xabacfa58UL, 0x934be303UL, - 0x552030faUL, 0xf6ad766dUL, 0x9188cc76UL, 0x25f5024cUL, - 0xfc4fe5d7UL, 0xd7c52acbUL, 0x80263544UL, 0x8fb562a3UL, - 0x49deb15aUL, 0x6725ba1bUL, 0x9845ea0eUL, 0xe15dfec0UL, - 0x02c32f75UL, 0x12814cf0UL, 0xa38d4697UL, 0xc66bd3f9UL, - 0xe7038f5fUL, 0x9515929cUL, 0xebbf6d7aUL, 0xda955259UL, - 0x2dd4be83UL, 0xd3587421UL, 0x2949e069UL, 0x448ec9c8UL, - 0x6a75c289UL, 0x78f48e79UL, 0x6b99583eUL, 0xdd27b971UL, - 0xb6bee14fUL, 0x17f088adUL, 0x66c920acUL, 0xb47dce3aUL, - 0x1863df4aUL, 0x82e51a31UL, 0x60975133UL, 0x4562537fUL, - 0xe0b16477UL, 0x84bb6baeUL, 0x1cfe81a0UL, 0x94f9082bUL, - 0x58704868UL, 0x198f45fdUL, 0x8794de6cUL, 0xb7527bf8UL, - 0x23ab73d3UL, 0xe2724b02UL, 0x57e31f8fUL, 0x2a6655abUL, - 0x07b2eb28UL, 0x032fb5c2UL, 0x9a86c57bUL, 0xa5d33708UL, - 0xf2302887UL, 0xb223bfa5UL, 0xba02036aUL, 0x5ced1682UL, - 0x2b8acf1cUL, 0x92a779b4UL, 0xf0f307f2UL, 0xa14e69e2UL, - 0xcd65daf4UL, 0xd50605beUL, 0x1fd13462UL, 0x8ac4a6feUL, - 0x9d342e53UL, 0xa0a2f355UL, 0x32058ae1UL, 0x75a4f6ebUL, - 0x390b83ecUL, 0xaa4060efUL, 0x065e719fUL, 0x51bd6e10UL, - 0xf93e218aUL, 0x3d96dd06UL, 0xaedd3e05UL, 0x464de6bdUL, - 0xb591548dUL, 0x0571c45dUL, 0x6f0406d4UL, 0xff605015UL, - 0x241998fbUL, 0x97d6bde9UL, 0xcc894043UL, 0x7767d99eUL, - 0xbdb0e842UL, 0x8807898bUL, 0x38e7195bUL, 0xdb79c8eeUL, - 0x47a17c0aUL, 0xe97c420fUL, 0xc9f8841eUL, 0x00000000UL, - 0x83098086UL, 0x48322bedUL, 0xac1e1170UL, 0x4e6c5a72UL, - 0xfbfd0effUL, 0x560f8538UL, 0x1e3daed5UL, 0x27362d39UL, - 0x640a0fd9UL, 0x21685ca6UL, 0xd19b5b54UL, 0x3a24362eUL, - 0xb10c0a67UL, 0x0f9357e7UL, 0xd2b4ee96UL, 0x9e1b9b91UL, - 0x4f80c0c5UL, 0xa261dc20UL, 0x695a774bUL, 0x161c121aUL, - 0x0ae293baUL, 0xe5c0a02aUL, 0x433c22e0UL, 0x1d121b17UL, - 0x0b0e090dUL, 0xadf28bc7UL, 0xb92db6a8UL, 0xc8141ea9UL, - 0x8557f119UL, 0x4caf7507UL, 0xbbee99ddUL, 0xfda37f60UL, - 0x9ff70126UL, 0xbc5c72f5UL, 0xc544663bUL, 0x345bfb7eUL, - 0x768b4329UL, 0xdccb23c6UL, 0x68b6edfcUL, 0x63b8e4f1UL, - 0xcad731dcUL, 0x10426385UL, 0x40139722UL, 0x2084c611UL, - 0x7d854a24UL, 0xf8d2bb3dUL, 0x11aef932UL, 0x6dc729a1UL, - 0x4b1d9e2fUL, 0xf3dcb230UL, 0xec0d8652UL, 0xd077c1e3UL, - 0x6c2bb316UL, 0x99a970b9UL, 0xfa119448UL, 0x2247e964UL, - 0xc4a8fc8cUL, 0x1aa0f03fUL, 0xd8567d2cUL, 0xef223390UL, - 0xc787494eUL, 0xc1d938d1UL, 0xfe8ccaa2UL, 0x3698d40bUL, - 0xcfa6f581UL, 0x28a57adeUL, 0x26dab78eUL, 0xa43fadbfUL, - 0xe42c3a9dUL, 0x0d507892UL, 0x9b6a5fccUL, 0x62547e46UL, - 0xc2f68d13UL, 0xe890d8b8UL, 0x5e2e39f7UL, 0xf582c3afUL, - 0xbe9f5d80UL, 0x7c69d093UL, 0xa96fd52dUL, 0xb3cf2512UL, - 0x3bc8ac99UL, 0xa710187dUL, 0x6ee89c63UL, 0x7bdb3bbbUL, - 0x09cd2678UL, 0xf46e5918UL, 0x01ec9ab7UL, 0xa8834f9aUL, - 0x65e6956eUL, 0x7eaaffe6UL, 0x0821bccfUL, 0xe6ef15e8UL, - 0xd9bae79bUL, 0xce4a6f36UL, 0xd4ea9f09UL, 0xd629b07cUL, - 0xaf31a4b2UL, 0x312a3f23UL, 0x30c6a594UL, 0xc035a266UL, - 0x37744ebcUL, 0xa6fc82caUL, 0xb0e090d0UL, 0x1533a7d8UL, - 0x4af10498UL, 0xf741ecdaUL, 0x0e7fcd50UL, 0x2f1791f6UL, - 0x8d764dd6UL, 0x4d43efb0UL, 0x54ccaa4dUL, 0xdfe49604UL, - 0xe39ed1b5UL, 0x1b4c6a88UL, 0xb8c12c1fUL, 0x7f466551UL, - 0x049d5eeaUL, 0x5d018c35UL, 0x73fa8774UL, 0x2efb0b41UL, - 0x5ab3671dUL, 0x5292dbd2UL, 0x33e91056UL, 0x136dd647UL, - 0x8c9ad761UL, 0x7a37a10cUL, 0x8e59f814UL, 0x89eb133cUL, - 0xeecea927UL, 0x35b761c9UL, 0xede11ce5UL, 0x3c7a47b1UL, - 0x599cd2dfUL, 0x3f55f273UL, 0x791814ceUL, 0xbf73c737UL, - 0xea53f7cdUL, 0x5b5ffdaaUL, 0x14df3d6fUL, 0x867844dbUL, - 0x81caaff3UL, 0x3eb968c4UL, 0x2c382434UL, 0x5fc2a340UL, - 0x72161dc3UL, 0x0cbce225UL, 0x8b283c49UL, 0x41ff0d95UL, - 0x7139a801UL, 0xde080cb3UL, 0x9cd8b4e4UL, 0x906456c1UL, - 0x617bcb84UL, 0x70d532b6UL, 0x74486c5cUL, 0x42d0b857UL, -}; -const u32 TD2[256] = { - 0xa75051f4UL, 0x65537e41UL, 0xa4c31a17UL, 0x5e963a27UL, - 0x6bcb3babUL, 0x45f11f9dUL, 0x58abacfaUL, 0x03934be3UL, - 0xfa552030UL, 0x6df6ad76UL, 0x769188ccUL, 0x4c25f502UL, - 0xd7fc4fe5UL, 0xcbd7c52aUL, 0x44802635UL, 0xa38fb562UL, - 0x5a49deb1UL, 0x1b6725baUL, 0x0e9845eaUL, 0xc0e15dfeUL, - 0x7502c32fUL, 0xf012814cUL, 0x97a38d46UL, 0xf9c66bd3UL, - 0x5fe7038fUL, 0x9c951592UL, 0x7aebbf6dUL, 0x59da9552UL, - 0x832dd4beUL, 0x21d35874UL, 0x692949e0UL, 0xc8448ec9UL, - 0x896a75c2UL, 0x7978f48eUL, 0x3e6b9958UL, 0x71dd27b9UL, - 0x4fb6bee1UL, 0xad17f088UL, 0xac66c920UL, 0x3ab47dceUL, - 0x4a1863dfUL, 0x3182e51aUL, 0x33609751UL, 0x7f456253UL, - 0x77e0b164UL, 0xae84bb6bUL, 0xa01cfe81UL, 0x2b94f908UL, - 0x68587048UL, 0xfd198f45UL, 0x6c8794deUL, 0xf8b7527bUL, - 0xd323ab73UL, 0x02e2724bUL, 0x8f57e31fUL, 0xab2a6655UL, - 0x2807b2ebUL, 0xc2032fb5UL, 0x7b9a86c5UL, 0x08a5d337UL, - 0x87f23028UL, 0xa5b223bfUL, 0x6aba0203UL, 0x825ced16UL, - 0x1c2b8acfUL, 0xb492a779UL, 0xf2f0f307UL, 0xe2a14e69UL, - 0xf4cd65daUL, 0xbed50605UL, 0x621fd134UL, 0xfe8ac4a6UL, - 0x539d342eUL, 0x55a0a2f3UL, 0xe132058aUL, 0xeb75a4f6UL, - 0xec390b83UL, 0xefaa4060UL, 0x9f065e71UL, 0x1051bd6eUL, - 0x8af93e21UL, 0x063d96ddUL, 0x05aedd3eUL, 0xbd464de6UL, - 0x8db59154UL, 0x5d0571c4UL, 0xd46f0406UL, 0x15ff6050UL, - 0xfb241998UL, 0xe997d6bdUL, 0x43cc8940UL, 0x9e7767d9UL, - 0x42bdb0e8UL, 0x8b880789UL, 0x5b38e719UL, 0xeedb79c8UL, - 0x0a47a17cUL, 0x0fe97c42UL, 0x1ec9f884UL, 0x00000000UL, - 0x86830980UL, 0xed48322bUL, 0x70ac1e11UL, 0x724e6c5aUL, - 0xfffbfd0eUL, 0x38560f85UL, 0xd51e3daeUL, 0x3927362dUL, - 0xd9640a0fUL, 0xa621685cUL, 0x54d19b5bUL, 0x2e3a2436UL, - 0x67b10c0aUL, 0xe70f9357UL, 0x96d2b4eeUL, 0x919e1b9bUL, - 0xc54f80c0UL, 0x20a261dcUL, 0x4b695a77UL, 0x1a161c12UL, - 0xba0ae293UL, 0x2ae5c0a0UL, 0xe0433c22UL, 0x171d121bUL, - 0x0d0b0e09UL, 0xc7adf28bUL, 0xa8b92db6UL, 0xa9c8141eUL, - 0x198557f1UL, 0x074caf75UL, 0xddbbee99UL, 0x60fda37fUL, - 0x269ff701UL, 0xf5bc5c72UL, 0x3bc54466UL, 0x7e345bfbUL, - 0x29768b43UL, 0xc6dccb23UL, 0xfc68b6edUL, 0xf163b8e4UL, - 0xdccad731UL, 0x85104263UL, 0x22401397UL, 0x112084c6UL, - 0x247d854aUL, 0x3df8d2bbUL, 0x3211aef9UL, 0xa16dc729UL, - 0x2f4b1d9eUL, 0x30f3dcb2UL, 0x52ec0d86UL, 0xe3d077c1UL, - 0x166c2bb3UL, 0xb999a970UL, 0x48fa1194UL, 0x642247e9UL, - 0x8cc4a8fcUL, 0x3f1aa0f0UL, 0x2cd8567dUL, 0x90ef2233UL, - 0x4ec78749UL, 0xd1c1d938UL, 0xa2fe8ccaUL, 0x0b3698d4UL, - 0x81cfa6f5UL, 0xde28a57aUL, 0x8e26dab7UL, 0xbfa43fadUL, - 0x9de42c3aUL, 0x920d5078UL, 0xcc9b6a5fUL, 0x4662547eUL, - 0x13c2f68dUL, 0xb8e890d8UL, 0xf75e2e39UL, 0xaff582c3UL, - 0x80be9f5dUL, 0x937c69d0UL, 0x2da96fd5UL, 0x12b3cf25UL, - 0x993bc8acUL, 0x7da71018UL, 0x636ee89cUL, 0xbb7bdb3bUL, - 0x7809cd26UL, 0x18f46e59UL, 0xb701ec9aUL, 0x9aa8834fUL, - 0x6e65e695UL, 0xe67eaaffUL, 0xcf0821bcUL, 0xe8e6ef15UL, - 0x9bd9bae7UL, 0x36ce4a6fUL, 0x09d4ea9fUL, 0x7cd629b0UL, - 0xb2af31a4UL, 0x23312a3fUL, 0x9430c6a5UL, 0x66c035a2UL, - 0xbc37744eUL, 0xcaa6fc82UL, 0xd0b0e090UL, 0xd81533a7UL, - 0x984af104UL, 0xdaf741ecUL, 0x500e7fcdUL, 0xf62f1791UL, - 0xd68d764dUL, 0xb04d43efUL, 0x4d54ccaaUL, 0x04dfe496UL, - 0xb5e39ed1UL, 0x881b4c6aUL, 0x1fb8c12cUL, 0x517f4665UL, - 0xea049d5eUL, 0x355d018cUL, 0x7473fa87UL, 0x412efb0bUL, - 0x1d5ab367UL, 0xd25292dbUL, 0x5633e910UL, 0x47136dd6UL, - 0x618c9ad7UL, 0x0c7a37a1UL, 0x148e59f8UL, 0x3c89eb13UL, - 0x27eecea9UL, 0xc935b761UL, 0xe5ede11cUL, 0xb13c7a47UL, - 0xdf599cd2UL, 0x733f55f2UL, 0xce791814UL, 0x37bf73c7UL, - 0xcdea53f7UL, 0xaa5b5ffdUL, 0x6f14df3dUL, 0xdb867844UL, - 0xf381caafUL, 0xc43eb968UL, 0x342c3824UL, 0x405fc2a3UL, - 0xc372161dUL, 0x250cbce2UL, 0x498b283cUL, 0x9541ff0dUL, - 0x017139a8UL, 0xb3de080cUL, 0xe49cd8b4UL, 0xc1906456UL, - 0x84617bcbUL, 0xb670d532UL, 0x5c74486cUL, 0x5742d0b8UL, -}; -const u32 TD3[256] = { - 0xf4a75051UL, 0x4165537eUL, 0x17a4c31aUL, 0x275e963aUL, - 0xab6bcb3bUL, 0x9d45f11fUL, 0xfa58abacUL, 0xe303934bUL, - 0x30fa5520UL, 0x766df6adUL, 0xcc769188UL, 0x024c25f5UL, - 0xe5d7fc4fUL, 0x2acbd7c5UL, 0x35448026UL, 0x62a38fb5UL, - 0xb15a49deUL, 0xba1b6725UL, 0xea0e9845UL, 0xfec0e15dUL, - 0x2f7502c3UL, 0x4cf01281UL, 0x4697a38dUL, 0xd3f9c66bUL, - 0x8f5fe703UL, 0x929c9515UL, 0x6d7aebbfUL, 0x5259da95UL, - 0xbe832dd4UL, 0x7421d358UL, 0xe0692949UL, 0xc9c8448eUL, - 0xc2896a75UL, 0x8e7978f4UL, 0x583e6b99UL, 0xb971dd27UL, - 0xe14fb6beUL, 0x88ad17f0UL, 0x20ac66c9UL, 0xce3ab47dUL, - 0xdf4a1863UL, 0x1a3182e5UL, 0x51336097UL, 0x537f4562UL, - 0x6477e0b1UL, 0x6bae84bbUL, 0x81a01cfeUL, 0x082b94f9UL, - 0x48685870UL, 0x45fd198fUL, 0xde6c8794UL, 0x7bf8b752UL, - 0x73d323abUL, 0x4b02e272UL, 0x1f8f57e3UL, 0x55ab2a66UL, - 0xeb2807b2UL, 0xb5c2032fUL, 0xc57b9a86UL, 0x3708a5d3UL, - 0x2887f230UL, 0xbfa5b223UL, 0x036aba02UL, 0x16825cedUL, - 0xcf1c2b8aUL, 0x79b492a7UL, 0x07f2f0f3UL, 0x69e2a14eUL, - 0xdaf4cd65UL, 0x05bed506UL, 0x34621fd1UL, 0xa6fe8ac4UL, - 0x2e539d34UL, 0xf355a0a2UL, 0x8ae13205UL, 0xf6eb75a4UL, - 0x83ec390bUL, 0x60efaa40UL, 0x719f065eUL, 0x6e1051bdUL, - 0x218af93eUL, 0xdd063d96UL, 0x3e05aeddUL, 0xe6bd464dUL, - 0x548db591UL, 0xc45d0571UL, 0x06d46f04UL, 0x5015ff60UL, - 0x98fb2419UL, 0xbde997d6UL, 0x4043cc89UL, 0xd99e7767UL, - 0xe842bdb0UL, 0x898b8807UL, 0x195b38e7UL, 0xc8eedb79UL, - 0x7c0a47a1UL, 0x420fe97cUL, 0x841ec9f8UL, 0x00000000UL, - 0x80868309UL, 0x2bed4832UL, 0x1170ac1eUL, 0x5a724e6cUL, - 0x0efffbfdUL, 0x8538560fUL, 0xaed51e3dUL, 0x2d392736UL, - 0x0fd9640aUL, 0x5ca62168UL, 0x5b54d19bUL, 0x362e3a24UL, - 0x0a67b10cUL, 0x57e70f93UL, 0xee96d2b4UL, 0x9b919e1bUL, - 0xc0c54f80UL, 0xdc20a261UL, 0x774b695aUL, 0x121a161cUL, - 0x93ba0ae2UL, 0xa02ae5c0UL, 0x22e0433cUL, 0x1b171d12UL, - 0x090d0b0eUL, 0x8bc7adf2UL, 0xb6a8b92dUL, 0x1ea9c814UL, - 0xf1198557UL, 0x75074cafUL, 0x99ddbbeeUL, 0x7f60fda3UL, - 0x01269ff7UL, 0x72f5bc5cUL, 0x663bc544UL, 0xfb7e345bUL, - 0x4329768bUL, 0x23c6dccbUL, 0xedfc68b6UL, 0xe4f163b8UL, - 0x31dccad7UL, 0x63851042UL, 0x97224013UL, 0xc6112084UL, - 0x4a247d85UL, 0xbb3df8d2UL, 0xf93211aeUL, 0x29a16dc7UL, - 0x9e2f4b1dUL, 0xb230f3dcUL, 0x8652ec0dUL, 0xc1e3d077UL, - 0xb3166c2bUL, 0x70b999a9UL, 0x9448fa11UL, 0xe9642247UL, - 0xfc8cc4a8UL, 0xf03f1aa0UL, 0x7d2cd856UL, 0x3390ef22UL, - 0x494ec787UL, 0x38d1c1d9UL, 0xcaa2fe8cUL, 0xd40b3698UL, - 0xf581cfa6UL, 0x7ade28a5UL, 0xb78e26daUL, 0xadbfa43fUL, - 0x3a9de42cUL, 0x78920d50UL, 0x5fcc9b6aUL, 0x7e466254UL, - 0x8d13c2f6UL, 0xd8b8e890UL, 0x39f75e2eUL, 0xc3aff582UL, - 0x5d80be9fUL, 0xd0937c69UL, 0xd52da96fUL, 0x2512b3cfUL, - 0xac993bc8UL, 0x187da710UL, 0x9c636ee8UL, 0x3bbb7bdbUL, - 0x267809cdUL, 0x5918f46eUL, 0x9ab701ecUL, 0x4f9aa883UL, - 0x956e65e6UL, 0xffe67eaaUL, 0xbccf0821UL, 0x15e8e6efUL, - 0xe79bd9baUL, 0x6f36ce4aUL, 0x9f09d4eaUL, 0xb07cd629UL, - 0xa4b2af31UL, 0x3f23312aUL, 0xa59430c6UL, 0xa266c035UL, - 0x4ebc3774UL, 0x82caa6fcUL, 0x90d0b0e0UL, 0xa7d81533UL, - 0x04984af1UL, 0xecdaf741UL, 0xcd500e7fUL, 0x91f62f17UL, - 0x4dd68d76UL, 0xefb04d43UL, 0xaa4d54ccUL, 0x9604dfe4UL, - 0xd1b5e39eUL, 0x6a881b4cUL, 0x2c1fb8c1UL, 0x65517f46UL, - 0x5eea049dUL, 0x8c355d01UL, 0x877473faUL, 0x0b412efbUL, - 0x671d5ab3UL, 0xdbd25292UL, 0x105633e9UL, 0xd647136dUL, - 0xd7618c9aUL, 0xa10c7a37UL, 0xf8148e59UL, 0x133c89ebUL, - 0xa927eeceUL, 0x61c935b7UL, 0x1ce5ede1UL, 0x47b13c7aUL, - 0xd2df599cUL, 0xf2733f55UL, 0x14ce7918UL, 0xc737bf73UL, - 0xf7cdea53UL, 0xfdaa5b5fUL, 0x3d6f14dfUL, 0x44db8678UL, - 0xaff381caUL, 0x68c43eb9UL, 0x24342c38UL, 0xa3405fc2UL, - 0x1dc37216UL, 0xe2250cbcUL, 0x3c498b28UL, 0x0d9541ffUL, - 0xa8017139UL, 0x0cb3de08UL, 0xb4e49cd8UL, 0x56c19064UL, - 0xcb84617bUL, 0x32b670d5UL, 0x6c5c7448UL, 0xb85742d0UL, -}; - -const u32 Tks0[] = { -0x00000000UL, 0x0e090d0bUL, 0x1c121a16UL, 0x121b171dUL, 0x3824342cUL, 0x362d3927UL, 0x24362e3aUL, 0x2a3f2331UL, -0x70486858UL, 0x7e416553UL, 0x6c5a724eUL, 0x62537f45UL, 0x486c5c74UL, 0x4665517fUL, 0x547e4662UL, 0x5a774b69UL, -0xe090d0b0UL, 0xee99ddbbUL, 0xfc82caa6UL, 0xf28bc7adUL, 0xd8b4e49cUL, 0xd6bde997UL, 0xc4a6fe8aUL, 0xcaaff381UL, -0x90d8b8e8UL, 0x9ed1b5e3UL, 0x8ccaa2feUL, 0x82c3aff5UL, 0xa8fc8cc4UL, 0xa6f581cfUL, 0xb4ee96d2UL, 0xbae79bd9UL, -0xdb3bbb7bUL, 0xd532b670UL, 0xc729a16dUL, 0xc920ac66UL, 0xe31f8f57UL, 0xed16825cUL, 0xff0d9541UL, 0xf104984aUL, -0xab73d323UL, 0xa57ade28UL, 0xb761c935UL, 0xb968c43eUL, 0x9357e70fUL, 0x9d5eea04UL, 0x8f45fd19UL, 0x814cf012UL, -0x3bab6bcbUL, 0x35a266c0UL, 0x27b971ddUL, 0x29b07cd6UL, 0x038f5fe7UL, 0x0d8652ecUL, 0x1f9d45f1UL, 0x119448faUL, -0x4be30393UL, 0x45ea0e98UL, 0x57f11985UL, 0x59f8148eUL, 0x73c737bfUL, 0x7dce3ab4UL, 0x6fd52da9UL, 0x61dc20a2UL, -0xad766df6UL, 0xa37f60fdUL, 0xb16477e0UL, 0xbf6d7aebUL, 0x955259daUL, 0x9b5b54d1UL, 0x894043ccUL, 0x87494ec7UL, -0xdd3e05aeUL, 0xd33708a5UL, 0xc12c1fb8UL, 0xcf2512b3UL, 0xe51a3182UL, 0xeb133c89UL, 0xf9082b94UL, 0xf701269fUL, -0x4de6bd46UL, 0x43efb04dUL, 0x51f4a750UL, 0x5ffdaa5bUL, 0x75c2896aUL, 0x7bcb8461UL, 0x69d0937cUL, 0x67d99e77UL, -0x3daed51eUL, 0x33a7d815UL, 0x21bccf08UL, 0x2fb5c203UL, 0x058ae132UL, 0x0b83ec39UL, 0x1998fb24UL, 0x1791f62fUL, -0x764dd68dUL, 0x7844db86UL, 0x6a5fcc9bUL, 0x6456c190UL, 0x4e69e2a1UL, 0x4060efaaUL, 0x527bf8b7UL, 0x5c72f5bcUL, -0x0605bed5UL, 0x080cb3deUL, 0x1a17a4c3UL, 0x141ea9c8UL, 0x3e218af9UL, 0x302887f2UL, 0x223390efUL, 0x2c3a9de4UL, -0x96dd063dUL, 0x98d40b36UL, 0x8acf1c2bUL, 0x84c61120UL, 0xaef93211UL, 0xa0f03f1aUL, 0xb2eb2807UL, 0xbce2250cUL, -0xe6956e65UL, 0xe89c636eUL, 0xfa877473UL, 0xf48e7978UL, 0xdeb15a49UL, 0xd0b85742UL, 0xc2a3405fUL, 0xccaa4d54UL, -0x41ecdaf7UL, 0x4fe5d7fcUL, 0x5dfec0e1UL, 0x53f7cdeaUL, 0x79c8eedbUL, 0x77c1e3d0UL, 0x65daf4cdUL, 0x6bd3f9c6UL, -0x31a4b2afUL, 0x3fadbfa4UL, 0x2db6a8b9UL, 0x23bfa5b2UL, 0x09808683UL, 0x07898b88UL, 0x15929c95UL, 0x1b9b919eUL, -0xa17c0a47UL, 0xaf75074cUL, 0xbd6e1051UL, 0xb3671d5aUL, 0x99583e6bUL, 0x97513360UL, 0x854a247dUL, 0x8b432976UL, -0xd134621fUL, 0xdf3d6f14UL, 0xcd267809UL, 0xc32f7502UL, 0xe9105633UL, 0xe7195b38UL, 0xf5024c25UL, 0xfb0b412eUL, -0x9ad7618cUL, 0x94de6c87UL, 0x86c57b9aUL, 0x88cc7691UL, 0xa2f355a0UL, 0xacfa58abUL, 0xbee14fb6UL, 0xb0e842bdUL, -0xea9f09d4UL, 0xe49604dfUL, 0xf68d13c2UL, 0xf8841ec9UL, 0xd2bb3df8UL, 0xdcb230f3UL, 0xcea927eeUL, 0xc0a02ae5UL, -0x7a47b13cUL, 0x744ebc37UL, 0x6655ab2aUL, 0x685ca621UL, 0x42638510UL, 0x4c6a881bUL, 0x5e719f06UL, 0x5078920dUL, -0x0a0fd964UL, 0x0406d46fUL, 0x161dc372UL, 0x1814ce79UL, 0x322bed48UL, 0x3c22e043UL, 0x2e39f75eUL, 0x2030fa55UL, -0xec9ab701UL, 0xe293ba0aUL, 0xf088ad17UL, 0xfe81a01cUL, 0xd4be832dUL, 0xdab78e26UL, 0xc8ac993bUL, 0xc6a59430UL, -0x9cd2df59UL, 0x92dbd252UL, 0x80c0c54fUL, 0x8ec9c844UL, 0xa4f6eb75UL, 0xaaffe67eUL, 0xb8e4f163UL, 0xb6edfc68UL, -0x0c0a67b1UL, 0x02036abaUL, 0x10187da7UL, 0x1e1170acUL, 0x342e539dUL, 0x3a275e96UL, 0x283c498bUL, 0x26354480UL, -0x7c420fe9UL, 0x724b02e2UL, 0x605015ffUL, 0x6e5918f4UL, 0x44663bc5UL, 0x4a6f36ceUL, 0x587421d3UL, 0x567d2cd8UL, -0x37a10c7aUL, 0x39a80171UL, 0x2bb3166cUL, 0x25ba1b67UL, 0x0f853856UL, 0x018c355dUL, 0x13972240UL, 0x1d9e2f4bUL, -0x47e96422UL, 0x49e06929UL, 0x5bfb7e34UL, 0x55f2733fUL, 0x7fcd500eUL, 0x71c45d05UL, 0x63df4a18UL, 0x6dd64713UL, -0xd731dccaUL, 0xd938d1c1UL, 0xcb23c6dcUL, 0xc52acbd7UL, 0xef15e8e6UL, 0xe11ce5edUL, 0xf307f2f0UL, 0xfd0efffbUL, -0xa779b492UL, 0xa970b999UL, 0xbb6bae84UL, 0xb562a38fUL, 0x9f5d80beUL, 0x91548db5UL, 0x834f9aa8UL, 0x8d4697a3UL -}; - -const u32 Tks1[] = { -0x00000000UL, 0x0b0e090dUL, 0x161c121aUL, 0x1d121b17UL, 0x2c382434UL, 0x27362d39UL, 0x3a24362eUL, 0x312a3f23UL, -0x58704868UL, 0x537e4165UL, 0x4e6c5a72UL, 0x4562537fUL, 0x74486c5cUL, 0x7f466551UL, 0x62547e46UL, 0x695a774bUL, -0xb0e090d0UL, 0xbbee99ddUL, 0xa6fc82caUL, 0xadf28bc7UL, 0x9cd8b4e4UL, 0x97d6bde9UL, 0x8ac4a6feUL, 0x81caaff3UL, -0xe890d8b8UL, 0xe39ed1b5UL, 0xfe8ccaa2UL, 0xf582c3afUL, 0xc4a8fc8cUL, 0xcfa6f581UL, 0xd2b4ee96UL, 0xd9bae79bUL, -0x7bdb3bbbUL, 0x70d532b6UL, 0x6dc729a1UL, 0x66c920acUL, 0x57e31f8fUL, 0x5ced1682UL, 0x41ff0d95UL, 0x4af10498UL, -0x23ab73d3UL, 0x28a57adeUL, 0x35b761c9UL, 0x3eb968c4UL, 0x0f9357e7UL, 0x049d5eeaUL, 0x198f45fdUL, 0x12814cf0UL, -0xcb3bab6bUL, 0xc035a266UL, 0xdd27b971UL, 0xd629b07cUL, 0xe7038f5fUL, 0xec0d8652UL, 0xf11f9d45UL, 0xfa119448UL, -0x934be303UL, 0x9845ea0eUL, 0x8557f119UL, 0x8e59f814UL, 0xbf73c737UL, 0xb47dce3aUL, 0xa96fd52dUL, 0xa261dc20UL, -0xf6ad766dUL, 0xfda37f60UL, 0xe0b16477UL, 0xebbf6d7aUL, 0xda955259UL, 0xd19b5b54UL, 0xcc894043UL, 0xc787494eUL, -0xaedd3e05UL, 0xa5d33708UL, 0xb8c12c1fUL, 0xb3cf2512UL, 0x82e51a31UL, 0x89eb133cUL, 0x94f9082bUL, 0x9ff70126UL, -0x464de6bdUL, 0x4d43efb0UL, 0x5051f4a7UL, 0x5b5ffdaaUL, 0x6a75c289UL, 0x617bcb84UL, 0x7c69d093UL, 0x7767d99eUL, -0x1e3daed5UL, 0x1533a7d8UL, 0x0821bccfUL, 0x032fb5c2UL, 0x32058ae1UL, 0x390b83ecUL, 0x241998fbUL, 0x2f1791f6UL, -0x8d764dd6UL, 0x867844dbUL, 0x9b6a5fccUL, 0x906456c1UL, 0xa14e69e2UL, 0xaa4060efUL, 0xb7527bf8UL, 0xbc5c72f5UL, -0xd50605beUL, 0xde080cb3UL, 0xc31a17a4UL, 0xc8141ea9UL, 0xf93e218aUL, 0xf2302887UL, 0xef223390UL, 0xe42c3a9dUL, -0x3d96dd06UL, 0x3698d40bUL, 0x2b8acf1cUL, 0x2084c611UL, 0x11aef932UL, 0x1aa0f03fUL, 0x07b2eb28UL, 0x0cbce225UL, -0x65e6956eUL, 0x6ee89c63UL, 0x73fa8774UL, 0x78f48e79UL, 0x49deb15aUL, 0x42d0b857UL, 0x5fc2a340UL, 0x54ccaa4dUL, -0xf741ecdaUL, 0xfc4fe5d7UL, 0xe15dfec0UL, 0xea53f7cdUL, 0xdb79c8eeUL, 0xd077c1e3UL, 0xcd65daf4UL, 0xc66bd3f9UL, -0xaf31a4b2UL, 0xa43fadbfUL, 0xb92db6a8UL, 0xb223bfa5UL, 0x83098086UL, 0x8807898bUL, 0x9515929cUL, 0x9e1b9b91UL, -0x47a17c0aUL, 0x4caf7507UL, 0x51bd6e10UL, 0x5ab3671dUL, 0x6b99583eUL, 0x60975133UL, 0x7d854a24UL, 0x768b4329UL, -0x1fd13462UL, 0x14df3d6fUL, 0x09cd2678UL, 0x02c32f75UL, 0x33e91056UL, 0x38e7195bUL, 0x25f5024cUL, 0x2efb0b41UL, -0x8c9ad761UL, 0x8794de6cUL, 0x9a86c57bUL, 0x9188cc76UL, 0xa0a2f355UL, 0xabacfa58UL, 0xb6bee14fUL, 0xbdb0e842UL, -0xd4ea9f09UL, 0xdfe49604UL, 0xc2f68d13UL, 0xc9f8841eUL, 0xf8d2bb3dUL, 0xf3dcb230UL, 0xeecea927UL, 0xe5c0a02aUL, -0x3c7a47b1UL, 0x37744ebcUL, 0x2a6655abUL, 0x21685ca6UL, 0x10426385UL, 0x1b4c6a88UL, 0x065e719fUL, 0x0d507892UL, -0x640a0fd9UL, 0x6f0406d4UL, 0x72161dc3UL, 0x791814ceUL, 0x48322bedUL, 0x433c22e0UL, 0x5e2e39f7UL, 0x552030faUL, -0x01ec9ab7UL, 0x0ae293baUL, 0x17f088adUL, 0x1cfe81a0UL, 0x2dd4be83UL, 0x26dab78eUL, 0x3bc8ac99UL, 0x30c6a594UL, -0x599cd2dfUL, 0x5292dbd2UL, 0x4f80c0c5UL, 0x448ec9c8UL, 0x75a4f6ebUL, 0x7eaaffe6UL, 0x63b8e4f1UL, 0x68b6edfcUL, -0xb10c0a67UL, 0xba02036aUL, 0xa710187dUL, 0xac1e1170UL, 0x9d342e53UL, 0x963a275eUL, 0x8b283c49UL, 0x80263544UL, -0xe97c420fUL, 0xe2724b02UL, 0xff605015UL, 0xf46e5918UL, 0xc544663bUL, 0xce4a6f36UL, 0xd3587421UL, 0xd8567d2cUL, -0x7a37a10cUL, 0x7139a801UL, 0x6c2bb316UL, 0x6725ba1bUL, 0x560f8538UL, 0x5d018c35UL, 0x40139722UL, 0x4b1d9e2fUL, -0x2247e964UL, 0x2949e069UL, 0x345bfb7eUL, 0x3f55f273UL, 0x0e7fcd50UL, 0x0571c45dUL, 0x1863df4aUL, 0x136dd647UL, -0xcad731dcUL, 0xc1d938d1UL, 0xdccb23c6UL, 0xd7c52acbUL, 0xe6ef15e8UL, 0xede11ce5UL, 0xf0f307f2UL, 0xfbfd0effUL, -0x92a779b4UL, 0x99a970b9UL, 0x84bb6baeUL, 0x8fb562a3UL, 0xbe9f5d80UL, 0xb591548dUL, 0xa8834f9aUL, 0xa38d4697UL -}; - -const u32 Tks2[] = { -0x00000000UL, 0x0d0b0e09UL, 0x1a161c12UL, 0x171d121bUL, 0x342c3824UL, 0x3927362dUL, 0x2e3a2436UL, 0x23312a3fUL, -0x68587048UL, 0x65537e41UL, 0x724e6c5aUL, 0x7f456253UL, 0x5c74486cUL, 0x517f4665UL, 0x4662547eUL, 0x4b695a77UL, -0xd0b0e090UL, 0xddbbee99UL, 0xcaa6fc82UL, 0xc7adf28bUL, 0xe49cd8b4UL, 0xe997d6bdUL, 0xfe8ac4a6UL, 0xf381caafUL, -0xb8e890d8UL, 0xb5e39ed1UL, 0xa2fe8ccaUL, 0xaff582c3UL, 0x8cc4a8fcUL, 0x81cfa6f5UL, 0x96d2b4eeUL, 0x9bd9bae7UL, -0xbb7bdb3bUL, 0xb670d532UL, 0xa16dc729UL, 0xac66c920UL, 0x8f57e31fUL, 0x825ced16UL, 0x9541ff0dUL, 0x984af104UL, -0xd323ab73UL, 0xde28a57aUL, 0xc935b761UL, 0xc43eb968UL, 0xe70f9357UL, 0xea049d5eUL, 0xfd198f45UL, 0xf012814cUL, -0x6bcb3babUL, 0x66c035a2UL, 0x71dd27b9UL, 0x7cd629b0UL, 0x5fe7038fUL, 0x52ec0d86UL, 0x45f11f9dUL, 0x48fa1194UL, -0x03934be3UL, 0x0e9845eaUL, 0x198557f1UL, 0x148e59f8UL, 0x37bf73c7UL, 0x3ab47dceUL, 0x2da96fd5UL, 0x20a261dcUL, -0x6df6ad76UL, 0x60fda37fUL, 0x77e0b164UL, 0x7aebbf6dUL, 0x59da9552UL, 0x54d19b5bUL, 0x43cc8940UL, 0x4ec78749UL, -0x05aedd3eUL, 0x08a5d337UL, 0x1fb8c12cUL, 0x12b3cf25UL, 0x3182e51aUL, 0x3c89eb13UL, 0x2b94f908UL, 0x269ff701UL, -0xbd464de6UL, 0xb04d43efUL, 0xa75051f4UL, 0xaa5b5ffdUL, 0x896a75c2UL, 0x84617bcbUL, 0x937c69d0UL, 0x9e7767d9UL, -0xd51e3daeUL, 0xd81533a7UL, 0xcf0821bcUL, 0xc2032fb5UL, 0xe132058aUL, 0xec390b83UL, 0xfb241998UL, 0xf62f1791UL, -0xd68d764dUL, 0xdb867844UL, 0xcc9b6a5fUL, 0xc1906456UL, 0xe2a14e69UL, 0xefaa4060UL, 0xf8b7527bUL, 0xf5bc5c72UL, -0xbed50605UL, 0xb3de080cUL, 0xa4c31a17UL, 0xa9c8141eUL, 0x8af93e21UL, 0x87f23028UL, 0x90ef2233UL, 0x9de42c3aUL, -0x063d96ddUL, 0x0b3698d4UL, 0x1c2b8acfUL, 0x112084c6UL, 0x3211aef9UL, 0x3f1aa0f0UL, 0x2807b2ebUL, 0x250cbce2UL, -0x6e65e695UL, 0x636ee89cUL, 0x7473fa87UL, 0x7978f48eUL, 0x5a49deb1UL, 0x5742d0b8UL, 0x405fc2a3UL, 0x4d54ccaaUL, -0xdaf741ecUL, 0xd7fc4fe5UL, 0xc0e15dfeUL, 0xcdea53f7UL, 0xeedb79c8UL, 0xe3d077c1UL, 0xf4cd65daUL, 0xf9c66bd3UL, -0xb2af31a4UL, 0xbfa43fadUL, 0xa8b92db6UL, 0xa5b223bfUL, 0x86830980UL, 0x8b880789UL, 0x9c951592UL, 0x919e1b9bUL, -0x0a47a17cUL, 0x074caf75UL, 0x1051bd6eUL, 0x1d5ab367UL, 0x3e6b9958UL, 0x33609751UL, 0x247d854aUL, 0x29768b43UL, -0x621fd134UL, 0x6f14df3dUL, 0x7809cd26UL, 0x7502c32fUL, 0x5633e910UL, 0x5b38e719UL, 0x4c25f502UL, 0x412efb0bUL, -0x618c9ad7UL, 0x6c8794deUL, 0x7b9a86c5UL, 0x769188ccUL, 0x55a0a2f3UL, 0x58abacfaUL, 0x4fb6bee1UL, 0x42bdb0e8UL, -0x09d4ea9fUL, 0x04dfe496UL, 0x13c2f68dUL, 0x1ec9f884UL, 0x3df8d2bbUL, 0x30f3dcb2UL, 0x27eecea9UL, 0x2ae5c0a0UL, -0xb13c7a47UL, 0xbc37744eUL, 0xab2a6655UL, 0xa621685cUL, 0x85104263UL, 0x881b4c6aUL, 0x9f065e71UL, 0x920d5078UL, -0xd9640a0fUL, 0xd46f0406UL, 0xc372161dUL, 0xce791814UL, 0xed48322bUL, 0xe0433c22UL, 0xf75e2e39UL, 0xfa552030UL, -0xb701ec9aUL, 0xba0ae293UL, 0xad17f088UL, 0xa01cfe81UL, 0x832dd4beUL, 0x8e26dab7UL, 0x993bc8acUL, 0x9430c6a5UL, -0xdf599cd2UL, 0xd25292dbUL, 0xc54f80c0UL, 0xc8448ec9UL, 0xeb75a4f6UL, 0xe67eaaffUL, 0xf163b8e4UL, 0xfc68b6edUL, -0x67b10c0aUL, 0x6aba0203UL, 0x7da71018UL, 0x70ac1e11UL, 0x539d342eUL, 0x5e963a27UL, 0x498b283cUL, 0x44802635UL, -0x0fe97c42UL, 0x02e2724bUL, 0x15ff6050UL, 0x18f46e59UL, 0x3bc54466UL, 0x36ce4a6fUL, 0x21d35874UL, 0x2cd8567dUL, -0x0c7a37a1UL, 0x017139a8UL, 0x166c2bb3UL, 0x1b6725baUL, 0x38560f85UL, 0x355d018cUL, 0x22401397UL, 0x2f4b1d9eUL, -0x642247e9UL, 0x692949e0UL, 0x7e345bfbUL, 0x733f55f2UL, 0x500e7fcdUL, 0x5d0571c4UL, 0x4a1863dfUL, 0x47136dd6UL, -0xdccad731UL, 0xd1c1d938UL, 0xc6dccb23UL, 0xcbd7c52aUL, 0xe8e6ef15UL, 0xe5ede11cUL, 0xf2f0f307UL, 0xfffbfd0eUL, -0xb492a779UL, 0xb999a970UL, 0xae84bb6bUL, 0xa38fb562UL, 0x80be9f5dUL, 0x8db59154UL, 0x9aa8834fUL, 0x97a38d46UL -}; - -const u32 Tks3[] = { -0x00000000UL, 0x090d0b0eUL, 0x121a161cUL, 0x1b171d12UL, 0x24342c38UL, 0x2d392736UL, 0x362e3a24UL, 0x3f23312aUL, -0x48685870UL, 0x4165537eUL, 0x5a724e6cUL, 0x537f4562UL, 0x6c5c7448UL, 0x65517f46UL, 0x7e466254UL, 0x774b695aUL, -0x90d0b0e0UL, 0x99ddbbeeUL, 0x82caa6fcUL, 0x8bc7adf2UL, 0xb4e49cd8UL, 0xbde997d6UL, 0xa6fe8ac4UL, 0xaff381caUL, -0xd8b8e890UL, 0xd1b5e39eUL, 0xcaa2fe8cUL, 0xc3aff582UL, 0xfc8cc4a8UL, 0xf581cfa6UL, 0xee96d2b4UL, 0xe79bd9baUL, -0x3bbb7bdbUL, 0x32b670d5UL, 0x29a16dc7UL, 0x20ac66c9UL, 0x1f8f57e3UL, 0x16825cedUL, 0x0d9541ffUL, 0x04984af1UL, -0x73d323abUL, 0x7ade28a5UL, 0x61c935b7UL, 0x68c43eb9UL, 0x57e70f93UL, 0x5eea049dUL, 0x45fd198fUL, 0x4cf01281UL, -0xab6bcb3bUL, 0xa266c035UL, 0xb971dd27UL, 0xb07cd629UL, 0x8f5fe703UL, 0x8652ec0dUL, 0x9d45f11fUL, 0x9448fa11UL, -0xe303934bUL, 0xea0e9845UL, 0xf1198557UL, 0xf8148e59UL, 0xc737bf73UL, 0xce3ab47dUL, 0xd52da96fUL, 0xdc20a261UL, -0x766df6adUL, 0x7f60fda3UL, 0x6477e0b1UL, 0x6d7aebbfUL, 0x5259da95UL, 0x5b54d19bUL, 0x4043cc89UL, 0x494ec787UL, -0x3e05aeddUL, 0x3708a5d3UL, 0x2c1fb8c1UL, 0x2512b3cfUL, 0x1a3182e5UL, 0x133c89ebUL, 0x082b94f9UL, 0x01269ff7UL, -0xe6bd464dUL, 0xefb04d43UL, 0xf4a75051UL, 0xfdaa5b5fUL, 0xc2896a75UL, 0xcb84617bUL, 0xd0937c69UL, 0xd99e7767UL, -0xaed51e3dUL, 0xa7d81533UL, 0xbccf0821UL, 0xb5c2032fUL, 0x8ae13205UL, 0x83ec390bUL, 0x98fb2419UL, 0x91f62f17UL, -0x4dd68d76UL, 0x44db8678UL, 0x5fcc9b6aUL, 0x56c19064UL, 0x69e2a14eUL, 0x60efaa40UL, 0x7bf8b752UL, 0x72f5bc5cUL, -0x05bed506UL, 0x0cb3de08UL, 0x17a4c31aUL, 0x1ea9c814UL, 0x218af93eUL, 0x2887f230UL, 0x3390ef22UL, 0x3a9de42cUL, -0xdd063d96UL, 0xd40b3698UL, 0xcf1c2b8aUL, 0xc6112084UL, 0xf93211aeUL, 0xf03f1aa0UL, 0xeb2807b2UL, 0xe2250cbcUL, -0x956e65e6UL, 0x9c636ee8UL, 0x877473faUL, 0x8e7978f4UL, 0xb15a49deUL, 0xb85742d0UL, 0xa3405fc2UL, 0xaa4d54ccUL, -0xecdaf741UL, 0xe5d7fc4fUL, 0xfec0e15dUL, 0xf7cdea53UL, 0xc8eedb79UL, 0xc1e3d077UL, 0xdaf4cd65UL, 0xd3f9c66bUL, -0xa4b2af31UL, 0xadbfa43fUL, 0xb6a8b92dUL, 0xbfa5b223UL, 0x80868309UL, 0x898b8807UL, 0x929c9515UL, 0x9b919e1bUL, -0x7c0a47a1UL, 0x75074cafUL, 0x6e1051bdUL, 0x671d5ab3UL, 0x583e6b99UL, 0x51336097UL, 0x4a247d85UL, 0x4329768bUL, -0x34621fd1UL, 0x3d6f14dfUL, 0x267809cdUL, 0x2f7502c3UL, 0x105633e9UL, 0x195b38e7UL, 0x024c25f5UL, 0x0b412efbUL, -0xd7618c9aUL, 0xde6c8794UL, 0xc57b9a86UL, 0xcc769188UL, 0xf355a0a2UL, 0xfa58abacUL, 0xe14fb6beUL, 0xe842bdb0UL, -0x9f09d4eaUL, 0x9604dfe4UL, 0x8d13c2f6UL, 0x841ec9f8UL, 0xbb3df8d2UL, 0xb230f3dcUL, 0xa927eeceUL, 0xa02ae5c0UL, -0x47b13c7aUL, 0x4ebc3774UL, 0x55ab2a66UL, 0x5ca62168UL, 0x63851042UL, 0x6a881b4cUL, 0x719f065eUL, 0x78920d50UL, -0x0fd9640aUL, 0x06d46f04UL, 0x1dc37216UL, 0x14ce7918UL, 0x2bed4832UL, 0x22e0433cUL, 0x39f75e2eUL, 0x30fa5520UL, -0x9ab701ecUL, 0x93ba0ae2UL, 0x88ad17f0UL, 0x81a01cfeUL, 0xbe832dd4UL, 0xb78e26daUL, 0xac993bc8UL, 0xa59430c6UL, -0xd2df599cUL, 0xdbd25292UL, 0xc0c54f80UL, 0xc9c8448eUL, 0xf6eb75a4UL, 0xffe67eaaUL, 0xe4f163b8UL, 0xedfc68b6UL, -0x0a67b10cUL, 0x036aba02UL, 0x187da710UL, 0x1170ac1eUL, 0x2e539d34UL, 0x275e963aUL, 0x3c498b28UL, 0x35448026UL, -0x420fe97cUL, 0x4b02e272UL, 0x5015ff60UL, 0x5918f46eUL, 0x663bc544UL, 0x6f36ce4aUL, 0x7421d358UL, 0x7d2cd856UL, -0xa10c7a37UL, 0xa8017139UL, 0xb3166c2bUL, 0xba1b6725UL, 0x8538560fUL, 0x8c355d01UL, 0x97224013UL, 0x9e2f4b1dUL, -0xe9642247UL, 0xe0692949UL, 0xfb7e345bUL, 0xf2733f55UL, 0xcd500e7fUL, 0xc45d0571UL, 0xdf4a1863UL, 0xd647136dUL, -0x31dccad7UL, 0x38d1c1d9UL, 0x23c6dccbUL, 0x2acbd7c5UL, 0x15e8e6efUL, 0x1ce5ede1UL, 0x07f2f0f3UL, 0x0efffbfdUL, -0x79b492a7UL, 0x70b999a9UL, 0x6bae84bbUL, 0x62a38fb5UL, 0x5d80be9fUL, 0x548db591UL, 0x4f9aa883UL, 0x4697a38dUL -}; - - -const u32 rcon[] = { - 0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL, - 0x10000000UL, 0x20000000UL, 0x40000000UL, 0x80000000UL, - 0x1B000000UL, 0x36000000UL, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ -}; - - diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/hashes/sha1/sha1.c b/uxmhf-rpi3/libs/libxmhfcrypto/hashes/sha1/sha1.c deleted file mode 100644 index 8a5aa6fce0..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/hashes/sha1/sha1.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - - -#include -#include -#include - -// undef LTC_CLEAN_STACK -//#define LTC_SHA1 -// undef LTC_SMALL_CODE - - -#if 0 -const struct ltc_hash_descriptor sha1_desc = -{ - "sha1", - 2, - 20, - 64, - - /* OID */ - { 1, 3, 14, 3, 2, 26, }, - 6, - - &sha1_init, - &sha1_process, - &sha1_done, - &sha1_test, - NULL -}; -#endif //0 - -#define F0(x,y,z) (z ^ (x & (y ^ z))) -#define F1(x,y,z) (x ^ y ^ z) -#define F2(x,y,z) ((x & y) | (z & (x | y))) -#define F3(x,y,z) (x ^ y ^ z) - -int sha1_compress(hash_state *md, unsigned char *buf) -{ - uint32_t a,b,c,d,e,W[80],i; - - /* copy the state into 512-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD32H(W[i], buf + (4*i)); - } - - /* copy state */ - a = md->sha1.state[0]; - b = md->sha1.state[1]; - c = md->sha1.state[2]; - d = md->sha1.state[3]; - e = md->sha1.state[4]; - - /* expand it */ - for (i = 16; i < 80; i++) { - W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); - } - - /* compress */ - /* round one */ - #define FF0(a,b,c,d,e,i) e = (ROLc(a, 5) + F0(b,c,d) + e + W[i] + 0x5a827999UL); b = ROLc(b, 30); - #define FF1(a,b,c,d,e,i) e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30); - #define FF2(a,b,c,d,e,i) e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30); - #define FF3(a,b,c,d,e,i) e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30); - - - for (i = 0; i < 20; ) { - FF0(a,b,c,d,e,i++); - FF0(e,a,b,c,d,i++); - FF0(d,e,a,b,c,i++); - FF0(c,d,e,a,b,i++); - FF0(b,c,d,e,a,i++); - } - - /* round two */ - for (; i < 40; ) { - FF1(a,b,c,d,e,i++); - FF1(e,a,b,c,d,i++); - FF1(d,e,a,b,c,i++); - FF1(c,d,e,a,b,i++); - FF1(b,c,d,e,a,i++); - } - - /* round three */ - for (; i < 60; ) { - FF2(a,b,c,d,e,i++); - FF2(e,a,b,c,d,i++); - FF2(d,e,a,b,c,i++); - FF2(c,d,e,a,b,i++); - FF2(b,c,d,e,a,i++); - } - - /* round four */ - for (; i < 80; ) { - FF3(a,b,c,d,e,i++); - FF3(e,a,b,c,d,i++); - FF3(d,e,a,b,c,i++); - FF3(c,d,e,a,b,i++); - FF3(b,c,d,e,a,i++); - } - - #undef FF0 - #undef FF1 - #undef FF2 - #undef FF3 - - /* store */ - md->sha1.state[0] = md->sha1.state[0] + a; - md->sha1.state[1] = md->sha1.state[1] + b; - md->sha1.state[2] = md->sha1.state[2] + c; - md->sha1.state[3] = md->sha1.state[3] + d; - md->sha1.state[4] = md->sha1.state[4] + e; - - return CRYPT_OK; -} - - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha1_init(hash_state * md) -{ - LTC_ARGCHK(md != NULL); - md->sha1.state[0] = 0x67452301UL; - md->sha1.state[1] = 0xefcdab89UL; - md->sha1.state[2] = 0x98badcfeUL; - md->sha1.state[3] = 0x10325476UL; - md->sha1.state[4] = 0xc3d2e1f0UL; - md->sha1.curlen = 0; - md->sha1.length = 0; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -int sha1_process (hash_state * md, const unsigned char *in, unsigned long inlen) -{ - unsigned long n; - int err; - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(in != NULL); - if (md-> sha1 .curlen > sizeof(md-> sha1 .buf)) { - return CRYPT_INVALID_ARG; - } - if ((md-> sha1 .length + inlen) < md-> sha1 .length) { - return CRYPT_HASH_OVERFLOW; - } - while (inlen > 0) { - if (md-> sha1 .curlen == 0 && inlen >= 64) { - if ((err = sha1_compress (md, (unsigned char *)in)) != CRYPT_OK) { - return err; - } - md-> sha1 .length += 64 * 8; - in += 64; - inlen -= 64; - } else { - n = MIN(inlen, (64 - md-> sha1 .curlen)); - XMEMCPY(md-> sha1 .buf + md-> sha1.curlen, in, (size_t)n); - md-> sha1 .curlen += n; - in += n; - inlen -= n; - if (md-> sha1 .curlen == 64) { - if ((err = sha1_compress (md, md-> sha1 .buf)) != CRYPT_OK) { - return err; - } - md-> sha1 .length += 8*64; - md-> sha1 .curlen = 0; - } - } - } - return CRYPT_OK; -} - - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (20 bytes) - @return CRYPT_OK if successful -*/ -int sha1_done(hash_state * md, unsigned char *out) -{ - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->sha1.curlen >= sizeof(md->sha1.buf)) { - return CRYPT_INVALID_ARG; - } - - /* increase the length of the message */ - md->sha1.length += md->sha1.curlen * 8; - - /* append the '1' bit */ - md->sha1.buf[md->sha1.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->sha1.curlen > 56) { - while (md->sha1.curlen < 64) { - md->sha1.buf[md->sha1.curlen++] = (unsigned char)0; - } - sha1_compress(md, md->sha1.buf); - md->sha1.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->sha1.curlen < 56) { - md->sha1.buf[md->sha1.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64H(md->sha1.length, md->sha1.buf+56); - sha1_compress(md, md->sha1.buf); - - /* copy output */ - for (i = 0; i < 5; i++) { - STORE32H(md->sha1.state[i], out+(4*i)); - } - - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha1_test(void) -{ - static const struct { - char *msg; - unsigned char hash[20]; - } tests[] = { - { "abc", - { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, - 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, - 0x9c, 0xd0, 0xd8, 0x9d } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E, - 0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5, - 0xE5, 0x46, 0x70, 0xF1 } - } - }; - - int i; - unsigned char tmp[20]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha1_init(&md); - sha1_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha1_done(&md, tmp); - //if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA1", i)) { - // return CRYPT_FAIL_TESTVECTOR; - //} - } - return CRYPT_OK; -} - - -/** - Hash a block of memory and store the digest. - @param hash The index of the hash you wish to use - @param in The data you wish to hash - @param inlen The length of the data to hash (octets) - @param out [out] Where to store the digest - @param outlen [in/out] Max size and resulting size of the digest - @return CRYPT_OK if successful -*/ -//int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) -int sha1_memory(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) -{ - //hash_state *md; - hash_state md; - int err; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - //if ((err = hash_is_valid(hash)) != CRYPT_OK) { - // return err; - //} - - if (*outlen < 20) { - *outlen = 20; - return CRYPT_BUFFER_OVERFLOW; - } - - //md = XMALLOC(sizeof(hash_state)); - //if (md == NULL) { - // return CRYPT_MEM; - //} - - if ((err = sha1_init(&md)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = sha1_process(&md, in, inlen)) != CRYPT_OK) { - goto LBL_ERR; - } - err = sha1_done(&md, out); - *outlen = 20; -LBL_ERR: - - return err; -} - - - - -/** - Hash multiple (non-adjacent) blocks of memory at once. - @param hash The index of the hash you wish to use - @param out [out] Where to store the digest - @param outlen [in/out] Max size and resulting size of the digest - @param in The data you wish to hash - @param inlen The length of the data to hash (octets) - @param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care) - @return CRYPT_OK if successful -*/ -int sha1_memory_multi(unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...) -{ - //hash_state *md; - hash_state md; - int err; - va_list args; - const unsigned char *curptr; - unsigned long curlen; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - //if ((err = hash_is_valid(hash)) != CRYPT_OK) { - // return err; - //} - - if (*outlen < 20) { - *outlen = 20; - return CRYPT_BUFFER_OVERFLOW; - } - - //md = XMALLOC(sizeof(hash_state)); - //if (md == NULL) { - // return CRYPT_MEM; - //} - - if ((err = sha1_init(&md)) != CRYPT_OK) { - goto LBL_ERR; - } - - va_start(args, inlen); - curptr = in; - curlen = inlen; - for (;;) { - /* process buf */ - if ((err = sha1_process(&md, curptr, curlen)) != CRYPT_OK) { - goto LBL_ERR; - } - /* step to next */ - curptr = va_arg(args, const unsigned char*); - if (curptr == NULL) { - break; - } - curlen = va_arg(args, unsigned long); - } - err = sha1_done(&md, out); - *outlen = 20; -LBL_ERR: - //XFREE(md); - va_end(args); - return err; -} diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/hashes/sha2/sha256.c b/uxmhf-rpi3/libs/libxmhfcrypto/hashes/sha2/sha256.c deleted file mode 100644 index 234a66a342..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/hashes/sha2/sha256.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * Matt McCormack (matthew.mccormack@live.com) - * - */ - -#include -#include -#include - -/* Various logical functions */ -#define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) -#define S(x, n) RORc((x),(n)) -#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) -#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) -#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) -#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) -#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) - - -int sha256_compress(hash_state * md, const unsigned char *buf) { - uint32_t S[8], W[64], t0, t1; - int i; - - /* copy state into S */ - for (i = 0; i < 8; i++) { - S[i] = md->sha256.state[i]; - } - - /* copy the state into 512-bits into W[0..15] */ - for (i = 0; i < 16; i++) { - LOAD32H(W[i], buf + (4*i)); - } - - /* fill W[16..63] */ - for (i = 16; i < 64; i++) { - W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; - } - - #define RND(a,b,c,d,e,f,g,h,i,ki) \ - t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],0,0x428a2f98); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],1,0x71374491); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],2,0xb5c0fbcf); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],3,0xe9b5dba5); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],4,0x3956c25b); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],5,0x59f111f1); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],6,0x923f82a4); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],7,0xab1c5ed5); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],8,0xd807aa98); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],9,0x12835b01); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],10,0x243185be); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],11,0x550c7dc3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],12,0x72be5d74); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],13,0x80deb1fe); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],14,0x9bdc06a7); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],15,0xc19bf174); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],16,0xe49b69c1); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],17,0xefbe4786); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],18,0x0fc19dc6); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],19,0x240ca1cc); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],20,0x2de92c6f); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],21,0x4a7484aa); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],22,0x5cb0a9dc); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],23,0x76f988da); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],24,0x983e5152); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],25,0xa831c66d); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],26,0xb00327c8); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],27,0xbf597fc7); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],28,0xc6e00bf3); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],29,0xd5a79147); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],30,0x06ca6351); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],31,0x14292967); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],32,0x27b70a85); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],33,0x2e1b2138); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],34,0x4d2c6dfc); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],35,0x53380d13); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],36,0x650a7354); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],37,0x766a0abb); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],38,0x81c2c92e); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],39,0x92722c85); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],40,0xa2bfe8a1); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],41,0xa81a664b); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],42,0xc24b8b70); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],43,0xc76c51a3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],44,0xd192e819); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],45,0xd6990624); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],46,0xf40e3585); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],47,0x106aa070); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],48,0x19a4c116); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],49,0x1e376c08); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],50,0x2748774c); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],51,0x34b0bcb5); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],52,0x391c0cb3); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],53,0x4ed8aa4a); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],54,0x5b9cca4f); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],55,0x682e6ff3); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],56,0x748f82ee); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],57,0x78a5636f); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],58,0x84c87814); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],59,0x8cc70208); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],60,0x90befffa); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],61,0xa4506ceb); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2); - - #undef RND - - /* feedback */ - for (i = 0; i < 8; i++) { - md->sha256.state[i] = md->sha256.state[i] + S[i]; - } - return CRYPT_OK; -} - -/** - Initialize the hash state - @param md The hash state you wish to initialize - @return CRYPT_OK if successful -*/ -int sha256_init(hash_state * md) { - LTC_ARGCHK(md != NULL); - - md->sha256.curlen = 0; - md->sha256.length = 0; - md->sha256.state[0] = 0x6A09E667UL; - md->sha256.state[1] = 0xBB67AE85UL; - md->sha256.state[2] = 0x3C6EF372UL; - md->sha256.state[3] = 0xA54FF53AUL; - md->sha256.state[4] = 0x510E527FUL; - md->sha256.state[5] = 0x9B05688CUL; - md->sha256.state[6] = 0x1F83D9ABUL; - md->sha256.state[7] = 0x5BE0CD19UL; - return CRYPT_OK; -} - -/** - Process a block of memory though the hash - @param md The hash state - @param in The data to hash - @param inlen The length of the data (octets) - @return CRYPT_OK if successful -*/ -int sha256_process (hash_state * md, const unsigned char *in, - unsigned long inlen) { - unsigned long n; - int err; - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(in != NULL); - if (md->sha256.curlen > sizeof(md->sha256.buf)) { - return CRYPT_INVALID_ARG; - } - if ((md->sha256.length + inlen) < md->sha256.length) { - return CRYPT_HASH_OVERFLOW; - } - while (inlen > 0) { - if (md->sha256.curlen == 0 && inlen >= 64) { - if ((err = sha256_compress (md, (unsigned char *)in)) != CRYPT_OK) { - return err; - } - md->sha256.length += 64 * 8; - in += 64; - inlen -= 64; - } else { - n = MIN(inlen, (64 - md-> sha256.curlen)); - XMEMCPY(md->sha256.buf + md->sha256.curlen, in, (size_t)n); - md->sha256.curlen += n; - in += n; - inlen -= n; - if (md->sha256.curlen == 64) { - if ((err = sha256_compress (md, md->sha256.buf)) != CRYPT_OK) { - return err; - } - md->sha256.length += 8*64; - md->sha256.curlen = 0; - } - } - } - return CRYPT_OK; -} - -/** - Terminate the hash to get the digest - @param md The hash state - @param out [out] The destination of the hash (32 bytes) - @return CRYPT_OK if successful -*/ -int sha256_done(hash_state * md, unsigned char *out) { - int i; - - LTC_ARGCHK(md != NULL); - LTC_ARGCHK(out != NULL); - - if (md->sha256.curlen >= sizeof(md->sha256.buf)) { - return CRYPT_INVALID_ARG; - } - - /* increase the length of the message */ - md->sha256.length += md->sha256.curlen * 8; - - /* append the '1' bit */ - md->sha256.buf[md->sha256.curlen++] = (unsigned char)0x80; - - /* if the length is currently above 56 bytes we append zeros - * then compress. Then we can fall back to padding zeros and length - * encoding like normal. - */ - if (md->sha256.curlen > 56) { - while (md->sha256.curlen < 64) { - md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; - } - sha256_compress(md, md->sha256.buf); - md->sha256.curlen = 0; - } - - /* pad upto 56 bytes of zeroes */ - while (md->sha256.curlen < 56) { - md->sha256.buf[md->sha256.curlen++] = (unsigned char)0; - } - - /* store length */ - STORE64H(md->sha256.length, md->sha256.buf+56); - sha256_compress(md, md->sha256.buf); - - /* copy output */ - for (i = 0; i < 8; i++) { - STORE32H(md->sha256.state[i], out+(4*i)); - } - return CRYPT_OK; -} - -/** - Self-test the hash - @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ -int sha256_test(void) { - static const struct { - const char *msg; - unsigned char hash[32]; - } tests[] = { - { "abc", - { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, - 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, - 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, - 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad } - }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, - 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, - 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, - 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 } - }, - }; - - int i; - unsigned char tmp[32]; - hash_state md; - - for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { - sha256_init(&md); - sha256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); - sha256_done(&md, tmp); - } - return CRYPT_OK; -} - -/** - Hash a block of memory and store the digest. - @param hash The index of the hash you wish to use - @param in The data you wish to hash - @param inlen The length of the data to hash (octets) - @param out [out] Where to store the digest - @param outlen [in/out] Max size and resulting size of the digest - @return CRYPT_OK if successful -*/ -//int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) -int sha256_memory(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen) { - hash_state md; - int err; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if (*outlen < 32) { - *outlen = 32; - return CRYPT_BUFFER_OVERFLOW; - } - - if ((err = sha256_init(&md)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = sha256_process(&md, in, inlen)) != CRYPT_OK) { - goto LBL_ERR; - } - err = sha256_done(&md, out); - *outlen = 32; -LBL_ERR: - - return err; -} - -/** - Hash multiple (non-adjacent) blocks of memory at once. - @param hash The index of the hash you wish to use - @param out [out] Where to store the digest - @param outlen [in/out] Max size and resulting size of the digest - @param in The data you wish to hash - @param inlen The length of the data to hash (octets) - @param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care) - @return CRYPT_OK if successful -*/ -int sha256_memory_multi(unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...) { - hash_state md; - int err; - va_list args; - const unsigned char *curptr; - unsigned long curlen; - - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if (*outlen < 32) { - *outlen = 32; - return CRYPT_BUFFER_OVERFLOW; - } - - if ((err = sha256_init(&md)) != CRYPT_OK) { - goto LBL_ERR; - } - - va_start(args, inlen); - curptr = in; - curlen = inlen; - for (;;) { - /* process buf */ - if ((err = sha256_process(&md, curptr, curlen)) != CRYPT_OK) { - goto LBL_ERR; - } - /* step to next */ - curptr = va_arg(args, const unsigned char*); - if (curptr == NULL) { - break; - } - curlen = va_arg(args, unsigned long); - } - err = sha256_done(&md, out); - *outlen = 32; -LBL_ERR: - va_end(args); - return err; -} diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/include/aes.h b/uxmhf-rpi3/libs/libxmhfcrypto/include/aes.h deleted file mode 100644 index 0eefb0b9bc..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/include/aes.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#ifndef __AES_H__ -#define __AES_H__ - -#include - -#define AES_KEY_LEN_BYTES 16 - -#ifndef __ASSEMBLY__ - -extern const struct ltc_cipher_descriptor rijndael_desc; - -#define Te0(x) TE0[x] -#define Te1(x) TE1[x] -#define Te2(x) TE2[x] -#define Te3(x) TE3[x] - -#define Td0(x) TD0[x] -#define Td1(x) TD1[x] -#define Td2(x) TD2[x] -#define Td3(x) TD3[x] - -const u32 Te4[256]; -const u32 Td4[256]; - - -extern const u32 TE0[256]; -extern const u32 TE1[256]; -extern const u32 TE2[256]; -extern const u32 TE3[256]; - - -extern const u32 Te4_0[]; -extern const u32 Te4_1[]; -extern const u32 Te4_2[]; -extern const u32 Te4_3[]; - -extern const u32 TD0[256]; -extern const u32 TD1[256]; -extern const u32 TD2[256]; -extern const u32 TD3[256]; - -extern const u32 Tks0[]; -extern const u32 Tks1[]; -extern const u32 Tks2[]; -extern const u32 Tks3[]; - -extern const u32 rcon[]; - -int rijndael_cbc_start(const unsigned char * IV, const unsigned char *key, - int keylen, int num_rounds, symmetric_CBC *cbc); -int rijndael_cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc); -int rijndael_cbc_done(symmetric_CBC *cbc); -int rijndael_cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc); - - - -#endif // __ASSEMBLY__ - - -#endif /* __AES_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/include/hmac-sha1.h b/uxmhf-rpi3/libs/libxmhfcrypto/include/hmac-sha1.h deleted file mode 100644 index a56de81b1f..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/include/hmac-sha1.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#ifndef __HMAC_SHA1_H__ -#define __HMAC_SHA1_H__ - - -#ifndef __ASSEMBLY__ - -#include - -int hmac_sha1_init(hmac_state *hmac, const unsigned char *key, unsigned long keylen); -int hmac_sha1_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen); -int hmac_sha1_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen); - -int hmac_sha1_memory(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - - - - -#endif // __ASSEMBLY__ - - -#endif /* __HMAC_SHA1_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/include/hmac-sha256.h b/uxmhf-rpi3/libs/libxmhfcrypto/include/hmac-sha256.h deleted file mode 100644 index 59ad6683dc..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/include/hmac-sha256.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * matt mccormack (matthew.mccormack@live.com) - * - */ - -#ifndef __HMAC_SHA256_H__ -#define __HMAC_SHA256_H__ - -#ifndef __ASSEMBLY__ - -#include - -int hmac_sha256_init(hmac_state *hmac, const unsigned char *key, - unsigned long keylen); -int hmac_sha256_process(hmac_state *hmac, const unsigned char *in, - unsigned long inlen); -int hmac_sha256_done(hmac_state *hmac, unsigned char *out, - unsigned long *outlen); -int hmac_sha256_memory(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); - -#endif // __ASSEMBLY__ - -#endif /* __HMAC_SHA256_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/include/sha1.h b/uxmhf-rpi3/libs/libxmhfcrypto/include/sha1.h deleted file mode 100644 index e578580885..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/include/sha1.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#ifndef __SHA1_H__ -#define __SHA1_H__ - -#include - -#define SHA1_RESULTLEN (160/8) -#define SHA_DIGEST_LENGTH SHA1_RESULTLEN - -#ifndef __ASSEMBLY__ - - - -//int sha1(const uint8_t *message, uint32_t len, unsigned char md[SHA_DIGEST_LENGTH]); - -int sha1_compress(hash_state *md, unsigned char *buf); -int sha1_init(hash_state * md); -int sha1_process (hash_state * md, const unsigned char *in, unsigned long inlen); -int sha1_done(hash_state * md, unsigned char *out); -int sha1_memory(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); -int sha1_memory_multi(unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); - - - - -#endif // __ASSEMBLY__ - - -#endif /* __SHA1_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/include/sha256.h b/uxmhf-rpi3/libs/libxmhfcrypto/include/sha256.h deleted file mode 100644 index 3b54a878fc..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/include/sha256.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * Matt McCormack (matthew.mccormack@live.com) - * - */ - -#ifndef __SHA256_H__ -#define __SHA256_H__ - -#include - -#define SHA2_RESULTLEN (256/8) -#define SHA_DIGEST_LENGTH SHA2_RESULTLEN - -#ifndef __ASSEMBLY__ - -int sha256_compress(hash_state *md, const unsigned char *buf); -int sha256_init(hash_state * md); -int sha256_process (hash_state * md, const unsigned char *in, - unsigned long inlen); -int sha256_done(hash_state * md, unsigned char *out); -int sha256_memory(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen); -int sha256_memory_multi(unsigned char *out, unsigned long *outlen, - const unsigned char *in, unsigned long inlen, ...); -#endif // __ASSEMBLY__ - -#endif /* __SHA256_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/include/xmhfcrypto.h b/uxmhf-rpi3/libs/libxmhfcrypto/include/xmhfcrypto.h deleted file mode 100644 index ed80070ed2..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/include/xmhfcrypto.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#ifndef __XMHFCRYPTO_H__ -#define __XMHFCRYPTO_H__ - -//tomcrypt.h - -/* max size of either a cipher/hash block or symmetric key [largest of the two] */ -#define MAXBLOCKSIZE 128 - -/* descriptor table size */ -#define TAB_SIZE 32 - -/* error codes [will be expanded in future releases] */ -enum { - CRYPT_OK=0, /* Result OK */ - CRYPT_ERROR, /* Generic Error */ - CRYPT_NOP, /* Not a failure but no operation was performed */ - - CRYPT_INVALID_KEYSIZE, /* Invalid key size given */ - CRYPT_INVALID_ROUNDS, /* Invalid number of rounds */ - CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */ - - CRYPT_BUFFER_OVERFLOW, /* Not enough space for output */ - CRYPT_INVALID_PACKET, /* Invalid input packet given */ - - CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */ - CRYPT_ERROR_READPRNG, /* Could not read enough from PRNG */ - - CRYPT_INVALID_CIPHER, /* Invalid cipher specified */ - CRYPT_INVALID_HASH, /* Invalid hash specified */ - CRYPT_INVALID_PRNG, /* Invalid PRNG specified */ - - CRYPT_MEM, /* Out of memory */ - - CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */ - CRYPT_PK_NOT_PRIVATE, /* Requires a private PK key */ - - CRYPT_INVALID_ARG, /* Generic invalid argument */ - CRYPT_FILE_NOTFOUND, /* File Not Found */ - - CRYPT_PK_INVALID_TYPE, /* Invalid type of PK key */ - CRYPT_PK_INVALID_SYSTEM,/* Invalid PK system specified */ - CRYPT_PK_DUP, /* Duplicate key already in key ring */ - CRYPT_PK_NOT_FOUND, /* Key not found in keyring */ - CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */ - - CRYPT_INVALID_PRIME_SIZE,/* Invalid size of prime requested */ - CRYPT_PK_INVALID_PADDING, /* Invalid padding on input */ - - CRYPT_HASH_OVERFLOW /* Hash applied to too many bits */ - -}; - - - - - - -//tomcrypt_cfg.h -typedef uint32_t LTC_FAST_TYPE; -#define LTC_FAST_TYPE_PTR_CAST(x) ((LTC_FAST_TYPE*)(void*)(x)) - -//tomcrypt_macros.h -#define STORE32H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>24)&255); (y)[1] = (unsigned char)(((x)>>16)&255); \ - (y)[2] = (unsigned char)(((x)>>8)&255); (y)[3] = (unsigned char)((x)&255); } - -#define LOAD32H(x, y) \ - { x = ((unsigned long)((y)[0] & 255)<<24) | \ - ((unsigned long)((y)[1] & 255)<<16) | \ - ((unsigned long)((y)[2] & 255)<<8) | \ - ((unsigned long)((y)[3] & 255)); } - -#define STORE64H(x, y) \ - { (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255); \ - (y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255); \ - (y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \ - (y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); } - -#ifndef MIN - #define MIN(x, y) ( ((x)<(y))?(x):(y) ) -#endif - -/* rotates the hard way */ -#define ROL(x, y) ( (((unsigned long)(x)<<(unsigned long)((y)&31)) | (((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define ROR(x, y) ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define ROLc(x, y) ( (((unsigned long)(x)<<(unsigned long)((y)&31)) | (((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define RORc(x, y) ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) - -/* extract a byte portably */ -#define byte(x, n) (((x) >> (8 * (n))) & 255) - -//tomcrypt_cipher.h -//Empty for now - -struct rijndael_key { - uint32_t eK[60], dK[60]; - int Nr; -}; - - -typedef union Symmetric_key { - struct rijndael_key rijndael; - void *data; -} symmetric_key; - - -/** A block cipher CBC structure */ -typedef struct { - /** The index of the cipher chosen */ - int cipher, - /** The block size of the given cipher */ - blocklen; - /** The current IV */ - unsigned char IV[MAXBLOCKSIZE]; - /** The scheduled key */ - symmetric_key key; -} symmetric_CBC; - - - -/** cipher descriptor table, last entry has "name == NULL" to mark the end of table */ -struct ltc_cipher_descriptor { - /** name of cipher */ - char *name; - /** internal ID */ - unsigned char ID; - /** min keysize (octets) */ - int min_key_length, - /** max keysize (octets) */ - max_key_length, - /** block size (octets) */ - block_length, - /** default number of rounds */ - default_rounds; -}; - - -//tomcrypt_hash.h -struct sha1_state { - uint64_t length; - uint32_t state[5], curlen; - uint8_t buf[64]; -}; - -struct sha256_state { - uint64_t length; - uint32_t state[8], curlen; - uint8_t buf[64]; -}; - - -typedef union Hash_state { - char dummy[1]; - struct sha1_state sha1; - struct sha256_state sha256; - void *data; -} hash_state; - - -//tomcrypt_mac.h -//empty for now - -#define LTC_HMAC_BLOCKSIZE 64 - -typedef struct Hmac_state { - hash_state md; - int hash; - hash_state hashstate; - unsigned char key[LTC_HMAC_BLOCKSIZE]; -} hmac_state; - - -//tomcrypt_custom.h - -/* default no functions */ -#define LTC_MUTEX_GLOBAL(x) -#define LTC_MUTEX_PROTO(x) -#define LTC_MUTEX_TYPE(x) -#define LTC_MUTEX_INIT(x) -#define LTC_MUTEX_LOCK(x) -#define LTC_MUTEX_UNLOCK(x) - -#define XMEMCMP memcmp -#define XMEMCPY memcpy -#define XMEMSET memset -#define XMALLOC malloc -#define XCALLOC calloc -#define XREALLOC realloc -#define XQSORT qsort -#define XFREE free -#define XSTRCMP strcmp - -//tomcrypt_prng.h -//empty for now - - - -//tomcrypt_pk.h -//empty for now - - -//tomcrypt_math.h -//empty for now - - -//tommath.h - -#ifndef MIN - #define MIN(x,y) ((x)<(y)?(x):(y)) -#endif - -#ifndef MAX - #define MAX(x,y) ((x)>(y)?(x):(y)) -#endif - -#ifndef CHAR_BIT - #define CHAR_BIT 8 -#endif - - -//tomcrypt_misc.h -//empty for now - - -//tomcrypt_argchk.h -#define LTC_ARGCHK(x) -#define LTC_ARGCHKVD(x) LTC_ARGCHK(x) - - -//tomcrypt_pkcs.h -//empty for now - - -#endif /* __XMHFCRYPTO_H__ */ diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/libubersparkcrypto.mk b/uxmhf-rpi3/libs/libxmhfcrypto/libubersparkcrypto.mk deleted file mode 100644 index 6751c8b15c..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/libubersparkcrypto.mk +++ /dev/null @@ -1,42 +0,0 @@ -###### -# libubersparkcrypto Makefile -# author: amit vasudevan (amitvasudevan@acm.org) -###### - -###### archive name -ARCHIVE = libubersparkcrypto.a - -###### compute source directory where this Makefile resides -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) $(srcdir)/hashes/sha1 - -###### populate sources and objects -C_SOURCES := hashes/sha1/sha1.c -O_SOURCES := $(C_SOURCES) -O_SOURCES := $(patsubst hashes/sha1/%, %, $(O_SOURCES)) -OBJECTS = $(patsubst %.c, %.o, $(O_SOURCES)) - - -###### targets -.PHONY: verify -verify: - $(FRAMAC) -main sha1 -lib-entry -wp -wp-model +cint -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(V_FLAGS) $(srcdir)/hashes/sha1/sha1.c - -.PHONY: build -build: $(ARCHIVE) - -$(ARCHIVE): $(OBJECTS) - $(AR) -rcs $(ARCHIVE) $(OBJECTS) - -%.o: %.c - @echo Building "$@" from "$<" - $(CCERT) -c $(CCERT_CFLAGS) -o $@ $< - - -.PHONY: clean -clean: - $(RM) $(OBJECTS) - $(RM) $(ARCHIVE) - - - diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/mac/hmac-sha1/hmac-sha1.c b/uxmhf-rpi3/libs/libxmhfcrypto/mac/hmac-sha1/hmac-sha1.c deleted file mode 100644 index 5a0d1e73c4..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/mac/hmac-sha1/hmac-sha1.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * hmac-sha1 implementation - * author: amit vasudevan (amitvasudevan@acm.org) - * adapted from libtomcrypto - */ - -//#include -//#include -//#include -//#include -//#include - - -#include -#include -#include -#include - - -#define LTC_HMAC_SHA1_BLOCKSIZE 64 - -/** - Initialize an HMAC context. - @param hmac The HMAC state - @param hash The index of the hash you want to use - @param key The secret key - @param keylen The length of the secret key (octets) - @return CRYPT_OK if successful -**/ -int hmac_sha1_init(hmac_state *hmac, const unsigned char *key, unsigned long keylen) -{ - unsigned char buf[LTC_HMAC_SHA1_BLOCKSIZE]; - unsigned long hashsize; - unsigned long i, z; - int err; - - LTC_ARGCHK(hmac != NULL); - LTC_ARGCHK(key != NULL); - - hmac->hash = 0; - hashsize = 20; - - /* valid key length? */ - if (keylen == 0) { - return CRYPT_INVALID_KEYSIZE; - } - - /* (1) make sure we have a large enough key */ - if(keylen > LTC_HMAC_SHA1_BLOCKSIZE) { - z = LTC_HMAC_SHA1_BLOCKSIZE; - if ((err = sha1_memory(key, keylen, hmac->key, &z)) != CRYPT_OK) { - goto LBL_ERR; - } - keylen = hashsize; - } else { - XMEMCPY(hmac->key, key, (size_t)keylen); - } - - if(keylen < LTC_HMAC_SHA1_BLOCKSIZE) { - memset((hmac->key) + keylen, 0, (size_t)(LTC_HMAC_BLOCKSIZE - keylen)); - } - - /* Create the initial vector for step (3) */ - for(i=0; i < LTC_HMAC_SHA1_BLOCKSIZE; i++) { - buf[i] = hmac->key[i] ^ 0x36; - } - - /* Pre-pend that to the hash data */ - if ((err = sha1_init(&hmac->md)) != CRYPT_OK) { - goto LBL_ERR; - } - - if ((err = sha1_process(&hmac->md, buf, LTC_HMAC_SHA1_BLOCKSIZE)) != CRYPT_OK) { - goto LBL_ERR; - } - - goto done; -LBL_ERR: -done: - return err; -} - - - - -/** - Process data through HMAC - @param hmac The hmac state - @param in The data to send through HMAC - @param inlen The length of the data to HMAC (octets) - @return CRYPT_OK if successful -**/ -int hmac_sha1_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) -{ - LTC_ARGCHK(hmac != NULL); - LTC_ARGCHK(in != NULL); - return sha1_process(&hmac->md, in, inlen); -} - - -/** - Terminate an HMAC session - @param hmac The HMAC state - @param out [out] The destination of the HMAC authentication tag - @param outlen [in/out] The max size and resulting size of the HMAC - authentication tag - @return CRYPT_OK if successful -**/ -int hmac_sha1_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen) -{ - unsigned char buf[LTC_HMAC_SHA1_BLOCKSIZE], isha[20]; - unsigned long hashsize, i; - int err; - - LTC_ARGCHK(hmac != NULL); - LTC_ARGCHK(out != NULL); - - /* get the hash message digest size */ - hashsize = 20; - - /* Get the hash of the first HMAC vector plus the data */ - if ((err = sha1_done(&hmac->md, isha)) != CRYPT_OK) { - goto LBL_ERR; - } - - /* Create the second HMAC vector vector for step (3) */ - for(i=0; i < LTC_HMAC_SHA1_BLOCKSIZE; i++) { - buf[i] = hmac->key[i] ^ 0x5C; - } - - /* Now calculate the "outer" hash for step (5), (6), and (7) */ - if ((err = sha1_init(&hmac->md)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = sha1_process(&hmac->md, buf, LTC_HMAC_SHA1_BLOCKSIZE)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = sha1_process(&hmac->md, isha, hashsize)) != CRYPT_OK) { - goto LBL_ERR; - } - if ((err = sha1_done(&hmac->md, buf)) != CRYPT_OK) { - goto LBL_ERR; - } - - /* copy to output */ - for (i = 0; i < hashsize && i < *outlen; i++) { - out[i] = buf[i]; - } - *outlen = i; - - err = CRYPT_OK; -LBL_ERR: - - return err; -} - - - - -/** - HMAC a block of memory to produce the authentication tag - @param hash The index of the hash to use - @param key The secret key - @param keylen The length of the secret key (octets) - @param in The data to HMAC - @param inlen The length of the data to HMAC (octets) - @param out [out] Destination of the authentication tag - @param outlen [in/out] Max size and resulting size of - authentication tag - @return CRYPT_OK if successful -**/ - - -int hmac_sha1_memory(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen) -{ - hmac_state hmac; - int err; - - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if ((err = hmac_sha1_init(&hmac, key, keylen)) != CRYPT_OK) { - goto LBL_ERR; - } - - if ((err = hmac_sha1_process(&hmac, in, inlen)) != CRYPT_OK) { - goto LBL_ERR; - } - - if ((err = hmac_sha1_done(&hmac, out, outlen)) != CRYPT_OK) { - goto LBL_ERR; - } - - err = CRYPT_OK; -LBL_ERR: - - return err; -} diff --git a/uxmhf-rpi3/libs/libxmhfcrypto/mac/hmac-sha2/hmac-sha256.c b/uxmhf-rpi3/libs/libxmhfcrypto/mac/hmac-sha2/hmac-sha256.c deleted file mode 100644 index c70b7a2f00..0000000000 --- a/uxmhf-rpi3/libs/libxmhfcrypto/mac/hmac-sha2/hmac-sha256.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * hmac-sha2 implementation - * author: amit vasudevan (amitvasudevan@acm.org) - * matt mccormack (matthew.mccormack@live.com) - * adapted from libtomcrypto - */ - - -#include -#include -#include -#include - - -#define LTC_HMAC_SHA2_BLOCKSIZE 64 - -/** - Initialize an HMAC context. - @param hmac The HMAC state - @param hash The index of the hash you want to use - @param key The secret key - @param keylen The length of the secret key (octets) - @return CRYPT_OK if successful -**/ -int hmac_sha256_init(hmac_state *hmac, const unsigned char *key, unsigned long keylen) { - unsigned char buf[LTC_HMAC_SHA2_BLOCKSIZE]; - unsigned long hashsize; - unsigned long i, z; - int err; - - LTC_ARGCHK(hmac != NULL); - LTC_ARGCHK(key != NULL); - - hmac->hash = 0; - hashsize = 32; - - /* valid key length? */ - if (keylen == 0) { - return CRYPT_INVALID_KEYSIZE; - } - - /* (1) make sure we have a large enough key */ - if(keylen > LTC_HMAC_SHA2_BLOCKSIZE) { - z = LTC_HMAC_SHA2_BLOCKSIZE; - if ((err = sha256_memory(key, keylen, hmac->key, &z)) != CRYPT_OK) { - goto LBL_ERR; - } - keylen = hashsize; - } else { - XMEMCPY(hmac->key, key, (size_t)keylen); - } - - if(keylen < LTC_HMAC_SHA2_BLOCKSIZE) { - memset((hmac->key) + keylen, 0, (size_t)(LTC_HMAC_BLOCKSIZE - keylen)); - } - - /* Create the initial vector for step (3) */ - for(i=0; i < LTC_HMAC_SHA2_BLOCKSIZE; i++) { - buf[i] = hmac->key[i] ^ 0x36; - } - - /* Pre-pend that to the hash data */ - if ((err = sha256_init(&hmac->md)) != CRYPT_OK) { - goto LBL_ERR; - } - - if ((err = sha256_process(&hmac->md, buf, LTC_HMAC_SHA2_BLOCKSIZE)) != CRYPT_OK) { - goto LBL_ERR; - } - - goto done; -LBL_ERR: -done: - return err; -} - - -/** - Process data through HMAC - @param hmac The hmac state - @param in The data to send through HMAC - @param inlen The length of the data to HMAC (octets) - @return CRYPT_OK if successful -**/ -int hmac_sha256_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) { - LTC_ARGCHK(hmac != NULL); - LTC_ARGCHK(in != NULL); - return sha256_process(&hmac->md, in, inlen); -} - - -/** - Terminate an HMAC session - @param hmac The HMAC state - @param out [out] The destination of the HMAC authentication tag - @param outlen [in/out] The max size and resulting size of the HMAC - authentication tag - @return CRYPT_OK if successful -**/ -int hmac_sha256_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen) { - unsigned char buf[LTC_HMAC_SHA2_BLOCKSIZE], isha[32]; - unsigned long hashsize, i; - int err; - - LTC_ARGCHK(hmac != NULL); - LTC_ARGCHK(out != NULL); - - /* get the hash message digest size */ - hashsize = 32; - - /* Get the hash of the first HMAC vector plus the data */ - if ((err = sha256_done(&hmac->md, isha)) != CRYPT_OK) { - goto LBL_ERR; - } - - /* Create the second HMAC vector vector for step (3) */ - for(i=0; i < LTC_HMAC_SHA2_BLOCKSIZE; i++) { - buf[i] = hmac->key[i] ^ 0x5C; - } - - /* Now calculate the "outer" hash for step (5), (6), and (7) */ - if ((err = sha256_init(&hmac->md)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = sha256_process(&hmac->md, buf, LTC_HMAC_SHA2_BLOCKSIZE)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = sha256_process(&hmac->md, isha, hashsize)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = sha256_done(&hmac->md, buf)) != CRYPT_OK) { goto LBL_ERR; } - - /* copy to output */ - for (i = 0; i < hashsize && i < *outlen; i++) { - out[i] = buf[i]; - } - *outlen = i; - - err = CRYPT_OK; -LBL_ERR: - return err; -} - - -/** - HMAC a block of memory to produce the authentication tag - @param hash The index of the hash to use - @param key The secret key - @param keylen The length of the secret key (octets) - @param in The data to HMAC - @param inlen The length of the data to HMAC (octets) - @param out [out] Destination of the authentication tag - @param outlen [in/out] Max size and resulting size of authentication tag - @return CRYPT_OK if successful -**/ -int hmac_sha256_memory(const unsigned char *key, unsigned long keylen, - const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen) { - hmac_state hmac; - int err; - - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(in != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - if ((err = hmac_sha256_init(&hmac, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = hmac_sha256_process(&hmac, in, inlen)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = hmac_sha256_done(&hmac, out, outlen)) != CRYPT_OK) { goto LBL_ERR; } - err = CRYPT_OK; -LBL_ERR: - return err; -} diff --git a/uxmhf-rpi3/rgapps/linux/Makefile b/uxmhf-rpi3/rgapps/linux/Makefile deleted file mode 100644 index 1ac942c6e9..0000000000 --- a/uxmhf-rpi3/rgapps/linux/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# linux guest apps and libraries top-level Makefile -# -# author: amit vasudevan (amitvasudevan@acm.org) -# -# - -export CURRENT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export UXMHFRPI3_DIR := $(realpath $(CURRENT_DIR)/../../) - -# tools -export AR=ar -export CP=cp -export CCERT=$(TOOLPREFIX)gcc -export CC=$(TOOLPREFIX)gcc -export CCERT_FLAGS=$(CFLAGS) -export RM=rm - - -TOOLPREFIX ?= arm-linux-gnueabihf- - -INCS = -I. -INCS += -I$(CURRENT_DIR)/libs/libuhcall/include - -LIBS = $(CURRENT_DIR)/libs/libuhcall/libuhcall.a - -CFLAGS = -I. -I$(INCS) -c -g -Wall -CCERTFLAGS = $(CFLAGS) -LFLAGS = -g -Wall -Wextra - -export TOOLPREFIX -export CFLAGS -export CCERTFLAGS -export LIBS - - -.PHONY: all -all: - cd libs/libuhcall && make -w all - -.PHONY: clean -clean: - cd libs/libuhcall && make -w clean - diff --git a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/Makefile b/uxmhf-rpi3/rgapps/linux/libs/libkhcall/Makefile deleted file mode 100644 index 1b6d6aa322..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -CURRENT_DIR := $(realpath $(src)) - -UINCS = -I$(CURRENT_DIR)/include - -EXTRA_CFLAGS := $(UINCS) - -lib-m := khcall.o diff --git a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/README b/uxmhf-rpi3/rgapps/linux/libs/libkhcall/README deleted file mode 100644 index bd4b21d90d..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/README +++ /dev/null @@ -1,2 +0,0 @@ -library with supporting functions for interacting with the micro-hypervisor from a kernel module -author: amit vasudevan (amitvasudevan@acm.org), matt mccormack (matthew.mccormack@live.com) diff --git a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/build.sh b/uxmhf-rpi3/rgapps/linux/libs/libkhcall/build.sh deleted file mode 100755 index 4973bcc786..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -e - - -if [[ $# -ne 2 ]]; then - echo "usage: build " - exit 1 -fi - -LINUX_KERNEL_SRC=$1 -CROSS_COMPILE_TOOLS_DIR=$2 - -echo "Building module..." - -make -C $LINUX_KERNEL_SRC ARCH=arm \ -CROSS_COMPILE=$CROSS_COMPILE_TOOLS_DIR/arm-linux-gnueabihf- \ -M=$PWD - -mv lib.a libkhcall.a - -echo "Module build success!" - diff --git a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/include/khcall.h b/uxmhf-rpi3/rgapps/linux/libs/libkhcall/include/khcall.h deleted file mode 100644 index 8c2a3951ea..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/include/khcall.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - libkhcall header - - author: amit vasudevan (amitvasudevan@acm.org) - matt mccormack (matthew.mccormack@live.com) -*/ - -#ifndef __KHCALL_H__ -#define __KHCALL_H__ - -#define KHCALL_PM_PAGE_SIZE 4096 - -#ifndef __ASSEMBLY__ - -bool khcall(uint32_t khcall_function, void *khcall_buffer, uint32_t khcall_buffer_len); - - -#endif // __ASSEMBLY__ - - - -#endif //__KHCALL_H__ diff --git a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/khcall.c b/uxmhf-rpi3/rgapps/linux/libs/libkhcall/khcall.c deleted file mode 100644 index 98ed6ecb9f..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libkhcall/khcall.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * khcall -- guest interface for micro hypervisor hypercall - * - * author: amit vasudevan (amitvasudevan@acm.org), - * matt mccormack (matthew.mccormack@live.com) - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -static void khcall_hvc(uint32_t khcall_function, void *khcall_buffer, uint32_t khcall_buffer_len); - -////// -// khcall micro-hypervisor hypercall interface -// return true on success, false on error -////// -bool khcall(uint32_t khcall_function, void *khcall_buffer, uint32_t khcall_buffer_len){ - void *khcall_kbuff; - uint64_t khcall_kbuff_paddr; - struct page *k_page; - - //if khcall_buffer is NULL then khcall_buffer_len should be 0 - //for a NULL hypercall test - if(khcall_buffer == NULL && khcall_buffer_len != 0){ - printk("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - - //if khcall_buffer is not NULL then base address of khcall_buffer + khcall_buffer_len - //cannot exceed a page size - if(khcall_buffer != NULL){ - if ((((uint32_t)khcall_buffer % KHCALL_PM_PAGE_SIZE) + khcall_buffer_len) > KHCALL_PM_PAGE_SIZE){ - printk("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - } - - // allocate kernel page - k_page = alloc_page(GFP_KERNEL | __GFP_ZERO); - khcall_kbuff = (void *)page_address(k_page); - - // copy hypercall buffer into kernel page - memcpy(khcall_kbuff, khcall_buffer, khcall_buffer_len); - - // get kernel page physcial address - khcall_kbuff_paddr = page_to_phys(k_page); - - //issue the hypercall - khcall_hvc(khcall_function, (uint32_t)khcall_kbuff_paddr, khcall_buffer_len); - - // copy kernel page back to hypercall buffer - memcpy(khcall_buffer, khcall_kbuff, khcall_buffer_len); - - // free kernel page - __free_page(k_page); - - //hypercall succeeded - return true; -} - -static void khcall_hvc(uint32_t khcall_function, void *khcall_buffer, uint32_t khcall_buffer_len) { - asm volatile - ( " mov r0, %[in_0]\r\n" - " mov r1, %[in_1]\r\n" - " mov r2, %[in_2]\r\n" - ".long 0xE1400071 \r\n" - : - : [in_0] "r" (khcall_function), [in_1] "r" (khcall_buffer), [in_2] "r" (khcall_buffer_len) - : "r0", "r1", "r2" - ); -} diff --git a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/Makefile b/uxmhf-rpi3/rgapps/linux/libs/libuhcall/Makefile deleted file mode 100644 index 55481c875c..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# libuhcall top-level Makefile -# author: amit vasudevan (amitvasudevan@acm.org) - -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) - -C_SOURCES := $(wildcard $(srcdir)/*.c) -C_SOURCES := $(patsubst $(srcdir)/%, %, $(C_SOURCES)) - -OBJECTS = $(patsubst %.c, %.o, $(C_SOURCES)) - -LIBUHCALL_OBJECTS_DIR = _objs_libuhcall -THE_ARCHIVE = libuhcall.a - -# targets -.PHONY: verify -verify: - -.PHONY: all -all: $(THE_ARCHIVE) - -$(THE_ARCHIVE): $(OBJECTS) - cd $(LIBUHCALL_OBJECTS_DIR) && $(AR) -rcs $(THE_ARCHIVE) $(OBJECTS) - $(CP) $(LIBUHCALL_OBJECTS_DIR)/$(THE_ARCHIVE) . - -%.o: %.c - mkdir -p $(LIBUHCALL_OBJECTS_DIR) - @echo Building "$@" from "$<" - $(CCERT) -c $(CCERT_FLAGS) -o $(LIBUHCALL_OBJECTS_DIR)/$@ $< - - -.PHONY: clean -clean: - $(RM) -rf $(LIBUHCALL_OBJECTS_DIR) - $(RM) -f ./$(THE_ARCHIVE) - diff --git a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/README b/uxmhf-rpi3/rgapps/linux/libs/libuhcall/README deleted file mode 100644 index 4f1938612f..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/README +++ /dev/null @@ -1,2 +0,0 @@ -library with supporting functions for interacting with the micro-hypervisor -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/include/uhcall.h b/uxmhf-rpi3/rgapps/linux/libs/libuhcall/include/uhcall.h deleted file mode 100644 index d871ef0fcf..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/include/uhcall.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - libuhcall header - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#ifndef __UHCALL_H__ -#define __UHCALL_H__ - -#define UHCALL_PM_PAGE_SHIFT 12 -#define UHCALL_PM_PAGE_SIZE 4096 -#define UHCALL_PM_LENGTH 8 - - -#ifndef __ASSEMBLY__ - -typedef struct { - unsigned long uhcall_function; - void *uhcall_buffer; - unsigned long uhcall_buffer_len; -} uhcallkmod_param_t; - - -bool uhcall_va2pa(void *vaddr, uint64_t *paddr); -bool uhcall(uint32_t uhcall_function, void *uhcall_buffer, uint32_t uhcall_buffer_len); - - -#endif // __ASSEMBLY__ - - - -#endif //__UHCALL_H__ diff --git a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/uhcall.c b/uxmhf-rpi3/rgapps/linux/libs/libuhcall/uhcall.c deleted file mode 100644 index 3e60c78def..0000000000 --- a/uxmhf-rpi3/rgapps/linux/libs/libuhcall/uhcall.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * uhcall -- guest interface for micro hypervisor hypercall - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -////// -// va_to_pa: virtual to physical address mapping -// return true on success, false on error -////// -bool uhcall_va2pa(void *vaddr, uint64_t *paddr) { - FILE *pagemap; - uint32_t offset; - uint64_t page_frame_number = 0; - - //sanity check incoming parameters - if (paddr == NULL) - return false; - - // open the pagemap file for the current process - pagemap = fopen("/proc/self/pagemap", "rb"); - if(pagemap == NULL) - return false; //unable to open pagemap file - - // seek to the page that vaddr is on - offset = ((uint32_t)vaddr / getpagesize()) * UHCALL_PM_LENGTH; - if(fseek(pagemap, (uint32_t)offset, SEEK_SET) != 0) - return false; //Failed to seek pagemap to proper location - - // The page frame number is in bits 0-54 so read the - // 8 bytes and clear evrything but 0-54 - fread(&page_frame_number, UHCALL_PM_LENGTH, 1, pagemap); - - if (page_frame_number & (1ULL << 63)) { // page present ? - *paddr = page_frame_number & ((1ULL << 54) - 1); // pfn mask - *paddr = *paddr * getpagesize(); - fclose(pagemap); - return true; - }else{ - fclose(pagemap); - return false; - } - -#if 0 - page_frame_number &= 0x7FFFFFFFFFFFFFULL; - - fclose(pagemap); - - *paddr = (page_frame_number << UHCALL_PM_PAGE_SHIFT); - return true; -#endif -} - - -////// -// uhcall micro-hypervisor hypercall interface -// return true on success, false on error -////// -bool uhcall(uint32_t uhcall_function, void *uhcall_buffer, uint32_t uhcall_buffer_len){ - int ret, fd; - uhcallkmod_param_t uhcallp; - uint64_t uhcall_buffer_paddr; - - //if uhcall_buffer is NULL then uhcall_buffer_len should be 0 - //for a NULL hypercall test - if(uhcall_buffer == NULL && uhcall_buffer_len != 0){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - - //if uhcall_buffer is not NULL then base address of uhcall_buffer + uhcall_buffer_len - //cannot exceed a page size - if(uhcall_buffer != NULL){ - if ( (((uint32_t)uhcall_buffer % UHCALL_PM_PAGE_SIZE) + uhcall_buffer_len) > UHCALL_PM_PAGE_SIZE ){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - } - -#if 0 - //get buffer physical address - if(!uhcall_va2pa(uhcall_buffer, &uhcall_buffer_paddr) ){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - - - //printf("%s: uhcall_buffer_paddr=0x%08x\n", __FUNCTION__, (uint32_t)uhcall_buffer_paddr); -#endif - - //open uhcallkmod device - fd = open("/dev/uhcallkmod", O_RDWR); - if (fd < 0){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; //Failed to open /dev/uhcallkmod - } - - -#if 1 - //lock uhcall_buffer in memory - if(mlock(uhcall_buffer, uhcall_buffer_len) == -1){ - //if(mlock(uhcall_buffer, 4096) == -1){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; //nFailed to lock page in memory - } -#endif - //populate uhcallkmod_param_t - uhcallp.uhcall_function=uhcall_function; - //uhcallp.uhcall_buffer=(uint32_t)uhcall_buffer; - // uhcallp.uhcall_buffer=(void *)(uint32_t)uhcall_buffer_paddr; - uhcallp.uhcall_buffer=(void *)(uint32_t)uhcall_buffer; - uhcallp.uhcall_buffer_len=uhcall_buffer_len; - - //printf("%s: uhcall_function=%u, uhcall_buffer=0x%08x, uhcall_buffer_len=%u\n", __FUNCTION__, - // uhcallp.uhcall_function, uhcallp.uhcall_buffer, uhcallp.uhcall_buffer_len); - - //issue the hypercall - ret = write(fd, &uhcallp, sizeof(uhcallp)); - if (ret < 0){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; //error in issuing hypercall - } - -#if 1 - //unlock uhcall_buffer page - if(munlock(uhcall_buffer, uhcall_buffer_len) == -1){ - //if(munlock(uhcall_buffer, 4096) == -1){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; //Failed to unlock page in memory - } -#endif - if ( close(fd) < 0 ){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; //error in closing uhcallkmod device - } - - //hypercall succeeded - return true; -} diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/Makefile b/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/Makefile deleted file mode 100644 index 48d563b6d8..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# File: Makefile -# By: Andy Sayler -# Adopted from work by: Chris Wailes -# Project: CSCI 3753 Programming Assignment 5 -# Creation Date: 2010/04/06 -# Modififed Date: 2012/04/12 -# Description: -# This is the Makefile for PA5. -# Modified for uxmhf by amit vasudevan (amitvasudevan@acm.org) - -export CURRENT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export UXMHFRPI3_DIR := $(CURRENT_DIR)/../../.. -export RGAPPS_LIB_DIR := $(realpath $(CURRENT_DIR)/../libs) -export SYSROOT_USR_DIR := $(realpath $(HOME)/pi-tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot/usr) -export SYSROOT_LIB_DIR := $(realpath $(HOME)/pi-tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot/lib) - -CC = arm-linux-gnueabihf-gcc - -CFLAGSFUSE = -D_FILE_OFFSET_BITS=64 -I. -I/usr/include/fuse - -DIR_LIBFUSE = $(SYSROOT_LIB_DIR)/arm-linux-gnueabihf/libfuse.so.2.9.3 -DIR_LIBCRYPTO = $(SYSROOT_USR_DIR)/lib/arm-linux-gnueabihf/libcrypto.so -DIR_LIBPTHREAD = $(SYSROOT_USR_DIR)/lib/arm-linux-gnueabihf/libpthread.so -DIR_LIBDL = $(SYSROOT_LIB_DIR)/arm-linux-gnueabihf/libdl.so.2 -DIR_LIBXMHFCRYPTO = $(UXMHFRPI3_DIR)/libs/libxmhfcrypto/libxmhfcrypto.a - - -LIBS = $(RGAPPS_LIB_DIR)/libuhcall/libuhcall.a -LIBS += $(DIR_LIBXMHFCRYPTO) $(DIR_LIBFUSE) $(DIR_LIBPTHREAD) $(DIR_LIBCRYPTO) $(DIR_LIBDL) - - - - -INCS = -I$(UXMHFRPI3_DIR)/include -INCS += -I$(RGAPPS_LIB_DIR)/libuhcall/include -INCS += -I../../../libs/libxmhfcrypto/include - -CFLAGS = -I. $(INCS) -c -g -Wall -LFLAGS = -g -Wall -Wextra - -.PHONY: all pa5-encfs clean unmount mount debug -all: pa5-encfs - -pa5-encfs: pa5-encfs.o aes-crypt.o - $(CC) $(LFLAGS) $^ -o $@ $(LIBS) - -aes-crypt.o: aes-crypt.c aes-crypt.h - $(CC) $(CFLAGS) -o $@ $< - -pa5-encfs.o: pa5-encfs.c - $(CC) $(CFLAGS) $(CFLAGSFUSE) $< - -unmount: - fusermount -u mir - -debug: clean pa5-encfs - ./pa5-encfs -d mnt/ mir/ -e password - -mount: clean pa5-encfs - ./pa5-encfs mnt/ mir/ -e password - -clean: - rm -f pa5-encfs - rm -f *.o diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/README b/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/README deleted file mode 100644 index 37d52c2852..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/README +++ /dev/null @@ -1,2 +0,0 @@ -fuse encrypted file system application -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/aes-crypt.c b/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/aes-crypt.c deleted file mode 100644 index ee257c566c..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/aes-crypt.c +++ /dev/null @@ -1,511 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* aes-crypt.c - * High level function interface for performing AES encryption on FILE pointers - * Uses OpenSSL libcrypto EVP API - * - * By Andy Sayler (www.andysayler.com) - * Created 04/17/12 - * Modified 04/18/12 - * - * Derived from OpenSSL.org EVP_Encrypt_* Manpage Examples - * http://www.openssl.org/docs/crypto/EVP_EncryptInit.html#EXAMPLES - * - * With additional information from Saju Pillai's OpenSSL AES Example - * http://saju.net.in/blog/?p=36 - * http://saju.net.in/code/misc/openssl_aes.c.txt - * - */ - -#include -#include "aes-crypt.h" - - -#if 0 -extern int do_crypt(FILE* in, FILE* out, int action, char* key_str){ - /* Local Vars */ - - /* Buffers */ - unsigned char inbuf[BLOCKSIZE]; - int inlen; - /* Allow enough space in output buffer for additional cipher block */ - unsigned char outbuf[BLOCKSIZE + EVP_MAX_BLOCK_LENGTH]; - int outlen; - int writelen; - - /* OpenSSL libcrypto vars */ - EVP_CIPHER_CTX ctx; - unsigned char key[32]; - unsigned char iv[32]; - int nrounds = 5; - - /* tmp vars */ - int i; - fprintf(stderr, "aes-crypt debug: at location 1\n"); - /* Setup Encryption Key and Cipher Engine if in cipher mode */ - if(action >= 0){ - fprintf(stderr, "aes-crypt debug: at location: 2\n"); - if(!key_str){ - fprintf(stderr, "aes-crypt debug: at location: 3\n"); - /* Error */ - fprintf(stderr, "Key_str must not be NULL\n"); - return 0; - } - - /* Build Key from String */ - i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), NULL, - (unsigned char*)key_str, strlen(key_str), nrounds, key, iv); - - if (i != 32) { - fprintf(stderr, "aes-crypt debug: at location: 4\n"); - /* Error */ - fprintf(stderr, "Key size is %d bits - should be 256 bits\n", i*8); - return 0; - } - - /* Init Engine */ - EVP_CIPHER_CTX_init(&ctx); - EVP_CipherInit_ex(&ctx, EVP_aes_256_cbc(), NULL, key, iv, action); - } - - /* Loop through Input File*/ - for(;;){ - /* Read Block */ - inlen = fread(inbuf, sizeof(*inbuf), BLOCKSIZE, in); - if(inlen <= 0){ - /* EOF -> Break Loop */ - break; - } - - /* If in cipher mode, perform cipher transform on block */ - if(action >= 0){ - fprintf(stderr, "aes-crypt debug: at location: 5\n"); - if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) - { - fprintf(stderr, "aes-crypt debug: at location: 7\n"); - /* Error */ - EVP_CIPHER_CTX_cleanup(&ctx); - return 0; - } - } - /* If in pass-through mode. copy block as is */ - else{ - fprintf(stderr, "aes-crypt debug: at location: 8\n"); - memcpy(outbuf, inbuf, inlen); - outlen = inlen; - } - - /* Write Block */ - writelen = fwrite(outbuf, sizeof(*outbuf), outlen, out); - if(writelen != outlen){ - fprintf(stderr, "aes-crypt debug: at location: 9\n"); - /* Error */ - perror("fwrite error"); - EVP_CIPHER_CTX_cleanup(&ctx); - return 0; - } - } //end-for - - /* If in cipher mode, handle necessary padding */ - if(action >= 0){ - fprintf(stderr, "aes-crypt debug: at location: 10\n"); - /* Handle remaining cipher block + padding */ - if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) - { - fprintf(stderr, "aes-crypt debug: at location: 11\n"); - /* Error */ - EVP_CIPHER_CTX_cleanup(&ctx); - return 0; - } - /* Write remainign cipher block + padding*/ - fwrite(outbuf, sizeof(*inbuf), outlen, out); - EVP_CIPHER_CTX_cleanup(&ctx); - } - - fprintf(stderr, "aes-crypt debug: at location: 12\n"); - /* Success */ - return 1; -} -#endif //0 - - - - - -#if 0 -extern int do_crypt(FILE* in, FILE* out, int action, char* key_str){ - /* Local Vars */ - - /* Buffers */ - unsigned char inbuf[BLOCKSIZE]; - int inlen; - /* Allow enough space in output buffer for additional cipher block */ - unsigned char outbuf[BLOCKSIZE]; - int outlen; - int writelen; - - symmetric_CBC cbc_ctx; - - //action can be ENCRYPT (1), DECRYPT (0) or PASS_THROUGH (-1) - - fprintf(stderr, "aes-crypt debug: at location 1\n"); - - /* Setup Encryption Key and Cipher Engine if in cipher mode */ - if(action == ENCRYPT || action == DECRYPT){ - fprintf(stderr, "aes-crypt debug: at location: 2\n"); - - if(!key_str){ - fprintf(stderr, "aes-crypt debug: at location: 3\n"); - /* Error */ - fprintf(stderr, "Key_str must not be NULL\n"); - return 0; - } - - /* Build Key from String */ - //TBD - - /* Init Engine */ - if( rijndael_cbc_start(aes_iv, aes_key, AES_KEY_LEN_BYTES, 0, &cbc_ctx) != CRYPT_OK ) - return 0; - } - - /* Loop through Input File*/ - for(;;){ - /* Read Block */ - inlen = fread(inbuf, sizeof(*inbuf), BLOCKSIZE, in); - if(inlen <= 0){ - /* EOF -> Break Loop */ - break; - } - - //sanity check inlen is multiple of AES block length (16 bytes) - if( inlen % 16 ){ - fprintf(stderr, "aes-crypt debug: at location: 1.1\n"); - return 0; - } - - - /* If in cipher mode, perform cipher transform on block */ - if(action == ENCRYPT){ - fprintf(stderr, "aes-crypt debug: at location: 4\n"); - - if( rijndael_cbc_encrypt(inbuf, outbuf, inlen, &cbc_ctx) != CRYPT_OK) - return 0; - - outlen = inlen; - fprintf(stderr, "aes-crypt debug: at location: 5\n"); - - if( rijndael_cbc_done( &cbc_ctx) != CRYPT_OK) - return 0; - - fprintf(stderr, "aes-crypt debug: at location: 6\n"); - - }else if (action == DECRYPT){ - fprintf(stderr, "aes-crypt debug: at location: 7\n"); - - if( rijndael_cbc_decrypt(inbuf, outbuf, inlen, &cbc_ctx) != CRYPT_OK) - return 0; - - outlen = inlen; - fprintf(stderr, "aes-crypt debug: at location: 8\n"); - - if( rijndael_cbc_done( &cbc_ctx) != CRYPT_OK) - return 0; - - fprintf(stderr, "aes-crypt debug: at location: 9\n"); - - }else{ - /* If in pass-through mode. copy block as is */ - fprintf(stderr, "aes-crypt debug: at location: 10\n"); - memcpy(outbuf, inbuf, inlen); - outlen = inlen; - } - - /* Write Block */ - writelen = fwrite(outbuf, sizeof(*outbuf), outlen, out); - if(writelen != outlen){ - fprintf(stderr, "aes-crypt debug: at location: 11\n"); - /* Error */ - perror("fwrite error"); - return 0; - } - } //end-for - - fprintf(stderr, "aes-crypt debug: at location: 12\n"); - - return 1; -} -#endif - - - -#if 0 -////// -// back-end functions -////// -/* - do_crypt using libxmhfcrypto aes primitive - aeskey of size TPM_AES_KEY_LEN_BYTES (16) - iv of size TPM_AES_KEY_LEN_BYTES (16) which is random - cbc_start - cbc_encrypt - cbc_done - */ -uint8_t aes_iv[AES_KEY_LEN_BYTES] = - { - 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, 0x8a, - 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, 0x8b - }; -uint8_t aes_key[AES_KEY_LEN_BYTES] = - { - 0xfa, 0xea, 0xda, 0xca, 0xba, 0xaa, 0x9a, 0x8a, - 0xfb, 0xeb, 0xdb, 0xcb, 0xbb, 0xab, 0x9b, 0x8b - }; - -symmetric_CBC cbc_ctx; - -//returns 0 on fail -void do_crypt_start(pa5encfs_param_t *ep){ - /* Init Engine */ - if( rijndael_cbc_start(aes_iv, aes_key, AES_KEY_LEN_BYTES, 0, &cbc_ctx) != CRYPT_OK ) - ep->result = 0; - else - ep->result = 1; -} - -//returns 0 on fail -void do_crypt_encrypt(pa5encfs_param_t *ep){ - if( rijndael_cbc_encrypt(ep->inbuf, ep->outbuf, ep->inlen, &cbc_ctx) != CRYPT_OK) - ep->result=0; - else - ep->result=1; -} - -//returns 0 on fail -void do_crypt_decrypt(pa5encfs_param_t *ep){ - if( rijndael_cbc_decrypt(ep->inbuf, ep->outbuf, ep->inlen, &cbc_ctx) != CRYPT_OK) - ep->result=0; - else - ep->result=1; -} - -//returns 0 on fail -void do_crypt_done(pa5encfs_param_t *ep){ - if( rijndael_cbc_done( &cbc_ctx) != CRYPT_OK) - ep->result=0; - else - ep->result=1; -} - - - -////// -#endif - - -////// -// back-end functions -////// -/* - do_crypt using libxmhfcrypto aes primitive - aeskey of size TPM_AES_KEY_LEN_BYTES (16) - iv of size TPM_AES_KEY_LEN_BYTES (16) which is random - cbc_start - cbc_encrypt - cbc_done - */ -uint8_t aes_iv[AES_KEY_LEN_BYTES] = - { - 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, 0x8a, - 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, 0x8b - }; -uint8_t aes_key[AES_KEY_LEN_BYTES] = - { - 0xfa, 0xea, 0xda, 0xca, 0xba, 0xaa, 0x9a, 0x8a, - 0xfb, 0xeb, 0xdb, 0xcb, 0xbb, 0xab, 0x9b, 0x8b - }; - -symmetric_CBC cbc_ctx; - -//returns 0 on fail -void do_crypt_start(pa5encfs_param_t *ep){ - if(!uhcall(UAPP_PA5ENCFS_FUNCTION_START, ep, sizeof(pa5encfs_param_t))) - fprintf(stderr, "hypercall FAILED\n"); - else - fprintf(stderr, "hypercall SUCCESS\n"); -} - -//returns 0 on fail -void do_crypt_encrypt(pa5encfs_param_t *ep){ - if(!uhcall(UAPP_PA5ENCFS_FUNCTION_ENCRYPT, ep, sizeof(pa5encfs_param_t))) - fprintf(stderr, "hypercall FAILED\n"); - else - fprintf(stderr, "hypercall SUCCESS\n"); -} - -//returns 0 on fail -void do_crypt_decrypt(pa5encfs_param_t *ep){ - if(!uhcall(UAPP_PA5ENCFS_FUNCTION_DECRYPT, ep, sizeof(pa5encfs_param_t))) - fprintf(stderr, "hypercall FAILED\n"); - else - fprintf(stderr, "hypercall SUCCESS\n"); -} - -//returns 0 on fail -void do_crypt_done(pa5encfs_param_t *ep){ - if(!uhcall(UAPP_PA5ENCFS_FUNCTION_DONE, ep, sizeof(pa5encfs_param_t))) - fprintf(stderr, "hypercall FAILED\n"); - else - fprintf(stderr, "hypercall SUCCESS\n"); -} - - - -////// - - - -extern int do_crypt(FILE* in, FILE* out, int action, char* key_str){ - - /* Local Vars */ - pa5encfs_param_t *ep; - - - //allocate memory - if (posix_memalign(&ep, 4096, sizeof(pa5encfs_param_t)) != 0){ - //printf("%s: error: line %u\n", __FUNCTION__); - return 0; - } - - - //action can be ENCRYPT (1), DECRYPT (0) or PASS_THROUGH (-1) - - fprintf(stderr, "aes-crypt debug: at location 1\n"); - - /* Setup Encryption Key and Cipher Engine if in cipher mode */ - if(action == ENCRYPT || action == DECRYPT){ - fprintf(stderr, "aes-crypt debug: at location: 2\n"); - - if(!key_str){ - fprintf(stderr, "aes-crypt debug: at location: 3\n"); - /* Error */ - fprintf(stderr, "Key_str must not be NULL\n"); - goto ERR_freeall; - } - - /* Build Key from String */ - //TBD - - do_crypt_start(ep); - if(!ep->result) - goto ERR_freeall; - } - - /* Loop through Input File*/ - for(;;){ - /* Read Block */ - ep->inlen = fread(ep->inbuf, sizeof(unsigned char), BLOCKSIZE, in); - if(ep->inlen <= 0){ - /* EOF -> Break Loop */ - break; - } - - //sanity check inlen is multiple of AES block length (16 bytes) - if( ep->inlen % 16 ){ - fprintf(stderr, "aes-crypt debug: at location: 1.1\n"); - goto ERR_freeall; - } - - - /* If in cipher mode, perform cipher transform on block */ - if(action == ENCRYPT){ - fprintf(stderr, "aes-crypt debug: at location: 4\n"); - - do_crypt_encrypt(ep); - if(!ep->result) - goto ERR_freeall; - - ep->outlen = ep->inlen; - fprintf(stderr, "aes-crypt debug: at location: 5\n"); - - do_crypt_done(ep); - if(!ep->result) - goto ERR_freeall; - - - fprintf(stderr, "aes-crypt debug: at location: 6\n"); - - }else if (action == DECRYPT){ - fprintf(stderr, "aes-crypt debug: at location: 7\n"); - - do_crypt_decrypt(ep); - if(!ep->result) - goto ERR_freeall; - - ep->outlen = ep->inlen; - fprintf(stderr, "aes-crypt debug: at location: 8\n"); - - do_crypt_done(ep); - if(!ep->result) - goto ERR_freeall; - - fprintf(stderr, "aes-crypt debug: at location: 9\n"); - - }else{ - /* If in pass-through mode. copy block as is */ - fprintf(stderr, "aes-crypt debug: at location: 10\n"); - memcpy(ep->outbuf, ep->inbuf, ep->inlen); - ep->outlen = ep->inlen; - } - - /* Write Block */ - ep->writelen = fwrite(ep->outbuf, sizeof(unsigned char), ep->outlen, out); - if(ep->writelen != ep->outlen){ - fprintf(stderr, "aes-crypt debug: at location: 11\n"); - /* Error */ - perror("fwrite error"); - goto ERR_freeall; - } - } //end-for - - fprintf(stderr, "aes-crypt debug: at location: 12\n"); - free(ep); - return 1; - -ERR_freeall: - free(ep); - return 0; -} - diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/aes-crypt.h b/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/aes-crypt.h deleted file mode 100644 index 7bf7998f4f..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/aes-crypt.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* aes-crypt.h - * High level function interface for performing AES encryption on FILE pointers - * Uses OpenSSL libcrypto EVP API - * - * By Andy Sayler (www.andysayler.com) - * Created 04/17/12 - * Modified 04/18/12 - * - * Derived from OpenSSL.org EVP_Encrypt_* Manpage Examples - * http://www.openssl.org/docs/crypto/EVP_EncryptInit.html#EXAMPLES - * - * With additional information from Saju Pillai's OpenSSL AES Example - * http://saju.net.in/blog/?p=36 - * http://saju.net.in/code/misc/openssl_aes.c.txt - * - */ - -#ifndef AES_CRYPT_H -#define AES_CRYPT_H - -#include -#include -#include -#include - -#include -#include - -typedef unsigned int u32; -typedef unsigned long long int u64; -typedef unsigned char u8; - -#include -#include - -#define BLOCKSIZE 1024 -#define FAILURE 0 -#define SUCCESS 1 - -/* int do_crypt(FILE* in, FILE* out, int action, char* key_str) - * Purpose: Perform cipher on in File* and place result in out File* - * Args: FILE* in : Input File Pointer - * FILE* out : Output File Pointer - * int action : Cipher action (1=encrypt, 0=decrypt, -1=pass-through (copy)) - * char* key_str : C-string containing passpharse from which key is derived - * Return: FAILURE on error, SUCCESS on success - */ -extern int do_crypt(FILE* in, FILE* out, int action, char* key_str); - -#endif diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/pa5-encfs.c b/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/pa5-encfs.c deleted file mode 100644 index bc1df01cdb..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-pa5encfs/pa5-encfs.c +++ /dev/null @@ -1,705 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - moune FUSE: Filesystem in Userspace - Copyright (C) 2001-2007 Miklos Szeredi - - Minor modifications and note by Andy Sayler (2012) - - Source: fuse-2.8.7.tar.gz examples directory - http://sourceforge.net/projects/fuse/files/fuse-2.X/ - - This program can be distributed under the terms of the GNU GPL. - See the file COPYING. - - gcc -Wall `pkg-config fuse --cflags` fusexmp.c -o fusexmp `pkg-config fuse --libs` - - Note: This implementation is largely stateless and does not maintain - open file handels between open and release calls (fi->fh). - Instead, files are opened and closed as necessary inside read(), write(), - etc calls. As such, the functions that rely on maintaining file handles are - not implmented (fgetattr(), etc). Those seeking a more efficient and - more complete implementation may wish to add fi->fh support to minimize - open() and close() calls and support fh dependent functions. - -*/ - -#define FUSE_USE_VERSION 28 -#define HAVE_SETXATTR -#define ENCRYPT 1 -#define DECRYPT 0 -#define PASS_THROUGH (-1) - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef linux -/* For pread()/pwrite() */ -#define _XOPEN_SOURCE 500 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "aes-crypt.h" -#ifdef HAVE_SETXATTR -#include -#endif - -/* #define XMP_DATA ((struct xmp_state *) fuse_get_context()->private_data) */ - -////// -// helper functions -////// - - -char* root_path; -char* password; - -/* is_encrypted: returns 1 if encryption succeeded, 0 otherwise */ -int is_encrypted(const char *path) -{ - int ret; - char xattr_val[5]; - getxattr(path, "user.encfs", xattr_val, sizeof(char)*5); - fprintf(stderr, "xattr set to: %s\n", xattr_val); - - ret = (strcmp(xattr_val, "true") == 0); - return ret; -} - -/* add_encrypted_attr: returns 1 on success, 0 on failure */ -int add_encrypted_attr(const char *path) -{ - int ret; - int setxattr_ret; - setxattr_ret = setxattr(path, "user.encfs", "true", (sizeof(char)*5), 0); - ret = setxattr_ret == 0; - fprintf(stderr, "\n%s: setxattr %s\n", __FUNCTION__, ret > 0 ? "succeeded" : "failed"); - return ret; -} - -// add non-padded size attr -// returns 1 on success, 0 on failure -int add_nonpaddedsize_attr(const char *path, unsigned int nonpaddedsize){ - int ret; - int setxattr_ret; - - setxattr_ret = setxattr(path, "user.nonpaddedsize", &nonpaddedsize, sizeof(unsigned int), 0); - ret = setxattr_ret == 0; - fprintf(stderr, "\n%s: setxattr %s\n", __FUNCTION__, ((ret > 0) ? "succeeded" : "failed")); - - return ret; -} - - - -char *prefix_path(const char *path) -{ - size_t len = strlen(path) + strlen(root_path) + 1; - char *root_dir = malloc(len * sizeof(char)); - - strcpy(root_dir, root_path); - strcat(root_dir, path); - - return root_dir; -} - -static inline int file_size(FILE *file) { - struct stat st; - - if (fstat(fileno(file), &st) == 0) - return st.st_size; - - return -1; -} - -/* read_file: for debugging tempfiles */ -int read_file(FILE *file) -{ - int c; - int file_contains_something = 0; - FILE *read = file; /* don't move original file pointer */ - if (read) { - while ((c = getc(read)) != EOF) { - file_contains_something = 1; - putc(c, stderr); - } - } - if (!file_contains_something) - fprintf(stderr, "file was empty\n"); - rewind(file); - /* fseek(tmpf, offset, SEEK_END); */ - return 0; -} - - - - - - -////// -// various fuse entry-points -////// - -static int xmp_getattr(const char *fuse_path, struct stat *stbuf) -{ - char *path = prefix_path(fuse_path); - - int res; - - ////// - // TBD: return non-padded size in stbuf->st_size - ////// - - res = lstat(path, stbuf); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_access(const char *fuse_path, int mask) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = access(path, mask); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_readlink(const char *fuse_path, char *buf, size_t size) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = readlink(path, buf, size - 1); - if (res == -1) - return -errno; - - buf[res] = '\0'; - return 0; -} - -static int xmp_readdir(const char *fuse_path, void *buf, fuse_fill_dir_t filler, - off_t offset, struct fuse_file_info *fi) -{ - char *path = prefix_path(fuse_path); - - DIR *dp; - struct dirent *de; - fprintf(stderr, "Path: %s\n", path); - - (void) offset; - (void) fi; - - dp = opendir(path); - if (dp == NULL) - return -errno; - - while ((de = readdir(dp)) != NULL) { - struct stat st; - memset(&st, 0, sizeof(st)); - st.st_ino = de->d_ino; - st.st_mode = de->d_type << 12; - if (filler(buf, de->d_name, &st, 0)) - break; - } - - closedir(dp); - return 0; -} - -static int xmp_mknod(const char *fuse_path, mode_t mode, dev_t rdev) -{ - char *path = prefix_path(fuse_path); - - int res; - - /* On Linux this could just be 'mknod(path, mode, rdev)' but this - is more portable */ - if (S_ISREG(mode)) { - res = open(path, O_CREAT | O_EXCL | O_WRONLY, mode); - if (res >= 0) - res = close(res); - } else if (S_ISFIFO(mode)) - res = mkfifo(path, mode); - else - res = mknod(path, mode, rdev); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_mkdir(const char *fuse_path, mode_t mode) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = mkdir(path, mode); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_unlink(const char *fuse_path) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = unlink(path); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_rmdir(const char *fuse_path) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = rmdir(path); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_symlink(const char *from, const char *to) -{ - int res; - - res = symlink(from, to); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_rename(const char *from, const char *to) -{ - int res; - - res = rename(from, to); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_link(const char *from, const char *to) -{ - int res; - - res = link(from, to); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_chmod(const char *fuse_path, mode_t mode) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = chmod(path, mode); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_chown(const char *fuse_path, uid_t uid, gid_t gid) -{ - char *path = prefix_path(fuse_path); - - int res; - - res = lchown(path, uid, gid); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_truncate(const char *fuse_path, off_t size) -{ - char *path = prefix_path(fuse_path); - - int res; - - ////// - // TBD: check if file is encrypted, if so unencrypt and then - // truncate and then re-encrypt. - ////// - - res = truncate(path, size); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_utimens(const char *fuse_path, const struct timespec ts[2]) -{ - char *path = prefix_path(fuse_path); - - int res; - struct timeval tv[2]; - - tv[0].tv_sec = ts[0].tv_sec; - tv[0].tv_usec = ts[0].tv_nsec / 1000; - tv[1].tv_sec = ts[1].tv_sec; - tv[1].tv_usec = ts[1].tv_nsec / 1000; - - res = utimes(path, tv); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_open(const char *fuse_path, struct fuse_file_info *fi) -{ - char *path = prefix_path(fuse_path); - int res; - - ////we dont support O_TMPFILE, sanity check - //Note: this constant is not defined anywhere! - //if( (fi->flags & O_TMPFILE) ){ - // fprintf(stderr, "%s: unsupported O_TMPFILE in open -- error\n", __FUNCTION__); - // return EINVAL; - //} - - res = open(path, fi->flags); - if (res == -1) - return -errno; - - - if( (fi->flags & O_CREAT) ){ - if (!add_encrypted_attr(path)){ - fprintf(stderr, "%s: failed to add xattr-encrypted\n", __FUNCTION__); - return -errno; - } - } - - if( (fi->flags & O_CREAT) || (fi->flags & O_TRUNC)){ - if(!add_nonpaddedsize_attr(path, 0)){ - fprintf(stderr, "%s: failed to add xattr-nonpaddedsize.\n", __FUNCTION__); - return -errno; - } - } - - close(res); - return 0; -} - - -static int xmp_read(const char *fuse_path, char *buf, size_t size, off_t offset, - struct fuse_file_info *fi) -{ - FILE *path_ptr, *tmpf; - char *path; - int res, action; - - path = prefix_path(fuse_path); - path_ptr = fopen(path, "r"); - tmpf = tmpfile(); - - /* Either encrypt, or just move along. */ - action = is_encrypted(path) ? DECRYPT : PASS_THROUGH; - if (do_crypt(path_ptr, tmpf, action, password) == 0) - return -errno; - - /* Something went terribly wrong if this is the case. */ - if (path_ptr == NULL || tmpf == NULL) - return -errno; - - fflush(tmpf); - fseek(tmpf, offset, SEEK_SET); - - ////// - // TBD: only read "size" bytes and account for padding - ////// - - /* Read our tmpfile into the buffer. */ - res = fread(buf, 1, file_size(tmpf), tmpf); - if (res == -1) - res = -errno; - - fclose(tmpf); - fclose(path_ptr); - - return res; -} - - -static int xmp_write(const char *fuse_path, const char *buf, size_t size, - off_t offset, struct fuse_file_info *fi) -{ - FILE *path_ptr, *tmpf; - char *path; - int res, action; - int tmpf_descriptor; - - path = prefix_path(fuse_path); - path_ptr = fopen(path, "r+"); - tmpf = tmpfile(); - tmpf_descriptor = fileno(tmpf); - - - /* Something went terribly wrong if this is the case. */ - if (path_ptr == NULL || tmpf == NULL) - return -errno; - - /* if the file to write to exists, read it into the tempfile */ - if (xmp_access(fuse_path, R_OK) == 0 && file_size(path_ptr) > 0) { - action = is_encrypted(path) ? DECRYPT : PASS_THROUGH; - if (do_crypt(path_ptr, tmpf, action, password) == 0) - return --errno; - - rewind(path_ptr); - rewind(tmpf); - } - - /* Read our tmpfile into the buffer. */ - res = pwrite(tmpf_descriptor, buf, size, offset); - if (res == -1) - res = -errno; - - /* Either encrypt, or just move along. */ - action = is_encrypted(path) ? ENCRYPT : PASS_THROUGH; - - if (do_crypt(tmpf, path_ptr, action, password) == 0) - return -errno; - - fclose(tmpf); - fclose(path_ptr); - - return res; -} - -static int xmp_statfs(const char *fuse_path, struct statvfs *stbuf) -{ - char *path = prefix_path(fuse_path); - - int res; - ////// - // TBD: return non-padded size in stbuf->st_size - ////// - - res = statvfs(path, stbuf); - if (res == -1) - return -errno; - - return 0; -} - -static int xmp_create(const char* fuse_path, mode_t mode, - struct fuse_file_info* fi) -{ - char *path = prefix_path(fuse_path); - - (void) fi; - - int res; - res = creat(path, mode); - - if(res == -1) { - fprintf(stderr, "xmp_create: failed to creat\n"); - return -errno; - } - - close(res); - - if (!add_encrypted_attr(path)){ - fprintf(stderr, "%s: failed to add xattr-encrypted\n", __FUNCTION__); - return -errno; - } - - if(!add_nonpaddedsize_attr(path, 0)){ - fprintf(stderr, "%s: failed to add xattr-nonpaddedsize.\n", __FUNCTION__); - return -errno; - } - - - return 0; -} - - -static int xmp_release(const char *fuse_path, struct fuse_file_info *fi) -{ - /* Just a stub. This method is optional and can safely be left - unimplemented */ - char *path = prefix_path(fuse_path); - - (void) path; - (void) fi; - return 0; -} - -static int xmp_fsync(const char *fuse_path, int isdatasync, - struct fuse_file_info *fi) -{ - /* Just a stub. This method is optional and can safely be left - unimplemented */ - char *path = prefix_path(fuse_path); - - (void) path; - (void) isdatasync; - (void) fi; - return 0; -} - -#ifdef HAVE_SETXATTR -static int xmp_setxattr(const char *fuse_path, const char *name, - const char *value, size_t size, int flags) -{ - char *path = prefix_path(fuse_path); - - int res = lsetxattr(path, name, value, size, flags); - if (res == -1) - return -errno; - return 0; -} - -static int xmp_getxattr(const char *fuse_path, const char *name, char *value, - size_t size) -{ - char *path = prefix_path(fuse_path); - - int res = lgetxattr(path, name, value, size); - if (res == -1) - return -errno; - return res; -} - -static int xmp_listxattr(const char *fuse_path, char *list, size_t size) -{ - char *path = prefix_path(fuse_path); - - int res = llistxattr(path, list, size); - if (res == -1) - return -errno; - return res; -} - -static int xmp_removexattr(const char *fuse_path, const char *name) -{ - char *path = prefix_path(fuse_path); - - int res = lremovexattr(path, name); - if (res == -1) - return -errno; - return 0; -} -#endif /* HAVE_SETXATTR */ - -static struct fuse_operations xmp_oper = { - /* .opendir = xmp_opendir, */ - .getattr = xmp_getattr, - .access = xmp_access, - .readlink = xmp_readlink, - .readdir = xmp_readdir, - .mknod = xmp_mknod, - .mkdir = xmp_mkdir, - .symlink = xmp_symlink, - .unlink = xmp_unlink, - .rmdir = xmp_rmdir, - .rename = xmp_rename, - .link = xmp_link, - .chmod = xmp_chmod, - .chown = xmp_chown, - .truncate = xmp_truncate, - .utimens = xmp_utimens, - .open = xmp_open, - .read = xmp_read, - .write = xmp_write, - .statfs = xmp_statfs, - .create = xmp_create, - .release = xmp_release, - .fsync = xmp_fsync, -#ifdef HAVE_SETXATTR - .setxattr = xmp_setxattr, - .getxattr = xmp_getxattr, - .listxattr = xmp_listxattr, - .removexattr = xmp_removexattr, -#endif -}; - -int main(int argc, char *argv[]) -{ - umask(0); - - /* ./pa5-encfs mir mnt -e password */ - if ((root_path = realpath(argv[argc - 4], NULL)) == NULL){ - fprintf(stderr, "Please enter a valid root directory name.\n"); - return EXIT_FAILURE; - } - - if ((password = argv[argc - 1]) == NULL){ - fprintf(stderr, "Please enter an encryption password.\n"); - return EXIT_FAILURE; - } - - argv[argc-4] = argv[argc-3]; - argv[argc-1] = NULL; - argc -= 3; - - return fuse_main(argc, argv, &xmp_oper, NULL); -} diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uagent/README b/uxmhf-rpi3/rgapps/linux/rgapp-uagent/README deleted file mode 100644 index 1254e7f440..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uagent/README +++ /dev/null @@ -1,7 +0,0 @@ -guest app for demonstrating use of uberapp that encrypts a data blob. - -Includes 2 example programs: -- demo which has the hypervisor encrypt and decrypt a variable. -- a simple "chat" program (server/client) encrypts data prior to sending and decrypts upon receiving using shared symmetric secret key in hypervisor (AES encryption). Note: the chat program assumes that server is bound to an IP of 10.1.1.2 - -author: matt mccormack (matthew.mccormack@live.com) \ No newline at end of file diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uagent/client.c b/uxmhf-rpi3/rgapps/linux/rgapp-uagent/client.c deleted file mode 100644 index 123907fd63..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uagent/client.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Matt McCormack (matthew.mccormack@live.com) - * - */ - -/* - * hypercall program (uagent) - * author: matt mccormack () - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#define MAX_DATA 80 -#define PORT 54321 -#define SA struct sockaddr - -__attribute__((aligned(4096))) __attribute__((section(".data"))) uagent_param_t uhcp; - -void do_ucrypt(void *bufptr) { - uagent_param_t *ptr_uhcp = (uagent_param_t *)bufptr; - if(!uhcall(UAPP_UAGENT_FUNCTION_SIGN, ptr_uhcp, sizeof(uagent_param_t))) - printf("hypercall FAILED\n"); - /* - printf("output: "); - uint32_t i; - for(i=0;ipkt_size;i++) - printf("%02x", ptr_uhcp->pkt_data[i]); - printf("\n"); - */ -} - -int cryptLen(int in_len){ - int numBlocks=in_len/16; - if(in_len%16) - numBlocks++; - return numBlocks*16; -} - -void func(int sockfd) { - char buff[MAX_DATA]; - char encBuff[MAX_DATA]; - char decBuff[MAX_DATA]; - int n; - uhcp.vaddr = (uint32_t)&uhcp; - - for(;;) { - bzero(buff, sizeof(buff)); - bzero(encBuff, sizeof(encBuff)); - bzero(decBuff, sizeof(decBuff)); - memset(&uhcp.pkt_data, 0, 1600); - printf("Enter text : "); - n=0; - - while((buff[n++]=getchar())!='\n'); - memcpy(&uhcp.pkt_data, buff, n); - uhcp.pkt_size=n; - uhcp.op=1; //encrypt - do_ucrypt((void *)&uhcp); - memcpy(&encBuff[4], &uhcp.pkt_data, cryptLen(uhcp.pkt_size)); - encBuff[0]=cryptLen(uhcp.pkt_size); - - /* - int i; - printf("sending..."); - for(i=0; i<(uhcp.pkt_size); i++) - printf("%02x", encBuff[i+4]); - printf("\n"); - */ - - write(sockfd, encBuff, cryptLen(uhcp.pkt_size)+4); - if((strncmp(buff, "exit", 4))==0){ - printf("Client Exit...\n"); - break; - } - - bzero(buff, sizeof(buff)); - bzero(encBuff, sizeof(encBuff)); - bzero(decBuff, sizeof(decBuff)); - memset(&uhcp.pkt_data, 0, 1600); - - read(sockfd, encBuff, sizeof(encBuff)); - - /* - printf("received..."); - for(i=0; i) - * - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -__attribute__((aligned(4096))) __attribute__((section(".data"))) uagent_param_t uhcp; - -void do_ucrypt(void *bufptr) { - uagent_param_t *ptr_uhcp = (uagent_param_t *)bufptr; - if(!uhcall(UAPP_UAGENT_FUNCTION_SIGN, ptr_uhcp, sizeof(uagent_param_t))) - printf("hypercall FAILED\n"); - else - printf("SUCCESS\n"); - - - printf("output: "); - uint32_t i; - for(i=0;i<16;i++) - printf("%02x", ptr_uhcp->pkt_data[i]); - printf("\n"); -} - - -int main() { - uint8_t *data=(uint8_t *)"hello world"; - uint32_t data_len=11; - - printf("input: "); - uint32_t i; - for(i=0;i) - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#define MAX_DATA 80 -#define PORT 54321 -#define SA struct sockaddr - -__attribute__((aligned(4096))) __attribute__((section(".data"))) uagent_param_t uhcp; - -void do_ucrypt(void *bufptr) { - uagent_param_t *ptr_uhcp = (uagent_param_t *)bufptr; - if(!uhcall(UAPP_UAGENT_FUNCTION_SIGN, ptr_uhcp, sizeof(uagent_param_t))) - printf("hypercall FAILED\n"); - - /* - printf("output: "); - uint32_t i; - for(i=0;ipkt_size;i++) - printf("%02x", ptr_uhcp->pkt_data[i]); - printf("\n"); - */ -} - -int cryptLen(int in_len){ - int numBlocks=in_len/16; - if(in_len%16) - numBlocks++; - return numBlocks*16; -} - -void func(int sockfd) { - char buff[MAX_DATA]; - char encBuff[MAX_DATA]; - char decBuff[MAX_DATA]; - int n; - uhcp.vaddr = (uint32_t)&uhcp; - - for(;;) { - bzero(buff, sizeof(buff)); - bzero(encBuff, sizeof(encBuff)); - bzero(decBuff, sizeof(decBuff)); - memset(&uhcp.pkt_size, 0, 1600); - - read(sockfd, encBuff, sizeof(encBuff)); - - /* - int i; - printf("received..."); - for(i=0; i " - exit 1 -fi - -LINUX_KERNEL_SRC=$1 -CROSS_COMPILE_TOOLS_DIR=$2 - -echo "Building module..." - -make -C $LINUX_KERNEL_SRC ARCH=arm \ -CROSS_COMPILE=$CROSS_COMPILE_TOOLS_DIR/arm-linux-gnueabihf- \ -M=$PWD - -echo "Module build success!" - diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhcallkmod/uhcallkmod.c b/uxmhf-rpi3/rgapps/linux/rgapp-uhcallkmod/uhcallkmod.c deleted file mode 100644 index 806676f983..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhcallkmod/uhcallkmod.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -#include // macros used to mark up functions e.g. __init __exit -#include // core header for loading LKMs into the kernel -#include // header to support the kernel Driver Model -#include // contains types, macros, functions for the kernel -#include // header for the Linux file system support -#include // required for the copy to user function - -#include - -#include -#include - -#define DEVICE_NAME "uhcallkmod" //device will appear at /dev/uhcallkmod -#define CLASS_NAME "uhcallkmodchar" //we are a character device driver - -MODULE_LICENSE("GPL"); //appease the kernel -MODULE_AUTHOR("Amit Vasudevan"); -MODULE_DESCRIPTION("Hypercall char driver for uxmhf-rpi3"); -MODULE_VERSION("0.1"); - -static int major_number; -static int number_opens = 0; -static struct class* hypcallcharClass = NULL; -static struct device* hypcallcharDevice = NULL; - -//prototypes for character driver interaction -static int dev_open(struct inode *, struct file *); -static int dev_release(struct inode *, struct file *); -static ssize_t dev_write(struct file *, const char *, size_t, loff_t *); -static void uhcallkmod_hvc(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len); - -//file operations structure to interface with the above -static struct file_operations fops = -{ - .open = dev_open, - .write = dev_write, - .release = dev_release, -}; - -//prototype for va2pa -static unsigned long va2pa(unsigned long va); - -__attribute__((aligned(4096))) unsigned char buffer[]= {'a', 'b', 'c', 'd'}; - - -static void uhcallkmod_hvc(u32 uhcall_function, void *uhcall_buffer, - u32 uhcall_buffer_len){ - - asm volatile - ( " mov r0, %[in_0]\r\n" - " mov r1, %[in_1]\r\n" - " mov r2, %[in_2]\r\n" - ".long 0xE1400071 \r\n" - : // outputs - : [in_0] "r" (uhcall_function), [in_1] "r" (uhcall_buffer), [in_2] "r" (uhcall_buffer_len) // inouts - : "r0", "r1", "r2" //clobber - ); -} - - -static unsigned long va2pa(unsigned long va) { - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - unsigned long pa = 0; - unsigned long page_addr = 0; - unsigned long page_offset = 0; - - pgd = pgd_offset(current->mm, va); - if(pgd_none(*pgd)) - return -1; - - pud = pud_offset(pgd, va); - if(pud_none(*pud)) - return -1; - - pmd = pmd_offset(pud, va); - if(pmd_none(*pmd)) - return -1; - - pte = pte_offset_kernel(pmd, va); - if(pte_none(*pte)) - return -1; - - page_addr = pte_val(*pte) & PAGE_MASK; - page_offset = va & ~PAGE_MASK; - pa = page_addr | page_offset; - - return pa; -} - -static int dev_open(struct inode *inodep, struct file *filep){ - number_opens++; - printk(KERN_INFO "uhcallkmod: device has been opened %d time(s)\n", number_opens); - return 0; -} - -static int dev_release(struct inode *inodep, struct file *filep){ - number_opens--; - printk(KERN_INFO "uhcallkmod: device successfully closed\n"); - return 0; -} - -static ssize_t dev_write(struct file *filep, const char *buffer, size_t len, loff_t *offset){ - uhcallkmod_param_t *uhcallp; - unsigned long pa; - - if(buffer == NULL) - return -EINVAL; - - if(len != sizeof(uhcallkmod_param_t)) - return -EINVAL; - - uhcallp = (uhcallkmod_param_t *)buffer; - - pa = va2pa((u32)(uhcallp->uhcall_buffer)); - - printk(KERN_INFO "uhcallkmod: dev_write: uhcall_function=0x%08x, uhcall_buffer=0x%08x, uhcall_buffer_len=0x%08x\n", - uhcallp->uhcall_function, uhcallp->uhcall_buffer, uhcallp->uhcall_buffer_len); - - uhcallkmod_hvc(uhcallp->uhcall_function, (void *)pa, uhcallp->uhcall_buffer_len); - - return 0; -} - -//module initialization function -int uhcallkmod_init(void) -{ - printk(KERN_INFO "uhcallkmod: LOAD\n"); - printk(KERN_INFO "author: amit vasudevan (amitvasudevan@acm.org)\n"); - - //try to allocate a major number dynamically - major_number = register_chrdev(0, DEVICE_NAME, &fops); - if (major_number<0){ - printk(KERN_ALERT "uhcallkmod: failed to register a major number\n"); - return major_number; - } - printk(KERN_INFO "uhcallkmod: registered correctly with major number %d\n", major_number); - - // Register the device class - hypcallcharClass = class_create(THIS_MODULE, CLASS_NAME); - if (IS_ERR(hypcallcharClass)){ - unregister_chrdev(major_number, DEVICE_NAME); - printk(KERN_ALERT "uhcallkmod: Failed to register device class\n"); - return PTR_ERR(hypcallcharClass); - } - printk(KERN_INFO "uhcallkmod: device class registered correctly\n"); - - // register the device driver - hypcallcharDevice = device_create(hypcallcharClass, NULL, MKDEV(major_number, 0), NULL, DEVICE_NAME); - if (IS_ERR(hypcallcharDevice)){ - class_destroy(hypcallcharClass); - unregister_chrdev(major_number, DEVICE_NAME); - printk(KERN_ALERT "uhcallkmod:Failed to create the device\n"); - return PTR_ERR(hypcallcharDevice); - } - printk(KERN_INFO "uhcallkmod: device class created correctly\n"); - - - return 0; -} - -//module unload function -void uhcallkmod_exit(void) -{ - device_destroy(hypcallcharClass, MKDEV(major_number, 0)); // remove the device - class_unregister(hypcallcharClass); // unregister the device class - class_destroy(hypcallcharClass); // remove the device class - unregister_chrdev(major_number, DEVICE_NAME); // unregister the major number - printk(KERN_INFO "uhcallkmod: UNLOAD\n"); -} - -module_init(uhcallkmod_init); -module_exit(uhcallkmod_exit); diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/Makefile b/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/Makefile deleted file mode 100644 index 84ff582d7f..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -#top-level Makefile for usr mode application to test hypercall -# author: amit vasudevan (amitvasudevan@acm.org) - -export CURRENT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export UXMHFRPI3_DIR := $(CURRENT_DIR)/../../.. -export RGAPPS_LIB_DIR := $(realpath $(CURRENT_DIR)/../libs) - -INCS = -I$(UXMHFRPI3_DIR)/include -INCS += -I$(RGAPPS_LIB_DIR)/libuhcall/include - -LIBS = $(RGAPPS_LIB_DIR)/libuhcall/libuhcall.a - - -CFLAGS = -I. $(INCS) -c -g -Wall -LFLAGS = -g -Wall -Wextra - - -.PHONY: all -all: - arm-linux-gnueabihf-gcc $(CFLAGS) uhcalltest.c -o uhcalltest.o - arm-linux-gnueabihf-gcc $(LFLAGS) uhcalltest.o -o uhcalltest $(LIBS) - -.PHONY: clean -clean: - rm -f uhcalltest - rm -f *.o - \ No newline at end of file diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/README b/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/README deleted file mode 100644 index da3e858aa1..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/README +++ /dev/null @@ -1,2 +0,0 @@ -user-mode application to test hypercall -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/uhcalltest.c b/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/uhcalltest.c deleted file mode 100644 index e80c2c50ea..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhcalltest/uhcalltest.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - * hypercall test program (uhcalltest) - * author: amit vasudevan (amitvasudevan@acm.org) - * - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -__attribute__((aligned(4096))) __attribute__((section(".data"))) uhcalltest_param_t uhctp; - -#if 0 - -int main(){ - uint8_t ch='a'; - uint32_t i; - - if( mlockall(MCL_FUTURE) == -1){ - printf("error locking memory\n"); - exit(1); - } - - printf("Starting usr mode hypercall test\n"); - - printf("populating uhctp.in[] and uhctp.out[]...\n"); - for(i=0; i < 16; i++) - uhctp.in[i] = ch + i; - memset(&uhctp.out, 0, 16); - - printf("dumping uhctp.in[]...\n"); - for(i=0; i < 16; i++) - printf("%c", uhctp.in[i]); - printf("\ndumped uhctp.in[]\n"); - printf("dumping uhctp.out[]...\n"); - for(i=0; i < 16; i++) - printf("%c", uhctp.out[i]); - printf("\ndumped uhctp.out[]\n"); - - printf("Proceeding to issue hypercall...\n"); - - if(!uhcall(UAPP_UHCALLTEST_FUNCTION_TEST, &uhctp, sizeof(uhcalltest_param_t))) - printf("hypercall FAILED\n"); - else - printf("hypercall SUCCESS\n"); - - printf("dumping uhctp.in[]...\n"); - for(i=0; i < 16; i++) - printf("%c", uhctp.in[i]); - printf("\ndumped uhctp.in[]\n"); - printf("dumping uhctp.out[]...\n"); - for(i=0; i < 16; i++) - printf("%c", uhctp.out[i]); - printf("\ndumped uhctp.out[]\n"); - - if( munlockall() == -1){ - printf("error unlocking memory\n"); - exit(1); - } - - - printf("End of test\n"); - return 0; -} -#endif - -#if 0 -int main(){ - uhcalltest_param_t *ptr_uhctp; - uint32_t i; - uint8_t ch='a'; - - printf("%s: start\n", __FUNCTION__); - - if (posix_memalign(&ptr_uhctp, 4096, sizeof(uhcalltest_param_t)) != 0){ - printf("%s: error: line %u\n", __FUNCTION__); - exit(1); - } - - - printf("%s: populating in[] and out[]...\n", __FUNCTION__); - for(i=0; i < 16; i++) - ptr_uhctp->in[i] = ch + i; - memset(&ptr_uhctp->out, 0, 16); - - printf("dumping in[]...\n"); - for(i=0; i < 16; i++) - printf("%c", ptr_uhctp->in[i]); - printf("\n"); - - if(!uhcall(UAPP_UHCALLTEST_FUNCTION_TEST, ptr_uhctp, sizeof(uhcalltest_param_t))) - printf("hypercall FAILED\n"); - else - printf("hypercall SUCCESS\n"); - - printf("dumping out[]...\n"); - for(i=0; i < 16; i++) - printf("%c", ptr_uhctp->out[i]); - printf("\n"); - - - free(ptr_uhctp); - - printf("%s: end\n", __FUNCTION__); - return 0; - -} -#endif - - -void do_uhcalltest(void *bufptr){ - uhcalltest_param_t *ptr_uhctp = (uhcalltest_param_t *)bufptr; - uint32_t i; - uint8_t ch='a'; - - printf("%s: start\n", __FUNCTION__); - - printf("%s: populating in[] and out[]...\n", __FUNCTION__); - for(i=0; i < 16; i++) - ptr_uhctp->in[i] = ch + i; - memset(&ptr_uhctp->out, 0, 16); - - printf("dumping in[]...\n"); - for(i=0; i < 16; i++) - printf("%c", ptr_uhctp->in[i]); - printf("\n"); - - if(!uhcall(UAPP_UHCALLTEST_FUNCTION_TEST, ptr_uhctp, sizeof(uhcalltest_param_t))) - printf("hypercall FAILED\n"); - else - printf("hypercall SUCCESS\n"); - - printf("dumping out[]...\n"); - for(i=0; i < 16; i++) - printf("%c", ptr_uhctp->out[i]); - printf("\n"); - - printf("%s: end\n", __FUNCTION__); -} - - -int main(){ - uhcalltest_param_t *ptr_uhctp; - - printf("starting uhcalltest (with static buffer)...\n"); - do_uhcalltest((void *)&uhctp); - printf("end uhcalltest (with static buffer)...\n"); - - printf("starting uhcalltest (with dynamic buffer)...\n"); - - if (posix_memalign(&ptr_uhctp, 4096, sizeof(uhcalltest_param_t)) != 0){ - printf("%s: error: line %u\n", __FUNCTION__); - exit(1); - } - - do_uhcalltest((void *)ptr_uhctp); - - free(ptr_uhctp); - - printf("end uhcalltest (with dynamic buffer)...\n"); - - return 0; -} - - diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhsign/Makefile b/uxmhf-rpi3/rgapps/linux/rgapp-uhsign/Makefile deleted file mode 100644 index 0ec10a994e..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhsign/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -#top-level Makefile for usr mode application to test hypercall -# author: amit vasudevan (amitvasudevan@acm.org) - -export CURRENT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export UXMHFRPI3_DIR := $(CURRENT_DIR)/../../.. -export RGAPPS_LIB_DIR := $(realpath $(CURRENT_DIR)/../libs) - -INCS = -I$(UXMHFRPI3_DIR)/include -INCS += -I$(RGAPPS_LIB_DIR)/libuhcall/include -INCS += -I$(UXMHFRPI3_DIR)/libs/libxmhfcrypto/include - -LIBS = $(RGAPPS_LIB_DIR)/libuhcall/libuhcall.a -LIBS += $(UXMHFRPI3_DIR)/libs/libxmhfcrypto/libxmhfcrypto.a - -CFLAGS = -I. $(INCS) -c -g -Wall -LFLAGS = -g -Wall -Wextra - - -.PHONY: all -all: - arm-linux-gnueabihf-gcc $(CFLAGS) uhsign.c -o uhsign.o - arm-linux-gnueabihf-gcc $(LFLAGS) uhsign.o -o uhsign $(LIBS) - -local: - gcc $(CFLAGS) uhsign.c -o uhsign.o - gcc $(LFLAGS) uhsign.o -o uhsign $(LIBS) - -.PHONY: clean -clean: - rm -f uhsign - rm -f *.o diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhsign/uhsign.c b/uxmhf-rpi3/rgapps/linux/rgapp-uhsign/uhsign.c deleted file mode 100644 index d5d649b0a3..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhsign/uhsign.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Matt McCormack (matthew.mccormack@live.com) - * - */ - -/* - * hypercall program (uhsign) - * author: matt mccormack () - * - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -__attribute__((aligned(4096))) __attribute__((section(".data"))) uhsign_param_t uhcp; - -void do_uhsign(void *bufptr) { - uhsign_param_t *ptr_uhcp = (uhsign_param_t *)bufptr; - if(!uhcall(UAPP_UHSIGN_FUNCTION_SIGN, ptr_uhcp, sizeof(uhsign_param_t))) - printf("hypercall FAILED\n"); - else - printf("SUCCESS\n"); - - - printf("Digest: "); - uint32_t i; - for(i=0;i<32;i++) - printf("%02x", ptr_uhcp->digest[i]); - printf("\n"); -} - - -int main() { - uint8_t *data=(uint8_t *)"hello world"; - uint32_t data_len=11; - memcpy(&uhcp.pkt, data, data_len); - uhcp.pkt_size=data_len; - uhcp.vaddr = (uint32_t)&uhcp; - - printf("[] passing uhsign_param_t\n"); - - do_uhsign((void *)&uhcp); - - printf("[] test complete\n"); - - return 0; -} - diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhstateDB/README b/uxmhf-rpi3/rgapps/linux/rgapp-uhstateDB/README deleted file mode 100644 index b361fc7747..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhstateDB/README +++ /dev/null @@ -1,5 +0,0 @@ -guest app for demonstrating use of uberapp to store and mediate access to simple database - -First initializes the max stateDB, then gets a current state value, and finally increments the state value and returns that value: - -author: matt mccormack (matthew.mccormack@live.com) \ No newline at end of file diff --git a/uxmhf-rpi3/rgapps/linux/rgapp-uhstateDB/stateDBdemo.c b/uxmhf-rpi3/rgapps/linux/rgapp-uhstateDB/stateDBdemo.c deleted file mode 100644 index 0d25f71d43..0000000000 --- a/uxmhf-rpi3/rgapps/linux/rgapp-uhstateDB/stateDBdemo.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Matt McCormack (matthew.mccormack@live.com) - * - */ - -/* - * hypercall program (uhstateDB) - * author: matt mccormack () - * - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -__attribute__((aligned(4096))) __attribute__((section(".data"))) uhstatedb_param_t uhcp; - -void init(void *bufptr) { - uhstatedb_param_t *ptr_uhcp = (uhstatedb_param_t *)bufptr; - if(!uhcall(UAPP_UHSTATEDB_FUNCTION_INIT, ptr_uhcp, sizeof(uhstatedb_param_t))) - printf("hypercall FAILED\n"); - else { - printf("SUCCESS\n"); - printf("stateDB initialized\n"); - } -} - -void get(void *bufptr) { - uhstatedb_param_t *ptr_uhcp = (uhstatedb_param_t *)bufptr; - if(!uhcall(UAPP_UHSTATEDB_FUNCTION_GET, ptr_uhcp, sizeof(uhstatedb_param_t))) - printf("hypercall FAILED\n"); - else { - printf("SUCCESS\n"); - printf("State value for device: %d, -- %d\n", ptr_uhcp->deviceID, ptr_uhcp->stateVal); - } -} - -void next(void *bufptr) { - uhstatedb_param_t *ptr_uhcp = (uhstatedb_param_t *)bufptr; - if(!uhcall(UAPP_UHSTATEDB_FUNCTION_NEXT, ptr_uhcp, sizeof(uhstatedb_param_t))) - printf("hypercall FAILED\n"); - else { - printf("SUCCESS\n"); - printf("stateDB value udated\n"); - } -} - - -int main() { - uint32_t numDevices=3; - uint32_t maxArray[numDevices]; - int i; - for(i=0;i -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -//__attribute__((aligned(4096))) static uhcalltest_param_t uhctp; - -#define _XDPRINTF_ printf - -#if 0 - -void utpm_test(uint32_t cpuid) - ////// - // utpm test - ////// - { - utpm_master_state_t utpm; - TPM_DIGEST pcr0; - TPM_DIGEST measurement; - uint8_t digest[] = - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - }; - - uint8_t g_aeskey[TPM_AES_KEY_LEN_BYTES] = - { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18 - }; - - uint8_t g_hmackey[TPM_HMAC_KEY_LEN] = - { - 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x01, 0x02, - 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x11, 0x12, - 0xaa, 0xbb, 0xcc, 0xdd - }; - - uint8_t g_rsakey[] = {0x00, 0x00, 0x00, 0x00}; - char *seal_inbuf = "0123456789abcdef"; - uint32_t seal_inbuf_len = strlen(seal_inbuf)+1; - char seal_outbuf[32]; - char seal_outbuf2[32]; - uint32_t seal_outbuf_len; - uint32_t seal_outbuf2_len; - TPM_PCR_INFO tpmPcrInfo; - TPM_COMPOSITE_HASH digestAtCreation; - - if (utpm_init_master_entropy(&g_aeskey, &g_hmackey, &g_rsakey) != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_init_master_entropy FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - utpm_init_instance(&utpm); - - if( utpm_pcrread(&pcr0, &utpm, 0) != UTPM_SUCCESS ){ - _XDPRINTF_("%s[%u]: utpm_pcrread FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: pcr-0: %20D\n", __func__, cpuid, pcr0.value, " "); - - memcpy(&measurement.value, &digest, sizeof(digest)); - - if( utpm_extend(&measurement, &utpm, 0) != UTPM_SUCCESS ){ - _XDPRINTF_("%s[%u]: utpm_extend FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - if( utpm_pcrread(&pcr0, &utpm, 0) != UTPM_SUCCESS ){ - _XDPRINTF_("%s[%u]: utpm_pcrread FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: pcr-0: %20D\n", __func__, cpuid, pcr0.value, " "); - - tpmPcrInfo.pcrSelection.sizeOfSelect = 0; - tpmPcrInfo.pcrSelection.pcrSelect[0] = 0; - - if( utpm_seal(&utpm, &tpmPcrInfo, - seal_inbuf, seal_inbuf_len, - seal_outbuf, &seal_outbuf_len) ){ - _XDPRINTF_("%s[%u]: utpm_seal FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: utpm_seal PASSED\n", __func__, cpuid); - - if( utpm_unseal(&utpm, - seal_outbuf, seal_outbuf_len, - seal_outbuf2, &seal_outbuf2_len, - &digestAtCreation) ){ - _XDPRINTF_("%s[%u]: utpm_unseal FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: utpm_unseal PASSED\n", __func__, cpuid); - - } -#endif //0 - - -uint8_t g_aeskey[TPM_AES_KEY_LEN_BYTES] = - { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18 - }; - -uint8_t g_hmackey[TPM_HMAC_KEY_LEN] = - { - 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x01, 0x02, - 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x11, 0x12, - 0xaa, 0xbb, 0xcc, 0xdd - }; - -uint8_t g_rsakey[] = {0x00, 0x00, 0x00, 0x00}; - -uint8_t digest[] = - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - }; - - -char *seal_inbuf = "0123456789abcde"; - - - -__attribute__((aligned(4096))) __attribute__((section(".data"))) utpmtest_param_t utpmtest_param; - - -////// -// utpm test -////// -void utpm_test(uint32_t cpuid) -{ - //sanity check - if( sizeof(utpmtest_param_t) > 4096){ - _XDPRINTF_("%s[%u]: utpm_test: utpmtest_param_t > 4096. Halting!\n", __func__, cpuid); - exit(1); - }else{ - _XDPRINTF_("%s[%u]: utpm_test: utpmtest_param at 0x%08x, " - "utpmtest_param_t=%u\n", __func__, cpuid, - (uint32_t)&utpmtest_param, - sizeof(utpmtest_param_t)); - } - -#if 0 - //lock uhcall_buffer in memory - if(mlock(&utpmtest_param, sizeof(utpmtest_param)) == -1){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - exit(1); //nFailed to lock page in memory - } -#endif - - - utpmtest_param.magic = 0xDEADBEEF; - - memcpy(&utpmtest_param.g_aeskey, &g_aeskey, TPM_AES_KEY_LEN_BYTES); - memcpy(&utpmtest_param.g_hmackey, &g_hmackey, TPM_HMAC_KEY_LEN); - memcpy(&utpmtest_param.g_rsakey, &g_rsakey, 4); //TODO: change to RSA key len when implemented - - - if(!uhcall(UAPP_UTPM_FUNCTION_INIT_MASTER_ENTROPY, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_init_master_entropy hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - if (utpmtest_param.result != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_init_master_entropy FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - -#if 1 - if(!uhcall(UAPP_UTPM_FUNCTION_INIT_INSTANCE, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_init_instance hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - utpmtest_param.pcr_num=0; - if(!uhcall(UAPP_UTPM_FUNCTION_PCRREAD, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_pcrread hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - if (utpmtest_param.result != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_pcrread FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: pcr-0 read success\n", __func__, cpuid); - - memcpy(&utpmtest_param.measurement.value, &digest, sizeof(digest)); - utpmtest_param.pcr_num = 0; - - if(!uhcall(UAPP_UTPM_FUNCTION_EXTEND, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_extend hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - if (utpmtest_param.result != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_extend FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: pcr-0 extend success\n", __func__, cpuid); - - utpmtest_param.pcr_num=0; - if(!uhcall(UAPP_UTPM_FUNCTION_PCRREAD, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_pcrread hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - if (utpmtest_param.result != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_pcrread FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: pcr-0 read success\n", __func__, cpuid); - - - utpmtest_param.tpmPcrInfo.pcrSelection.sizeOfSelect = 0; - utpmtest_param.tpmPcrInfo.pcrSelection.pcrSelect[0] = 0; - memcpy(utpmtest_param.seal_inbuf, seal_inbuf, 16); - utpmtest_param.seal_inbuf_len = 16; - - if(!uhcall(UAPP_UTPM_FUNCTION_SEAL, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_seal hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - if (utpmtest_param.result != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_seal FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - - _XDPRINTF_("%s[%u]: utpm_seal PASSED, seal_outbuf_len=%u\n", __func__, cpuid, - utpmtest_param.seal_outbuf_len); - - - if(!uhcall(UAPP_UTPM_FUNCTION_UNSEAL, &utpmtest_param, sizeof(utpmtest_param_t))){ - _XDPRINTF_("%s[%u]: utpm_unseal hypercall FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - if (utpmtest_param.result != UTPM_SUCCESS){ - _XDPRINTF_("%s[%u]: utpm_unseal FAILED. Halting!\n", __func__, cpuid); - exit(1); - } - - _XDPRINTF_("%s[%u]: utpm_unseal PASSED\n", __func__, cpuid); -#endif - -#if 0 - //unlock uhcall_buffer page - if(munlock(&utpmtest_param, sizeof(utpmtest_param)) == -1){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - exit(1); - } -#endif - - -} - - - -int main(){ - - printf("Starting usr mode utpm test...\n"); - - utpm_test(0); - - printf("End of utpm test\n"); - return 0; -} diff --git a/uxmhf-rpi3/rpi3-config.txt.in b/uxmhf-rpi3/rpi3-config.txt.in deleted file mode 100644 index 56ed1c14c3..0000000000 --- a/uxmhf-rpi3/rpi3-config.txt.in +++ /dev/null @@ -1,33 +0,0 @@ -#enable uart -enable_uart=1 - -#setup uart baud rate -init_uart_baud=115200 - -#force turbo mode (max freq.) -force_turbo=0 - -core_freq=250 - -#allocate miniuart to bluetooth and make full UART available in case -#--enable-debug-uart-pl011 is selected -@RPI3CONFIG_ENABLE_DEBUG_UART_PL011@ - -#disable overscan -disable_overscan=1 - -#allocate GPU memory (in megabytes) -gpu_mem=64 - -#disable splash screen if set to 1 -disable_splash=0 - -#kernel name -kernel=uxmhf-rpi3.img - -#kernel address -kernel_address=0x7000 - -#device tree address -device_tree_address=0x20000000 - diff --git a/uxmhf-rpi3/uapps/uapp-ctxtrace/README b/uxmhf-rpi3/uapps/uapp-ctxtrace/README deleted file mode 100644 index 1689b698de..0000000000 --- a/uxmhf-rpi3/uapps/uapp-ctxtrace/README +++ /dev/null @@ -1,2 +0,0 @@ -hypapp for tracing guest context switches -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/uapps/uapp-ctxtrace/ctxtrace.c b/uxmhf-rpi3/uapps/uapp-ctxtrace/ctxtrace.c deleted file mode 100644 index 434d8616b5..0000000000 --- a/uxmhf-rpi3/uapps/uapp-ctxtrace/ctxtrace.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - guest context switch tracer - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include -#include - -//initialize guest context tracing -void ctxtrace_init(u32 cpuid){ - u32 hstr; - - hstr = sysreg_read_hstr(); - _XDPRINTFSMP_("%s[%u]: HSTR before=0x%08x\n", __func__, cpuid, hstr); - - hstr = hstr | (1UL << 2); //activate trap on CP15, c2 - - _XDPRINTFSMP_("%s[%u]: HSTR after=0x%08x\n", __func__, cpuid, hstr); - sysreg_write_hstr(hstr); - - _XDPRINTFSMP_("%s[%u]: initialized guest context tracing\n", __func__, cpuid); -} - - - -void ctxtrace_ttbr0_access_handler(arm8_32_regs_t *r, u32 rw, u32 rt){ - //_XDPRINTFSMP_("%s: rw=%u, rt=%u\n", __func__, rw, rt); - if(rw == 1){ - //read from system register and write to guest general purpose register - guest_regwrite(r, rt, sysreg_read_ttbr0()); - }else{ - //write to system register by reading from guest general purpose register - sysreg_write_ttbr0(guest_regread(r, rt)); - } -} - -void ctxtrace_ttbr1_access_handler(arm8_32_regs_t *r, u32 rw, u32 rt){ - //_XDPRINTFSMP_("%s: rw=%u, rt=%u\n", __func__, rw, rt); - if(rw == 1){ - //read from system register and write to guest general purpose register - guest_regwrite(r, rt, sysreg_read_ttbr1()); - }else{ - //write to system register by reading from guest general purpose register - sysreg_write_ttbr1(guest_regread(r, rt)); - } -} - -void ctxtrace_ttbcr_access_handler(arm8_32_regs_t *r, u32 rw, u32 rt){ - //_XDPRINTFSMP_("%s: rw=%u, rt=%u\n", __func__, rw, rt); - if(rw == 1){ - //read from system register and write to guest general purpose register - guest_regwrite(r, rt, sysreg_read_ttbcr()); - }else{ - //write to system register by reading from guest general purpose register - sysreg_write_ttbcr(guest_regread(r, rt)); - } -} - - - -//cp15 trap handler -void ctxtrace_cp15_trap_handler(arm8_32_regs_t *r, u32 hsr){ - u32 trap_iss; - u32 rw; - u32 crm; - u32 rt; - u32 crn; - u32 opc1; - u32 opc2; - u32 cond; - u32 cv; - - //get trap iss - trap_iss = (hsr & HSR_ISS_MASK) >> HSR_ISS_SHIFT; - - //populate trap variables for easy trace/emulation - rw = ( trap_iss & 0x00000001UL ); - crm = ( trap_iss & 0x0000001eUL ) >> 1; - rt = ( trap_iss & 0x000001e0UL ) >> 5; - crn = ( trap_iss & 0x00003c00UL ) >> 10; - opc1 = ( trap_iss & 0x0001c000UL ) >> 14; - opc2 = ( trap_iss & 0x000e0000UL ) >> 17; - cond = ( trap_iss & 0x00f00000UL ) >> 20; - cv = ( trap_iss & 0x01000000UL ) >> 24; - - - //if cv is zero bail-out - if(cv == 0){ - _XDPRINTFSMP_("%s: cv=%u, cond=%x, opc2=%u, opc1=%u, crn=%u, rt=%u, crm=%u, rw=%u\n", - __func__, cv, cond, opc2, opc1, crn, rt, crm, rw); - _XDPRINTFSMP_("%s: unhandled case with cv=0. Halting!\n", __func__); - HALT(); - } - - //we currently ignore cond - - //cases we support - if( crn == 0x2 && opc1 == 0 && crm == 0 && opc2 == 0){ - //ttbr0 access - ctxtrace_ttbr0_access_handler(r, rw, rt); - - }else if (crn == 0x2 && opc1 == 0 && crm == 0 && opc2 == 1){ - //ttbr1 access - ctxtrace_ttbr1_access_handler(r, rw, rt); - - }else if (crn == 0x2 && opc1 == 0 && crm == 0 && opc2 == 2){ - //ttbcr access - ctxtrace_ttbcr_access_handler(r, rw, rt); - - }else{ - _XDPRINTFSMP_("%s: cv=%u, cond=%x, opc2=%u, opc1=%u, crn=%u, rt=%u, crm=%u, rw=%u\n", - __func__, cv, cond, opc2, opc1, crn, rt, crm, rw); - _XDPRINTFSMP_("%s: invalid case; unsupported. Halting!\n", __func__); - HALT(); - } - -} diff --git a/uxmhf-rpi3/uapps/uapp-pa5encfs/README b/uxmhf-rpi3/uapps/uapp-pa5encfs/README deleted file mode 100644 index 6591534bcb..0000000000 --- a/uxmhf-rpi3/uapps/uapp-pa5encfs/README +++ /dev/null @@ -1,2 +0,0 @@ -pa5encfs hypapp -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/uapps/uapp-pa5encfs/uapp-pa5encfs.c b/uxmhf-rpi3/uapps/uapp-pa5encfs/uapp-pa5encfs.c deleted file mode 100644 index 3316ebd1a9..0000000000 --- a/uxmhf-rpi3/uapps/uapp-pa5encfs/uapp-pa5encfs.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - pa5encfs hypapp - FUSE encrypted filesystem hypapp - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include - -/* - do_crypt using libxmhfcrypto aes primitive - aeskey of size TPM_AES_KEY_LEN_BYTES (16) - iv of size TPM_AES_KEY_LEN_BYTES (16) which is random - cbc_start - cbc_encrypt - cbc_done - */ -__attribute__((section(".data"))) uint8_t pa5encfs_aes_iv[AES_KEY_LEN_BYTES] = - { - 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, 0x8a, - 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, 0x8b - }; -__attribute__((section(".data"))) uint8_t pa5encfs_aes_key[AES_KEY_LEN_BYTES] = - { - 0xfa, 0xea, 0xda, 0xca, 0xba, 0xaa, 0x9a, 0x8a, - 0xfb, 0xeb, 0xdb, 0xcb, 0xbb, 0xab, 0x9b, 0x8b - }; - -__attribute__((section(".data"))) symmetric_CBC cbc_ctx; - - -//return true if handled the hypercall, false if not -bool uapp_pa5encfs_handlehcall(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len){ - pa5encfs_param_t *ep; - - ep = (pa5encfs_param_t *)uhcall_buffer; - - if(uhcall_function == UAPP_PA5ENCFS_FUNCTION_START){ - - /* Init Engine */ - if( rijndael_cbc_start(pa5encfs_aes_iv, pa5encfs_aes_key, AES_KEY_LEN_BYTES, 0, &cbc_ctx) != CRYPT_OK ) - ep->result = 0; - else - ep->result = 1; - - return true; - - }else if (uhcall_function == UAPP_PA5ENCFS_FUNCTION_ENCRYPT){ - - if( rijndael_cbc_encrypt(ep->inbuf, ep->outbuf, ep->inlen, &cbc_ctx) != CRYPT_OK) - ep->result=0; - else - ep->result=1; - - return true; - - }else if (uhcall_function == UAPP_PA5ENCFS_FUNCTION_DECRYPT){ - - if( rijndael_cbc_decrypt(ep->inbuf, ep->outbuf, ep->inlen, &cbc_ctx) != CRYPT_OK) - ep->result=0; - else - ep->result=1; - - - return true; - - }else if (uhcall_function == UAPP_PA5ENCFS_FUNCTION_DONE){ - - if( rijndael_cbc_done( &cbc_ctx) != CRYPT_OK) - ep->result=0; - else - ep->result=1; - - return true; - - }else{ - - return false; - } - -} diff --git a/uxmhf-rpi3/uapps/uapp-pvdriver-uart/README b/uxmhf-rpi3/uapps/uapp-pvdriver-uart/README deleted file mode 100644 index 47defdd045..0000000000 --- a/uxmhf-rpi3/uapps/uapp-pvdriver-uart/README +++ /dev/null @@ -1,2 +0,0 @@ -UART para-virtualized driver uapp -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/uapps/uapp-pvdriver-uart/uapp-pvdriver-uart.c b/uxmhf-rpi3/uapps/uapp-pvdriver-uart/uapp-pvdriver-uart.c deleted file mode 100644 index 6577d6def7..0000000000 --- a/uxmhf-rpi3/uapps/uapp-pvdriver-uart/uapp-pvdriver-uart.c +++ /dev/null @@ -1,241 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -////////////////////////////////////////////////////////////////////////////// -// UART para-virtualized driver interfaces -////////////////////////////////////////////////////////////////////////////// - - -////// -// initialize UART hardware for 115200 baudrate -// 8 stop bits, no parity, 1 stop bit configuration (8N1) -////// -void uapp_pvdriver_uart_init(void){ - uart_init(); -} - -////// -// write bytes to UART -////// -void uapp_pvdriver_uart_send(u8 *buffer, u32 buf_len){ - u32 i; - - for(i=0; i < buf_len; i++){ - uart_putc(buffer[i]); - } -} - -////// -// read bytes from UART until max_len or read buffer exhausted -// return 0: read buffer still has characters -// return 1: read buffer exhausted -////// -int uapp_pvdriver_uart_recv(u8 *buffer, u32 max_len, u32 *len_read){ - u32 i; - - i=0; - while(uart_getc(&buffer[i])){ - i++; - if(i == max_len) - break; - } - - *len_read = i; - - if(uart_can_recv()) - return 0; - else - return 1; -} - - -////// -// check if we can send via UART -// return 0: if we __cannot__ send -// return 1: if we __can__ send -////// -int uapp_pvdriver_uart_can_send(void){ - if(uart_can_send()) - return 1; - else - return 0; -} - -////// -// check if we have something to receive from UART -// return 0: if we __dont have__ anything to read -// return 1: if we __have__ something to read -////// -int uapp_pvdriver_uart_can_recv(void){ - if(uart_can_recv()) - return 1; - else - return 0; -} - - -////// -// flush FIFO -////// -void uapp_pvdriver_uart_flush(void){ - uart_flush(); -} - - - - -////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////// -// pvdriver_uart hypercall APIs -////////////////////////////////////////////////////////////////////////////// - -////// init -void uapp_pvdriver_uart_handlehcall_init(uapp_pvdriver_uart_param_t *hparams){ - - //init - uapp_pvdriver_uart_init(); - - hparams->status=1; -} - - -////// send -void uapp_pvdriver_uart_handlehcall_send(uapp_pvdriver_uart_param_t *hparams){ - //iparam_1 = buffer physical address - //iparam_2 = buffer length (in bytes) - - //sanity check buffer length, currently only a max of 4096 bytes - //can be sent at a time - if(hparams->iparam_2 > 4096){ - hparams->status=0; - return; - } - - //send the bytes out through the UART and flush output - uapp_pvdriver_uart_send(hparams->iparam_1, hparams->iparam_2); - uapp_pvdriver_uart_flush(); - - //set status to indicate success - hparams->status=1; -} - - - - -////// recv -void uapp_pvdriver_uart_handlehcall_recv(uapp_pvdriver_uart_param_t *hparams){ - //iparam_1 = buffer physical address - //iparam_2 = buffer max length (in bytes) - - //oparam_1 = length read - //oparam_2 = UART read buffer status (1=exhausted, 0=not exhausted) - - //sanity check buffer length, currently only a max of 4096 bytes - //can be received at a time - if(hparams->iparam_2 > 4096){ - hparams->status=0; - return; - } - - //read bytes from UART - hparams->oparam_2 = uapp_pvdriver_uart_recv(hparams->iparam_1, hparams->iparam_2, &hparams->oparam_1); - - //set status to indicate success - hparams->status=1; -} - - - -////// can_send -void uapp_pvdriver_uart_handlehcall_can_send(uapp_pvdriver_uart_param_t *hparams){ - - if(uapp_pvdriver_uart_can_send()) - hparams->status=1; - else - hparams->status=0; - - return; -} - -////// can_recv -void uapp_pvdriver_uart_handlehcall_can_recv(uapp_pvdriver_uart_param_t *hparams){ - - if(uapp_pvdriver_uart_can_recv()) - hparams->status=1; - else - hparams->status=0; - - return; -} - -////// flush -void uapp_pvdriver_uart_handlehcall_flush(uapp_pvdriver_uart_param_t *hparams){ - uapp_pvdriver_uart_flush(); - hparams->status=1; -} - - -////// hypercall handler hub -////// return true if handled the hypercall, false if not -bool uapp_pvdriver_uart_handlehcall(u32 uhcall_function, void *uhcall_buffer, - u32 uhcall_buffer_len){ - uapp_pvdriver_uart_param_t *hparams; - - if(uhcall_function != UAPP_PVDRIVER_UART_UHCALL){ - return false; - } - - hparams = (uapp_pvdriver_uart_param_t *)uhcall_buffer; - - if(hparams->uhcall_fn == UAPP_PVDRIVER_UART_UHCALL_INIT){ - uapp_pvdriver_uart_handlehcall_init(hparams); - - }else if(hparams->uhcall_fn == UAPP_PVDRIVER_UART_UHCALL_SEND){ - uapp_pvdriver_uart_handlehcall_send(hparams); - - }else if(hparams->uhcall_fn == UAPP_PVDRIVER_UART_UHCALL_RECV){ - uapp_pvdriver_uart_handlehcall_recv(hparams); - - }else if(hparams->uhcall_fn == UAPP_PVDRIVER_UART_UHCALL_CAN_SEND){ - uapp_pvdriver_uart_handlehcall_can_send(hparams); - - }else if(hparams->uhcall_fn == UAPP_PVDRIVER_UART_UHCALL_CAN_RECV){ - uapp_pvdriver_uart_handlehcall_can_recv(hparams); - - }else if(hparams->uhcall_fn == UAPP_PVDRIVER_UART_UHCALL_FLUSH){ - uapp_pvdriver_uart_handlehcall_flush(hparams); - - }else{ - //ignore unknown uhcall_fn silently - - } - - return true; -} - - -////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////// -// main uapp initialization -////////////////////////////////////////////////////////////////////////////// - -void uapp_pvdriver_uart_initialize_uapp(u32 cpuid){ - - //only initialize for boot-cpu - if(cpuid == 0){ - _XDPRINTFSMP_("%s[%u]: Initializing UART para-virtualized driver backend...\n", __func__, cpuid); - } - -} - - -////////////////////////////////////////////////////////////////////////////// diff --git a/uxmhf-rpi3/uapps/uapp-uagent/README b/uxmhf-rpi3/uapps/uapp-uagent/README deleted file mode 100644 index a8f63c23e1..0000000000 --- a/uxmhf-rpi3/uapps/uapp-uagent/README +++ /dev/null @@ -1,4 +0,0 @@ -hypapp for encrypting/decrypting data -Note: poor use of crypto, using fixed IV (for AES-CBC). - -author: matt mccormack (matthew.mccormack@live.com) \ No newline at end of file diff --git a/uxmhf-rpi3/uapps/uapp-uagent/uapp-uagent.c b/uxmhf-rpi3/uapps/uapp-uagent/uapp-uagent.c deleted file mode 100644 index 266b950ea5..0000000000 --- a/uxmhf-rpi3/uapps/uapp-uagent/uapp-uagent.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Authors: Matt McCormack () - * Amit Vasudevan () - */ - -/* - uagent hypapp - guest hypercall to encrypt/decrypt a data blob - - authors: matt mccormack () - amit vasudevan () -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - -#define UAGENT_BLOCK_SIZE 16 - -uint32_t calc_crypto_size(uint32_t input_size){ - uint32_t num_blocks; - num_blocks=input_size/UAGENT_BLOCK_SIZE; - if(input_size%UAGENT_BLOCK_SIZE) - num_blocks++; - return num_blocks*UAGENT_BLOCK_SIZE; -} - -__attribute__((section(".data"))) uint8_t uagent_key[16]={ - 0x73, 0x75, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x5f, 0x6b, 0x65, 0x79 -}; //"super_secret_key" -__attribute__((section(".data"))) uint8_t iv[16]={ - 0x31, 0x32, 0x33, 0x34, 0x035, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, - 0x32, 0x33, 0x34, 0x35, 0x36 -}; //"1234567890123456" -#define UAGENT_KEY_SIZE (sizeof(uagent_key)) - -bool uapp_uagent_handlehcall(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len) -{ - uagent_param_t *uhcp; - - if(uhcall_function != UAPP_UAGENT_FUNCTION_SIGN) - return false; - - uhcp=(uagent_param_t *)uhcall_buffer; - - //debug dump - #if 0 - _XDPRINTFSMP_("%s: elr_hyp va=0x%08x\n", __func__, sysreg_read_elrhyp()); - #endif - - //call acl function - uapp_checkacl(sysreg_read_elrhyp()); - - //Call AES_CBC function(s) - symmetric_CBC cbc_ctx; - uint8_t data_buffer[1600]; - - memset(data_buffer, 0, 1600); - - if(rijndael_cbc_start(iv, uagent_key, UAGENT_KEY_SIZE, 0, &cbc_ctx)) { - return false; - } - - uint32_t cipher_len=calc_crypto_size(uhcp->pkt_size); - - // encrypt - if(uhcp->op==1){ - if(rijndael_cbc_encrypt(uhcp->pkt_data, data_buffer, (unsigned long) cipher_len, &cbc_ctx)) { - return false; - } - memset(uhcp->pkt_data, 0, 1600); - memcpy(uhcp->pkt_data, data_buffer, cipher_len); - rijndael_cbc_done(&cbc_ctx); - return true; - //decrypt - } else if(uhcp->op==2){ - if(rijndael_cbc_decrypt(uhcp->pkt_data, data_buffer, (unsigned long) cipher_len, &cbc_ctx)) { - return false; - } - memset(uhcp->pkt_data, 0, 1600); - memcpy(uhcp->pkt_data, data_buffer, cipher_len); - rijndael_cbc_done(&cbc_ctx); - return true; - } else { - return false; - } -} diff --git a/uxmhf-rpi3/uapps/uapp-uhcalltest/README b/uxmhf-rpi3/uapps/uapp-uhcalltest/README deleted file mode 100644 index 786030a769..0000000000 --- a/uxmhf-rpi3/uapps/uapp-uhcalltest/README +++ /dev/null @@ -1,2 +0,0 @@ -test hypercall hypapp -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/uapps/uapp-uhcalltest/uapp-uhcalltest.c b/uxmhf-rpi3/uapps/uapp-uhcalltest/uapp-uhcalltest.c deleted file mode 100644 index a0dea3d906..0000000000 --- a/uxmhf-rpi3/uapps/uapp-uhcalltest/uapp-uhcalltest.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - uhcalltest hypapp - guest hypercall test hypapp - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -#include - -#define MAX_LVL1_ENTRIES 4096 -#define MAX_LVL2_ENTRIES 256 - -#define SIZEOF_LVL1_ENTRY_MAP (1024*1024) //each lvl1 entry maps to 1MB of memory -#define SIZEOF_LVL2_ENTRY_MAP (1024*1024) //each lvl1 entry maps to 1MB of memory - -/* -uint32_t va2pa(uint32_t va){ - u32 ttbcr; - u32 ttbr0; - u32 ttbr1; - u32 pdbr; - u32 *lvl1tbl; //4096 entries - u32 i; - u32 lvl1tbl_index; - u32 lvl2tbl_index; - u32 lvl1tbl_entry; - u32 lvl2tbl_entry; - u32 *lvl2tbl; - - _XDPRINTFSMP_("%s: ENTER: va=0x%08x\n", __func__, va); - - ttbcr = sysreg_read_ttbcr(); - _XDPRINTFSMP_("%s: ttbcr=0x%08x\n", __func__, ttbcr); - - ttbr0 = sysreg_read_ttbr0(); - _XDPRINTFSMP_("%s: ttbr0=0x%08x\n", __func__, ttbr0); - - ttbr1 = sysreg_read_ttbr1(); - _XDPRINTFSMP_("%s: ttbr1=0x%08x\n", __func__, ttbr1); - - - pdbr = ttbr0 & 0xFFFFFF80UL; //strip lower 7 bits - _XDPRINTFSMP_("%s: pdbr=0x%08x\n", __func__, pdbr); - - lvl1tbl_index = va/SIZEOF_LVL1_ENTRY_MAP; - lvl2tbl_index = (va % SIZEOF_LVL1_ENTRY_MAP) / 4096; - - lvl1tbl = (u32 *)pdbr; - - _XDPRINTFSMP_("%s: lvl1tbl=0x%08x\n", __func__, lvl1tbl); - - lvl1tbl_entry = lvl1tbl[lvl1tbl_index]; - - _XDPRINTFSMP_("%s: lvl1tbl_index=%u, lvl1tbl entry=0x%08x\n", __func__, - lvl1tbl_index, lvl1tbl_entry); - - if( (lvl1tbl_entry & 0x00000003UL) != 0x1){ - _XDPRINTFSMP_("%s: unhandled lvl1tbl_entry. Halting!\n", __func__); - HALT(); - } - - lvl2tbl = (u32 *) (u32)( lvl1tbl_entry & 0xFFFFFE00UL); - - _XDPRINTFSMP_("%s: lvl2tbl=0x%08x\n", __func__, lvl2tbl); - - lvl2tbl_entry = lvl2tbl[lvl2tbl_index]; - - _XDPRINTFSMP_("%s: lvl2tbl_index=%u, lvl2tbl entry=0x%08x\n", __func__, - lvl2tbl_index, lvl2tbl_entry); - - _XDPRINTFSMP_("%s: WiP\n", __func__); -} -*/ - - -bool va2pa(uint32_t va, u32 *pa){ - u32 par; - - //_XDPRINTFSMP_("%s: ENTER: va=0x%08x\n", __func__, va); - - //sysreg_tlbiallh(); -#if 0 - sysreg_ats12nsour(va); - par = sysreg_read_par(); -#endif - - sysreg_ats1cpr(va); - par = sysreg_read_par(); - - //_XDPRINTFSMP_("%s: PAR=0x%08x\n", __func__, par); - - if(par & 0x1) - return false; //_XDPRINTFSMP_("%s: Fault in address translation. Halting!\n", __func__); - - par &= 0xFFFFF000UL; - - //_XDPRINTFSMP_("%s: PAR after pruning=0x%08x\n", __func__, par); - - *pa = par; - - //_XDPRINTFSMP_("%s: EXIT: pa=0x%08x\n", __func__, *pa); - - return true; -} - - - -//return true if handled the hypercall, false if not -bool uapp_uhcalltest_handlehcall(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len){ - uhcalltest_param_t *uhctp; - - if(uhcall_function != UAPP_UHCALLTEST_FUNCTION_TEST) - return false; - - //u32 uhcall_buffer_paddr; - //_XDPRINTFSMP_("%s: hcall: uhcall_function=0x%08x, uhcall_buffer=0x%08x, uhcall_buffer_len=0x%08x\n", __func__, - // uhcall_function, uhcall_buffer, uhcall_buffer_len); - - //if(!va2pa((uint32_t)uhcall_buffer, &uhcall_buffer_paddr)) - // return false; - // - //uhctp = (uhcalltest_param_t *)uhcall_buffer_paddr; - uhctp = (uhcalltest_param_t *)uhcall_buffer; - -#if 0 - uint32_t i; - _XDPRINTFSMP_("dumping in[]...\n"); - for(i=0; i < 16; i++) - _XDPRINTFSMP_("%c", uhctp->in[i]); - _XDPRINTFSMP_("\ndumped uhctp->in[]\n"); -#endif - - memcpy(&uhctp->out, &uhctp->in, 16); - -#if 0 - _XDPRINTFSMP_("dumping out[]...\n"); - for(i=0; i < 16; i++) - _XDPRINTFSMP_("%c", uhctp->out[i]); - _XDPRINTFSMP_("\ndumped uhctp->out[]\n"); -#endif - - return true; -} diff --git a/uxmhf-rpi3/uapps/uapp-uhsign/uapp-uhsign.c b/uxmhf-rpi3/uapps/uapp-uhsign/uapp-uhsign.c deleted file mode 100644 index 59bda358cc..0000000000 --- a/uxmhf-rpi3/uapps/uapp-uhsign/uapp-uhsign.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Authors: Matt McCormack () - * Amit Vasudevan () - */ - -/* - uhsign hypapp - guest hypercall to generate HMAC signature of data blob - - authors: matt mccormack () - amit vasudevan () -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - -__attribute__((section(".data"))) unsigned char uhsign_key[]="super_secret_key_for_hmac"; -#define UHSIGN_KEY_SIZE (sizeof(uhsign_key)) - -bool uapp_uhsign_handlehcall(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len) -{ - uhsign_param_t *uhcp; - - if(uhcall_function != UAPP_UHSIGN_FUNCTION_SIGN) - return false; - - uhcp=(uhsign_param_t *)uhcall_buffer; - - //debug dump - #if 0 - _XDPRINTFSMP_("%s: elr_hyp va=0x%08x\n", __func__, sysreg_read_elrhyp()); - #endif - - //call acl function - uapp_checkacl(sysreg_read_elrhyp()); - - //Call HMAC function - unsigned long digest_size = HMAC_DIGEST_SIZE; - unsigned char digest_result[HMAC_DIGEST_SIZE]; - - if(hmac_sha256_memory(uhsign_key, (unsigned long) UHSIGN_KEY_SIZE, (unsigned char *) uhcp->pkt, (unsigned long) uhcp->pkt_size, &digest_result, &digest_size)==CRYPT_OK) { - memcpy(uhcp->digest, digest_result, HMAC_DIGEST_SIZE); - - return true; - } else { - return false; - } -} diff --git a/uxmhf-rpi3/uapps/uapp-uhstateDB/uapp-uhstateDB.c b/uxmhf-rpi3/uapps/uapp-uhstateDB/uapp-uhstateDB.c deleted file mode 100644 index 67d049623f..0000000000 --- a/uxmhf-rpi3/uapps/uapp-uhstateDB/uapp-uhstateDB.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Authors: Matt McCormack () - * Amit Vasudevan () - */ - -/* - uhstateDB hypapp - guest hypercall to protected DB, containing the current and max states - - authors: matt mccormack () - amit vasudevan () -*/ - -#include -#include -#include -#include -#include - -#include -#include - -__attribute__((section(".data"))) int32_t stateDB[MAX_STATES]={0}; -__attribute__((section(".data"))) uint32_t maxStateDB[MAX_STATES]={0}; -__attribute__((section(".data"))) int32_t DB_SET=0; - -bool uapp_uhstateDB_handlehcall(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len) -{ - uhstatedb_param_t *uhcp; - - if((uhcall_function != UAPP_UHSTATEDB_FUNCTION_GET) && (uhcall_function != UAPP_UHSTATEDB_FUNCTION_NEXT) && (uhcall_function != UAPP_UHSTATEDB_FUNCTION_INIT)) - return false; - - uhcp = (uhstatedb_param_t *)uhcall_buffer; - int i; - - //call acl function - uapp_checkacl(sysreg_read_elrhyp()); - - if(uhcall_function == UAPP_UHSTATEDB_FUNCTION_INIT) { - if(DB_SET==0) { - - // Initialize maximum state values, based upon input - for(i=0; inumStates; i++){ - maxStateDB[i]=uhcp->maxArray[i]; - } - // only allow this to run once. - DB_SET = 1; - } - return true; - } - - if((uhcall_function == UAPP_UHSTATEDB_FUNCTION_GET) || (uhcall_function == UAPP_UHSTATEDB_FUNCTION_NEXT)) { - - #if 0 - //debug dump - _XDPRINTFSMP_("%s: elr_hyp va=0x%08x\n", __func__, sysreg_read_elrhyp()); - #endif - - if(uhcall_function == UAPP_UHSTATEDB_FUNCTION_GET) { - uhcp->stateVal=stateDB[uhcp->deviceID]; - return true; - } else if(uhcall_function == UAPP_UHSTATEDB_FUNCTION_NEXT) { - if (stateDB[uhcp->deviceID]deviceID]) - stateDB[uhcp->deviceID]++; - return true; - } else { - return false; - } - } - return false; -} diff --git a/uxmhf-rpi3/uapps/uapp-utpmtest/README b/uxmhf-rpi3/uapps/uapp-utpmtest/README deleted file mode 100644 index 8ed8bd8981..0000000000 --- a/uxmhf-rpi3/uapps/uapp-utpmtest/README +++ /dev/null @@ -1,2 +0,0 @@ -micro-tpm implementation -author: amitvasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/uapps/uapp-utpmtest/uapp-utpmtest.c b/uxmhf-rpi3/uapps/uapp-utpmtest/uapp-utpmtest.c deleted file mode 100644 index 4f8076df83..0000000000 --- a/uxmhf-rpi3/uapps/uapp-utpmtest/uapp-utpmtest.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - uhcalltest hypapp - guest hypercall test hypapp - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include - - -//return true if handled the hypercall, false if not -bool uapp_utpmtest_handlehcall(u32 uhcall_function, void *uhcall_buffer, u32 uhcall_buffer_len){ - utpmtest_param_t *utpmtest_param = (utpmtest_param_t *)uhcall_buffer; - - //_XDPRINTFSMP_("%s: uhcall_function=%x, uhcall_buffer=0x%08x, uhcall_buffer_len=%u\n", - // __func__, uhcall_function, uhcall_buffer, uhcall_buffer_len); - -#if 0 - if(utpmtest_param->magic != 0xDEADBEEF){ - _XDPRINTFSMP_("%s: invalid magic -- check buffer locking!\n", - __func__); - - } -#endif - - if(uhcall_function == UAPP_UTPM_FUNCTION_INIT_MASTER_ENTROPY){ - //_XDPRINTFSMP_("%s: INIT_MASTER_ENTROPY: magic=0x%08x\n", - // __func__, utpmtest_param->magic); - - - #if 1 - utpmtest_param->result = - utpm_init_master_entropy(&utpmtest_param->g_aeskey, - &utpmtest_param->g_hmackey, - &utpmtest_param->g_rsakey); - #endif - - return true; - - } else if(uhcall_function == UAPP_UTPM_FUNCTION_INIT_INSTANCE){ - - utpm_init_instance(&utpmtest_param->utpm); - - return true; - - } else if(uhcall_function == UAPP_UTPM_FUNCTION_PCRREAD){ - - utpmtest_param->result = - utpm_pcrread(&utpmtest_param->pcr0, &utpmtest_param->utpm, utpmtest_param->pcr_num); - - return true; - - } else if(uhcall_function == UAPP_UTPM_FUNCTION_EXTEND){ - //_XDPRINTFSMP_("%s: going to perform extend...pcr_num=%u\n", - // __func__, utpmtest_param->pcr_num); - utpmtest_param->result = - utpm_extend(&utpmtest_param->measurement, - &utpmtest_param->utpm, utpmtest_param->pcr_num); - - //_XDPRINTFSMP_("%s: extend successful\n", __func__); - - return true; - - - - } else if(uhcall_function == UAPP_UTPM_FUNCTION_SEAL){ - //_XDPRINTFSMP_("%s: SEAL function: seal_inbuf_len=%u\n", __func__, - // utpmtest_param->seal_inbuf_len); - - #if 1 - utpmtest_param->result = - utpm_seal(&utpmtest_param->utpm, &utpmtest_param->tpmPcrInfo, - &utpmtest_param->seal_inbuf, utpmtest_param->seal_inbuf_len, - &utpmtest_param->seal_outbuf, &utpmtest_param->seal_outbuf_len); - #endif - - //_XDPRINTFSMP_("%s: SEAL function done: seal_outbuf_len=%u\n", __func__, - // utpmtest_param->seal_outbuf_len); - - - return true; - - } else if(uhcall_function == UAPP_UTPM_FUNCTION_UNSEAL){ - //_XDPRINTFSMP_("%s: UNSEAL function: seal_outbuf_len=%u\n", __func__, - // utpmtest_param->seal_outbuf_len); - - #if 1 - //if(utpmtest_param->seal_outbuf_len <= 32){ - utpmtest_param->result = - utpm_unseal(&utpmtest_param->utpm, - &utpmtest_param->seal_outbuf, utpmtest_param->seal_outbuf_len, - &utpmtest_param->seal_outbuf2, &utpmtest_param->seal_outbuf2_len, - &utpmtest_param->digestAtCreation); - //}else - // utpmtest_param->result = UTPM_ERR; - #endif - - //_XDPRINTFSMP_("%s: UNSEAL function done: seal_outbuf2_len=%u\n", __func__, - // utpmtest_param->seal_outbuf2_len); - - return true; - - - }else{ - return false; - } -} diff --git a/uxmhf-rpi3/uapps/uapp-watchdog/README b/uxmhf-rpi3/uapps/uapp-watchdog/README deleted file mode 100644 index f9fda30aae..0000000000 --- a/uxmhf-rpi3/uapps/uapp-watchdog/README +++ /dev/null @@ -1,2 +0,0 @@ -watchdog hypapp; example of timer handling -author: amit vasudevan (amitvasudevan@acm.org) diff --git a/uxmhf-rpi3/uapps/uapp-watchdog/uapp-watchdog.c b/uxmhf-rpi3/uapps/uapp-watchdog/uapp-watchdog.c deleted file mode 100644 index 4f4cb04b57..0000000000 --- a/uxmhf-rpi3/uapps/uapp-watchdog/uapp-watchdog.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - watchdog hypapp - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -extern void uapp_watchdog_fiq_handler(void); - -__attribute__((section(".data"))) volatile u32 *gpio; -bool led_on=false; - -#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3)) -#define OUT_GPIO(g) *(gpio+((g)/10)) |= (1<<(((g)%10)*3)) -#define GPIO_SET *(gpio+7) // sets bits which are 1 ignores bits which are 0 -#define GPIO_CLR *(gpio+10) // clears bits which are 1 ignores bits which are 0 - - -////// -// uapp watchdog timer_initialize -// initialize hypervisor timer functionality -////// -void uapp_watchdog_timer_initialize(u32 cpuid){ - u32 cpsr; - u64 cntpct_val; - u32 cpu0_tintctl_value; - u32 loop_counter=0; - - _XDPRINTFSMP_("%s[%u]: ENTER\n", __func__, cpuid); - - //enable cpu0 timer interrupt control to generate FIQs - cpu0_tintctl_value = mmio_read32(LOCAL_TIMER_INT_CONTROL0); - _XDPRINTFSMP_("%s[%u]: cpu0_tintctl_value[before]=0x%08x, CNTHPFIQ=%u, CNTHPIRQ=%u\n", - __func__, cpuid, - cpu0_tintctl_value, - ((cpu0_tintctl_value & (1UL << 6)) >> 6), - ((cpu0_tintctl_value & (1UL << 2)) >> 2) - ); - - cpu0_tintctl_value &= ~(1UL << 2); //disable IRQs - cpu0_tintctl_value |= (1UL << 6); //enable FIQs - mmio_write32(LOCAL_TIMER_INT_CONTROL0, cpu0_tintctl_value); - - - cpu0_tintctl_value = mmio_read32(LOCAL_TIMER_INT_CONTROL0); - _XDPRINTFSMP_("%s[%u]: cpu0_tintctl_value[after]=0x%08x, CNTHPFIQ=%u, CNTHPIRQ=%u\n", - __func__, cpuid, - cpu0_tintctl_value, - ((cpu0_tintctl_value & (1UL << 6)) >> 6), - ((cpu0_tintctl_value & (1UL << 2)) >> 2) - ); - - - - //cpsr = sysreg_read_cpsr(); - //_XDPRINTFSMP_("%s[%u]: CPSR[before]=0x%08x; CPSR.A=%u, CPSR.I=%u, CPSR.F=%u\n", - // __func__, cpuid, cpsr, ((cpsr & (1UL << 8)) >> 8), - // ((cpsr & (1UL << 7)) >> 7), - // ((cpsr & (1UL << 6)) >> 6) ); - - - _XDPRINTFSMP_("%s[%u]: CNTHP_TVAL[initial]=%d\n", __func__, cpuid, sysreg_read_cnthp_tval()); - sysreg_write_cnthp_tval(10*1024*1024); - _XDPRINTFSMP_("%s[%u]: CNTHP_TVAL[reset]=%d\n", __func__, cpuid, sysreg_read_cnthp_tval()); - - sysreg_write_cnthp_ctl(0x1); - _XDPRINTFSMP_("%s[%u]: CNTHP_TVAL[current]=%d\n", __func__, cpuid, sysreg_read_cnthp_tval()); - _XDPRINTFSMP_("%s[%u]: CNTHP_CTL[current]=%d\n", __func__, cpuid, sysreg_read_cnthp_ctl()); - - - //cpsr &= ~(1UL << 6); //clear CPSR.F to allow FIQs - //sysreg_write_cpsr(cpsr); - - _XDPRINTFSMP_("%s[%u]: EXIT\n", __func__, cpuid); -} - - -void uapp_watchdog_fiqhandler(void){ - uapp_watchdog_timerhandler(); - - //reset timer counter - sysreg_write_cnthp_tval(10*1024*1024); -} - - -void uapp_watchdog_timerhandler(void){ - gpio = (u32 *)GPIO_BASE; - - // set GPIO pin 7 as output - INP_GPIO(7); // must use INP_GPIO before we can use OUT_GPIO - OUT_GPIO(7); - - if(led_on){ - GPIO_CLR = (1 << 7); - led_on=false; - }else{ - GPIO_SET = (1 << 7); - led_on=true; - } - - //uart_puts("WATCHDOG EXCEPTION-- Resuming\n"); -} - - -void uapp_watchdog_initialize(u32 cpuid){ - if(cpuid == 0){ - hypvtable_setentry(cpuid, 7, (u32)&uapp_watchdog_fiq_handler); - uapp_watchdog_timer_initialize(cpuid); - - } -} diff --git a/uxmhf-rpi3/uapps/uapp-watchdog/uapp-watchdogsup.s b/uxmhf-rpi3/uapps/uapp-watchdog/uapp-watchdogsup.s deleted file mode 100644 index c18aef1dfa..0000000000 --- a/uxmhf-rpi3/uapps/uapp-watchdog/uapp-watchdogsup.s +++ /dev/null @@ -1,98 +0,0 @@ -/* - * @UBERXMHF_LICENSE_HEADER_START@ - * - * uber eXtensible Micro-Hypervisor Framework (Raspberry Pi) - * - * Copyright 2018 Carnegie Mellon University. All Rights Reserved. - * - * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING - * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON - * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - * AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR - * PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF - * THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF - * ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT - * INFRINGEMENT. - * - * Released under a BSD (SEI)-style license, please see LICENSE or - * contact permission@sei.cmu.edu for full terms. - * - * [DISTRIBUTION STATEMENT A] This material has been approved for public - * release and unlimited distribution. Please see Copyright notice for - * non-US Government use and distribution. - * - * Carnegie Mellon is registered in the U.S. Patent and Trademark Office by - * Carnegie Mellon University. - * - * @UBERXMHF_LICENSE_HEADER_END@ - */ - -/* - * Author: Amit Vasudevan (amitvasudevan@acm.org) - * - */ - -/* - uapp watchdog low-level support routines - - author: amit vasudevan (amitvasudevan@acm.org) -*/ - - -.section ".text" - - - .balign 32 - .global uapp_watchdog_fiq_handler -uapp_watchdog_fiq_handler: - ldr sp, =uapp_watchdog_fiqhandler_stack_top - - push {lr} - - push {r12} - push {r11} - push {r10} - push {r9} - push {r8} - push {r7} - push {r6} - push {r5} - push {r4} - push {r3} - push {r2} - push {r1} - push {r0} - - bl uapp_watchdog_fiqhandler - - // restore all saved registers - pop {r0} - pop {r1} - pop {r2} - pop {r3} - pop {r4} - pop {r5} - pop {r6} - pop {r7} - pop {r8} - pop {r9} - pop {r10} - pop {r11} - pop {r12} - - pop {lr} - - eret - - - - -.section ".stack" - - .balign 8 - .global uapp_watchdog_fiqhandler_stack - uapp_watchdog_fiqhandler_stack: .space 8192 - .global uapp_watchdog_fiqhandler_stack_top - uapp_watchdog_fiqhandler_stack_top: - - diff --git a/uxmhf/.gitignore b/uxmhf/.gitignore deleted file mode 100644 index 0214b585d3..0000000000 --- a/uxmhf/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -*.*~ -*~ -*.cache -*.log -*.status -confdefs.h -*.exe -*.bin -*.ls -*.tmp -*.cache -_objects/ -Makefile -*.pp -*.lscript -configure -configure-uxmhfuobj -*.mk -*.v.c -_verif \ No newline at end of file diff --git a/uxmhf/LICENSE b/uxmhf/LICENSE deleted file mode 100644 index ad7285dfd3..0000000000 --- a/uxmhf/LICENSE +++ /dev/null @@ -1,44 +0,0 @@ -The following license and copyright notice applies to all content in -this repository in addition to licenses and notices in sub-directories -and individual source files. - -See COPYING for more information. - -UberSpark -Copyright (c) 2013-2016 Carnegie Mellon University / CyLab -Copyright (c) 2013-2016 Amit Vasudevan (amitvasudevan@acm.org) -All Rights Reserved. - -Developed by: UberSpark Team - Carnegie Mellon University / CyLab - http://uberspark.org - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the -distribution. - -Neither the names of Carnegie Mellon or CyLab, nor the names of -its contributors may be used to endorse or promote products derived -from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/uxmhf/Makefile.in b/uxmhf/Makefile.in deleted file mode 100644 index 6e6d2429a6..0000000000 --- a/uxmhf/Makefile.in +++ /dev/null @@ -1,156 +0,0 @@ -###### -# top-level Makefile for XMHF -# author: amit vasudevan (amitvasudevan@acm.org) -###### - -include ./uxmhf-common.mk - - - -###### -# uXMHF build variables -###### - -## bootloader source path -export XMHF_BOOTLOADER_SRC := $(realpath $(XMHF_DIR)/xmhf-bootloader) - - -## uobj source paths and count -#export XMHF_SLAB_DIRS := $(shell awk -F, '{print $$1}' $(XMHF_DIR)/xmhf-uobjs/UOBJLIST) -export XMHF_SLAB_DIRS := $(shell sed '1,2d;$$d' $(XMHF_DIR)/xmhf-uobjs/UOBJLIST | sed '$$d' | awk '{$$1=$$1;print}') -XMHF_SLAB_NAMES := $(notdir $(XMHF_SLAB_DIRS)) -export XMHF_SLAB_TOTAL := $(shell sed '1,2d;$$d' $(XMHF_DIR)/xmhf-uobjs/UOBJLIST | sed '$$d' | awk '{$$1=$$1;print}' | wc -l) - - - -###### -# top-level build targets -###### - - -###### -# uxmhf image -.PHONY: uxmhf-image -uxmhf-image: uxmhf-uobjsbuild uxmhf-bootloader uxmhf-binimage - - - - - - -###### -# uxmhf uobj manifest/infotable related build harness - - -.PHONY: _uobjs_preprocessmanifests -_uobjs_preprocessmanifests: - mkdir -p $(XMHF_OBJDIR) - @for i in $(XMHF_SLAB_NAMES); \ - do \ - (cd $(XMHF_OBJDIR) && echo "Prepping uobj manifest for $$i..." && $(CP) -f $(XMHF_DIR)/xmhf-uobjs/$$i/$$i.gsm $$i.gsm.c && $(CCERT) -E $(CCERT_CFLAGS) -D__ASSEMBLY__ $$i.gsm.c >$(XMHF_DIR)/xmhf-uobjs/$$i/$$i.gsm.pp) || exit 1; \ - done; - @echo uobj manifests prepped - -.PHONY: _uobjs_configureandgenerateuobjinfo -_uobjs_configureandgenerateuobjinfo: - $(MKDIR) -p $(XMHF_OBJDIR) - cd $(XMHF_DIR) && $(USPARK_INSTALL_TOOLSDIR)/umf $(XMHF_DIR)/xmhf-uobjs/UOBJLIST $(XMHF_DIR)/configure-uxmhfuobj $(XMHF_OBJDIR)/uobjinfotable.c $(XMHF_OBJDIR)/xmhf.lscript $(XMHF_CONFIG_LOADADDR) $(XMHF_CONFIG_LOADMAXSIZE) $(XMHFGEEC_TOTAL_UHSLABS) $(XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES) $(XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES) $(XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES) 0 "$(CCERT_CFLAGS)" - - -.PHONY: uobjinfotable_build -uobjinfotable_build: - @echo building uobjinfotable... - $(MKDIR) -p $(XMHF_OBJDIR) - cd $(XMHF_OBJDIR) && $(CCERT) -c $(CCERT_CFLAGS) -o $(XMHF_OBJDIR)/uobjinfotable.o uobjinfotable.c - @echo uobjinfotable built sucessfully. - -###### -# uxmhf uobj build - -.PHONY: uxmhf-uobjsbuild -uxmhf-uobjsbuild: _uobjs_configureandgenerateuobjinfo uobjinfotable_build - @echo Building uobjs... - @for i in $(XMHF_SLAB_DIRS); \ - do \ - (cd $(XMHF_OBJDIR) && echo "Making all in $$i..." && $(MAKE) -f $(XMHF_DIR)/xmhf-uobjs/$$i/Makefile -w all) || exit 1; \ - done; - @echo uobjs build SUCCESS - - - - -###### -# uxmhf bootloader -.PHONY: uxmhf-bootloader -uxmhf-bootloader: - @echo Building XMHF boot loader... - cd $(XMHF_OBJDIR) && $(MAKE) -f $(XMHF_BOOTLOADER_SRC)/Makefile -w all - @echo XMHF boot loader build SUCCESS - - - -###### -# uxmhf binary image -.PHONY: uxmhf-binimage -uxmhf-binimage: - @echo Generating uXMHF binary image... - cd $(XMHF_OBJDIR) && $(CP) -f xmhf.lscript xmhf.lscript.c - cd $(XMHF_OBJDIR) && $(CC) $(ASMFLAGS) -P -E xmhf.lscript.c -o xmhf.lds - cd $(XMHF_OBJDIR) && $(LD) --oformat elf32-i386 -T xmhf.lds -o xmhf.exe - cd $(XMHF_OBJDIR) && $(OBJCOPY) --output-format=binary xmhf.exe xmhf.bin - cd $(XMHF_OBJDIR) && $(CAT) ./_objs_xmhf-bootloader/xmhf-bootloader.bin ./xmhf.bin > ./xmhf.tmp.img - cd $(XMHF_OBJDIR) && gzip -c ./xmhf.tmp.img > ./xmhf-$(XMHF_TARGET_TRIAD).bin.gz - cd $(XMHF_OBJDIR) && $(RM) -rf ./xmhf.tmp.img - @echo uXMHF binary image generation SUCCESS - - -###### -# uxmhf verify targets - -.PHONY: uxmhf-verif-gensentinelstubs -uxmhf-verif-gensentinelstubs: _uobjs_configureandgenerateuobjinfo - @echo Proceeding to generate sentinel stubs for blueprint conformance... - $(MKDIR) -p $(XMHF_OBJDIR)/_verif_bp - cd $(XMHF_DIR) && $(USPARK_INSTALL_TOOLSDIR)/ubp $(XMHF_DIR)/xmhf-uobjs/UOBJLIST $(XMHF_OBJDIR)/_verif_bp/ $(XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES) $(XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES) $(XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES) 0 - @echo sentinel stubs generated - - -.PHONY: uxmhf-verifyuobjs-prep -uxmhf-verifyuobjs-prep: _uobjs_configureandgenerateuobjinfo uxmhf-verif-gensentinelstubs - - -.PHONY: uxmhf-verifyuobjs-all -uxmhf-verifyuobjs-all: uxmhf-verifyuobjs-prep - @for i in $(XMHF_SLAB_NAMES); \ - do \ - (cd $(XMHF_DIR)/xmhf-uobjs/$$i && echo "Verifying uobj $$i..." && $(MAKE) -w verify) || exit 1; \ - done; - @echo All uobjs verified! - - -###### -# uxmhf cleanup targets - -.PHONY: clean -clean: - $(RM) -rf $(XMHF_OBJDIR) - -# http://www.gnu.org/software/automake/manual/automake.html#Clean -distclean: clean - $(RM) config.log config.status - $(RM) -rf Makefile - @find $(XMHF_DIR) -name _verif* -type d -exec rm -rf {} + - - -###### -# uxmhf autoconf targets - -Makefile: Makefile.in config.status - ./config.status $@ - -config.status: configure - ./config.status --recheck - -configure: configure.ac - autoconf --output=configure configure.ac - diff --git a/uxmhf/bsconfigure.sh b/uxmhf/bsconfigure.sh deleted file mode 100755 index e1048bef4b..0000000000 --- a/uxmhf/bsconfigure.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# top-level configure boot-strap script -# author: amit vasudevan (amitvasudevan@acm.org) - -autoconf --output=configure configure.ac -autoconf --output=configure-uxmhfuobj configure-uxmhfuobj.ac -exit 0 diff --git a/uxmhf/configure-uxmhfuobj.ac b/uxmhf/configure-uxmhfuobj.ac deleted file mode 100644 index dcd547f522..0000000000 --- a/uxmhf/configure-uxmhfuobj.ac +++ /dev/null @@ -1,113 +0,0 @@ -AC_INIT([uxmhfuobj], [6.1.0]) - -###### simple configuration of tools. (just looks for matching binary on PATH) -AC_CHECK_PROG([MAKE], [make], [make]) -AC_CHECK_PROG([UBERSPARKCONFIG], [ubersparkconfig], [ubersparkconfig]) -AC_CHECK_PROG([FRAMAC], [frama-c], [frama-c]) -AC_CHECK_PROG([CCERT], [ccomp], [ccomp]) -AC_CHECK_PROG([CC], [gcc -m32], [gcc -m32]) -AC_CHECK_PROG([AS], [as], [as]) -AC_CHECK_PROG([AR], [ar], [ar]) -AC_CHECK_PROG([RM], [rm -f], [rm -f]) -AC_CHECK_PROG([CP], [cp], [cp]) -AC_CHECK_PROG([MKDIR], [mkdir], [mkdir]) -AC_CHECK_PROG([LD], [ld], [ld]) -AC_CHECK_PROG([OBJCOPY], [objcopy], [objcopy]) -AC_CHECK_PROG([CAT], [cat], [cat]) - -###### autoconf general options -AC_SUBST([prefix]) - - -# user-defined options - -# slab type -AC_SUBST([SLABTYPE]) -AC_ARG_WITH([slabtype], - AS_HELP_STRING([--with-slabtype=@<:@TYPE@:>@], - [select slab type]), - , [with_slabtype=]) -SLABTYPE=$[]with_slabtype - -# slab sub type -AC_SUBST([SLABSUBTYPE]) -AC_ARG_WITH([slabsubtype], - AS_HELP_STRING([--with-slabsubtype=@<:@SUBTYPE@:>@], - [select slab sub-type]), - , [with_slabsubtype=]) -SLABSUBTYPE=$[]with_slabsubtype - - -# code section memory extents -AC_SUBST([SLABCODESTART]) -AC_ARG_WITH([slabcodestart], - AS_HELP_STRING([--with-slabcodestart=@<:@CODESTART@:>@], - [slab code section start address]), - , [with_slabcodestart=]) -SLABCODESTART=$[]with_slabcodestart - -AC_SUBST([SLABCODEEND]) -AC_ARG_WITH([slabcodeend], - AS_HELP_STRING([--with-slabcodeend=@<:@CODEEND@:>@], - [slab code section end address]), - , [with_slabcodeend=]) -SLABCODEEND=$[]with_slabcodeend - - - -# data section memory extents -AC_SUBST([SLABDATASTART]) -AC_ARG_WITH([slabdatastart], - AS_HELP_STRING([--with-slabdatastart=@<:@DATASTART@:>@], - [slab data section start address]), - , [with_slabdatastart=]) -SLABDATASTART=$[]with_slabdatastart - -AC_SUBST([SLABDATAEND]) -AC_ARG_WITH([slabdataend], - AS_HELP_STRING([--with-slabdataend=@<:@DATAEND@:>@], - [slab data section end address]), - , [with_slabdataend=]) -SLABDATAEND=$[]with_slabdataend - - - -# stack section memory extents -AC_SUBST([SLABSTACKSTART]) -AC_ARG_WITH([slabstackstart], - AS_HELP_STRING([--with-slabstackstart=@<:@STACKSTART@:>@], - [slab stack section start address]), - , [with_slabstackstart=]) -SLABSTACKSTART=$[]with_slabstackstart - -AC_SUBST([SLABSTACKEND]) -AC_ARG_WITH([slabstackend], - AS_HELP_STRING([--with-slabstackend=@<:@STACKEND@:>@], - [slab stack section end address]), - , [with_slabstackend=]) -SLABSTACKEND=$[]with_slabstackend - - - -# dmadata section memory extents -AC_SUBST([SLABDMADATASTART]) -AC_ARG_WITH([slabdmadatastart], - AS_HELP_STRING([--with-slabdmadatastart=@<:@DMADATASTART@:>@], - [slab dmadata section start address]), - , [with_slabdmadatastart=]) -SLABDMADATASTART=$[]with_slabdmadatastart - -AC_SUBST([SLABDMADATAEND]) -AC_ARG_WITH([slabdmadataend], - AS_HELP_STRING([--with-slabdmadataend=@<:@DMADATAEND@:>@], - [slab dmadata section end address]), - , [with_slabdmadataend=]) -SLABDMADATAEND=$[]with_slabdmadataend - - -###### output files - -AC_CONFIG_FILES( - [Makefile:../../uxmhf-uobjcommonharness.mk.in:xmhfgeecslab.mk.in:../../uxmhf-uobjcommontargets.mk.in] - [xmhfgeecslab.lscript:../../uxmhf-uobjlscript.in]) -AC_OUTPUT diff --git a/uxmhf/configure.ac b/uxmhf/configure.ac deleted file mode 100644 index 2cb08445d5..0000000000 --- a/uxmhf/configure.ac +++ /dev/null @@ -1,99 +0,0 @@ -AC_INIT([uxmhf], [6.1.0]) - -###### simple configuration of tools. (just looks for matching binary on PATH) -AC_CHECK_PROG([MAKE], [make], [make]) -AC_CHECK_PROG([UBERSPARKCONFIG], [ubersparkconfig], [ubersparkconfig]) -AC_CHECK_PROG([FRAMAC], [frama-c], [frama-c]) -AC_CHECK_PROG([CCERT], [ccomp], [ccomp]) -AC_CHECK_PROG([CC], [gcc -m32], [gcc -m32]) -AC_CHECK_PROG([AS], [as], [as]) -AC_CHECK_PROG([AR], [ar], [ar]) -AC_CHECK_PROG([RM], [rm -f], [rm -f]) -AC_CHECK_PROG([CP], [cp], [cp]) -AC_CHECK_PROG([MKDIR], [mkdir], [mkdir]) -AC_CHECK_PROG([LD], [ld], [ld]) -AC_CHECK_PROG([OBJCOPY], [objcopy], [objcopy]) -AC_CHECK_PROG([CAT], [cat], [cat]) - -###### autoconf general options -AC_SUBST([prefix]) - -###### uxmhf specific options - -# target cpu -AC_SUBST([TARGET_CPU]) -AC_ARG_WITH([target_cpu], - AS_HELP_STRING([--with-target-cpu=@<:@CPU@:>@], - [select target cpu (x86)]), - , [with_target_cpu=x86]) -TARGET_CPU=$[]with_target_cpu - -# target container -AC_SUBST([TARGET_CONTAINER]) -AC_ARG_WITH([target_container], - AS_HELP_STRING([--with-target-container=@<:@CONTAINER@:>@], - [select target container (vmx)]), - , [with_target_container=vmx]) -TARGET_CONTAINER=$[]with_target_container - -# target platform -AC_SUBST([TARGET_PLATFORM]) -AC_ARG_WITH([target_platform], - AS_HELP_STRING([--with-target-platform=@<:@PLATFORM@:>@], - [select target platform (x86pc)]), - , [with_target_platform=x86pc]) -TARGET_PLATFORM=$[]with_target_platform - - -#debugging -AC_SUBST([DEBUG_SERIAL]) -AC_SUBST([DEBUG_SERIAL_PORT]) -AC_ARG_ENABLE([debug_serial], - AS_HELP_STRING([--enable-debug-serial@<:@=PORT|no@:>@], - [enable serial debugging on specified port]), - , [enable_debug_serial=0x3f8]) -AS_IF([test "x${enable_debug_serial}" != "xno"], - [DEBUG_SERIAL=y - DEBUG_SERIAL_PORT=$[]enable_debug_serial], - [DEBUG_SERIAL=n]) - -#debugging -AC_SUBST([DEBUG_SERIAL_MAXCPUS]) -AC_ARG_WITH([debug_serial_maxcpus], - AS_HELP_STRING([--with-debug-serial-maxcpus@<:@=CPUS@:>@], - [specify number of CPUS on the platform when debug mode is enabled]), - , [with_debug_serial_maxcpus=8]) -DEBUG_SERIAL_MAXCPUS=$[]with_debug_serial_maxcpus - - - -# selectively enable/disable Dynamic Root-of-Trust (DRT) -AC_SUBST([DRT]) -AC_ARG_ENABLE([drt], - AS_HELP_STRING([--enable-drt@<:@=yes|no@:>@], - [enable Dynamic Root-of-Trust (DRT)]), - , [enable_drt=yes]) -AS_IF([test "x${enable_drt}" != "xno"], - [DRT=y], - [DRT=n]) - - -# selectively enable/disable DMA protection (DMAP) -AC_SUBST([DMAP]) -AC_ARG_ENABLE([dmap], - AS_HELP_STRING([--enable-dmap@<:@=yes|no@:>@], - [enable DMA protection]), - , [enable_dmap=yes]) -AS_IF([test "x${enable_dmap}" != "xno"], - [DMAP=y], - [DMAP=n]) - - -###### autoconf output files -AC_CONFIG_FILES( - [uxmhf-common.mk] - [Makefile] - [xmhf-uobjs/UOBJLIST] - ) - -AC_OUTPUT diff --git a/uxmhf/include/xmhf-config.h b/uxmhf/include/xmhf-config.h deleted file mode 100644 index 40dee36cb1..0000000000 --- a/uxmhf/include/xmhf-config.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF platform/arch configuration header -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XMHF_CONFIG_H__ -#define __XMHF_CONFIG_H__ - - -//total unverified hypervisor slabs -#define XMHFGEEC_TOTAL_UHSLABS __XMHFGEEC_TOTAL_UHSLABS__ - -//total unverified guest slabs -#define XMHFGEEC_TOTAL_UGSLABS __XMHFGEEC_TOTAL_UGSLABS__ - - - -//max. include device list entries -//#define XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES __XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES__ - -//max. exclude device list entries -//#define XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES __XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES__ - - -//max. memoffset entries -//#define XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES __XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES__ - - - -//"runtime" parameter block magic value -#define RUNTIME_PARAMETER_BLOCK_MAGIC 0xF00DDEAD - -#define SL_PARAMETER_BLOCK_MAGIC 0xF00DDEAD - -//16K stack for each core during runtime -#define RUNTIME_STACK_SIZE (16384) - -//8K stack for each core in "init" -#define INIT_STACK_SIZE (8192) - -//max. size of command line parameter buffer -#define MAX_CMDLINE_BUFFER_SIZE (128) - -//max. cores/vcpus we support currently -//#ifndef __XMHF_VERIFICATION__ -// #define MAX_PLATFORM_CPUS (256) -//#else -// #define MAX_PLATFORM_CPUS (1) -//#endif - -//max. platform devices we support currently -#define MAX_PLATFORM_DEVICES (64) - -#define MAX_MIDTAB_ENTRIES (MAX_PLATFORM_CPUS) -#define MAX_PCPU_ENTRIES (MAX_PLATFORM_CPUS) -#define MAX_VCPU_ENTRIES (MAX_PLATFORM_CPUS) - -//max. primary partitions we support -#define MAX_PRIMARY_PARTITIONS (1) - -//max. secondary partitions we support -#define MAX_SECONDARY_PARTITIONS (4) - -//max. size of primary partition HPT data buffer -#define MAX_PRIMARY_PARTITION_HPTDATA_SIZE (2054*4096) - -//max. size of primary partition HPT data buffer -#define MAX_SECONDARY_PARTITION_HPTDATA_SIZE (6*4096) - -//max. partition trapmask data buffer -#define MAX_PRIMARY_PARTITION_TRAPMASKDATA_SIZE (4*4096) - -//max. size of CPU arch. specific data (32K default) -#define MAX_PLATFORM_CPUARCHDATA_SIZE (8*4096) - -//max. size of CPU stack (16K default) -#define MAX_PLATFORM_CPUSTACK_SIZE (4*4096) - -//max. number of arch. specific parameters for hypapp callback -#define MAX_XC_HYPAPP_CB_ARCH_PARAMS 8 - -//maximum system memory map entries (e.g., E820) currently supported -#define MAX_E820_ENTRIES (64) - -// SHA-1 hash of runtime should be defined during build process. -// However, if it's not, don't fail. Just proceed with all zeros. -// XXX TODO Disable proceeding with insecure hash value. -#define BAD_INTEGRITY_HASH "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - -#ifndef ___RUNTIME_INTEGRITY_HASH___ -#define ___RUNTIME_INTEGRITY_HASH___ BAD_INTEGRITY_HASH -#endif // ___RUNTIME_INTEGRITY_HASH___ - -//====================================================================== - -//#define XMHF_SLAB_STACKSIZE (16384) - - - - -////// -// TODO: automatically generate the constants below based on build conf. -// for now, manually keep in sync based on the conf. selected -////// - -//#define XMHFGEEC_MAX_SLABS 32 -//#define XMHFGEEC_TOTAL_SLABS 16 - -#define XMHFGEEC_SLAB_GEEC_SENTINEL 0 -#define XMHFGEEC_SLAB_GEEC_PRIME 1 -#define XMHFGEEC_SLAB_XC_INIT 2 -#define XMHFGEEC_SLAB_XC_EXHUB 3 -#define XMHFGEEC_SLAB_XC_IHUB 4 -#define XMHFGEEC_SLAB_XC_NWLOG 5 -#define XMHFGEEC_SLAB_UAPI_GCPUSTATE 6 -#define XMHFGEEC_SLAB_UAPI_HCPUSTATE 7 -#define XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL 8 -#define XMHFGEEC_SLAB_UAPI_SYSDATA 9 -#define UOBJ_UAPI_IOTBL 10 -#define UOBJ_UAPI_UHMPGTBL 11 -#define XMHFGEEC_SLAB_XH_SYSCALLLOG 12 -//#define XMHFGEEC_SLAB_XH_UHCALLTEST 13 -#define XMHFGEEC_SLAB_XH_HYPERDEP 13 -#define XMHFGEEC_SLAB_XH_SSTEPTRACE 14 -#define XMHFGEEC_SLAB_XG_RICHGUEST 15 - - - - -#define XMHFGEEC_VHSLAB_BASE_IDX 0 -#define XMHFGEEC_VHSLAB_MAX_IDX 13 -#define XMHFGEEC_UHSLAB_BASE_IDX 14 -#define XMHFGEEC_UHSLAB_MAX_IDX 14 -#define XMHFGEEC_UGSLAB_BASE_IDX 15 -#define XMHFGEEC_UGSLAB_MAX_IDX 15 - - -#define XMHFGEEC_TOTAL_VHSLABS ((XMHFGEEC_VHSLAB_MAX_IDX - XMHFGEEC_VHSLAB_BASE_IDX) + 1) -#define __XMHFGEEC_TOTAL_UHSLABS ((XMHFGEEC_UHSLAB_MAX_IDX - XMHFGEEC_UHSLAB_BASE_IDX) + 1) -#define __XMHFGEEC_TOTAL_UGSLABS ((XMHFGEEC_UGSLAB_MAX_IDX - XMHFGEEC_UGSLAB_BASE_IDX) + 1) - - -#if (XMHFGEEC_TOTAL_UHSLABS != __XMHFGEEC_TOTAL_UHSLABS) - #error FATAL: Mistmatch in XMHFGEEC_TOTAL_UHSLABS (common.mk.in) and __XMHFGEEC_TOTAL_UHSLABS (xmhf-config.h) -#endif - -#if (XMHFGEEC_TOTAL_UGSLABS != __XMHFGEEC_TOTAL_UGSLABS) - #error FATAL: Mistmatch in XMHFGEEC_TOTAL_UGSLABS (common.mk.in) and __XMHFGEEC_TOTAL_UGSLABS (xmhf-config.h) -#endif - -////// - - - - -//====================================================================== -//XMHF platform/arch. specific configurable constant definitions - -//---------------------------------------------------------------------- -// XMHF platform memory map - //physical memory extents of the XMHF framework - #define __TARGET_BASE_XMHF __XMHF_CONFIG_LOADADDR__ - #define __TARGET_SIZE_XMHF __XMHF_CONFIG_LOADMAXSIZE__ - #define __TARGET_MAX_XMHF __XMHF_CONFIG_LOADMAXADDR__ - #define __TARGET_MAX_SYS __XMHF_CONFIG_MAXSYSADDR__ - - - //physical address where the XMHF boot-loader is loaded (e.g., via GRUB) - #define __TARGET_BASE_BOOTLOADER 0x01E00000 //30MB - - //size of the boot-loader should put the bootloader base + size to - //match __TARGET_BASE_XMHF - #define __TARGET_SIZE_BOOTLOADER (__TARGET_BASE_XMHF - __TARGET_BASE_BOOTLOADER) - - //physical address of geec_prime slab (acts as secure loader) - #define __TARGET_BASE_SL (__TARGET_BASE_XMHF + 0x01200000) - - #define __TARGET_SIZE_SL 0x00200000 - -//---------------------------------------------------------------------- - -//"sl" parameter block magic value -//#define SL_PARAMETER_BLOCK_MAGIC 0xDEADBEEF - -//size of core DMA protection buffer (if platform DMA protections need to be re-initialized within the core) -#define SIZE_CORE_DMAPROT_BUFFER (128*1024) - -//preferred TPM locality to use for access inside hypervisor -//needs to be 2 or 1 (4 is hw-only, 3 is sinit-only on Intel) -#define EMHF_TPM_LOCALITY_PREF 2 - -//where the guest OS boot record is loaded -#define __GUESTOSBOOTMODULE_BASE 0x7c00 -#define __GUESTOSBOOTMODULESUP1_BASE 0x7C00 - -//---------------------------------------------------------------------- - -//code segment of memory address where APs startup initially -//address 0x1000:0x0000 or 0x10000 physical -#define X86SMP_APBOOTSTRAP_CODESEG 0x1000 - -//data segment of memory address where APs startup initially -//address 0x1100:0x0000 or 0x11000 physical -#define X86SMP_APBOOTSTRAP_DATASEG 0x1100 - -#define X86SMP_APBOOTSTRAP_MAXGDTENTRIES 4 - -#define X86SMP_LAPIC_MEMORYADDRESS 0xFEE00000 -#define X86SMP_LAPIC_ID_MEMORYADDRESS 0xFEE00020 - -#define TPM_LOCALITY_BASE 0xfed40000 - -//---------------------------------------------------------------------- - -//TXT SENTER MLE specific constants -#define TEMPORARY_HARDCODED_MLE_SIZE 0x10000 -#define TEMPORARY_MAX_MLE_HEADER_SIZE 0x80 -#define TEMPORARY_HARDCODED_MLE_ENTRYPOINT TEMPORARY_MAX_MLE_HEADER_SIZE - -//VMX Unrestricted Guest (UG) E820 hook support -//we currently use the BIOS data area (BDA) unused region -//at 0x0040:0x00AC -#define VMX_UG_E820HOOK_CS (0x0040) -#define VMX_UG_E820HOOK_IP (0x00AC) - - -#define MAX_X86_APIC_ID 256 - - -#define MAX_SLAB_DMADATA_SIZE (32*1024*1024) -#define MAX_SLAB_DMADATA_PDT_ENTRIES (MAX_SLAB_DMADATA_SIZE/(2*1024*1024)) - - -// segment selectors -#define __NULLSEL 0x0000 //NULL selector -#define __CS_CPL0 0x0008 //CPL-0 code segment selector -#define __DS_CPL0 0x0010 //CPL-0 data segment selector -#define __CS_CPL3 0x001b //CPL-3 code segment selector -#define __DS_CPL3 0x0023 //CPL-3 data segment selector -#define __CS_CPL3_SE 0x002b //CPL-3 code segment selector -#define __DS_CPL3_SE 0x0033 //CPL-3 data segment selector -#define __TRSEL 0x0038 //TSS (task) selector - -// max. segment descriptors not including TSS descriptors -#define XMHFGEEC_MAX_GDT_CODEDATA_DESCRIPTORS 7 - -#define EMHF_XCPHANDLER_MAXEXCEPTIONS 32 - - - -#ifndef __ASSEMBLY__ - -/*#if defined (__DEBUG_SERIAL__) - -extern uint8_t _libxmhfdebugdata_start[]; -extern uint8_t _libxmhfdebugdata_end[]; - -#define ADDR_LIBXMHFDEBUGDATA_START ((uint32_t)_libxmhfdebugdata_start) -#define ADDR_LIBXMHFDEBUGDATA_END ((uint32_t)_libxmhfdebugdata_end) - -#endif // defined -*/ - -#endif // __ASSEMBLY__ - - -#endif //__XMHF_CONFIG_H__ diff --git a/uxmhf/include/xmhf-error.h b/uxmhf/include/xmhf-error.h deleted file mode 100644 index 5b5e5afa03..0000000000 --- a/uxmhf/include/xmhf-error.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -//error.h - error handling -//author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XMHF_ERROR_H_ -#define __XMHF_ERROR_H_ - - -#ifndef __ASSEMBLY__ - -#if defined (__XMHF_VERIFICATION__) - #define HALT() - #define HALT_ON_ERRORCOND(_p) - -#else - #define HALT() { while(1); } - #define HALT_ON_ERRORCOND(_p) { if ( !(_p) ) { _XDPRINTF_("\nFatal: Halting! Condition '%s' failed, line %d, file %s\n\n", #_p , __LINE__, __FILE__); HALT(); } } -#endif // defined - - - -/* awesome trick from http://www.jaggersoft.com/pubs/CVu11_3.html */ -#define COMPILE_TIME_ASSERT(pred) \ - switch(0){case 0:case pred:;} - -/* Overflow functions from tboot-20101005/tboot/include/misc.h */ - -/* - * These three "plus overflow" functions take a "x" value - * and add the "y" value to it and if the two values are - * greater than the size of the variable type, they will - * overflow the type and end up with a smaller value and - * return TRUE - that they did overflow. i.e. - * x + y <= variable type maximum. - */ -static inline bool plus_overflow_u64(uint64_t x, uint64_t y) -{ - return ((((uint64_t)(~0)) - x) < y); -} - -static inline bool plus_overflow_u32(uint32_t x, uint32_t y) -{ - return ((((uint32_t)(~0)) - x) < y); -} - -/* - * This checks to see if two numbers multiplied together are larger - * than the type that they are. Returns TRUE if OVERFLOWING. - * If the first parameter "x" is greater than zero and - * if that is true, that the largest possible value 0xFFFFFFFF / "x" - * is less than the second parameter "y". If "y" is zero then - * it will also fail because no unsigned number is less than zero. - */ -static inline bool multiply_overflow_u32(uint32_t x, uint32_t y) -{ - return (x > 0) ? ((((uint32_t)(~0))/x) < y) : false; -} - -#endif /*__ASSEMBLY__*/ - -#endif /* _XMHF_ERROR_H */ diff --git a/uxmhf/include/xmhf-types.h b/uxmhf/include/xmhf-types.h deleted file mode 100644 index b2896be9af..0000000000 --- a/uxmhf/include/xmhf-types.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -//types.h - base types -#ifndef __XMHF_TYPES_H_ -#define __XMHF_TYPES_H_ - - -#ifndef __ASSEMBLY__ - -//define a pseudo attribute definition that allows us to annotate -//core API/hypapp callbacks function parameters -//core-ro = parameter in core and is read-only within hypapp -//hypapp-ro = parameter in hypapp area is read-only in core -//core-rw = parameter in core and is read-write within core -//hypapp-rw = parameter in hypapp area and is rad-write in hypapp -#define __xmhfattribute__(x) - - -typedef uint32_t paddr_t; //physical address -typedef void* hva_t; //hypervisor virtual address -typedef uint64_t spa_t; //system physical address -typedef uint32_t gva_t; //guest virtual address. we only support 32-bit guests -typedef uint64_t gpa_t; //guest physical address. can be 64-bit with PAE -typedef void* dma_addr_t; - -//"golden" digest values injected during build process -//NOTE: NO WAY TO SELF-CHECK slbelow64K; JUST A SANITY-CHECK -typedef struct _integrity_measurement_values { - uint8_t sha_slbelow64K[20]; // TODO: play nice with SHA_DIGEST_LENGTH in sha1.h - uint8_t sha_slabove64K[20]; - uint8_t sha_runtime[20]; -} INTEGRITY_MEASUREMENT_VALUES; - -//XXX: this is currently close to GRUB, but is essentially a generic memory map structure -typedef struct _grube820 { - uint32_t baseaddr_low; - uint32_t baseaddr_high; - uint32_t length_low; - uint32_t length_high; - uint32_t type; -} __attribute__((packed)) GRUBE820; - -#define SIZE_STRUCT_GRUBE820 (sizeof(struct _grube820)) - -//XXX: this is currently close to x86 platforms, but is essentially a generic physical CPU structure -typedef struct _pcpu { - uint32_t lapic_id; - uint32_t lapic_ver; - uint32_t lapic_base; - uint32_t isbsp; -} __attribute__((packed)) PCPU; - -#define SIZE_STRUCT_PCPU (sizeof(struct _pcpu)) - -//---------------------------------------------------------------------- -//the master-id table, which is used by the AP bootstrap code -//to locate its own vcpu structure -typedef struct _midtab { - uint32_t cpu_lapic_id; //CPU LAPIC id (unique) - uint32_t vcpu_vaddr_ptr; //virt. addr. pointer to vcpu struct for this CPU -} __attribute__((packed)) MIDTAB; - -#define SIZE_STRUCT_MIDTAB (sizeof(struct _midtab)) - -//XMHF_BOOTINFO -typedef struct { - uint32_t magic; - uint32_t richguest_bootmodule_base; - uint32_t richguest_bootmodule_size; - uint32_t memmapinfo_numentries; - GRUBE820 memmapinfo_buffer[MAX_E820_ENTRIES]; - uint32_t cpuinfo_numentries; - PCPU cpuinfo_buffer[MAX_PCPU_ENTRIES]; - uint8_t debugcontrol_buffer[16]; - uint8_t cmdline_buffer[MAX_CMDLINE_BUFFER_SIZE]; - uint8_t filler[2652]; -} __attribute__((packed)) XMHF_BOOTINFO; - -__attribute__(( section(".sharedro_xcbootinfoptr") )) extern XMHF_BOOTINFO *xcbootinfo; - -typedef struct { - uint32_t cpuid; //unique CPU id - uint32_t cpu_index; //0 based index -} __attribute__((packed)) xmhf_cputable_t; - - -//------------------------------------------------------- - -//XMHF core api CPU descriptor type -typedef struct { - bool isbsp; - uint32_t cpu_index; -} cpu_desc_t; - -//XMHF core api partition descriptor type -typedef struct { - uint32_t partition_index; - uint32_t numcpus; -} partition_desc_t; - -//XMHF core api context descriptor type (context = partition + cpu pair) -typedef struct { - partition_desc_t partition_desc; - cpu_desc_t cpu_desc; -} context_desc_t; - - -#if !defined (__DRT__) -typedef void(*FCALL)(void); -#endif - - -#endif /*ifndef __ASSEMBLY__*/ - -#endif /* __XMHF_TYPES_H_ */ diff --git a/uxmhf/include/xmhf.h b/uxmhf/include/xmhf.h deleted file mode 100644 index b6a95c36aa..0000000000 --- a/uxmhf/include/xmhf.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// xmhf.h - main XMHF header file -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XMHF_H_ -#define __XMHF_H_ - -#include -#include - - -#include //XMHF platform/arch config, TODO: this needs to be platform/arch independent push arch dependent stuff into arch/ -#include //XMHF specific base types -#include //error handling -#include //core framework decls. - -#endif /* __XMHF_H_ */ diff --git a/uxmhf/uxmhf-common.mk.in b/uxmhf/uxmhf-common.mk.in deleted file mode 100644 index 22f59d8345..0000000000 --- a/uxmhf/uxmhf-common.mk.in +++ /dev/null @@ -1,279 +0,0 @@ -# common Makefile boilerplate for XMHF -# author: amit vasudevan (amitvasudevan@acm.org) - -mydir := $(dir $(lastword $(MAKEFILE_LIST))) -mydir := $(realpath $(mydir)) - - - - -###### -# autoconf controlled variables -###### - -export MAKE = @MAKE@ -export UBERSPARKCONFIG = @UBERSPARKCONFIG@ -export FRAMAC = @FRAMAC@ -export CCERT = @CCERT@ -export CC = @CC@ -export AS = @AS@ -export AR = @AR@ -export RM = @RM@ -export CP = @CP@ -export MKDIR = @MKDIR@ -export LD = @LD@ -export OBJCOPY = @OBJCOPY@ -export CAT = @CAT@ -#export CCLIB = @CCLIB@ -#export CCLIB := $(realpath $(CCLIB)) - -export prefix=@prefix@ - -export DEBUG_SERIAL := @DEBUG_SERIAL@ -export DEBUG_SERIAL_PORT := @DEBUG_SERIAL_PORT@ -export XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS := @DEBUG_SERIAL_MAXCPUS@ - -#export DEBUG_VGA := @DEBUG_VGA@ -export DRT := @DRT@ -export DMAP := @DMAP@ -export XMHF_TARGET_CPU := @TARGET_CPU@ -export XMHF_TARGET_CONTAINER := @TARGET_CONTAINER@ -export XMHF_TARGET_PLATFORM := @TARGET_PLATFORM@ - - - -###### -# pull-in base uberspark common makefile -###### - -UBERSPARK_HOMEDIR := $(shell $(UBERSPARKCONFIG) --print-uberspark-homedir) -include $(UBERSPARK_HOMEDIR)/uberspark-common.mk - - - - -###### -# uxmhf common variables -###### - -export XMHF_TARGET_TRIAD := $(XMHF_TARGET_CPU)-$(XMHF_TARGET_CONTAINER)-$(XMHF_TARGET_PLATFORM) -CCERT_REALPATH := $(realpath $(shell which $(CCERT))) -CCERT_BINDIR := $(dir $(CCERT_REALPATH)) -CCERT_BINDIR_NOSLASH := $(CCERT_BINDIR:/=) -export CCERT_LIB := $(dir $(CCERT_BINDIR_NOSLASH))lib/compcert/ - -###### -# configuration definitions -###### - -export XMHFGEEC_TOTAL_UHSLABS := 1 -export XMHFGEEC_TOTAL_UGSLABS := 1 - -## load base, at 36M -export XMHF_CONFIG_LOADADDR := 0x06200000 -## load max size -export XMHF_CONFIG_LOADMAXSIZE := 0x1D200000 -## load max addr -export XMHF_CONFIG_LOADMAXADDR := 0x23400000 -## system max addr, 4GB -export XMHF_CONFIG_MAXSYSADDR := 0xFFFFFFFF - -export XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES := 6 -export XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES := 6 - -export XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES := 64 - - -## build version -#export XMHF_BUILD_VERSION := $(shell git describe --abbrev=0) -export XMHF_BUILD_VERSION := 6.1.0 - -## build revision -#export XMHF_BUILD_REVISION_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) -#export XMHF_BUILD_REVISION_COMMIT := $(shell git log --pretty=format:'%H' -n 1) -#export XMHF_BUILD_REVISION := $(XMHF_BUILD_REVISION_BRANCH)-$(XMHF_BUILD_REVISION_COMMIT) -export XMHF_BUILD_REVISION := you-gotta-have-faith-not-in-who-you-are-but-who-you-can-be - - - - - - -###### -# common paths -###### - -## directory where this Makefile resides (source root) -export XMHF_DIR := $(mydir) - -## objects directory (used for building binaries without polluting source namespace) -export XMHF_OBJDIR = $(XMHF_DIR)/_objects - -## XMHF libs dirs and object locations -export XMHF_LIBDIRS := $(wildcard $(XMHF_DIR)/libs/lib*) -export XMHF_LIBS_OBJECTS_DIR := $(XMHF_OBJDIR)/_objs_libs - -# construct XMHF additional include paths for verification and build -XMHF_ADDL_INCLUDES := -XMHF_V_ADDL_INCLUDES := -XMHF_ADDL_INCLUDES += -I$(XMHF_DIR)/include -XMHF_V_ADDL_INCLUDES += -cpp-extra-args=-I$(XMHF_DIR)/include -XMHF_ADDL_INCLUDES += -I$(XMHF_DIR)/xmhf-uobjs/include -XMHF_V_ADDL_INCLUDES += -cpp-extra-args=-I$(XMHF_DIR)/xmhf-uobjs/include -XMHF_LIBSINC = $(foreach dir,$(XMHF_LIBDIRS),-I$(dir)/include) -XMHF_V_LIBSINC = $(foreach dir,$(XMHF_LIBDIRS),-cpp-extra-args=-I$(dir)/include) -XMHF_ADDL_INCLUDES += $(XMHF_LIBSINC) -XMHF_V_ADDL_INCLUDES += $(XMHF_V_LIBSINC) - -# construct module list that comprise the hardware model -UBERSPARK_HWMDIR := $(shell $(UBERSPARKCONFIG) --print-uberspark-hwmdir) -export V_XMHFHWM_MODULES := $(realpath $(wildcard $(UBERSPARK_HWMDIR)/*.c)) - -# construct module list that comprise libubersparkhw -UBERSPARK_LIBSDIR := $(shell $(UBERSPARKCONFIG) --print-uberspark-libsdir) -V_LIBXMHFHW_MODULES_DIR := $(realpath $(UBERSPARK_LIBSDIR)/libubersparkhw) -V_LIBXMHFHW_MODULES_ABS := $(wildcard $(V_LIBXMHFHW_MODULES_DIR)/*.c) -V_LIBXMHFHW_MODULES_ABS += $(wildcard $(V_LIBXMHFHW_MODULES_DIR)/*.cS) -V_LIBXMHFHW_MODULES := $(patsubst $(V_LIBXMHFHW_MODULES_DIR)/%, %, $(V_LIBXMHFHW_MODULES_ABS)) -export V_LIBXMHFHW_MODULES_DIR; -export V_LIBXMHFHW_MODULES; - -# construct directory for libxmhfgeec -V_LIBXMHFGEEC_MODULES_DIR := $(realpath $(UBERSPARK_LIBSDIR)/libxmhfgeec) -export V_LIBXMHFGEEC_MODULES_DIR; - - - - - - - - - - - - - - - - - - - -###### -# compiler/assembler flags -###### - -## three flags, CCERT_FLAGS, V_FLAGS and ASMFLAGS are brought in by uberspark -## current XMHF build process expects verification flags in VFLAGS - -ASMFLAGS += $(XMHF_ADDL_INCLUDES) -CCERT_FLAGS += $(XMHF_ADDL_INCLUDES) -V_FLAGS += $(XMHF_V_ADDL_INCLUDES) - -ASMFLAGS += -D___XMHF_BUILD_VERSION___=\"$(XMHF_BUILD_VERSION)\" -CCERT_FLAGS += -D___XMHF_BUILD_VERSION___=\"$(XMHF_BUILD_VERSION)\" -V_FLAGS += -cpp-extra-args=-D___XMHF_BUILD_VERSION___=\"$(XMHF_BUILD_VERSION)\" - -ASMFLAGS += -D___XMHF_BUILD_REVISION___=\"$(XMHF_BUILD_REVISION)\" -CCERT_FLAGS += -D___XMHF_BUILD_REVISION___=\"$(XMHF_BUILD_REVISION)\" -V_FLAGS += -cpp-extra-args=-D___XMHF_BUILD_REVISION___=\"$(XMHF_BUILD_REVISION)\" - -# target cpu -ifeq ($(XMHF_TARGET_CPU), x86) - ASMFLAGS += -D__XMHF_TARGET_CPU_X86__ - CCERT_FLAGS += -D__XMHF_TARGET_CPU_X86__ - V_FLAGS += -cpp-extra-args=-D__XMHF_TARGET_CPU_X86__ -endif - -# target container -ifeq ($(XMHF_TARGET_CONTAINER), vmx) - ASMFLAGS += -D__XMHF_TARGET_CONTAINER_VMX__ - CCERT_FLAGS += -D__XMHF_TARGET_CONTAINER_VMX__ - V_FLAGS += -cpp-extra-args=-D__XMHF_TARGET_CONTAINER_VMX__ -endif - -# target platform -ifeq ($(XMHF_TARGET_PLATFORM), x86pc) - ASMFLAGS += -D__XMHF_TARGET_PLATFORM_X86PC__ - CCERT_FLAGS += -D__XMHF_TARGET_PLATFORM_X86PC__ - V_FLAGS += -cpp-extra-args=-D__XMHF_TARGET_PLATFORM_X86PC__ -endif - -# target triad -ifeq ($(XMHF_TARGET_TRIAD), x86-vmx-x86pc) - ASMFLAGS += -D__XMHF_TARGET_TRIAD_X86_VMX_X86PC__ - CCERT_FLAGS += -D__XMHF_TARGET_TRIAD_X86_VMX_X86PC__ - V_FLAGS += -cpp-extra-args=-D__XMHF_TARGET_TRIAD_X86_VMX_X86PC__ -endif - -# other options -ifeq ($(DEBUG_SERIAL), y) - ASMFLAGS += -D__DEBUG_SERIAL__ - CCERT_FLAGS += -D__DEBUG_SERIAL__ - V_FLAGS += -cpp-extra-args=-D__DEBUG_SERIAL__ - - ASMFLAGS += -D__DEBUG_SERIAL__ - CCERT_FLAGS += -DDEBUG_PORT=$(DEBUG_SERIAL_PORT) - V_FLAGS += -cpp-extra-args=-DDEBUG_PORT=$(DEBUG_SERIAL_PORT) - - ASMFLAGS += -D__DEBUG_SERIAL__ - CCERT_FLAGS += -D__XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS__=$(XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS) - V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS__=$(XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS) -endif -ifeq ($(DRT), y) - ASMFLAGS += -D__DRT__ - CCERT_FLAGS += -D__DRT__ - V_FLAGS += -cpp-extra-args=-D__DRT__ -endif -ifeq ($(DMAP), y) - ASMFLAGS += -D__DMAP__ - CCERT_FLAGS += -D__DMAP__ - V_FLAGS += -cpp-extra-args=-D__DMAP__ -endif - - -# configuration definitions -ASMFLAGS += -D__XMHFGEEC_TOTAL_UHSLABS__=$(XMHFGEEC_TOTAL_UHSLABS) -CCERT_FLAGS += -D__XMHFGEEC_TOTAL_UHSLABS__=$(XMHFGEEC_TOTAL_UHSLABS) -V_FLAGS += -cpp-extra-args=-D__XMHFGEEC_TOTAL_UHSLABS__=$(XMHFGEEC_TOTAL_UHSLABS) - -ASMFLAGS += -D__XMHFGEEC_TOTAL_UGSLABS__=$(XMHFGEEC_TOTAL_UGSLABS) -CCERT_FLAGS += -D__XMHFGEEC_TOTAL_UGSLABS__=$(XMHFGEEC_TOTAL_UGSLABS) -V_FLAGS += -cpp-extra-args=-D__XMHFGEEC_TOTAL_UGSLABS__=$(XMHFGEEC_TOTAL_UGSLABS) - -ASMFLAGS += -D__XMHF_CONFIG_LOADADDR__=$(XMHF_CONFIG_LOADADDR) -CCERT_FLAGS += -D__XMHF_CONFIG_LOADADDR__=$(XMHF_CONFIG_LOADADDR) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_LOADADDR__=$(XMHF_CONFIG_LOADADDR) - -ASMFLAGS += -D__XMHF_CONFIG_LOADMAXSIZE__=$(XMHF_CONFIG_LOADMAXSIZE) -CCERT_FLAGS += -D__XMHF_CONFIG_LOADMAXSIZE__=$(XMHF_CONFIG_LOADMAXSIZE) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_LOADMAXSIZE__=$(XMHF_CONFIG_LOADMAXSIZE) - -ASMFLAGS += -D__XMHF_CONFIG_LOADMAXADDR__=$(XMHF_CONFIG_LOADMAXADDR) -CCERT_FLAGS += -D__XMHF_CONFIG_LOADMAXADDR__=$(XMHF_CONFIG_LOADMAXADDR) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_LOADMAXADDR__=$(XMHF_CONFIG_LOADMAXADDR) - -ASMFLAGS += -D__XMHF_CONFIG_MAXSYSADDR__=$(XMHF_CONFIG_MAXSYSADDR) -CCERT_FLAGS += -D__XMHF_CONFIG_MAXSYSADDR__=$(XMHF_CONFIG_MAXSYSADDR) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_MAXSYSADDR__=$(XMHF_CONFIG_MAXSYSADDR) - -ASMFLAGS += -D__XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES__=$(XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES) -CCERT_FLAGS += -D__XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES__=$(XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES__=$(XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES) - -ASMFLAGS += -D__XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES__=$(XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES) -CCERT_FLAGS += -D__XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES__=$(XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES__=$(XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES) - -ASMFLAGS += -D__XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES__=$(XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES) -CCERT_FLAGS += -D__XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES__=$(XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES) -V_FLAGS += -cpp-extra-args=-D__XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES__=$(XMHF_CONFIG_MAX_MEMOFFSET_ENTRIES) - - -export VFLAGS := $(V_FLAGS) - - - - - diff --git a/uxmhf/uxmhf-uobjcommonharness.mk.in b/uxmhf/uxmhf-uobjcommonharness.mk.in deleted file mode 100644 index ba52b3236b..0000000000 --- a/uxmhf/uxmhf-uobjcommonharness.mk.in +++ /dev/null @@ -1,83 +0,0 @@ -# common makefile for slabs -# author: amit vasudevan (amitvasudevan@acm.org) -export srcdir := $(dir $(lastword $(MAKEFILE_LIST))) - -vpath %.c $(srcdir) -vpath %.S $(srcdir) -vpath %.cS $(srcdir) -vpath %.lscript $(srcdir) - -include $(srcdir)/../../uxmhf-common.mk - -export XMHF_SLAB_FULLLINK := y -export XMHF_SLAB_TYPE := @SLABTYPE@ -export XMHF_SLAB_SUBTYPE := @SLABSUBTYPE@ -export XMHF_SLAB_MAIN := slab_main - -# populate slab stub type based on the slab type -ifeq ($(XMHF_SLAB_TYPE), VfT_SLAB) - - ifeq ($(XMHF_SLAB_SUBTYPE), SENTINEL) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o - else ifeq ($(XMHF_SLAB_SUBTYPE), PRIME) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else ifeq ($(XMHF_SLAB_SUBTYPE), UAPI) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else ifeq ($(XMHF_SLAB_SUBTYPE), INIT) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else ifeq ($(XMHF_SLAB_SUBTYPE), EXCEPTION) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else ifeq ($(XMHF_SLAB_SUBTYPE), INTERCEPT) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else ifeq ($(XMHF_SLAB_SUBTYPE), XCORE) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else ifeq ($(XMHF_SLAB_SUBTYPE), XHYPAPP) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - #else ifeq ($(XMHF_SLAB_SUBTYPE), XGUEST) - # XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_vft.o - else - #unsupported slab sub-type - XMHF_SLAB_STUBOBJECTS := - endif - - -else ifeq ($(XMHF_SLAB_TYPE), uVT_SLAB) - - - ifeq ($(XMHF_SLAB_SUBTYPE), INIT) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_uvt.o - else ifeq ($(XMHF_SLAB_SUBTYPE), XCORE) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_uvt.o - else ifeq ($(XMHF_SLAB_SUBTYPE), XHYPAPP) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_uvt.o - #else ifeq ($(XMHF_SLAB_SUBTYPE), XGUEST) - # XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_uvtg.o - else - #unsupported slab sub-type - XMHF_SLAB_STUBOBJECTS := - endif - - -else ifeq ($(XMHF_SLAB_TYPE), uVU_SLAB) - - - ifeq ($(XMHF_SLAB_SUBTYPE), XHYPAPP) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_uvu.o - else ifeq ($(XMHF_SLAB_SUBTYPE), XGUEST) - XMHF_SLAB_STUBOBJECTS := $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabmapdef.o $(XMHF_OBJDIR)/uobjinfotable.o $(USPARK_INSTALL_LIBSDIR)/xmhfgeec_slabstubs_uvug.o - else ifeq ($(XMHF_SLAB_SUBTYPE), XRICHGUEST) - XMHF_SLAB_STUBOBJECTS := - else - #unsupported slab sub-type - XMHF_SLAB_STUBOBJECTS := - endif - - -else - - #unsupported slab type - XMHF_SLAB_STUBOBJECTS := - -endif - - diff --git a/uxmhf/uxmhf-uobjcommontargets.mk.in b/uxmhf/uxmhf-uobjcommontargets.mk.in deleted file mode 100644 index 594746db28..0000000000 --- a/uxmhf/uxmhf-uobjcommontargets.mk.in +++ /dev/null @@ -1,119 +0,0 @@ -# common makefile for slabs -# author: amit vasudevan (amitvasudevan@acm.org) - -XMHF_SLAB_SOURCES_SUBST := $(patsubst $(srcdir)/%, %, $(XMHF_SLAB_SOURCES)) - -# grab list of file names only for binary generation -XMHF_SLAB_SOURCES_FILENAMEONLY := $(notdir $(XMHF_SLAB_SOURCES_SUBST)) - -XMHF_SLAB_OBJECTS_ARCHIVE := $(patsubst %.c, %.o, $(XMHF_SLAB_SOURCES_FILENAMEONLY)) -XMHF_SLAB_OBJECTS_ARCHIVE := $(patsubst %.cS, %.o, $(XMHF_SLAB_OBJECTS_ARCHIVE)) -XMHF_SLAB_OBJECTS_ARCHIVE := $(patsubst %.S, %.o, $(XMHF_SLAB_OBJECTS_ARCHIVE)) - -XMHF_SLAB_VERIFICATION_SOURCES := $(patsubst %.c, %.c.v.c, $(XMHF_SLAB_SOURCES_FILENAMEONLY)) -XMHF_SLAB_VERIFICATION_SOURCES := $(patsubst %.cS, %.cS.v.c, $(XMHF_SLAB_VERIFICATION_SOURCES)) - - -# list of object dependencies -XMHF_SLAB_OBJECTS := $(patsubst %.c, %.o, $(XMHF_SLAB_SOURCES_SUBST)) -XMHF_SLAB_OBJECTS := $(patsubst %.cS, %.o, $(XMHF_SLAB_OBJECTS)) -XMHF_SLAB_OBJECTS := $(patsubst %.S, %.o, $(XMHF_SLAB_OBJECTS)) - -# folder where objects go -XMHF_SLAB_OBJECTS_DIR := _objs_slab_$(XMHF_SLAB_NAME) -XMHF_SLAB_VERIFICATION_DIR := _verif_$(XMHF_SLAB_NAME) - -LINKER_SCRIPT_INPUT := $(XMHF_DIR)/xmhf-uobjs/$(XMHF_SLAB_NAME)/xmhfgeecslab.lscript -LINKER_SCRIPT_OUTPUT := $(XMHF_SLAB_NAME).lds - -#ifeq ($(XMHF_SLAB_FULLLINK), y) -export LDFLAGS := --oformat elf32-i386 -#else - -#endif - -# targets -ifeq ($(XMHF_SLAB_SUBTYPE), XRICHGUEST) - -.PHONY: all -all: - @echo Nothing to compile for rich guest object - -else - -.PHONY: all -all: buildslabbin - -endif - - -#uspark -.PHONY: verifybase -verifybase: - @echo Prepping sources... - $(MKDIR) -p $(XMHF_SLAB_VERIFICATION_DIR) - @for i in $(XMHF_SLAB_SOURCES_SUBST); \ - do \ - ($(CP) -f $$i $(XMHF_SLAB_VERIFICATION_DIR)/$$i.v.c) || exit 1; \ - done; - $(CP) -f $(XMHF_OBJDIR)/_verif_bp/$(XMHF_SLAB_NAME)_sstub.ag.v.c $(XMHF_SLAB_VERIFICATION_DIR)/. - $(CP) -f $(V_LIBXMHFGEEC_MODULES_DIR)/xmhfgeec_slabmapdef.c $(XMHF_SLAB_VERIFICATION_DIR)/. - $(CP) -f $(XMHF_OBJDIR)/uobjinfotable.c $(XMHF_SLAB_VERIFICATION_DIR)/xmhfgeec_slabinfotable.c - $(MKDIR) -p $(XMHF_SLAB_VERIFICATION_DIR)/libxmhfhw - @for i in $(V_LIBXMHFHW_MODULES); \ - do \ - ($(CP) -f $(V_LIBXMHFHW_MODULES_DIR)/$$i $(XMHF_SLAB_VERIFICATION_DIR)/libxmhfhw/$$i.v.c) || exit 1; \ - done; - @echo Sources prepped. - - -ifeq ($(XMHF_SLAB_SUBTYPE), XRICHGUEST) - -.PHONY: linkslabbin -linkslabbin: - @echo Nothing to link for rich guest object - -else - -.PHONY: linkslabbin -linkslabbin: - cd $(XMHF_SLAB_OBJECTS_DIR) && $(CP) -f $(LINKER_SCRIPT_INPUT) $(XMHF_SLAB_NAME).lscript.c - cd $(XMHF_SLAB_OBJECTS_DIR) && $(CC) -E -P $(ASMFLAGS) $(XMHF_SLAB_NAME).lscript.c -o $(LINKER_SCRIPT_OUTPUT) - cd $(XMHF_SLAB_OBJECTS_DIR) && $(LD) $(LDFLAGS) -T $(LINKER_SCRIPT_OUTPUT) -o $(XMHF_SLAB_NAME).slo $(XMHF_SLAB_OBJECTS_ARCHIVE) $(XMHF_SLAB_STUBOBJECTS) -L$(CCERT_LIB) -L$(XMHF_LIBS_OBJECTS_DIR) -L$(USPARK_INSTALL_LIBSDIR) -lubersparkc -lubersparkcrypto -lxmhfdebug -lubersparkhw -lubersparkc -lcompcert - cd $(XMHF_SLAB_OBJECTS_DIR) && nm $(XMHF_SLAB_NAME).slo | awk '{ print $$3 }' | awk NF >$(XMHF_SLAB_NAME).slo.syms - cd $(XMHF_SLAB_OBJECTS_DIR) && $(OBJCOPY) --localize-symbols=$(XMHF_SLAB_NAME).slo.syms $(XMHF_SLAB_NAME).slo $(XMHF_SLAB_NAME).slo - cd $(XMHF_SLAB_OBJECTS_DIR) && nm $(XMHF_SLAB_NAME).slo | awk '{ print $$3,":",$$1 }' | awk NF >$(XMHF_SLAB_NAME).mmap - -endif - - -buildslabbin: $(XMHF_SLAB_OBJECTS) linkslabbin - -%.o: %.c - $(MKDIR) -p $(XMHF_SLAB_OBJECTS_DIR) - $(CCERT) -c $(CCERT_CFLAGS) -o $(XMHF_SLAB_OBJECTS_DIR)/$@ $< - -%.o: %.cS - $(MKDIR) -p $(XMHF_SLAB_OBJECTS_DIR) - @echo Building "$@" from "$<" - $(CP) -f $< $(XMHF_SLAB_OBJECTS_DIR)/$(@F).c - cd $(XMHF_SLAB_OBJECTS_DIR) && $(CCERT) -c -dmach $(CCERT_CASMFLAGS) $(@F).c - cd $(XMHF_SLAB_OBJECTS_DIR) && $(FRAMAC) -load-module $(USPARK_INSTALL_TOOLSDIR)/Ucasm -ucasm-infile $(@F).mach -ucasm-outfile $(@F).S - cd $(XMHF_SLAB_OBJECTS_DIR) && $(CC) -c $(ASMFLAGS) -o $@ $(@F).S - - -%.o: %.S - mkdir -p $(XMHF_SLAB_OBJECTS_DIR) - cd $(XMHF_SLAB_OBJECTS_DIR) && $(CC) -c $(ASMFLAGS) $< -o $(@F) - -.PHONY: clean -clean: - $(RM) -rf $(XMHF_SLAB_OBJECTS_DIR) - - - - - - - - diff --git a/uxmhf/uxmhf-uobjlist.in b/uxmhf/uxmhf-uobjlist.in deleted file mode 100644 index ab047a8af4..0000000000 --- a/uxmhf/uxmhf-uobjlist.in +++ /dev/null @@ -1,14 +0,0 @@ -uxmhf/xmhf-uobjs/geec_sentinel , VfT_SLAB, SENTINEL -uxmhf/xmhf-uobjs/geec_prime , VfT_SLAB, PRIME -uxmhf/xmhf-uobjs/xc_init , VfT_SLAB, INIT -uxmhf/xmhf-uobjs/xc_exhub , VfT_SLAB, EXCEPTION -uxmhf/xmhf-uobjs/xc_ihub , VfT_SLAB, INTERCEPT -uxmhf/xmhf-uobjs/xc_nwlog , VfT_SLAB, XCORE -uxmhf/xmhf-uobjs/uapi_gcpustate , VfT_SLAB, UAPI -uxmhf/xmhf-uobjs/uapi_hcpustate , VfT_SLAB, UAPI -uxmhf/xmhf-uobjs/uapi_slabmempgtbl , VfT_SLAB, UAPI -uxmhf/xmhf-uobjs/uapi_sysdata , VfT_SLAB, UAPI -uxmhf/xmhf-uobjs/xh_syscalllog , VfT_SLAB, XHYPAPP -uxmhf/xmhf-uobjs/xh_hyperdep , VfT_SLAB, XHYPAPP -uxmhf/xmhf-uobjs/xh_ssteptrace , uVU_SLAB, XHYPAPP -uxmhf/xmhf-uobjs/xg_richguest , uVU_SLAB, XRICHGUEST diff --git a/uxmhf/uxmhf-uobjlscript.in b/uxmhf/uxmhf-uobjlscript.in deleted file mode 100644 index 2189d7d042..0000000000 --- a/uxmhf/uxmhf-uobjlscript.in +++ /dev/null @@ -1,106 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include - -OUTPUT_ARCH("i386") - -MEMORY -{ - smem_code (rwxai) : ORIGIN = @SLABCODESTART@, LENGTH = (@SLABCODEEND@ - @SLABCODESTART@) - smem_data (rwxai) : ORIGIN = @SLABDATASTART@, LENGTH = (@SLABDATAEND@ - @SLABDATASTART@) - smem_stack (rwxai) : ORIGIN = @SLABSTACKSTART@, LENGTH = (@SLABSTACKEND@ - @SLABSTACKSTART@) - smem_dmadata (rwxai) : ORIGIN = @SLABDMADATASTART@, LENGTH = (@SLABDMADATAEND@ - @SLABDMADATASTART@) - unaccounted (rwxai) : ORIGIN = 0, LENGTH = 0 /* see section .unaccounted at end */ -} - -SECTIONS -{ - . = @SLABCODESTART@; - - .slabcode : { - *(.slab_codehdr) - *(.slab_entrystub) - *(.text) - . = (@SLABCODEEND@ - @SLABCODESTART@); - } >smem_code =0x9090 - - .slabdata : { - *(.rwdatahdr) - *(.data) - *(.bss) - *(.rodata) - *(.rodata.str1.1) - *(.comment) - *(.eh_frame) - . = (@SLABDATAEND@ - @SLABDATASTART@); - } >smem_data =0x0000 - - .slabstack : { - *(.stackhdr) - *(.stack) - *(.note.GNU-stack) - . = (@SLABSTACKEND@ - @SLABSTACKSTART@); - } >smem_stack =0x0000 - - .slabdmadata : { - *(.slab_dmadata) - . = (@SLABDMADATAEND@ - @SLABDMADATASTART@); - } >smem_dmadata =0x0000 - - - /* this is to cause the link to fail if there is - * anything we didn't explicitly place. - * when this does cause link to fail, temporarily comment - * this part out to see what sections end up in the output - * which are not handled above, and handle them. - */ - .unaccounted : { - *(*) - } >unaccounted - - -} diff --git a/uxmhf/xmhf-bootloader/Makefile b/uxmhf/xmhf-bootloader/Makefile deleted file mode 100644 index b26d8fc343..0000000000 --- a/uxmhf/xmhf-bootloader/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# makefile for xmhf bootloader -# author: amit vasudevan (amitvasudevan@acm.org) - -srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -vpath %.c $(srcdir) -vpath %.S $(srcdir) - -# grab list of all source files -C_SOURCES := $(shell find $(srcdir)/ -type f -name '*.c') -A_SOURCES := $(shell find $(srcdir)/ -type f -name '*.S') - -C_SOURCES := $(patsubst $(srcdir)/%, %, $(C_SOURCES)) -A_SOURCES := $(patsubst $(srcdir)/%, %, $(A_SOURCES)) - -# grab list of file names only for binary generation -C_SOURCES_FILENAMEONLY := $(notdir $(C_SOURCES)) -A_SOURCES_FILENAMEONLY := $(notdir $(A_SOURCES)) - -OBJECTS_ARCHIVE := $(patsubst %.c, %.o, $(C_SOURCES_FILENAMEONLY)) -OBJECTS_ARCHIVE += $(patsubst %.S, %.o, $(A_SOURCES_FILENAMEONLY)) - -# list of object dependencies -OBJECTS := $(patsubst %.c, %.o, $(C_SOURCES)) -OBJECTS += $(patsubst %.S, %.o, $(A_SOURCES)) - - -# folder where objects go -XMHF_BOOTLOADER_OBJECTS_DIR = _objs_xmhf-bootloader - -# archive name -THE_ARCHIVE = xmhf-bootloader - -# targets -.PHONY: all -all: $(THE_ARCHIVE) - -$(THE_ARCHIVE): $(OBJECTS) - cd $(XMHF_BOOTLOADER_OBJECTS_DIR) && $(LD) --oformat elf32-i386 -T $(srcdir)/init.lds -o $(THE_ARCHIVE).exe $(OBJECTS_ARCHIVE) -L$(CCERT_LIB) -L$(XMHF_LIBS_OBJECTS_DIR) -L$(USPARK_INSTALL_LIBSDIR) -lubersparkc -lxmhfdebug -lubersparkcrypto -lubersparkhw -lubersparkc -lcompcert - cd $(XMHF_BOOTLOADER_OBJECTS_DIR) && $(OBJCOPY) --output-format=binary $(THE_ARCHIVE).exe $(THE_ARCHIVE).bin - -%.o: %.S - $(MKDIR) -p $(XMHF_BOOTLOADER_OBJECTS_DIR) - @echo Building "$(@F)" from "$<" - $(CC) -c $(ASMFLAGS) -o $(XMHF_BOOTLOADER_OBJECTS_DIR)/$(@F) $< - -%.o: %.c - $(MKDIR) -p $(XMHF_BOOTLOADER_OBJECTS_DIR) - @echo Building "$(@F)" from "$<" - $(CCERT) -c $(CCERT_CFLAGS) -o $(XMHF_BOOTLOADER_OBJECTS_DIR)/$@ $< - - -.PHONY: clean -clean: - $(RM) -rf $(XMHF_BOOTLOADER_OBJECTS_DIR) - - - - diff --git a/uxmhf/xmhf-bootloader/_multiboot.h b/uxmhf/xmhf-bootloader/_multiboot.h deleted file mode 100644 index 4496f6438b..0000000000 --- a/uxmhf/xmhf-bootloader/_multiboot.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// multiboot.h - declarations for the multiboot spec -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __MULTIBOOT_H_ -#define __MULTIBOOT_H_ - -#define MULTIBOOT_HEADER_MAGIC 0x1badb002 -#define MEM_INFO 0x01 -#define MULTIBOOT_HEADER_FLAGS ((1<size_of_select);\ - UNLOAD_BLOB(buf, offset, (sel)->pcr_select, (sel)->size_of_select);\ -} - -#define UNLOAD_PCR_INFO_SHORT(buf, offset, info) {\ - UNLOAD_PCR_SELECTION(buf, offset, &(info)->pcr_selection);\ - UNLOAD_BLOB_TYPE(buf, offset, &(info)->locality_at_release);\ - UNLOAD_BLOB_TYPE(buf, offset, &(info)->digest_at_release);\ -} - -#define UNLOAD_NV_ATTRIBUTES(buf, offset, attr) {\ - UNLOAD_INTEGER(buf, offset, (attr)->tag);\ - UNLOAD_INTEGER(buf, offset, (attr)->attributes);\ -} - -/* Single-byte values do not require reverse_copy(endianness n/a) */ -#define UNLOAD_NV_DATA_PUBLIC(buf, offset, pub) {\ - UNLOAD_INTEGER(buf, offset, (pub)->tag);\ - UNLOAD_INTEGER(buf, offset, (pub)->nv_index);\ - UNLOAD_PCR_INFO_SHORT(buf, offset, &(pub)->pcr_info_read);\ - UNLOAD_PCR_INFO_SHORT(buf, offset, &(pub)->pcr_info_write);\ - UNLOAD_NV_ATTRIBUTES(buf, offset, &(pub)->permission);\ - *(buf + offset) = (pub)->b_read_st_clear; offset += 1;\ - *(buf + offset) = (pub)->b_write_st_clear; offset += 1;\ - *(buf + offset) = (pub)->b_write_define; offset += 1;\ - UNLOAD_INTEGER(buf, offset, (pub)->data_size);\ -} - -#define UNLOAD_PCR_INFO_LONG(buf, offset, info) {\ - UNLOAD_INTEGER(buf, offset, (info)->tag);\ - UNLOAD_BLOB_TYPE(buf, offset, &(info)->locality_at_creation);\ - UNLOAD_BLOB_TYPE(buf, offset, &(info)->locality_at_release);\ - UNLOAD_PCR_SELECTION(buf, offset, &(info)->creation_pcr_selection);\ - UNLOAD_PCR_SELECTION(buf, offset, &(info)->release_pcr_selection);\ - UNLOAD_BLOB_TYPE(buf, offset, &(info)->digest_at_creation);\ - UNLOAD_BLOB_TYPE(buf, offset, &(info)->digest_at_release);\ -} - -#define UNLOAD_STORED_DATA12(buf, offset, hdr) {\ - UNLOAD_INTEGER(buf, offset, ((const tpm_stored_data12_header_t *)(hdr))->tag);\ - UNLOAD_INTEGER(buf, offset, ((const tpm_stored_data12_header_t *)(hdr))->et);\ - UNLOAD_INTEGER(buf, offset,\ - ((const tpm_stored_data12_header_t *)(hdr))->seal_info_size);\ - if ( ((const tpm_stored_data12_header_t *)(hdr))->seal_info_size == 0 ) {\ - UNLOAD_INTEGER(buf, offset,\ - ((const tpm_stored_data12_short_t *)hdr)->enc_data_size);\ - UNLOAD_BLOB(buf, offset,\ - ((const tpm_stored_data12_short_t *)hdr)->enc_data,\ - ((const tpm_stored_data12_short_t *)hdr)->enc_data_size);\ - }\ - else {\ - UNLOAD_PCR_INFO_LONG(buf, offset,\ - &((const tpm_stored_data12_t *)hdr)->seal_info);\ - UNLOAD_INTEGER(buf, offset,\ - ((const tpm_stored_data12_t *)hdr)->enc_data_size);\ - UNLOAD_BLOB(buf, offset,\ - ((const tpm_stored_data12_t *)hdr)->enc_data,\ - ((const tpm_stored_data12_t *)hdr)->enc_data_size);\ - }\ -} - -#define LOAD_INTEGER(buf, offset, var) {\ - reverse_copy(&(var), buf + offset, sizeof(var));\ - offset += sizeof(var);\ -} - -#define LOAD_BLOB(buf, offset, blob, size) {\ - memcpy(blob, buf + offset, size);\ - offset += size;\ -} - -#define LOAD_BLOB_TYPE(buf, offset, blob) \ - LOAD_BLOB(buf, offset, blob, sizeof(*(blob))) - -#define LOAD_PCR_SELECTION(buf, offset, sel) {\ - LOAD_INTEGER(buf, offset, (sel)->size_of_select);\ - LOAD_BLOB(buf, offset, (sel)->pcr_select, (sel)->size_of_select);\ -} - -#define LOAD_PCR_INFO_SHORT(buf, offset, info) {\ - LOAD_PCR_SELECTION(buf, offset, &(info)->pcr_selection);\ - LOAD_BLOB_TYPE(buf, offset, &(info)->locality_at_release);\ - LOAD_BLOB_TYPE(buf, offset, &(info)->digest_at_release);\ -} - -#define LOAD_NV_ATTRIBUTES(buf, offset, attr) {\ - LOAD_INTEGER(buf, offset, (attr)->tag);\ - LOAD_INTEGER(buf, offset, (attr)->attributes);\ -} - -/* Single-byte values do not require reverse_copy(endianness n/a) */ -#define LOAD_NV_DATA_PUBLIC(buf, offset, pub) {\ - LOAD_INTEGER(buf, offset, (pub)->tag);\ - LOAD_INTEGER(buf, offset, (pub)->nv_index);\ - LOAD_PCR_INFO_SHORT(buf, offset, &(pub)->pcr_info_read);\ - LOAD_PCR_INFO_SHORT(buf, offset, &(pub)->pcr_info_write);\ - LOAD_NV_ATTRIBUTES(buf, offset, &(pub)->permission);\ - (pub)->b_read_st_clear = *(buf + offset); offset += 1;\ - (pub)->b_write_st_clear = *(buf + offset); offset += 1;\ - (pub)->b_write_define = *(buf + offset); offset += 1;\ - LOAD_INTEGER(buf, offset, (pub)->data_size);\ -} - -#define LOAD_PCR_INFO_LONG(buf, offset, info) {\ - LOAD_INTEGER(buf, offset, (info)->tag);\ - LOAD_BLOB_TYPE(buf, offset, &(info)->locality_at_creation);\ - LOAD_BLOB_TYPE(buf, offset, &(info)->locality_at_release);\ - LOAD_PCR_SELECTION(buf, offset, &(info)->creation_pcr_selection);\ - LOAD_PCR_SELECTION(buf, offset, &(info)->release_pcr_selection);\ - LOAD_BLOB_TYPE(buf, offset, &(info)->digest_at_creation);\ - LOAD_BLOB_TYPE(buf, offset, &(info)->digest_at_release);\ -} - -#define LOAD_STORED_DATA12(buf, offset, hdr) {\ - LOAD_INTEGER(buf, offset, ((tpm_stored_data12_header_t *)(hdr))->tag);\ - LOAD_INTEGER(buf, offset, ((tpm_stored_data12_header_t *)(hdr))->et);\ - LOAD_INTEGER(buf, offset, \ - ((tpm_stored_data12_header_t *)(hdr))->seal_info_size);\ - if ( ((tpm_stored_data12_header_t *)(hdr))->seal_info_size == 0 ) {\ - LOAD_INTEGER(buf, offset,\ - ((tpm_stored_data12_short_t *)hdr)->enc_data_size);\ - LOAD_BLOB(buf, offset,\ - ((tpm_stored_data12_short_t *)hdr)->enc_data,\ - ((tpm_stored_data12_short_t *)hdr)->enc_data_size);\ - }\ - else {\ - LOAD_PCR_INFO_LONG(buf, offset,\ - &((tpm_stored_data12_t *)hdr)->seal_info);\ - LOAD_INTEGER(buf, offset,\ - ((tpm_stored_data12_t *)hdr)->enc_data_size);\ - LOAD_BLOB(buf, offset,\ - ((tpm_stored_data12_t *)hdr)->enc_data,\ - ((tpm_stored_data12_t *)hdr)->enc_data_size);\ - }\ -} - - -#define XOR_BLOB_TYPE(data, pad) {\ - uint32_t i; \ - for ( i = 0; i < sizeof(*(data)); i++ ) \ - ((uint8_t *)data)[i] ^= ((uint8_t *)pad)[i % sizeof(*(pad))];\ -} - - -typedef uint32_t tpm_capability_area_t; - -#define TPM_CAP_NV_INDEX 0x00000011 - - -typedef struct __attribute__ ((packed)) { - tpm_pcr_selection_t pcr_selection; - tpm_locality_selection_t locality_at_release; - tpm_composite_hash_t digest_at_release; -} tpm_pcr_info_short_t; - -typedef struct __attribute__ ((packed)) { - tpm_structure_tag_t tag; - uint32_t attributes; -} tpm_nv_attributes_t; - -typedef struct __attribute__ ((packed)) { - tpm_structure_tag_t tag; - tpm_nv_index_t nv_index; - tpm_pcr_info_short_t pcr_info_read; - tpm_pcr_info_short_t pcr_info_write; - tpm_nv_attributes_t permission; - uint8_t b_read_st_clear; - uint8_t b_write_st_clear; - uint8_t b_write_define; - uint32_t data_size; -} tpm_nv_data_public_t; - - - -typedef struct __attribute__ ((packed)) { - tpm_structure_tag_t tag; - uint8_t disable; - uint8_t ownership; - uint8_t deactivated; - uint8_t read_pubek; - uint8_t disable_owner_clear; - uint8_t allow_maintenance; - uint8_t physical_presence_lifetime_lock; - uint8_t physical_presence_hw_enable; - uint8_t physical_presence_cmd_enable; - uint8_t cekp_used; - uint8_t tpm_post; - uint8_t tpm_post_lock; - uint8_t fips; - uint8_t operator; - uint8_t enable_revoke_ek; - uint8_t nv_locked; - uint8_t read_srk_pub; - uint8_t tpm_established; - uint8_t maintenance_done; - uint8_t disable_full_da_logic_info; -} tpm_permanent_flags_t; - -typedef struct __attribute__ ((packed)) { - tpm_structure_tag_t tag; - uint8_t deactivated; - uint8_t disable_force_clear; - uint8_t physical_presence; - uint8_t phycical_presence_lock; - uint8_t b_global_lock; -} tpm_stclear_flags_t; - -#define TPM_CAP_FLAG 0x00000004 -#define TPM_CAP_FLAG_PERMANENT 0x00000108 -#define TPM_CAP_FLAG_VOLATILE 0x00000109 - - -#define TPM_CAP_PROPERTY 0x00000005 -#define TPM_CAP_PROP_TIS_TIMEOUT 0x00000115 - - - - - - - - - - - - - - - - - -/* - -//---------------------------------------------------------------------- -//exported FUNCTIONS -//---------------------------------------------------------------------- - -//open TPM locality -int xmhf_tpm_open_locality(int locality); - -//check if TPM is ready for use -bool xmhf_tpm_is_tpm_ready(uint32_t locality); - -//deactivate all TPM localities -void xmhf_tpm_deactivate_all_localities(void); - -//prepare TPM for use -bool xmhf_tpm_prepare_tpm(void); - -//---------------------------------------------------------------------- -//ARCH. BACKENDS -//---------------------------------------------------------------------- -//open TPM locality -int xmhf_tpm_arch_open_locality(int locality); - -//check if TPM is ready for use -bool xmhf_tpm_arch_is_tpm_ready(uint32_t locality); - -//deactivate all TPM localities -void xmhf_tpm_arch_deactivate_all_localities(void); - -//prepare TPM for use -bool xmhf_tpm_arch_prepare_tpm(void); -*/ - - -//---------------------------------------------------------------------- -//x86 ARCH. INTERFACES -//---------------------------------------------------------------------- -#define TPM_LOCALITY_BASE 0xfed40000 -#define NR_TPM_LOCALITY_PAGES ((TPM_LOCALITY_1 - TPM_LOCALITY_0) >> \ - PAGE_SHIFT) - -#define TPM_LOCALITY_0 TPM_LOCALITY_BASE -#define TPM_LOCALITY_1 (TPM_LOCALITY_BASE | 0x1000) -#define TPM_LOCALITY_2 (TPM_LOCALITY_BASE | 0x2000) -/* these localities (3+4) are mostly not usable by Xen */ -#define TPM_LOCALITY_3 (TPM_LOCALITY_BASE | 0x3000) -#define TPM_LOCALITY_4 (TPM_LOCALITY_BASE | 0x4000) - -#define TPM_LOCALITY_BASE_N(n) (TPM_LOCALITY_BASE | ((n) << 12)) - - - -#define TPM_VALIDATE_LOCALITY_TIME_OUT 0x100 - -/* - * TPM registers and data structures - * - * register values are offsets from each locality base - * see {read,write}_tpm_reg() for data struct format - */ - -/* TPM_ACCESS_x */ -#define TPM_REG_ACCESS 0x00 -#define SIZE_TPM_REG_ACCESS 0x1 - -typedef struct { - uint32_t tpm_establishment ; //: 1; // RO, 0=T/OS has been established - // before - uint32_t request_use ; //: 1; // RW, 1=locality is requesting TPM use - uint32_t pending_request ; //: 1; // RO, 1=other locality is requesting - // TPM usage - uint32_t seize ; //: 1; // WO, 1=seize locality - uint32_t been_seized ; //: 1; // RW, 1=locality seized while active - uint32_t active_locality ; //: 1; // RW, 1=locality is active - uint32_t reserved ; //: 1; // - uint32_t tpm_reg_valid_sts ; //: 1; // RO, 1=other bits are valid -} __attribute__((packed)) tpm_reg_access_t; - -#define pack_tpm_reg_access_t(s) \ - (uint8_t)( \ - (((uint32_t)(s)->tpm_reg_valid_sts & 0x00000001UL) << 7) | \ - (((uint32_t)(s)->reserved & 0x00000001UL) << 6) | \ - (((uint32_t)(s)->active_locality & 0x00000001UL) << 5) | \ - (((uint32_t)(s)->been_seized & 0x00000001UL) << 4) | \ - (((uint32_t)(s)->seize & 0x00000001UL) << 3) | \ - (((uint32_t)(s)->pending_request & 0x00000001UL) << 2) | \ - (((uint32_t)(s)->request_use & 0x00000001UL) << 1) | \ - (((uint32_t)(s)->tpm_establishment & 0x00000001UL) << 0 ) \ - ) - -#define unpack_tpm_reg_access_t(s, value) \ - (s)->tpm_reg_valid_sts = (uint32_t)(((uint8_t)value >> 7) & 0x00000001UL); \ - (s)->reserved = (uint32_t)(((uint8_t)value >> 6) & 0x00000001UL); \ - (s)->active_locality = (uint32_t)(((uint8_t)value >> 5) & 0x00000001UL); \ - (s)->been_seized = (uint32_t)(((uint8_t)value >> 4) & 0x00000001UL); \ - (s)->seize = (uint32_t)(((uint8_t)value >> 3) & 0x00000001UL); \ - (s)->pending_request = (uint32_t)(((uint8_t)value >> 2) & 0x00000001UL); \ - (s)->request_use = (uint32_t)(((uint8_t)value >> 1) & 0x00000001UL); \ - (s)->tpm_establishment = (uint32_t)(((uint8_t)value >> 0) & 0x00000001UL); - - - -/* TPM_STS_x */ -#define TPM_REG_STS 0x18 -#define SIZE_TPM_REG_STS 0x3 -/*typedef struct { - uint8_t reserved1 : 1; - uint8_t response_retry : 1; // WO, 1=re-send response - uint8_t reserved2 : 1; - uint8_t expect : 1; // RO, 1=more data for command expected - uint8_t data_avail : 1; // RO, 0=no more data for response - uint8_t tpm_go : 1; // WO, 1=execute sent command - uint8_t command_ready : 1; // RW, 1=TPM ready to receive new cmd - uint8_t sts_valid : 1; // RO, 1=data_avail and expect bits are - // valid - uint16_t burst_count : 16; // RO, # read/writes bytes before wait -} __attribute__((packed)) tpm_reg_sts_t; -*/ - -typedef struct { - uint32_t reserved1 ;//: 1; - uint32_t response_retry ;//: 1; // WO, 1=re-send response - uint32_t reserved2 ;//: 1; - uint32_t expect ;//: 1; // RO, 1=more data for command expected - uint32_t data_avail ;//: 1; // RO, 0=no more data for response - uint32_t tpm_go ;//: 1; // WO, 1=execute sent command - uint32_t command_ready ;//: 1; // RW, 1=TPM ready to receive new cmd - uint32_t sts_valid ;//: 1; // RO, 1=data_avail and expect bits are - // valid - uint32_t burst_count ;//: 16; // RO, # read/writes bytes before wait -} __attribute__((packed)) tpm_reg_sts_t; - -#define pack_tpm_reg_sts_t(s) \ - (uint32_t)( \ - (((uint32_t)(s)->burst_count & 0x0000FFFFUL) << 8) | \ - (((uint32_t)(s)->sts_valid & 0x00000001UL) << 7) | \ - (((uint32_t)(s)->command_ready & 0x00000001UL) << 6) | \ - (((uint32_t)(s)->tpm_go & 0x00000001UL) << 5) | \ - (((uint32_t)(s)->data_avail & 0x00000001UL) << 4) | \ - (((uint32_t)(s)->expect & 0x00000001UL) << 3) | \ - (((uint32_t)(s)->reserved2 & 0x00000001UL) << 2) | \ - (((uint32_t)(s)->response_retry & 0x00000001UL) << 1) | \ - (((uint32_t)(s)->reserved1 & 0x00000001UL) << 0 ) \ - ) - -#define unpack_tpm_reg_sts_t(s, value) \ - (s)->burst_count = (uint32_t)(((uint32_t)value >> 8) & 0x0000FFFFUL); \ - (s)->sts_valid = (uint32_t)(((uint32_t)value >> 7) & 0x00000001UL); \ - (s)->command_ready = (uint32_t)(((uint32_t)value >> 6) & 0x00000001UL); \ - (s)->tpm_go = (uint32_t)(((uint32_t)value >> 5) & 0x00000001UL); \ - (s)->data_avail = (uint32_t)(((uint32_t)value >> 4) & 0x00000001UL); \ - (s)->expect = (uint32_t)(((uint32_t)value >> 3) & 0x00000001UL); \ - (s)->reserved2 = (uint32_t)(((uint32_t)value >> 2) & 0x00000001UL); \ - (s)->response_retry = (uint32_t)(((uint32_t)value >> 1) & 0x00000001UL); \ - (s)->reserved1 = (uint32_t)(((uint32_t)value >> 0) & 0x00000001UL); - - - -/* TPM_DATA_FIFO_x */ -#define TPM_REG_DATA_FIFO 0x24 -#define SIZE_TPM_REG_DATA_FIFO 0x1 -//typedef union { -// uint8_t _raw[1]; /* 1-byte reg */ -//} tpm_reg_data_fifo_t; - -typedef uint8_t tpm_reg_data_fifo_t; -/* - * assumes that all reg types follow above format: - * - packed - * - member named '_raw' which is array whose size is that of data to read - */ -#define read_tpm_reg(locality, reg, pdata) \ - _read_tpm_reg(locality, reg, (pdata)->_raw, sizeof(*(pdata))) - -#define write_tpm_reg(locality, reg, pdata) \ - _write_tpm_reg(locality, reg, (pdata)->_raw, sizeof(*(pdata))) - - -/********************************************************************* - * Moved in from tboot's tpm.c; I think it belongs in a .h file. Also - * facilitates split into tpm.c and tpm_extra.c. - *********************************************************************/ - -/* TODO: Give these a more appropriate home */ -#define readb(va) xmhfhw_sysmemaccess_readu8(va) -#define writeb(va, d) xmhfhw_sysmemaccess_writeu8(va, d) - -/*#ifndef __XMHF_VERIFICATION__ - - static inline void writeb(uint32_t addr, uint8_t val) { - __asm__ __volatile__("movb %%al, %%fs:(%%ebx)\r\n" - : - : "b"(addr), "a"((uint32_t)val) - ); - } - - static inline uint8_t readb(uint32_t addr) { - uint32_t ret; - __asm__ __volatile("xor %%eax, %%eax\r\n" - "movb %%fs:(%%ebx), %%al\r\n" - : "=a"(ret) - : "b"(addr) - ); - return (uint8_t)ret; - } - -#else //__XMHF_VERIFICATION__ - - static inline void writeb(uint32_t addr, uint8_t val) { - - } - - static inline uint8_t readb(uint32_t addr) { - return 0; - } - -#endif //__XMHF_VERIFICATION__ -*/ - -//TPM timeouts -#define TIMEOUT_UNIT (0x100000 / 330) /* ~1ms, 1 tpm r/w need > 330ns */ -#define TIMEOUT_A 750 /* 750ms */ -#define TIMEOUT_B 2000 /* 2s */ -#define TIMEOUT_C 750 /* 750ms */ -#define TIMEOUT_D 750 /* 750ms */ - -typedef struct __attribute__ ((packed)) { - uint32_t timeout_a; - uint32_t timeout_b; - uint32_t timeout_c; - uint32_t timeout_d; -} tpm_timeout_t; - - -#define TPM_ACTIVE_LOCALITY_TIME_OUT \ - (TIMEOUT_UNIT * g_timeout.timeout_a) /* according to spec */ -#define TPM_CMD_READY_TIME_OUT \ - (TIMEOUT_UNIT * g_timeout.timeout_b) /* according to spec */ -#define TPM_CMD_WRITE_TIME_OUT \ - (TIMEOUT_UNIT * g_timeout.timeout_d) /* let it long enough */ -#define TPM_DATA_AVAIL_TIME_OUT \ - (TIMEOUT_UNIT * g_timeout.timeout_c) /* let it long enough */ -#define TPM_RSP_READ_TIME_OUT \ - (TIMEOUT_UNIT * g_timeout.timeout_d) /* let it long enough */ - -/* -//---------------------------------------------------------------------- -//x86vmx SUBARCH. INTERFACES -//---------------------------------------------------------------------- -//open TPM locality -int xmhf_tpm_arch_x86vmx_open_locality(int locality); - - -//---------------------------------------------------------------------- -//x86vmx SUBARCH. INTERFACES -//---------------------------------------------------------------------- -//open TPM locality -int xmhf_tpm_arch_x86svm_open_locality(int locality); - -*/ - -static inline uint32_t tpm_get_capability( - uint32_t locality, tpm_capability_area_t cap_area, - uint32_t sub_cap_size, const uint8_t *sub_cap, - uint32_t *resp_size, uint8_t *resp); - - - - - - - - -static inline void _read_tpm_reg(int locality, uint32_t reg, uint8_t *_raw, size_t size) -{ - size_t i; - for ( i = 0; i < size; i++ ) - _raw[i] = readb((TPM_LOCALITY_BASE_N(locality) | reg) + i); -} - -static inline void _write_tpm_reg(int locality, uint32_t reg, uint8_t *_raw, size_t size) -{ - size_t i; - for ( i = 0; i < size; i++ ) - writeb((TPM_LOCALITY_BASE_N(locality) | reg) + i, _raw[i]); -} - - -static tpm_timeout_t g_timeout = {TIMEOUT_A, - TIMEOUT_B, - TIMEOUT_C, - TIMEOUT_D}; - -static inline bool tpm_validate_locality(uint32_t locality) -{ - uint32_t i; - tpm_reg_access_t reg_acc; - - for ( i = TPM_VALIDATE_LOCALITY_TIME_OUT; i > 0; i-- ) { - /* - * TCG spec defines reg_acc.tpm_reg_valid_sts bit to indicate whether - * other bits of access reg are valid.( but this bit will also be 1 - * while this locality is not available, so check seize bit too) - * It also defines that reading reg_acc.seize should always return 0 - */ - { - uint8_t value; - _read_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - unpack_tpm_reg_access_t(®_acc, value); - } - if ( reg_acc.tpm_reg_valid_sts == 1 && reg_acc.seize == 0) - return true; - cpu_relax(CASM_NOPARAM); - } - - //if ( i <= 0 ) - //_XDPRINTF_("\nTPM: tpm_validate_locality timeout\n"); - - return false; -} - -/* -static void dump_locality_access_regs(void) { - tpm_reg_access_t reg_acc; - uint32_t locality; - - _XDPRINTF_("\n%s():\n", __FUNCTION__); - for(locality=0; locality <= 3; locality++) { - read_tpm_reg(locality, TPM_REG_ACCESS, ®_acc); - _XDPRINTF_(" TPM: Locality %d Access reg content: 0x%02x\n", - locality, (uint32_t)reg_acc._raw[0]); - if ( reg_acc.tpm_reg_valid_sts == 0 ) { - _XDPRINTF_(" TPM: Access reg not valid\n"); - } - } -}*/ - - - -static inline uint32_t tpm_get_flags(uint32_t locality, uint32_t flag_id, - uint8_t *flags, uint32_t flag_size) -{ - uint32_t ret, offset, resp_size; - uint8_t sub_cap[sizeof(flag_id)]; - tpm_structure_tag_t tag; - - if ( flags == NULL ) { - //_XDPRINTF_("TPM: tpm_get_flags() bad parameter\n"); - return TPM_BAD_PARAMETER; - } - - offset = 0; - UNLOAD_INTEGER(sub_cap, offset, flag_id); - - resp_size = flag_size; - ret = tpm_get_capability(locality, TPM_CAP_FLAG, sizeof(sub_cap), - sub_cap, &resp_size, flags); - -//#ifdef TPM_TRACE -// _XDPRINTF_("TPM: get flags %08X, return value = %08X\n", flag_id, ret); -//#endif - if ( ret != TPM_SUCCESS ) - return ret; - - /* 1.2 spec, main part 2, rev 103 add one more byte to permanent flags, to - be backward compatible, not assume all expected bytes can be gotten */ - if ( resp_size > flag_size ) { - //_XDPRINTF_("TPM: tpm_get_flags() response size too small\n"); - return TPM_FAIL; - } - - offset = 0; - LOAD_INTEGER(flags, offset, tag); - offset = 0; - UNLOAD_BLOB_TYPE(flags, offset, &tag); - - return ret; -} - - -static inline uint32_t tpm_get_timeout(uint32_t locality, - uint8_t *prop, uint32_t prop_size) -{ - uint32_t ret, offset, resp_size, prop_id = TPM_CAP_PROP_TIS_TIMEOUT; - uint8_t sub_cap[sizeof(prop_id)]; - uint32_t resp[4]; - - if ( (prop == NULL) || (prop_size < sizeof(resp)) ) { - //_XDPRINTF_("TPM: tpm_get_timeout() bad parameter\n"); - return TPM_BAD_PARAMETER; - } - - offset = 0; - UNLOAD_INTEGER(sub_cap, offset, prop_id); - - resp_size = prop_size; - ret = tpm_get_capability(locality, TPM_CAP_PROPERTY, sizeof(sub_cap), - sub_cap, &resp_size, prop); - -//#ifdef TPM_TRACE -// _XDPRINTF_("TPM: get prop %08X, return value = %08X\n", prop_id, ret); -//#endif - if ( ret != TPM_SUCCESS ) - return ret; - - if ( resp_size != prop_size ) { - //_XDPRINTF_("TPM: tpm_get_property() response size incorrect\n"); - return TPM_FAIL; - } - - offset = 0; - LOAD_INTEGER(prop, offset, resp); - offset = 0; - UNLOAD_BLOB_TYPE(prop, offset, &resp); - - return ret; -} - - -/* ensure TPM is ready to accept commands */ -static inline bool is_tpm_ready(uint32_t locality) -{ - tpm_permanent_flags_t pflags; - tpm_stclear_flags_t vflags; - uint32_t timeout[4]; - uint32_t ret; - - if ( !tpm_validate_locality(locality) ) { - //_XDPRINTF_("TPM is not available.\n"); - return false; - } - - /* make sure tpm is not disabled/deactivated */ - memset(&pflags, 0, sizeof(pflags)); - ret = tpm_get_flags(locality, TPM_CAP_FLAG_PERMANENT, - (uint8_t *)&pflags, sizeof(pflags)); - if ( ret != TPM_SUCCESS ) { - //_XDPRINTF_("TPM is disabled or deactivated.\n"); - return false; - } - if ( pflags.disable ) { - //_XDPRINTF_("TPM is disabled.\n"); - return false; - } - - memset(&vflags, 0, sizeof(vflags)); - ret = tpm_get_flags(locality, TPM_CAP_FLAG_VOLATILE, - (uint8_t *)&vflags, sizeof(vflags)); - if ( ret != TPM_SUCCESS ) { - //_XDPRINTF_("TPM is disabled or deactivated.\n"); - return false; - } - if ( vflags.deactivated ) { - //_XDPRINTF_("TPM is deactivated.\n"); - return false; - } - - //_XDPRINTF_("TPM is ready\n"); - //_XDPRINTF_("TPM nv_locked: %s\n", (pflags.nv_locked != 0) ? "TRUE" : "FALSE"); - - /* get tpm timeout values */ - ret = tpm_get_timeout(locality, (uint8_t *)&timeout, sizeof(timeout)); - if ( ret != TPM_SUCCESS ){ - //_XDPRINTF_("TPM timeout values are not achieved, " - // "default values will be used.\n"); - }else { - /* - * timeout_x represents the number of milliseconds for the timeout - * and timeout[x] represents the number of microseconds. - */ - g_timeout.timeout_a = timeout[0]/1000; - g_timeout.timeout_b = timeout[1]/1000; - g_timeout.timeout_c = timeout[2]/1000; - g_timeout.timeout_d = timeout[3]/1000; - //_XDPRINTF_("TPM timeout values: A: %u, B: %u, C: %u, D: %u\n", - // g_timeout.timeout_a, g_timeout.timeout_b, g_timeout.timeout_c, - // g_timeout.timeout_d); - /* - * if any timeout values are less than default values, set to default - * value (due to bug with some TPMs) - */ - if ( g_timeout.timeout_a < TIMEOUT_A ) g_timeout.timeout_a = TIMEOUT_A; - if ( g_timeout.timeout_b < TIMEOUT_B ) g_timeout.timeout_b = TIMEOUT_B; - if ( g_timeout.timeout_c < TIMEOUT_C ) g_timeout.timeout_c = TIMEOUT_C; - if ( g_timeout.timeout_d < TIMEOUT_D ) g_timeout.timeout_d = TIMEOUT_D; - } - - return true; -} - - -static inline bool release_locality(uint32_t locality) -{ - uint32_t i; - tpm_reg_access_t reg_acc; -//#ifdef TPM_TRACE -// _XDPRINTF_("TPM: releasing locality %u\n", locality); -//#endif - - if ( !tpm_validate_locality(locality) ) - return true; - - { - uint8_t value; - _read_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - unpack_tpm_reg_access_t(®_acc, value); - } - - if ( reg_acc.active_locality == 0 ) - return true; - - /* make inactive by writing a 1 */ - unpack_tpm_reg_access_t(®_acc, 0); - //reg_acc._raw[0]= 0; - //memset(®_acc, 0, SIZE_TPM_REG_ACCESS); - reg_acc.active_locality = 1; - - { - uint8_t value = pack_tpm_reg_access_t(®_acc); - _write_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - } - - i = 0; - do { - { - uint8_t value; - _read_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - unpack_tpm_reg_access_t(®_acc, value); - } - if ( reg_acc.active_locality == 0 ) - return true; - else - cpu_relax(CASM_NOPARAM); - i++; - } while ( i <= TPM_ACTIVE_LOCALITY_TIME_OUT ); - - //_XDPRINTF_("TPM: access reg release locality timeout\n"); - return false; -} - -//====================================================================== -//ARCH. Backends -//====================================================================== - -//deactivate all TPM localities -static inline void xmhf_tpm_arch_deactivate_all_localities(void) { - tpm_reg_access_t reg_acc; - uint32_t locality; - - //_XDPRINTF_("\nTPM: %s()\n", __FUNCTION__); - for(locality=0; locality <= 3; locality++) { - unpack_tpm_reg_access_t(®_acc, 0); - reg_acc.active_locality = 1; - { - uint8_t value = pack_tpm_reg_access_t(®_acc); - _write_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - } - } -} - - -//check if TPM is ready for use -static inline bool xmhf_tpm_arch_is_tpm_ready(uint32_t locality){ - return is_tpm_ready(locality); -} - - - -//prepare TPM for use -static inline bool xmhf_tpm_arch_prepare_tpm(void){ - /* - * must ensure TPM_ACCESS_0.activeLocality bit is clear - * (: locality is not active) - */ - - return release_locality(0); -} - - - -//====================================================================== -// libtpm environment specific function definitions -//====================================================================== - - -static inline uint32_t tpm_wait_cmd_ready(uint32_t locality) -{ - uint32_t i; - tpm_reg_access_t reg_acc; - tpm_reg_sts_t reg_sts; - -/* //temporary debug prints */ -/* dump_locality_access_regs(); */ -/* deactivate_all_localities(); */ -/* dump_locality_access_regs(); */ - - /* ensure the contents of the ACCESS register are valid */ - { - uint8_t value; - _read_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - unpack_tpm_reg_access_t(®_acc, value); - } -//#ifdef TPM_TRACE -// _XDPRINTF_("\nTPM: Access reg content: 0x%02x\n", (uint32_t)reg_acc._raw[0]); -//#endif - if ( reg_acc.tpm_reg_valid_sts == 0 ) { - //_XDPRINTF_("TPM: Access reg not valid\n"); - return TPM_FAIL; - } - - /* request access to the TPM from locality N */ - unpack_tpm_reg_access_t(®_acc, 0); - //memset(®_acc, 0, SIZE_TPM_REG_ACCESS); - reg_acc.request_use = 1; - - { - uint8_t value = pack_tpm_reg_access_t(®_acc); - _write_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - } - i = 0; - do { - { - uint8_t value; - _read_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - unpack_tpm_reg_access_t(®_acc, value); - } - if ( reg_acc.active_locality == 1 ) - break; - else - cpu_relax(CASM_NOPARAM); - i++; - } while ( i <= TPM_ACTIVE_LOCALITY_TIME_OUT); - - if ( i > TPM_ACTIVE_LOCALITY_TIME_OUT ) { - //_XDPRINTF_("TPM: access reg request use timeout (i=%d)\n", i); - return TPM_FAIL; - } - - /* ensure the TPM is ready to accept a command */ -//#ifdef TPM_TRACE -// _XDPRINTF_("TPM: wait for cmd ready "); -//#endif - i = 0; - do { - /* write 1 to TPM_STS_x.commandReady to let TPM enter ready state */ - memset((void *)®_sts, 0, sizeof(reg_sts)); - reg_sts.command_ready = 1; - { - uint32_t value = pack_tpm_reg_sts_t(®_sts); - _write_tpm_reg(locality, TPM_REG_STS, &value, SIZE_TPM_REG_STS); - } - cpu_relax(CASM_NOPARAM); - - /* then see if it has */ - { - uint32_t value; - _read_tpm_reg(locality, TPM_REG_STS, &value, SIZE_TPM_REG_STS); - unpack_tpm_reg_sts_t(®_sts, value); - } -//#ifdef TPM_TRACE -// _XDPRINTF_("."); -//#endif - if ( reg_sts.command_ready == 1 ) - break; - else - cpu_relax(CASM_NOPARAM); - i++; - } while ( i <= TPM_CMD_READY_TIME_OUT ); -//#ifdef TPM_TRACE -// _XDPRINTF_("\n"); -//#endif - - if ( i > TPM_CMD_READY_TIME_OUT ) { - //_XDPRINTF_("TPM: status reg content: %02x %02x %02x\n", - // (uint32_t)reg_sts._raw[0], - // (uint32_t)reg_sts._raw[1], - // (uint32_t)reg_sts._raw[2]); - //_XDPRINTF_("TPM: tpm timeout for command_ready\n"); - goto RelinquishControl; - } - return TPM_SUCCESS; - -RelinquishControl: - /* deactivate current locality */ - unpack_tpm_reg_access_t(®_acc, 0); - reg_acc.active_locality = 1; - { - uint8_t value = pack_tpm_reg_access_t(®_acc); - _write_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - } - - return TPM_FAIL; -} - -/* - * locality : TPM locality (0 - 3) - * in : All bytes for a single TPM command, including TAG, SIZE, - * ORDINAL, and other arguments. All data should be in big-endian - * style. The in MUST NOT be NULL, containing at least 10 bytes. - * 0 1 2 3 4 5 6 7 8 9 10 ... - * ------------------------------------------------------------- - * | TAG | SIZE | ORDINAL | arguments ... - * ------------------------------------------------------------- - * in_size : The size of the whole command contained within the in buffer. - * It should equal to the SIZE contained in the in buffer. - * out : All bytes of the TPM response to a single command. All data - * within it will be in big-endian style. The out MUST not be - * NULL, and will return at least 10 bytes. - * 0 1 2 3 4 5 6 7 8 9 10 ... - * ------------------------------------------------------------- - * | TAG | SIZE | RETURN CODE | other data ... - * ------------------------------------------------------------- - * out_size : In/out paramter. As in, it is the size of the out buffer; - * as out, it is the size of the response within the out buffer. - * The out_size MUST NOT be NULL. - * return : 0 = success; if not 0, it equal to the RETURN CODE in out buf. - */ - -static inline uint32_t tpm_write_cmd_fifo(uint32_t locality, uint8_t *in, - uint32_t in_size, uint8_t *out, - uint32_t *out_size) -{ - uint32_t i, rsp_size, offset, ret; - uint16_t row_size; - tpm_reg_access_t reg_acc; - tpm_reg_sts_t reg_sts; - - if ( locality >= TPM_NR_LOCALITIES ) { - //_XDPRINTF_("TPM: Invalid locality for tpm_write_cmd_fifo()\n"); - return TPM_BAD_PARAMETER; - } - if ( in == NULL || out == NULL || out_size == NULL ) { - //_XDPRINTF_("TPM: Invalid parameter for tpm_write_cmd_fifo()\n"); - return TPM_BAD_PARAMETER; - } - if ( in_size < CMD_HEAD_SIZE || *out_size < RSP_HEAD_SIZE ) { - //_XDPRINTF_("TPM: in/out buf size must be larger than 10 bytes\n"); - return TPM_BAD_PARAMETER; - } - - if ( !tpm_validate_locality(locality) ) { - //_XDPRINTF_("TPM: Locality %d is not open\n", locality); - return TPM_FAIL; - } - - ret = tpm_wait_cmd_ready(locality); - if ( ret != TPM_SUCCESS ) - return ret; - -//#ifdef TPM_TRACE -// { -// _XDPRINTF_("TPM: cmd size = %d\nTPM: cmd content: ", in_size); -// print_hex("TPM: \t", in, in_size); -// } -//#endif - - /* write the command to the TPM FIFO */ - offset = 0; - do { - i = 0; - do { - { - uint32_t value; - _read_tpm_reg(locality, TPM_REG_STS, &value, SIZE_TPM_REG_STS); - unpack_tpm_reg_sts_t(®_sts, value); - } - /* find out how many bytes the TPM can accept in a row */ - row_size = reg_sts.burst_count; - if ( row_size > 0 ) - break; - else - cpu_relax(CASM_NOPARAM); - i++; - } while ( i <= TPM_CMD_WRITE_TIME_OUT ); - if ( i > TPM_CMD_WRITE_TIME_OUT ) { - //_XDPRINTF_("TPM: write cmd timeout\n"); - ret = TPM_FAIL; - goto RelinquishControl; - } - - for ( ; row_size > 0 && offset < in_size; row_size--, offset++ ) - _write_tpm_reg(locality, TPM_REG_DATA_FIFO, - (tpm_reg_data_fifo_t *)&in[offset], SIZE_TPM_REG_DATA_FIFO); - } while ( offset < in_size ); - - /* command has been written to the TPM, it is time to execute it. */ - memset(®_sts, 0, sizeof(reg_sts)); - reg_sts.tpm_go = 1; - { - uint32_t value = pack_tpm_reg_sts_t(®_sts); - _write_tpm_reg(locality, TPM_REG_STS, &value, SIZE_TPM_REG_STS); - } - /* check for data available */ - i = 0; - do { - { - uint32_t value; - _read_tpm_reg(locality,TPM_REG_STS, &value, SIZE_TPM_REG_STS); - unpack_tpm_reg_sts_t(®_sts, value); - } - if ( reg_sts.sts_valid == 1 && reg_sts.data_avail == 1 ) - break; - else - cpu_relax(CASM_NOPARAM); - i++; - } while ( i <= TPM_DATA_AVAIL_TIME_OUT ); - if ( i > TPM_DATA_AVAIL_TIME_OUT ) { - //_XDPRINTF_("TPM: wait for data available timeout\n"); - ret = TPM_FAIL; - goto RelinquishControl; - } - - rsp_size = 0; - offset = 0; - do { - /* find out how many bytes the TPM returned in a row */ - i = 0; - do { - { - uint32_t value; - _read_tpm_reg(locality,TPM_REG_STS, &value, SIZE_TPM_REG_STS); - unpack_tpm_reg_sts_t(®_sts, value); - } - row_size = reg_sts.burst_count; - if ( row_size > 0 ) - break; - else - cpu_relax(CASM_NOPARAM); - i++; - } while ( i <= TPM_RSP_READ_TIME_OUT ); - if ( i > TPM_RSP_READ_TIME_OUT ) { - //_XDPRINTF_("TPM: read rsp timeout\n"); - ret = TPM_FAIL; - goto RelinquishControl; - } - - for ( ; row_size > 0 && offset < *out_size; row_size--, offset++ ) { - if ( offset < *out_size ) - _read_tpm_reg(locality, TPM_REG_DATA_FIFO, - (tpm_reg_data_fifo_t *)&out[offset], SIZE_TPM_REG_DATA_FIFO); - else { - /* discard the responded bytes exceeding out buf size */ - tpm_reg_data_fifo_t discard; - _read_tpm_reg(locality, TPM_REG_DATA_FIFO, - (tpm_reg_data_fifo_t *)&discard, SIZE_TPM_REG_DATA_FIFO); - } - - /* get outgoing data size */ - if ( offset == RSP_RST_OFFSET - 1 ) { - reverse_copy(&rsp_size, &out[RSP_SIZE_OFFSET], - sizeof(rsp_size)); - } - } - } while ( offset < RSP_RST_OFFSET || - (offset < rsp_size && offset < *out_size) ); - - *out_size = (*out_size > rsp_size) ? rsp_size : *out_size; - - /* out buffer contains the complete outgoing data, get return code */ - reverse_copy(&ret, &out[RSP_RST_OFFSET], sizeof(ret)); - -//#ifdef TPM_TRACE -// { -// _XDPRINTF_("TPM: response size = %d\n", *out_size); -// _XDPRINTF_("TPM: response content: "); -// print_hex("TPM: \t", out, *out_size); -// } -//#endif - - memset(®_sts, 0, sizeof(reg_sts)); - reg_sts.command_ready = 1; - { - uint32_t value = pack_tpm_reg_sts_t(®_sts); - _write_tpm_reg(locality, TPM_REG_STS, &value, SIZE_TPM_REG_STS); - } -RelinquishControl: - /* deactivate current locality */ - unpack_tpm_reg_access_t(®_acc, 0); - //memset(®_acc, 0, SIZE_TPM_REG_ACCESS); - reg_acc.active_locality = 1; - { - uint8_t value = pack_tpm_reg_access_t(®_acc); - _write_tpm_reg(locality, TPM_REG_ACCESS, &value, SIZE_TPM_REG_ACCESS); - } - - return ret; -} - - - - - - - -//open TPM locality -static inline int xmhf_tpm_arch_x86vmx_open_locality(int locality){ - txt_didvid_t didvid; - txt_ver_fsbif_emif_t ver; - - // display chipset fuse and device and vendor id info - unpack_txt_didvid_t(&didvid, read_pub_config_reg(TXTCR_DIDVID)); - //_XDPRINTF_("\n%s: chipset ids: vendor: 0x%x, device: 0x%x, revision: 0x%x", __FUNCTION__, - // didvid.vendor_id, didvid.device_id, didvid.revision_id); - unpack_txt_ver_fsbif_emif_t(&ver, read_pub_config_reg(TXTCR_VER_FSBIF)); - if ( (pack_txt_ver_fsbif_emif_t(&ver) & 0xffffffff) == 0xffffffff || - (pack_txt_ver_fsbif_emif_t(&ver) & 0xffffffff) == 0x00 ) /* need to use VER.EMIF */ - unpack_txt_ver_fsbif_emif_t(&ver, read_pub_config_reg(TXTCR_VER_EMIF)); - //_XDPRINTF_("\n%s: chipset production fused: %x", __FUNCTION__, ver.prod_fused); - - if(txt_is_launched()) { - write_priv_config_reg(locality == 1 ? TXTCR_CMD_OPEN_LOCALITY1 - : TXTCR_CMD_OPEN_LOCALITY2, 0x01); - read_priv_config_reg(TXTCR_E2STS); /* just a fence, so ignore return */ - return 0; - } else { - //_XDPRINTF_("\n%s: ERROR: Locality opening UNIMPLEMENTED on Intel without SENTER\n", __FUNCTION__); - return 1; - } -} - -//open TPM locality -static inline int xmhf_tpm_arch_open_locality(int locality){ - return xmhf_tpm_arch_x86vmx_open_locality(locality); -} - - - - -//check if TPM is ready for use -static inline bool xmhf_tpm_is_tpm_ready(uint32_t locality){ - return xmhf_tpm_arch_is_tpm_ready(locality); -} - - - -//open TPM locality -static inline int xmhf_tpm_open_locality(int locality){ - /* We expect locality 1 or 2 */ - if(locality < 1 || locality > 2) { - return 1; - } - - if(xmhf_tpm_arch_open_locality(locality)) { - //_XDPRINTF_("\n%s: FAILED to open TPM locality %d\n", __FUNCTION__, locality); - return 1; - }; - - if(!xmhf_tpm_is_tpm_ready(locality)) { - //_XDPRINTF_("\n%s: ERROR TPM is not ready, failed to open locality %d\n", __FUNCTION__, locality); - return 1; - } - - //_XDPRINTF_("\n%s: opened TPM locality %d", __FUNCTION__, locality); - return 0; -} - - -//deactivate all TPM localities -static inline void xmhf_tpm_deactivate_all_localities(void){ - xmhf_tpm_arch_deactivate_all_localities(); -} - -//prepare TPM for use -static inline bool xmhf_tpm_prepare_tpm(void){ - return xmhf_tpm_arch_prepare_tpm(); -} - - -/* - * The _tpm_submit_cmd function comes with 2 global buffers: cmd_buf & rsp_buf. - * Before calling, caller should fill cmd arguements into cmd_buf via - * WRAPPER_IN_BUF macro. After calling, caller should fetch result from - * rsp_buffer via WRAPPER_OUT_BUF macro. - * cmd_buf content: - * 0 1 2 3 4 5 6 7 8 9 10 ... - * ------------------------------------------------------------- - * | TAG | SIZE | ORDINAL | arguments ... - * ------------------------------------------------------------- - * rsp_buf content: - * 0 1 2 3 4 5 6 7 8 9 10 ... - * ------------------------------------------------------------- - * | TAG | SIZE | RETURN CODE | other data ... - * ------------------------------------------------------------- - * - * locality : TPM locality (0 - 4) - * tag : The TPM command tag - * cmd : The TPM command ordinal - * arg_size : Size of argument data. - * out_size : IN/OUT paramter. The IN is the expected size of out data; - * the OUT is the size of output data within out buffer. - * The out_size MUST NOT be NULL. - * return : TPM_SUCCESS for success, for other error code, refer to the .h - */ - -/* static */ -static inline uint32_t _tpm_submit_cmd(uint32_t locality, uint16_t tag, uint32_t cmd, - uint32_t arg_size, uint32_t *out_size) -{ - uint32_t ret; - uint32_t cmd_size, rsp_size = 0; - - - if ( out_size == NULL ) { - //_XDPRINTF_("TPM: invalid param for _tpm_submit_cmd()\n"); - return TPM_BAD_PARAMETER; - } - - /* - * real cmd size should add 10 more bytes: - * 2 bytes for tag - * 4 bytes for size - * 4 bytes for ordinal - */ - cmd_size = CMD_HEAD_SIZE + arg_size; - - if ( cmd_size > TPM_CMD_SIZE_MAX ) { - //_XDPRINTF_("TPM: cmd exceeds the max supported size.\n"); - return TPM_BAD_PARAMETER; - } - - /* copy tag, size & ordinal into buf in a reversed byte order */ - reverse_copy(cmd_buf, &tag, sizeof(tag)); - reverse_copy(cmd_buf + CMD_SIZE_OFFSET, &cmd_size, sizeof(cmd_size)); - reverse_copy(cmd_buf + CMD_ORD_OFFSET, &cmd, sizeof(cmd)); - - rsp_size = RSP_HEAD_SIZE + *out_size; - rsp_size = (rsp_size > TPM_RSP_SIZE_MAX) ? TPM_RSP_SIZE_MAX: rsp_size; - ret = tpm_write_cmd_fifo(locality, cmd_buf, cmd_size, rsp_buf, &rsp_size); - - /* - * should subtract 10 bytes from real response size: - * 2 bytes for tag - * 4 bytes for size - * 4 bytes for return code - */ - rsp_size -= (rsp_size > RSP_HEAD_SIZE) ? RSP_HEAD_SIZE : rsp_size; - - if ( ret != TPM_SUCCESS ) - return ret; - - if ( *out_size == 0 || rsp_size == 0 ) - *out_size = 0; - else - *out_size = (rsp_size < *out_size) ? rsp_size : *out_size; - - return ret; -} - - -/*static inline*/ -static inline uint32_t tpm_submit_cmd(uint32_t locality, uint32_t cmd, - uint32_t arg_size, uint32_t *out_size) -{ - uint32_t rv; - //uint64_t start, end; - - //start = rdtsc64(); - rv = _tpm_submit_cmd(locality, TPM_TAG_RQU_COMMAND, cmd, - arg_size, out_size); - //end = rdtsc64(); - //_XDPRINTF_("TPM: PERF: Command 0x%08x consumed %lld cycles\n", cmd, end-start); - return rv; -} - - -/* static */ -static inline uint32_t tpm_get_capability( - uint32_t locality, tpm_capability_area_t cap_area, - uint32_t sub_cap_size, const uint8_t *sub_cap, - uint32_t *resp_size, uint8_t *resp) -{ - uint32_t ret, offset, out_size; - - if ( sub_cap == NULL || resp_size == NULL || resp == NULL ) { - //_XDPRINTF_("TPM: tpm_get_capability() bad parameter\n"); - return TPM_BAD_PARAMETER; - } - - offset = 0; - UNLOAD_INTEGER(WRAPPER_IN_BUF, offset, cap_area); - UNLOAD_INTEGER(WRAPPER_IN_BUF, offset, sub_cap_size); - UNLOAD_BLOB(WRAPPER_IN_BUF, offset, sub_cap, sub_cap_size); - - out_size = sizeof(*resp_size) + *resp_size; - - ret = tpm_submit_cmd(locality, TPM_ORD_GET_CAPABILITY, offset, &out_size); - -//#ifdef TPM_TRACE -// _XDPRINTF_("TPM: get capability, return value = %08X\n", ret); -//#endif - if ( ret != TPM_SUCCESS ) { - //_XDPRINTF_("TPM: get capability, return value = %08X\n", ret); - return ret; - } - - offset = 0; - LOAD_INTEGER(WRAPPER_OUT_BUF, offset, *resp_size); - if ( out_size < sizeof(*resp_size) + *resp_size ) { - //_XDPRINTF_("TPM: capability response too small\n"); - return TPM_FAIL; - } - LOAD_BLOB(WRAPPER_OUT_BUF, offset, resp, *resp_size); - - return ret; -} - -#endif //__ASSEMBLY__ - -#endif //__XMHF_TPM_ARCH_X86_H__ diff --git a/uxmhf/xmhf-bootloader/_txt_acmod.h b/uxmhf/xmhf-bootloader/_txt_acmod.h deleted file mode 100644 index 7ad77150fa..0000000000 --- a/uxmhf/xmhf-bootloader/_txt_acmod.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * acmod.c: support functions for use of Intel(r) TXT Authenticated - * Code (AC) Modules - * - * Copyright (c) 2003-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.04 - * - * XXX TODO: [Almost?] All of this is only needed in init; pull out of - * common include directory to reduce SL/Runtime TCB. - */ - -#ifndef __TXT_ACMOD_H__ -#define __TXT_ACMOD_H__ - -/* - * authenticated code (AC) module header (ver 0.0) - */ - -/*typedef union { - uint16_t _raw; - struct { - uint16_t reserved : 14; - uint16_t pre_production : 1; - uint16_t debug_signed : 1; - }; -} acm_flags_t;*/ - -typedef uint16_t acm_flags_t; - -#define ACM_FLAGS_T_PRE_PRODUCTION (1 << 15) -#define ACM_FLAGS_T_DEBUG_SIGNED (1 << 16) - - -typedef struct { - uint32_t module_type; - uint32_t header_len; - uint32_t header_ver; /* currently 0.0 */ - uint16_t chipset_id; - acm_flags_t flags; - uint32_t module_vendor; - uint32_t date; - uint32_t size; - uint32_t reserved1; - uint32_t code_control; - uint32_t error_entry_point; - uint32_t gdt_limit; - uint32_t gdt_base; - uint32_t seg_sel; - uint32_t entry_point; - uint8_t reserved2[64]; - uint32_t key_size; - uint32_t scratch_size; - uint8_t rsa2048_pubkey[256]; - uint32_t pub_exp; - uint8_t rsa2048_sig[256]; - uint32_t scratch[143]; - uint8_t user_area[]; -} acm_hdr_t; - -/* value of module_type field */ -#define ACM_TYPE_CHIPSET 0x02 - -/* value of module_vendor field */ -#define ACM_VENDOR_INTEL 0x8086 - -typedef struct { - uuid_t uuid; - uint8_t chipset_acm_type; - uint8_t version; /* currently 3 */ - uint16_t length; - uint32_t chipset_id_list; - uint32_t os_sinit_data_ver; - uint32_t min_mle_hdr_ver; - txt_caps_t capabilities; - uint8_t acm_ver; - uint8_t reserved[3]; -} acm_info_table_t; - -/* ACM UUID value */ -#define ACM_UUID_V3 {0x7fc03aaa, 0x46a7, 0x18db, 0xac2e, \ - {0x69, 0x8f, 0x8d, 0x41, 0x7f, 0x5a}} - -/* chipset_acm_type field values */ -#define ACM_CHIPSET_TYPE_BIOS 0x00 -#define ACM_CHIPSET_TYPE_SINIT 0x01 - -typedef struct { - uint32_t flags; - uint16_t vendor_id; - uint16_t device_id; - uint16_t revision_id; - uint16_t reserved; - uint32_t extended_id; -} acm_chipset_id_t; - -typedef struct { - uint32_t count; - acm_chipset_id_t chipset_ids[]; -} acm_chipset_id_list_t; - -extern void print_uuid(const uuid_t *uuid); -extern void print_txt_caps(const char *prefix, txt_caps_t caps); -extern bool is_sinit_acmod(void *acmod_base, size_t acmod_size, bool quiet); -extern bool does_acmod_match_chipset(acm_hdr_t* hdr); -extern acm_hdr_t *copy_sinit(acm_hdr_t *sinit); -extern bool verify_acmod(acm_hdr_t *acm_hdr); -extern uint32_t get_supported_os_sinit_data_ver(acm_hdr_t* hdr); -extern uint32_t get_sinit_capabilities(acm_hdr_t* hdr); -#endif /* __TXT_ACMOD_H__ */ - -/* - * Local variables: - * mode: C - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/uxmhf/xmhf-bootloader/cmdline.c b/uxmhf/xmhf-bootloader/cmdline.c deleted file mode 100644 index 41a0beac11..0000000000 --- a/uxmhf/xmhf-bootloader/cmdline.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * cmdline.c: command line parsing fns - * - * Copyright (c) 2006-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** - * Modified for XMHF by Amit Vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - -#include "cmdline.h" - - -#ifndef ULONG_MAX -#define ULONG_MAX 0xFFFFFFFFUL -#endif - -/* - * Convert a string to an unsigned long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -static unsigned long cmdline_strtoul(const char *nptr, const char **endptr, unsigned int base) -{ - const char *s = nptr; - unsigned long acc; - unsigned char c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = ULONG_MAX; - } else if (neg) - acc = -acc; - if (endptr != 0) - *((const char **)endptr) = any ? s - 1 : nptr; - return (acc); -} - - -const char* cmdline_get_option_val(const cmdline_option_t *options, - char vals[][MAX_VALUE_LEN], - const char *opt_name) -{ - int i; - for ( i = 0; options[i].name != NULL; i++ ) { - if ( strcmp(options[i].name, opt_name) == 0 ) - return vals[i]; - } - _XDPRINTF_("requested unknown option: %s\n", opt_name); - return NULL; -} - -void cmdline_parse(const char *cmdline, const cmdline_option_t *options, - char vals[][MAX_VALUE_LEN]) -{ - const char *p = cmdline; - int i; - - /* copy default values to vals[] */ - for ( i = 0; options[i].name != NULL; i++ ) { - strncpy(vals[i], options[i].def_val, MAX_VALUE_LEN-1); - vals[i][MAX_VALUE_LEN-1] = '\0'; - } - - if ( p == NULL ) - return; - - /* parse options */ - while ( true ) - { - /* skip whitespace */ - while ( isspace(*p) ) - p++; - if ( *p == '\0' ) - break; - - { - /* find end of current option */ - const char *opt_start = p; - const char *opt_end = strchr(opt_start, ' '); - if ( opt_end == NULL ) - opt_end = opt_start + strlen(opt_start); - p = opt_end; - - { - /* find value part; if no value found, use default and continue */ - const char *val_start = strchr(opt_start, '='); - if ( val_start == NULL || val_start > opt_end ) - continue; - val_start++; - - { - unsigned int opt_name_size = val_start - opt_start - 1; - unsigned int copy_size = opt_end - val_start; - if ( copy_size > MAX_VALUE_LEN - 1 ) - copy_size = MAX_VALUE_LEN - 1; - if ( opt_name_size == 0 || copy_size == 0 ) - continue; - - /* value found, so copy it */ - for ( i = 0; options[i].name != NULL; i++ ) { - if ( strncmp(options[i].name, opt_start, opt_name_size ) == 0 ) { - strncpy(vals[i], val_start, copy_size); - vals[i][copy_size] = '\0'; /* add '\0' to the end of string */ - break; - } - } - } - } - } - } -} - - - - - - - - - - - - -/* - * copy of original command line - * part of tboot measurement (hence in .text section) - * FIXME - is this getting measured? - */ -char g_cmdline[MAX_CMDLINE_SIZE] = { 0 }; - -/* - * the option names and default values must be separate from the actual - * params entered - * this allows the names and default values to be part of the MLE measurement - * param_values[] need to be in .bss section so that will get cleared on launch - */ - -/* global option array for command line */ -static const cmdline_option_t g_tboot_cmdline_options[] = { - { "loglvl", "all" }, /* all|none */ - { "logging", "serial,vga" }, /* vga,serial,memory|none */ - { "serial", "115200,8n1,0x3f8" }, - /* serial=[/][,[,[,[,[,]]]]] */ - - /* { "vga_delay", "0" }, /\* # secs *\/ */ - /* { "no_usb", "true" }, /\* true|false *\/ */ - { NULL, NULL } -}; - -static const cmdline_option_t g_linux_cmdline_options[] = { - { "vga", "" }, - { "mem", "" }, - { NULL, NULL } -}; -/* static char g_linux_param_values[ARRAY_SIZE(g_linux_cmdline_options)][MAX_VALUE_LEN]; */ -static char g_tboot_param_values[ARRAY_SIZE(g_tboot_cmdline_options)][MAX_VALUE_LEN]; - - -void tboot_parse_cmdline(void) -{ - cmdline_parse(g_cmdline, g_tboot_cmdline_options, g_tboot_param_values); -} - - -#if defined (__DEBUG_SERIAL__) - -static bool parse_com_fmt(const char **fmt) -{ - /* fmt: <5|6|7|8><0|1> */ - /* default 8n1 */ - /* uint8_t data_bits = 8; */ - /* uint8_t parity = 'n'; */ - /* uint8_t stop_bits = 1; */ - - /* must specify all values */ - if ( strlen(*fmt) < 3 ) - return false; - - /* data bits */ - if ( **fmt >= '5' && **fmt <= '8' ) - g_uart_config.data_bits = **fmt - '0'; - else - return false; - (*fmt)++; - - /* parity */ - if ( **fmt == 'n' || **fmt == 'o' || **fmt == 'e' || **fmt == 'm' || - **fmt == 's' ) - g_uart_config.parity = - (**fmt == 'n') - ? PARITY_NONE - : (**fmt == 'o') - ? PARITY_ODD - : (**fmt == 'e') - ? PARITY_EVEN - : (**fmt == 'm') - ? PARITY_MARK - : PARITY_SPACE; - else - return false; - (*fmt)++; - - /* stop bits */ - if ( **fmt == '0' || **fmt == '1' ) - g_uart_config.stop_bits = **fmt - '0'; - else - return false; - (*fmt)++; - - return true; -} - -static bool parse_serial_param(const char *com) -{ - /* parse baud */ - g_uart_config.baud = cmdline_strtoul(com, &com, 10); - if ( (g_uart_config.baud < 1200) || - (g_uart_config.baud > 115200) ) - return false; - - /* parse clock hz */ - if ( *com == '/' ) { - ++com; - g_uart_config.clock_hz = cmdline_strtoul(com, &com, 0) << 4; - if ( g_uart_config.clock_hz == 0 ) - return false; - } - - /* parse data_bits/parity/stop_bits */ - if ( *com != ',' ) - goto exit; - ++com; - while ( isspace(*com) ) - com++; - if ( !parse_com_fmt(&com) ) - return false; - - /* parse IO base */ - if ( *com != ',' ) - goto exit; - ++com; - g_uart_config.port = cmdline_strtoul(com, &com, 0); - if ( g_uart_config.port == 0 ) - return false; - - /* we don't handle additional params */ - if ( *com == ',' ) { - return false; - } - - - exit: - return true; -} - -bool get_tboot_serial(void) -{ - const char *serial = cmdline_get_option_val(g_tboot_cmdline_options, - g_tboot_param_values, "serial"); - if ( serial == NULL || *serial == '\0' ) - return false; - - return parse_serial_param(serial); -} - -#endif - diff --git a/uxmhf/xmhf-bootloader/cmdline.h b/uxmhf/xmhf-bootloader/cmdline.h deleted file mode 100644 index ebd5783363..0000000000 --- a/uxmhf/xmhf-bootloader/cmdline.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#ifndef __COMMAND_LINE_H__ -#define __COMMAND_LINE_H__ - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -#endif /* ARRAY_SIZE */ - -typedef struct { - const char *name; /* set to NULL for last item in list */ - const char *def_val; -} cmdline_option_t; - -#define MAX_VALUE_LEN 64 -#define MAX_CMDLINE_SIZE 512 - -const char* cmdline_get_option_val(const cmdline_option_t *options, - char vals[][MAX_VALUE_LEN], - const char *opt_name); - -void cmdline_parse(const char *cmdline, const cmdline_option_t *options, - char vals[][MAX_VALUE_LEN]); - -#endif /* __COMMAND_LINE_H__ */ diff --git a/uxmhf/xmhf-bootloader/init.c b/uxmhf/xmhf-bootloader/init.c deleted file mode 100644 index d0cc69a3e7..0000000000 --- a/uxmhf/xmhf-bootloader/init.c +++ /dev/null @@ -1,1227 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -//init.c - EMHF early initialization blob functionality -//author: amit vasudevan (amitvasudevan@acm.org) - -//---includes------------------------------------------------------------------- -#include -#include -#include -#include - -//#include - -#include -//#include -#include "cmdline.h" - -#include "_txt_hash.h" -#include "_txt_acmod.h" -#include "_tpm.h" -#include "_multiboot.h" - -////libxmhfdebug -//uint32_t libxmhfdebug_lock = 1; - - - - -//the vcpu structure which holds the current state of a core -typedef struct _bootvcpu { - uint32_t esp; //used to establish stack for the CPU - uint32_t id; //LAPIC id of the core - uint32_t cpu_vendor; //Intel or AMD - uint32_t isbsp; //1 if this core is BSP else 0 -} __attribute__((packed)) BOOTVCPU; - -#define SIZE_STRUCT_BOOTVCPU (sizeof(struct _bootvcpu)) - -//---forward prototypes--------------------------------------------------------- -uint32_t smp_getinfo(PCPU *pcpus, uint32_t *num_pcpus); -void cstartup(multiboot_info_t *mbi); -MPFP * MP_GetFPStructure(void); -uint32_t _MPFPComputeChecksum(uint32_t spaddr, uint32_t size); -uint32_t isbsp(void); - -//---globals-------------------------------------------------------------------- - __attribute__(( section(".data") )) PCPU pcpus[MAX_PCPU_ENTRIES]; -uint32_t pcpus_numentries=0; - __attribute__(( section(".data") )) uint32_t cpu_vendor; //CPU_VENDOR_INTEL or CPU_VENDOR_AMD - __attribute__(( section(".data") )) uint32_t hypervisor_image_baseaddress; //2M aligned highest physical memory address -//where the hypervisor binary is relocated to - __attribute__(( section(".data") )) GRUBE820 grube820list[MAX_E820_ENTRIES]; -uint32_t grube820list_numentries=0; //actual number of e820 entries returned -//by grub - -//master-id table which holds LAPIC ID to BOOTVCPU mapping for each physical core -MIDTAB midtable[MAX_MIDTAB_ENTRIES] __attribute__(( section(".data") )); - -//number of physical cores in the system -uint32_t midtable_numentries=0; - -//BOOTVCPU buffers for all cores -BOOTVCPU vcpubuffers[MAX_VCPU_ENTRIES] __attribute__(( section(".data") )); - -//initial stacks for all cores -uint8_t cpustacks[RUNTIME_STACK_SIZE * MAX_PCPU_ENTRIES] __attribute__(( section(".stack") )); - -XMHF_BOOTINFO *xslbootinfo = NULL; - -/* TODO: refactor to eliminate a lot of these globals, or at least use - * static where appropriate */ -static uint8_t *g_sinit_module_ptr = NULL; -static uint32_t g_sinit_module_size = 0; - -extern void init_core_lowlevel_setup(void); - -extern char g_cmdline[MAX_CMDLINE_SIZE]; -extern void tboot_parse_cmdline(void); -//extern void get_tboot_loglvl(void); -//extern void get_tboot_log_targets(void); -extern bool get_tboot_serial(void); -extern void get_tboot_baud(void); -extern void get_tboot_fmt(void); - -/* Don't break the build if the Makefile fails to define these. */ -#ifndef ___RUNTIME_INTEGRITY_HASH___ -#define ___RUNTIME_INTEGRITY_HASH___ BAD_INTEGRITY_HASH -#endif /* ___RUNTIME_INTEGRITY_HASH___ */ -#ifndef ___SLABOVE64K_INTEGRITY_HASH___ -#define ___SLABOVE64K_INTEGRITY_HASH___ BAD_INTEGRITY_HASH -#endif /* ___SLABOVE64K_INTEGRITY_HASH___ */ -#ifndef ___SLBELOW64K_INTEGRITY_HASH___ -#define ___SLBELOW64K_INTEGRITY_HASH___ BAD_INTEGRITY_HASH -#endif /* ___SLBELOW64K_INTEGRITY_HASH___ */ - -// we should get all of these from the build process, but don't forget -// that here in 'init' these values are UNTRUSTED -/*INTEGRITY_MEASUREMENT_VALUES g_init_gold = { - .sha_runtime = ___RUNTIME_INTEGRITY_HASH___, - .sha_slabove64K = ___SLABOVE64K_INTEGRITY_HASH___, - .sha_slbelow64K = ___SLBELOW64K_INTEGRITY_HASH___ -}; -*/ -//size of SL + runtime in bytes -//size_t sl_rt_size; - - -void skinit(unsigned long eax) { - /*__asm__("mov %0, %%eax": :"r" (eax)); - __asm__("skinit %%eax":);*/ - _XDPRINTF_("%s: AMD SKINIT currently voided out. Halting!\n", __func__); - HALT(); -} - - -//---MP config table handling--------------------------------------------------- -void dealwithMP(void){ - if(!smp_getinfo(pcpus, &pcpus_numentries)){ - _XDPRINTF_("\nFatal error with SMP detection. Halting!"); - HALT(); - } -} - - -//---microsecond delay---------------------------------------------------------- -void udelay(uint32_t usecs){ - uint8_t val; - uint32_t latchregval; - - //enable 8254 ch-2 counter - val = inb(0x61); - val &= 0x0d; //turn PC speaker off - val |= 0x01; //turn on ch-2 - outb(val, 0x61); - - //program ch-2 as one-shot - outb(0xB0, 0x43); - - //compute appropriate latch register value depending on usecs - latchregval = (1193182 * usecs) / 1000000; - - //write latch register to ch-2 - val = (uint8_t)latchregval; - outb(val, 0x42); - val = (uint8_t)((uint32_t)latchregval >> (uint32_t)8); - outb(val , 0x42); - - //wait for countdown - while(!(inb(0x61) & 0x20)); - - //disable ch-2 counter - val = inb(0x61); - val &= 0x0c; - outb(val, 0x61); -} - - -//---INIT IPI routine----------------------------------------------------------- -void send_init_ipi_to_all_APs(void) { - uint32_t eax, edx; - uint64_t msr_value; - volatile uint32_t *icr; - uint32_t timeout = 0x01000000; - - //read LAPIC base address from MSR - msr_value = rdmsr64( MSR_APIC_BASE); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - - HALT_ON_ERRORCOND( edx == 0 ); //APIC is below 4G - _XDPRINTF_("\nLAPIC base and status=0x%08x", eax); - - icr = (uint32_t *) (((uint32_t)eax & 0xFFFFF000UL) + 0x300); - - //send INIT - _XDPRINTF_("\nSending INIT IPI to all APs..."); - *icr = 0x000c4500UL; - udelay(10000); - //wait for command completion - { - uint32_t val; - do{ - val = *icr; - }while(--timeout > 0 && (val & 0x1000) ); - } - if(timeout == 0) { - _XDPRINTF_("\nERROR: send_init_ipi_to_all_APs() TIMEOUT!\n"); - } - _XDPRINTF_("\nDone.\n"); -} - - - -//---E820 parsing and handling-------------------------------------------------- -//runtimesize is assumed to be 2M aligned -uint32_t dealwithE820(multiboot_info_t *mbi, uint32_t runtimesize __attribute__((unused))){ - //check if GRUB has a valid E820 map - if(!(mbi->flags & MBI_MEMMAP)){ - _XDPRINTF_("\n%s: no E820 map provided. HALT!", __func__); - HALT(); - } - - //zero out grub e820 list - memset((void *)&grube820list, 0, sizeof(GRUBE820)*MAX_E820_ENTRIES); - - //grab e820 list into grube820list - { - memory_map_t *mmap; - for ( mmap = (memory_map_t *) mbi->mmap_addr; - (unsigned long) mmap < mbi->mmap_addr + mbi->mmap_length; - mmap = (memory_map_t *) ((unsigned long) mmap - + mmap->size + sizeof (mmap->size))){ - grube820list[grube820list_numentries].baseaddr_low = mmap->base_addr_low; - grube820list[grube820list_numentries].baseaddr_high = mmap->base_addr_high; - grube820list[grube820list_numentries].length_low = mmap->length_low; - grube820list[grube820list_numentries].length_high = mmap->length_high; - grube820list[grube820list_numentries].type = mmap->type; - grube820list_numentries++; - } - } - - //debug: print grube820list - { - uint32_t i; - _XDPRINTF_("\noriginal system E820 map follows:\n"); - for(i=0; i < grube820list_numentries; i++){ - _XDPRINTF_("\n0x%08x%08x, size=0x%08x%08x (%u)", - grube820list[i].baseaddr_high, grube820list[i].baseaddr_low, - grube820list[i].length_high, grube820list[i].length_low, - grube820list[i].type); - } - - } - - //traverse e820 list forward to find an entry with type=0x1 (free) - //with free amount of memory for runtime - { - uint32_t foundentry=0; - uint32_t slruntimephysicalbase=__TARGET_BASE_XMHF; //SL + runtime base - uint32_t i; - - //for(i= (int)(grube820list_numentries-1); i >=0; i--){ - for(i= 0; i < grube820list_numentries; i++){ - uint32_t baseaddr, size; - baseaddr = grube820list[i].baseaddr_low; - size = grube820list[i].length_low; - - if(grube820list[i].type == 0x1){ //free memory? - if(grube820list[i].baseaddr_high) //greater than 4GB? then skip - continue; - - if(grube820list[i].length_high){ - _XDPRINTF_("\n%s: E820 parsing error (64-bit length for < 4GB). HALT!"); - HALT(); - } - - //check if this E820 range can accomodate SL + runtime - if( slruntimephysicalbase >= baseaddr && (slruntimephysicalbase + runtimesize) < (baseaddr + size) ){ - foundentry=1; - break; - } - } - } - - if(!foundentry){ - _XDPRINTF_("\n%s: unable to find E820 memory for SL+runtime. HALT!"); - HALT(); - } - - //entry number we need to split is indexed by i - _XDPRINTF_("\nproceeding to revise E820..."); - - { - - //temporary E820 table with index - GRUBE820 te820[MAX_E820_ENTRIES]; - uint32_t j=0; - - //copy all entries from original E820 table until index i - for(j=0; j < i; j++) - memcpy((void *)&te820[j], (void *)&grube820list[j], sizeof(GRUBE820)); - - //we need a maximum of 2 extra entries for the final table, make a sanity check - HALT_ON_ERRORCOND( (grube820list_numentries+2) < MAX_E820_ENTRIES ); - - //split entry i into required number of entries depending on the memory range alignments - if( (slruntimephysicalbase == grube820list[i].baseaddr_low) && ((slruntimephysicalbase+runtimesize) == (grube820list[i].baseaddr_low+grube820list[i].length_low)) ){ - //exact match, no split - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=grube820list[i].baseaddr_low; te820[j].length_low=grube820list[i].length_low; te820[j].type=grube820list[i].type; - j++; - i++; - }else if ( (slruntimephysicalbase == grube820list[i].baseaddr_low) && (runtimesize < grube820list[i].length_low) ){ - //left aligned, split into 2 - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=grube820list[i].baseaddr_low; te820[j].length_low=runtimesize; te820[j].type=0x2; - j++; - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=grube820list[i].baseaddr_low+runtimesize; te820[j].length_low=grube820list[i].length_low-runtimesize; te820[j].type=1; - j++; - i++; - }else if ( ((slruntimephysicalbase+runtimesize) == (grube820list[i].baseaddr_low+grube820list[i].length_low)) && slruntimephysicalbase > grube820list[i].baseaddr_low ){ - //right aligned, split into 2 - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=grube820list[i].baseaddr_low; te820[j].length_low=slruntimephysicalbase-grube820list[i].baseaddr_low; te820[j].type=0x1; - j++; - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low= slruntimephysicalbase; te820[j].length_low=runtimesize; te820[j].type=0x1; - j++; - i++; - }else{ - //range in the middle, split into 3 - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=grube820list[i].baseaddr_low; te820[j].length_low=slruntimephysicalbase-grube820list[i].baseaddr_low; te820[j].type=0x1; - j++; - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=slruntimephysicalbase; te820[j].length_low=runtimesize; te820[j].type=0x2; - j++; - te820[j].baseaddr_high=0; te820[j].length_high=0; te820[j].baseaddr_low=slruntimephysicalbase+runtimesize; te820[j].length_low=grube820list[i].length_low-runtimesize-(slruntimephysicalbase-grube820list[i].baseaddr_low); te820[j].type=1; - j++; - i++; - } - - //copy entries i through end of original E820 list into temporary E820 list starting at index j - while(i < grube820list_numentries){ - memcpy((void *)&te820[j], (void *)&grube820list[i], sizeof(GRUBE820)); - i++; - j++; - } - - //copy temporary E820 list into global E20 list and setup final E820 entry count - grube820list_numentries = j; - memcpy((void *)&grube820list, (void *)&te820, (grube820list_numentries * sizeof(GRUBE820)) ); - } - - _XDPRINTF_("\nE820 revision complete."); - - //debug: print grube820list - { - uint32_t i; - _XDPRINTF_("\nrevised system E820 map follows:\n"); - for(i=0; i < grube820list_numentries; i++){ - _XDPRINTF_("\n0x%08x%08x, size=0x%08x%08x (%u)", - grube820list[i].baseaddr_high, grube820list[i].baseaddr_low, - grube820list[i].length_high, grube820list[i].length_low, - grube820list[i].type); - } - } - - - return slruntimephysicalbase; - } - -} - -/* Run tests to determine if platform supports TXT. Note that this - * enables SMX on the platform, but is safe to run more than once. */ -/* Based primarily on tboot-20101005's txt/verify.c */ -bool txt_supports_txt(void) { - - uint32_t cpuid_ext_feat_info, dummy; - uint64_t feat_ctrl_msr; - capabilities_t cap; - - xmhfhw_cpu_cpuid(1, &dummy, &dummy, &cpuid_ext_feat_info, &dummy); - feat_ctrl_msr = rdmsr64(MSR_EFCR); - - /* Check for VMX support */ - if ( !(cpuid_ext_feat_info & CPUID_X86_FEATURE_VMX) ) { - _XDPRINTF_("ERR: CPU does not support VMX\n"); - return false; - } - _XDPRINTF_("CPU is VMX-capable\n"); - /* and that VMX is enabled in the feature control MSR */ - if ( !(feat_ctrl_msr & IA32_FEATURE_CONTROL_MSR_ENABLE_VMX_IN_SMX) ) { - _XDPRINTF_("ERR: VMXON disabled by feature control MSR (%llx)\n", - feat_ctrl_msr); - return false; - } - - - /* Check that processor supports SMX instructions */ - if ( !(cpuid_ext_feat_info & CPUID_X86_FEATURE_SMX) ) { - _XDPRINTF_("ERR: CPU does not support SMX\n"); - return false; - } - _XDPRINTF_("CPU is SMX-capable\n"); - - /* and that SENTER (w/ full params) is enabled */ - if ( !(feat_ctrl_msr & (IA32_FEATURE_CONTROL_MSR_ENABLE_SENTER | - IA32_FEATURE_CONTROL_MSR_SENTER_PARAM_CTL)) ) { - _XDPRINTF_("ERR: SENTER disabled by feature control MSR (%llx)\n", - feat_ctrl_msr); - return false; - } - _XDPRINTF_("SENTER should work.\n"); - - /* testing for chipset support requires enabling SMX on the processor */ - write_cr4(read_cr4(CASM_NOPARAM) | CR4_SMXE); - _XDPRINTF_("SMX enabled in CR4\n"); - - /* Verify that an TXT-capable chipset is present and check that - * all needed SMX capabilities are supported. */ - - unpack_capabilities_t(&cap, __getsec_capabilities(0)); - if(!cap.chipset_present) { - _XDPRINTF_("ERR: TXT-capable chipset not present\n"); - return false; - } - if (!(cap.senter && cap.sexit && cap.parameters && cap.smctrl && - cap.wakeup)) { - _XDPRINTF_("ERR: insufficient SMX capabilities (0x%08x)\n", pack_capabilities_t(&cap)); - return false; - } - _XDPRINTF_("TXT chipset and all needed capabilities (0x%08x) present\n", pack_capabilities_t(&cap)); - - return true; -} - -/* Inspired by tboot-20101005/tboot/txt/verify.c */ -tb_error_t txt_verify_platform(void) -{ - txt_heap_t *txt_heap; - txt_ests_t ests; - - _XDPRINTF_("txt_verify_platform\n"); - - /* check TXT supported */ - if(!txt_supports_txt()) { - _XDPRINTF_("FATAL ERROR: TXT not suppported\n"); - HALT(); - } - - /* check is TXT_RESET.STS is set, since if it is SENTER will fail */ - //ests = (txt_ests_t)read_pub_config_reg(TXTCR_ESTS); - unpack_txt_ests_t(&ests, read_pub_config_reg(TXTCR_ESTS)); - if ( ests.txt_reset_sts ) { - _XDPRINTF_("TXT_RESET.STS is set and SENTER is disabled (%llx)\n", - pack_txt_ests_t(&ests)); - return TB_ERR_SMX_NOT_SUPPORTED; - } - - /* verify BIOS to OS data */ - txt_heap = get_txt_heap(); - if ( !verify_bios_data(txt_heap) ) - return TB_ERR_FATAL; - - return TB_ERR_NONE; -} - - -/* Read values in TXT status registers */ -/* Some tboot-20101005 code from tboot/txt/errors.c */ -void txt_status_regs(void) { - txt_errorcode_t err; - txt_ests_t ests; - txt_e2sts_t e2sts; - txt_errorcode_sw_t sw_err; - acmod_error_t acmod_err; - - //err = (txt_errorcode_t)read_pub_config_reg(TXTCR_ERRORCODE); - unpack_txt_errorcode_t(&err, read_pub_config_reg(TXTCR_ERRORCODE)); - _XDPRINTF_("TXT.ERRORCODE=%llx\n", pack_txt_errorcode_t(&err)); - - /* AC module error (don't know how to parse other errors) */ - if ( err.valid ) { - if ( err.external == 0 ) /* processor error */ - _XDPRINTF_("\t processor error %x\n", (uint32_t)err.type); - else { /* external SW error */ - unpack_txt_errorcode_sw_t(&sw_err, err.type); - if ( sw_err.src == 1 ) /* unknown SW error */ - _XDPRINTF_("unknown SW error %x:%x\n", sw_err.err1, sw_err.err2); - else { /* ACM error */ - unpack_acmod_error_t(&acmod_err, pack_txt_errorcode_sw_t(&sw_err)); - _XDPRINTF_("AC module error : acm_type=%x, progress=%02x, " - "error=%x\n", acmod_err.acm_type, acmod_err.progress, - acmod_err.error); - /* error = 0x0a, progress = 0x0d => error2 is a TPM error */ - if ( acmod_err.error == 0x0a && acmod_err.progress == 0x0d ) - _XDPRINTF_("TPM error code = %x\n", acmod_err.error2); - } - } - } - - /* - * display LT.ESTS error - */ - //ests = (txt_ests_t)read_pub_config_reg(TXTCR_ESTS); - unpack_txt_ests_t(&ests, read_pub_config_reg(TXTCR_ESTS)); - _XDPRINTF_("LT.ESTS=%llx\n", pack_txt_ests_t(&ests)); - - /* - * display LT.E2STS error - * - only valid if LT.WAKE-ERROR.STS set in LT.STS reg - */ - if ( ests.txt_wake_error_sts ) { - //e2sts = (txt_e2sts_t)read_pub_config_reg(TXTCR_E2STS); - unpack_txt_e2sts_t(&e2sts, read_pub_config_reg(TXTCR_E2STS)); - _XDPRINTF_("LT.E2STS=%llx\n", pack_txt_e2sts_t(&e2sts)); - } -} - -/* Transfer control to the SL using GETSEC[SENTER] */ -/*///XXX TODO not fully functional yet. Expected flow: -txt_prepare_cpu(); -txt_verify_platform(); -// Legacy USB? - // disable legacy USB #SMIs - get_tboot_no_usb(); - disable_smis(); -prepare_tpm(); -txt_launch_environment(mbi);*/ - -bool txt_do_senter(void *phys_mle_start, size_t mle_size) { - tb_error_t err; - - txt_status_regs(); - - if((err = txt_verify_platform()) != TB_ERR_NONE) { - _XDPRINTF_("ERROR: txt_verify_platform returned 0x%08x\n", (uint32_t)err); - return false; - } - if(!txt_prepare_cpu()) { - _XDPRINTF_("ERROR: txt_prepare_cpu failed.\n"); - return false; - } - - ///XXX TODO get addresses of SL, populate a mle_hdr_t - txt_launch_environment(g_sinit_module_ptr, g_sinit_module_size, - phys_mle_start, mle_size); - - return false; /* unreachable if launch is successful, thus should return failure */ -} - -/** - * Check each module to see if it is an SINIT module. If it is, set - * the globals g_sinit_module_ptr and g_sinit_module_size to point to - * it. - * - * Returns true if an SINIT module was found, false otherwise. - */ -static bool txt_parse_sinit(module_t *mod_array, unsigned int mods_count) { - int i; - unsigned int bytes; - - /* I can't think of a legitimate reason why this would ever be - * this large. */ - if(mods_count > 10) { - return false; - } - - for(i=(int)mods_count-1; i >= 0; i--) { - bytes = mod_array[i].mod_end - mod_array[i].mod_start; - _XDPRINTF_("Checking whether MBI module %i is SINIT...\n", i); - if(is_sinit_acmod((void*)mod_array[i].mod_start, bytes, false)) { - g_sinit_module_ptr = (uint8_t*)mod_array[i].mod_start; - g_sinit_module_size = bytes; - _XDPRINTF_("YES! SINIT found @ %p, %d bytes\n", - g_sinit_module_ptr, g_sinit_module_size); - return true; - } else { - _XDPRINTF_("no.\n"); - } - } - - return false; -} - -//---svm_verify_platform------------------------------------------------------- -//do some basic checks on SVM platform to ensure DRTM should work as expected -static bool svm_verify_platform(void) __attribute__((unused)); -static bool svm_verify_platform(void) -{ - uint32_t eax, edx, ebx, ecx; - uint64_t msr_value; - uint64_t efer; - - xmhfhw_cpu_cpuid(0x80000001, &eax, &ebx, &ecx, &edx); - - if ((ecx & SVM_CPUID_FEATURE) == 0) { - _XDPRINTF_("ERR: CPU does not support AMD SVM\n"); - return false; - } - - /* Check whether SVM feature is disabled in BIOS */ - msr_value = rdmsr64( VM_CR_MSR); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - - if (eax & VM_CR_SVME_DISABLE) { - _XDPRINTF_("ERR: AMD SVM Extension is disabled in BIOS\n"); - return false; - } - - /* Turn on SVM */ - efer = rdmsr64(MSR_EFER) | (1<> 32)); - efer = rdmsr64(MSR_EFER); - if ((efer & (1< this is implicit in even getting this far */ - /* since our bootstrap code loads a GDT, etc. */ - - /* must be in protected mode */ - cr0 = read_cr0(CASM_NOPARAM); - if (!(cr0 & CR0_PE)) { - _XDPRINTF_("ERR: not in protected mode\n"); - return false; - } - - /* make sure the APIC is enabled */ - apicbase = rdmsr64(MSR_APIC_BASE); - if (!(apicbase & MSR_IA32_APICBASE_ENABLE)) { - _XDPRINTF_("APIC disabled\n"); - return false; - } - - /* verify all machine check status registers are clear */ - - /* no machine check in progress (IA32_MCG_STATUS.MCIP=1) */ - mcg_stat = rdmsr64(MSR_MCG_STATUS); - if (mcg_stat & 0x04) { - _XDPRINTF_("machine check in progress\n"); - return false; - } - - /* all machine check regs are clear */ - mcg_cap = rdmsr64(MSR_MCG_CAP); - bound = (uint32_t)mcg_cap & 0x000000ff; - for (i = 0; i < bound; i++) { - mcg_stat = rdmsr64(MSR_MC0_STATUS + 4*i); - if (mcg_stat & (1ULL << 63)) { - _XDPRINTF_("MCG[%d] = %llx ERROR\n", i, mcg_stat); - return false; - } - } - - _XDPRINTF_("no machine check errors\n"); - - /* clear microcode on all the APs handled in mp_cstartup() */ - /* put all APs in INIT handled in do_drtm() */ - - /* all is well with the processor state */ - _XDPRINTF_("CPU is ready for SKINIT\n"); - - return true; -} - -//---do_drtm-------------------------------------------------------------------- -//this establishes a dynamic root of trust -//inputs: -//cpu_vendor = intel or amd -//slbase= physical memory address of start of sl -void do_drtm(BOOTVCPU __attribute__((unused))*vcpu, uint32_t slbase, size_t mle_size __attribute__((unused))){ -#if !defined (__DRT__) - uint32_t sl_entry_point; - uint16_t *sl_entry_point_offset = (uint16_t *)slbase; - //typedef void(*FCALL)(void); - FCALL invokesl; -#endif - - -//#ifdef __MP_VERSION__ - HALT_ON_ERRORCOND(vcpu->id == 0); - //send INIT IPI to all APs - send_init_ipi_to_all_APs(); - _XDPRINTF_("\nINIT(early): sent INIT IPI to APs"); -//#endif - -#if defined (__DRT__) - - if(vcpu->cpu_vendor == CPU_VENDOR_AMD){ - if(!svm_verify_platform()) { - _XDPRINTF_("\nINIT(early): ERROR: svm_verify_platform FAILED!\n"); - HALT(); - } - if(!svm_prepare_cpu()) { - _XDPRINTF_("\nINIT(early): ERROR: svm_prepare_cpu FAILED!\n"); - HALT(); - } - //issue SKINIT - //our secure loader is the first 64K of the hypervisor image - _XDPRINTF_("\nINIT(early): transferring control to SL via SKINIT..."); - //#ifndef PERF_CRIT - //if(NULL != xslbootinfo) { - // __asm__ __volatile__ ( - // "cpuid\r\n" - // "cpuid\r\n" - // "cpuid\r\n" - // "rdtsc\r\n" - // : "=A"(xslbootinfo->rdtsc_before_drtm) - // : /* no inputs */ - // : "ebx","ecx"); - // } - //#endif - skinit((uint32_t)slbase); - } else { - _XDPRINTF_("\n****** INIT(early): Begin TXT Stuff ******\n"); - txt_do_senter((void*)(slbase+3*PAGE_SIZE_4K), TEMPORARY_HARDCODED_MLE_SIZE); - _XDPRINTF_("\nINIT(early): error(fatal), should never come here!"); - HALT(); - } - -#else //!__DRT__ - //don't use SKINIT or SENTER - _XDPRINTF_("\n****** NO DRTM startup ******\n"); - _XDPRINTF_("\nslbase=0x%08x, sl_entry_point_offset=0x%08x", (uint32_t)slbase, *sl_entry_point_offset); - sl_entry_point = (uint32_t)slbase + (uint32_t) (*sl_entry_point_offset); - invokesl = (FCALL)(uint32_t)sl_entry_point; - _XDPRINTF_("\nSL entry point to transfer control to: 0x%08x", invokesl); - invokesl(); - _XDPRINTF_("\nINIT(early): error(fatal), should never come here!"); - HALT(); -#endif - -} - - -void setupvcpus(uint32_t cpu_vendor, MIDTAB *midtable, uint32_t midtable_numentries){ - uint32_t i; - BOOTVCPU *vcpu; - - _XDPRINTF_("\n%s: cpustacks range 0x%08x-0x%08x in 0x%08x chunks", - __func__, (uint32_t)cpustacks, (uint32_t)cpustacks + (RUNTIME_STACK_SIZE * MAX_VCPU_ENTRIES), - RUNTIME_STACK_SIZE); - _XDPRINTF_("\n%s: vcpubuffers range 0x%08x-0x%08x in 0x%08x chunks", - __func__, (uint32_t)vcpubuffers, (uint32_t)vcpubuffers + (SIZE_STRUCT_BOOTVCPU * MAX_VCPU_ENTRIES), - SIZE_STRUCT_BOOTVCPU); - - for(i=0; i < midtable_numentries; i++){ - vcpu = (BOOTVCPU *)((uint32_t)vcpubuffers + (uint32_t)(i * SIZE_STRUCT_BOOTVCPU)); - memset((void *)vcpu, 0, sizeof(BOOTVCPU)); - - vcpu->cpu_vendor = cpu_vendor; - - vcpu->esp = ((uint32_t)cpustacks + (i * RUNTIME_STACK_SIZE)) + RUNTIME_STACK_SIZE; - vcpu->id = midtable[i].cpu_lapic_id; - - midtable[i].vcpu_vaddr_ptr = (uint32_t)vcpu; - _XDPRINTF_("\nCPU #%u: vcpu_vaddr_ptr=0x%08x, esp=0x%08x", i, midtable[i].vcpu_vaddr_ptr, - vcpu->esp); - } -} - - -//---wakeupAPs------------------------------------------------------------------ -void wakeupAPs(void){ - uint32_t eax, edx; - volatile uint32_t *icr; - uint64_t msr_value; - - //read LAPIC base address from MSR - msr_value = rdmsr64( MSR_APIC_BASE); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - - HALT_ON_ERRORCOND( edx == 0 ); //APIC is below 4G - //_XDPRINTF_("\nLAPIC base and status=0x%08x", eax); - - icr = (uint32_t *) (((uint32_t)eax & 0xFFFFF000UL) + 0x300); - - { - extern uint32_t _ap_bootstrap_start[], _ap_bootstrap_end[]; - memcpy((void *)0x10000, (void *)_ap_bootstrap_start, (uint32_t)_ap_bootstrap_end - (uint32_t)_ap_bootstrap_start + 1); - } - - //our test code is at 1000:0000, we need to send 10 as vector - //send INIT - _XDPRINTF_("\nSending INIT IPI to all APs..."); - *icr = 0x000c4500UL; - udelay(10000); - //wait for command completion - { - uint32_t val; - do{ - val = *icr; - }while( (val & 0x1000) ); - } - _XDPRINTF_("Done."); - - //send SIPI (twice as per the MP protocol) - { - int i; - for(i=0; i < 2; i++){ - _XDPRINTF_("\nSending SIPI-%u...", i); - *icr = 0x000c4610UL; - udelay(200); - //wait for command completion - { - uint32_t val; - do{ - val = *icr; - }while( (val & 0x1000) ); - } - _XDPRINTF_("Done."); - } - } - - _XDPRINTF_("\nAPs should be awake!"); -} - -/* The TPM must be ready for the AMD CPU to send it commands at - * Locality 4 when executing SKINIT. Ideally all that is necessary is - * to xmhf_tpm_deactivate_all_localities(), but some TPM's are still not - * sufficiently "awake" after that. Thus, make sure it successfully - * responds to a command at some locality, *then* - * xmhf_tpm_deactivate_all_localities(). - */ -bool svm_prepare_tpm(void) { - uint32_t locality = EMHF_TPM_LOCALITY_PREF; /* target.h */ - bool ret = true; - - _XDPRINTF_("\nINIT:TPM: prepare_tpm starting."); - //dump_locality_access_regs(); - xmhf_tpm_deactivate_all_localities(); - //dump_locality_access_regs(); - - if(TPM_SUCCESS == tpm_wait_cmd_ready(locality)) { - _XDPRINTF_("INIT:TPM: successfully opened in Locality %d.\n", locality); - } else { - _XDPRINTF_("INIT:TPM: ERROR: Locality %d could not be opened.\n", locality); - ret = false; - } - xmhf_tpm_deactivate_all_localities(); - //dump_locality_access_regs(); - _XDPRINTF_("\nINIT:TPM: prepare_tpm done."); - - return ret; -} - -//---init main---------------------------------------------------------------- -void cstartup(multiboot_info_t *mbi){ - module_t *mod_array; - uint32_t mods_count; - size_t hypapp_size; - - /* parse command line */ - memset(g_cmdline, '\0', sizeof(g_cmdline)); - strncpy(g_cmdline, (char*)mbi->cmdline, sizeof(g_cmdline)-1); - g_cmdline[sizeof(g_cmdline)-1] = '\0'; /* in case strncpy truncated */ - tboot_parse_cmdline(); - -#if defined (__DEBUG_SERIAL__) - /* parse serial port params */ - { - uart_config_t uart_config_backup = g_uart_config; - if(!get_tboot_serial()) { - /* TODO: What's going on here? Redundant? */ - g_uart_config = uart_config_backup; - } - } - - //initialize debugging early on - xmhf_debug_init((char *)&g_uart_config); -#endif - - mod_array = (module_t*)mbi->mods_addr; - mods_count = mbi->mods_count; - - //welcome banner - _XDPRINTF_("\neXtensible Modular Hypervisor Framework (XMHF) %s", ___XMHF_BUILD_VERSION___); - _XDPRINTF_("\nBuild revision: %s\n", ___XMHF_BUILD_REVISION___); - - _XDPRINTF_("XMHF boot-loader: initializing, total modules=%u\n", mods_count); - - //we need at least 2 modules passed to us via GRUB, the hypapp binary and the guest OS boot-sector. - //If we don't have the bare minimum, bail out early - if(mods_count < 2){ - _XDPRINTF_("XMHF boot-loader: Halting, you need a hypapp and the guest OS boot sector at bare minimum!\n"); - HALT(); - } - - _XDPRINTF_("XMHF boot-loader: mod_0: start=0x%08x, end=0x%08x\n", - mod_array[0].mod_start, mod_array[0].mod_end); - _XDPRINTF_("XMHF boot-loader: mod_1: start=0x%08x, end=0x%08x\n", - mod_array[1].mod_start, mod_array[1].mod_end); - - //sl_rt_size = (mod_array[0].mod_start - __TARGET_BASE_BOOTLOADER) - __TARGET_SIZE_BOOTLOADER; - - - //check CPU type (Intel vs AMD) - cpu_vendor = xmhf_baseplatform_arch_getcpuvendor(); - - if(CPU_VENDOR_INTEL == cpu_vendor) { - _XDPRINTF_("INIT(early): detected an Intel CPU\n"); - - /* Intel systems require an SINIT module */ - if(!txt_parse_sinit(mod_array, mods_count)) { - _XDPRINTF_("INIT(early): FATAL ERROR: Intel CPU without SINIT module!\n"); - HALT(); - } - } else if(CPU_VENDOR_AMD == cpu_vendor) { - _XDPRINTF_("INIT(early): detected an AMD CPU\n"); - } else { - _XDPRINTF_("INIT(early): Dazed and confused: Unknown CPU vendor %d. Halting!\n", cpu_vendor); - HALT(); - } - - //deal with MP and get CPU table - dealwithMP(); - - //check (and revise) platform E820 memory map to see if we can load at __TARGET_BASE_XMHF - _XDPRINTF_("xmhf-bootloader: %s:%u\n", __func__, __LINE__); - //sl_rt_size = (mod_array[0].mod_start - __TARGET_BASE_BOOTLOADER) - __TARGET_SIZE_BOOTLOADER; - hypervisor_image_baseaddress = dealwithE820(mbi, __TARGET_SIZE_XMHF); - _XDPRINTF_("xmhf-bootloader: XMHF binary base=%08x, reserved size=%08x bytes\n", hypervisor_image_baseaddress, __TARGET_SIZE_XMHF); - - //sanity check memory map and limits; ensure we are loading at 256M - HALT_ON_ERRORCOND( (hypervisor_image_baseaddress == __TARGET_BASE_XMHF) ); - - //load address of XMHF bootloader = 30MB - //sizeof ( XMHF bootloader) = 2MB - //sizeof ( XMHF hypervisor binary + guest OS boot-sector + SINIT module (if any) + hypapp specific modules (if any) ) - //should not be greater than 224MB since we will be loading our system at absolute address 256MB and our current memcpy does not tackle overlaps - //if ( mod_array[mods_count-1].mod_end >= __TARGET_BASE_XMHF ){ - // _XDPRINTF_("XMHF boot-loader: Halting! XMHF load memory map limits violated. TOMM=0x%08x\n", mod_array[mods_count-1].mod_end); - // HALT(); - //} - - //SL+core memory map is from 0x10000000-0x1D000000 - //if(sl_rt_size > (__TARGET_BASE_XMHFHYPAPP - __TARGET_BASE_SL) ){ - // _XDPRINTF_("\nXMHF boot-loader: Halting! XMHF SL + core memory limit overflow. size=%08x (max:%08x)", sl_rt_size, (__TARGET_BASE_XMHFHYPAPP - __TARGET_BASE_SL)); - // HALT(); - // } - - // //hypapp memory map is from 0x1D000000-0x20000000 - // if( hypapp_size > __TARGET_SIZE_XMHFHYPAPP ){ - // _XDPRINTF_("\nXMHF boot-loader: Halting! XMHF hypapp memory limit overflow. size=%08x (max:%08x)", hypapp_size, __TARGET_SIZE_XMHFHYPAPP); - // HALT(); - // } - - - //_XDPRINTF_("xmhf-bootloader: %s:%u\n", __func__, __LINE__); - ////relocate XMHF hypervisor binary to preferred load address - // memcpy((void*)__TARGET_BASE_XMHF, (void*)(__TARGET_BASE_BOOTLOADER+__TARGET_SIZE_BOOTLOADER), sl_rt_size); - //_XDPRINTF_("xmhf-bootloader: %s:%u\n", __func__, __LINE__); - - - /* runtime */ - //print_hex(" INIT(early): *UNTRUSTED* gold runtime: ", - // g_init_gold.sha_runtime, SHA_DIGEST_LENGTH); - //hashandprint(" INIT(early): *UNTRUSTED* comp runtime: ", - // (uint8_t*)hypervisor_image_baseaddress+0x200000, sl_rt_size-0x200000); - /* SL low 64K */ - //print_hex(" INIT(early): *UNTRUSTED* gold SL low 64K: ", - // g_init_gold.sha_slbelow64K, SHA_DIGEST_LENGTH); - //hashandprint(" INIT(early): *UNTRUSTED* comp SL low 64K: ", - // (uint8_t*)hypervisor_image_baseaddress, 0x10000); - /* SL above 64K */ - //print_hex(" INIT(early): *UNTRUSTED* gold SL above 64K: ", - // g_init_gold.sha_slabove64K, SHA_DIGEST_LENGTH); - //hashandprint(" INIT(early): *UNTRUSTED* comp SL above 64K): ", - // (uint8_t*)hypervisor_image_baseaddress+0x10000, 0x200000-0x10000); - - - //print out stats - //_XDPRINTF_("\nINIT(early): relocated hypervisor binary image to 0x%08x", hypervisor_image_baseaddress); - //_XDPRINTF_("\nINIT(early): 2M aligned size = 0x%08lx", PAGE_ALIGN_UP2M((mod_array[0].mod_end - mod_array[0].mod_start))); - //_XDPRINTF_("\nINIT(early): un-aligned size = 0x%08x", mod_array[0].mod_end - mod_array[0].mod_start); - -#if 0 - //fill in "sl" parameter block - { - //"sl" parameter block is at hypervisor_image_baseaddress + 0x10000 - xslbootinfo = (XMHF_BOOTINFO *)((uint32_t)hypervisor_image_baseaddress + 0x10000); - HALT_ON_ERRORCOND(xslbootinfo->magic == SL_PARAMETER_BLOCK_MAGIC); - xslbootinfo->memmapinfo_numentries = grube820list_numentries; - HALT_ON_ERRORCOND(xslbootinfo->memmapinfo_numentries <= 64); - memcpy((void *)&xslbootinfo->memmapinfo_buffer, (void *)&grube820list, (sizeof(GRUBE820) * grube820list_numentries)); - xslbootinfo->cpuinfo_numentries = pcpus_numentries; - HALT_ON_ERRORCOND(xslbootinfo->cpuinfo_numentries <= 8); - memcpy((void *)&xslbootinfo->cpuinfo_buffer, (void *)&pcpus, (sizeof(PCPU) * pcpus_numentries)); - //xslbootinfo->runtime_size = sl_rt_size - PAGE_SIZE_2M; - //xslbootinfo->xmhf_size = sl_rt_size; - xslbootinfo->richguest_bootmodule_base = mod_array[1].mod_start; - xslbootinfo->richguest_bootmodule_size = (mod_array[1].mod_end - mod_array[1].mod_start); - - /*//check if we have an optional app module and if so populate relevant SLPB - //fields - { - uint32_t i, bytes; - xslbootinfo->runtime_appmodule_base= 0; - xslbootinfo->runtime_appmodule_size= 0; - - //we search from module index 2 upto and including mods_count-1 - //and grab the first non-SINIT module in the list - for(i=2; i < mods_count; i++) { - bytes = mod_array[i].mod_end - mod_array[i].mod_start; - if(!is_sinit_acmod((void*)mod_array[i].mod_start, bytes, false)){ - xslbootinfo->runtime_appmodule_base= mod_array[i].mod_start; - xslbootinfo->runtime_appmodule_size= bytes; - _XDPRINTF_("\nINIT(early): found app module, base=0x%08x, size=0x%08x", - xslbootinfo->runtime_appmodule_base, xslbootinfo->runtime_appmodule_size); - break; - } - } - }*/ - -#if defined (__DEBUG_SERIAL__) - //xslbootinfo->uart_config = g_uart_config; - memcpy(&xslbootinfo->debugcontrol_buffer, &g_uart_config, sizeof(uart_config_t)); -#endif - strncpy(xslbootinfo->cmdline_buffer, (const char *)mbi->cmdline, sizeof(xslbootinfo->cmdline_buffer)); - } -#endif //old parameter block fill logic - - - //fill in bootinfo - { - xslbootinfo = (XMHF_BOOTINFO *)((uint32_t)__TARGET_BASE_SL + PAGE_SIZE_2M); - _XDPRINTF_("xmhf-bootloader: xslbootinfo=%08x, magic=%x\n", (uint32_t)xslbootinfo, xslbootinfo->magic); - HALT_ON_ERRORCOND(xslbootinfo->magic == RUNTIME_PARAMETER_BLOCK_MAGIC); - xslbootinfo->memmapinfo_numentries = grube820list_numentries; - HALT_ON_ERRORCOND(xslbootinfo->memmapinfo_numentries <= 64); - memcpy((void *)&xslbootinfo->memmapinfo_buffer, (void *)&grube820list, (sizeof(GRUBE820) * grube820list_numentries)); - xslbootinfo->cpuinfo_numentries = pcpus_numentries; - HALT_ON_ERRORCOND(xslbootinfo->cpuinfo_numentries <= 8); - memcpy((void *)&xslbootinfo->cpuinfo_buffer, (void *)&pcpus, (sizeof(PCPU) * pcpus_numentries)); - //xslbootinfo->xmhf_size = sl_rt_size; - xslbootinfo->richguest_bootmodule_base = mod_array[0].mod_start; - xslbootinfo->richguest_bootmodule_size = (mod_array[0].mod_end - mod_array[0].mod_start); - - - #if defined (__DEBUG_SERIAL__) - memcpy(&xslbootinfo->debugcontrol_buffer, &g_uart_config, sizeof(uart_config_t)); - #endif - strncpy(xslbootinfo->cmdline_buffer, (const char *)mbi->cmdline, sizeof(xslbootinfo->cmdline_buffer)); - } - - _XDPRINTF_("xmhf-bootloader: %s:%u\n", __func__, __LINE__); - - //switch to MP mode - //setup Master-ID Table (MIDTABLE) - { - int i; - for(i=0; i < (int)pcpus_numentries; i++){ - midtable[midtable_numentries].cpu_lapic_id = pcpus[i].lapic_id; - midtable[midtable_numentries].vcpu_vaddr_ptr = 0; - midtable_numentries++; - } - } - - //setup vcpus - setupvcpus(cpu_vendor, midtable, midtable_numentries); - - //wakeup all APs - if(midtable_numentries > 1) - wakeupAPs(); - - //fall through and enter mp_cstartup via init_core_lowlevel_setup - init_core_lowlevel_setup(); - - _XDPRINTF_("\nINIT(early): error(fatal), should never come here!"); - HALT(); -} - -//---isbsp---------------------------------------------------------------------- -//returns 1 if the calling CPU is the BSP, else 0 -uint32_t isbsp(void){ - uint32_t eax, edx; - uint64_t msr_value; - - //read LAPIC base address from MSR - msr_value = rdmsr64( MSR_APIC_BASE); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - - HALT_ON_ERRORCOND( edx == 0 ); //APIC is below 4G - - if(eax & 0x100) - return 1; - else - return 0; -} - - -//---CPUs must all have their microcode cleared for SKINIT to be successful----- -void svm_clear_microcode(BOOTVCPU *vcpu){ - uint32_t ucode_rev; - uint32_t dummy=0; - uint64_t msr_value, clear_value; - - // Current microcode patch level available via MSR read - msr_value = rdmsr64( MSR_AMD64_PATCH_LEVEL); - ucode_rev = (uint32_t)msr_value; - dummy = (uint32_t)(msr_value >> 32); - - - - _XDPRINTF_("\nCPU(0x%02x): existing microcode version 0x%08x", vcpu->id, ucode_rev); - - clear_value = (uint64_t)(((uint64_t)dummy << 32) | dummy); - if(ucode_rev != 0) { - wrmsr64(MSR_AMD64_PATCH_CLEAR, (uint32_t)clear_value, (uint32_t)((uint64_t)clear_value >> 32) ); - _XDPRINTF_("\nCPU(0x%02x): microcode CLEARED", vcpu->id); - } -} - - -uint32_t cpus_active=0; //number of CPUs that are awake, should be equal to -//midtable_numentries -1 if all went well with the -//MP startup protocol -uint32_t lock_cpus_active=1; //spinlock to access the above - - -//------------------------------------------------------------------------------ -//all cores enter here -void mp_cstartup (BOOTVCPU *vcpu){ - //sanity, we should be an Intel or AMD core - HALT_ON_ERRORCOND(vcpu->cpu_vendor == CPU_VENDOR_INTEL || - vcpu->cpu_vendor == CPU_VENDOR_AMD); - - if(isbsp()){ - //clear microcode if AMD CPU - if(vcpu->cpu_vendor == CPU_VENDOR_AMD){ - _XDPRINTF_("\nBSP(0x%02x): Clearing microcode...", vcpu->id); - svm_clear_microcode(vcpu); - _XDPRINTF_("\nBSP(0x%02x): Microcode clear.", vcpu->id); - - if(!svm_prepare_tpm()) { - _XDPRINTF_("\nBSP(0x%02x): ERROR: svm_prepare_tpm FAILED.", vcpu->id); - // XXX TODO HALT(); - } - } - - _XDPRINTF_("\nBSP(0x%02x): Rallying APs...", vcpu->id); - - //increment a CPU to account for the BSP - spin_lock(&lock_cpus_active); - cpus_active++; - spin_unlock(&lock_cpus_active); - - //wait for cpus_active to become midtable_numentries -1 to indicate - //that all APs have been successfully started - while(cpus_active < midtable_numentries); - - - //put all APs in INIT state - - _XDPRINTF_("\nBSP(0x%02x): APs ready, doing DRTM...", vcpu->id); - //do_drtm(vcpu, hypervisor_image_baseaddress, sl_rt_size); // this function will not return - do_drtm(vcpu, __TARGET_BASE_SL, __TARGET_SIZE_SL); // this function will not return - - _XDPRINTF_("\nBSP(0x%02x): FATAL, should never be here!", vcpu->id); - HALT(); - - }else{ - //clear microcode if AMD CPU - if(vcpu->cpu_vendor == CPU_VENDOR_AMD){ - _XDPRINTF_("\nAP(0x%02x): Clearing microcode...", vcpu->id); - svm_clear_microcode(vcpu); - _XDPRINTF_("\nAP(0x%02x): Microcode clear.", vcpu->id); - } - - //update the AP startup counter - spin_lock(&lock_cpus_active); - cpus_active++; - spin_unlock(&lock_cpus_active); - - _XDPRINTF_("\nAP(0x%02x): Waiting for DRTM establishment...", vcpu->id); - - HALT(); - } - - -} diff --git a/uxmhf/xmhf-bootloader/init.lds b/uxmhf/xmhf-bootloader/init.lds deleted file mode 100644 index 5743755e43..0000000000 --- a/uxmhf/xmhf-bootloader/init.lds +++ /dev/null @@ -1,109 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/*OUTPUT_FORMAT("pe-i386")*/ -OUTPUT_ARCH(i386) - -ENTRY(init_start) - -MEMORY -{ - all (rwxai) : ORIGIN = 0x1E00000, LENGTH = 20M - bl_hdr (rwxai) : ORIGIN = 0x1E00000, LENGTH = 0x1000 /*4K*/ - bl_code (rwxai) : ORIGIN = 0x1E01000, LENGTH = 0x10000 /*64K*/ - bl_data (rwxai) : ORIGIN = 0x1E11000, LENGTH = 0x8000 /*32K*/ - bl_stack (rwxai) : ORIGIN = 0x1E19000, LENGTH = 0x500000 /*5M*/ - bl_filler (rwxai) : ORIGIN = 0x2319000, LENGTH = 0x3EE7000 - unaccounted (rwxai) : ORIGIN = 0, LENGTH = 0 /* see section .unaccounted at end */ -} - -SECTIONS -{ - - . = 0x1E00000; - - .hdr : { - *(.multiboot_header) - . = 0x1000; - } >bl_hdr=0x0000 - - .code : { - *(.text) - . = 0x10000; - } >bl_code=0x9090 - - .data : { - *(.data) - *(.rodata) - *(.rodata.str1.1) - *(.eh_frame) - *(.bss) - *(.comment) - . = 0x8000; - } >bl_data=0x0000 - - .stack : { - *(.stack) - . = 0x500000; - } >bl_stack=0x0000 - - - .filler : { - LONG(0) - . = 0x3EE7000; - } >bl_filler=0x9090 - - /* this is to cause the link to fail if there is - * anything we didn't explicitly place. - * when this does cause link to fail, temporarily comment - * this part out to see what sections end up in the output - * which are not handled above, and handle them. - */ - .unaccounted : { - *(*) - } >unaccounted - -} diff --git a/uxmhf/xmhf-bootloader/initsup.S b/uxmhf/xmhf-bootloader/initsup.S deleted file mode 100644 index 335c8167ec..0000000000 --- a/uxmhf/xmhf-bootloader/initsup.S +++ /dev/null @@ -1,169 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// init low-level support routines -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -.extern midtable_numentries -.extern mp_cstartup -.extern midtable - -//---AP boot-strap code--------------------------------------------------------- -.section .text - .code16 - .global _ap_bootstrap_start - _ap_bootstrap_start: - jmp ap_bootstrap_bypassdata - _ap_gdtdesc: - .word _ap_gdt_end - _ap_gdt_start - 1 - .long _ap_gdt_start - _ap_bootstrap_start + (X86SMP_APBOOTSTRAP_CODESEG << 4) - .align 16 - _ap_gdt_start: - .quad 0x0000000000000000 - .quad 0x00cf9a000000ffff - .quad 0x00cf92000000ffff - _ap_gdt_end: - .word 0 - ap_bootstrap_bypassdata: - movw $0x1000, %ax - movw %ax, %ds - movw %ax, %es - movw $0xFFFF, %sp - movw $0x4000, %ax - movw %ax, %ss - - movw $0x0002, %si - - lgdt (%si) - - movl %cr0, %eax - orl $0x1, %eax - movl %eax, %cr0 - - jmpl $0x08, $(_ap_clear_pipe - _ap_bootstrap_start + (X86SMP_APBOOTSTRAP_CODESEG << 4)) - .code32 - _ap_clear_pipe: - movw $0x10, %ax - movw %ax, %ds - movw %ax, %es - movw %ax, %ss - movw %ax, %fs - movw %ax, %gs - - movl $init_core_lowlevel_setup, %eax - jmpl *%eax - hlt - - .global _ap_bootstrap_end - _ap_bootstrap_end: - nop - nop - nop - nop - -//---init_core_lowlevel_setup--------------------------------------------------- -.section .text - .global init_core_lowlevel_setup - init_core_lowlevel_setup: - - //load our gdt - lgdt init_gdt - - //get hold of local APIC id - mov $(MSR_APIC_BASE), %ecx - rdmsr - andl $0xFFFFF000, %eax - addl $0x20, %eax - movl (%eax), %eax - shr $24, %eax - - movl midtable_numentries, %edx - - //get vcpu virtual address of this CPU/core - movl $(midtable), %ebx - xorl %ecx, %ecx -getvcpuloop: - movl 0x0(%ebx, %ecx, 8), %ebp //ebp contains the lapic id - cmpl %eax, %ebp - jz gotvcpu - incl %ecx - cmpl %edx, %ecx - jb getvcpuloop - //we should never get here, if so just halt - hlt -gotvcpu: - movl 0x4(%ebx, %ecx, 8), %esi //esi contains vcpu pointer - movl 0x0(%esi), %esp //load stack for this CPU - pushl %esi - call mp_cstartup - //we should never get here, if so just halt - hlt - - - -//------------------------------------------------------------------------------ -.section .data - - //the GDT - init_gdt: - .word init_gdt_end - init_gdt_start - 1 - .long init_gdt_start - - .align 16 - init_gdt_start: - .quad 0x0000000000000000 - .quad 0x00cf9a000000ffff - .quad 0x00cf92000000ffff - .quad 0x0000000000000000 - init_gdt_end: - - - - diff --git a/uxmhf/xmhf-bootloader/smp.c b/uxmhf/xmhf-bootloader/smp.c deleted file mode 100644 index 49c569e006..0000000000 --- a/uxmhf/xmhf-bootloader/smp.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -//------------------------------------------------------------------------------ -//smp.c -//this module scans for multi-core/CPUs within the system and -//returns the number of cores/CPUs as well as their LAPIC id, -//version, base and BSP indications -//author: amit vasudevan (amitvasudevan@acm.org) -#include -#include -#include -#include - - - -//forward prototypes -static int mp_checksum(unsigned char *mp, int len); -static uint32_t mp_scan_config(uint32_t base, uint32_t length, MPFP **mpfp); -static uint32_t mp_getebda(void); -ACPI_RSDP * ACPIGetRSDP(void); - -//exposed interface to the outside world -//inputs: array of type PCPU and pointer to uint32_t which will -//receive the number of cores/CPUs in the system -//returns: 1 on succes, 0 on any failure -uint32_t smp_getinfo(PCPU *pcpus, uint32_t *num_pcpus){ - MPFP *mpfp; - MPCONFTABLE *mpctable; - - ACPI_RSDP *rsdp; - -#if 0 - ACPI_XSDT *xsdt; - uint32_t n_xsdt_entries; - uint64_t *xsdtentrylist; -#else - ACPI_RSDT *rsdt; - uint32_t n_rsdt_entries; - uint32_t *rsdtentrylist; -#endif - - ACPI_MADT *madt; - uint8_t madt_found=0; - uint32_t i; - - //we scan ACPI MADT and then the MP configuration table if one is - //present, in that order! - - //if we get here it means that we did not find a MP table, so - //we need to look at ACPI MADT. Logical cores on some machines - //(e.g HP8540p laptop with Core i5) are reported only using ACPI MADT - //and there is no MP structures on such systems! - _XDPRINTF_("\nFinding SMP info. via ACPI..."); - rsdp=(ACPI_RSDP *)ACPIGetRSDP(); - if(!rsdp){ - _XDPRINTF_("\nSystem is not ACPI Compliant, falling through..."); - goto fallthrough; - } - - _XDPRINTF_("\nACPI RSDP at 0x%08x", (uint32_t)rsdp); - -#if 0 - xsdt=(ACPI_XSDT *)(uint32_t)rsdp->xsdtaddress; - n_xsdt_entries=(uint32_t)((xsdt->length-sizeof(ACPI_XSDT))/8); - - _XDPRINTF_("\nACPI XSDT at 0x%08x", xsdt); - _XDPRINTF_("\n len=0x%08x, headerlen=0x%08x, numentries=%u", - xsdt->length, sizeof(ACPI_XSDT), n_xsdt_entries); - - xsdtentrylist=(uint64_t *) ( (uint32_t)xsdt + sizeof(ACPI_XSDT) ); - - for(i=0; i< n_xsdt_entries; i++){ - madt=(ACPI_MADT *)( (uint32_t)xsdtentrylist[i]); - if(madt->signature == ACPI_MADT_SIGNATURE){ - madt_found=1; - break; - } - } -#else - rsdt=(ACPI_RSDT *)(uint32_t)rsdp->rsdtaddress; - n_rsdt_entries=(uint32_t)((rsdt->length-sizeof(ACPI_RSDT))/4); - - _XDPRINTF_("\nACPI RSDT at 0x%08x", (uint32_t)rsdt); - _XDPRINTF_("\n len=0x%08x, headerlen=0x%08x, numentries=%u", - rsdt->length, sizeof(ACPI_RSDT), n_rsdt_entries); - - rsdtentrylist=(uint32_t *) ( (uint32_t)rsdt + sizeof(ACPI_RSDT) ); - - for(i=0; i< n_rsdt_entries; i++){ - madt=(ACPI_MADT *)( (uint32_t)rsdtentrylist[i]); - if(madt->signature == ACPI_MADT_SIGNATURE){ - madt_found=1; - break; - } - } - -#endif - - - if(!madt_found){ - _XDPRINTF_("\nACPI MADT not found, falling through..."); - goto fallthrough; - } - - _XDPRINTF_("\nACPI MADT at 0x%08x", (uint32_t)madt); - _XDPRINTF_("\n len=0x%08x, record-length=%u bytes", madt->length, - madt->length - sizeof(ACPI_MADT)); - - //scan through MADT APIC records to find processors - *num_pcpus=0; - { - uint32_t madtrecordlength = madt->length - sizeof(ACPI_MADT); - uint32_t madtcurrentrecordoffset=0; - uint32_t i=0; - uint32_t foundcores=0; - - do{ - ACPI_MADT_APIC *apicrecord = (ACPI_MADT_APIC *)((uint32_t)madt + sizeof(ACPI_MADT) + madtcurrentrecordoffset); - _XDPRINTF_("\nrec type=0x%02x, length=%u bytes, flags=0x%08x, id=0x%02x", apicrecord->type, - apicrecord->length, apicrecord->flags, apicrecord->lapicid); - - if(apicrecord->type == 0x0 && (apicrecord->flags & 0x1)){ //processor record - - foundcores=1; - HALT_ON_ERRORCOND( *num_pcpus < MAX_PCPU_ENTRIES); - i = *num_pcpus; - pcpus[i].lapic_id = apicrecord->lapicid; - pcpus[i].lapic_ver = 0; - pcpus[i].lapic_base = madt->lapicaddress; - if(i == 0) - pcpus[i].isbsp = 1; //ACPI spec says that first processor entry MUST be BSP - else - pcpus[i].isbsp = 0; - - *num_pcpus = *num_pcpus + 1; - } - madtcurrentrecordoffset += apicrecord->length; - }while(madtcurrentrecordoffset < madtrecordlength); - - if(foundcores) - return 1; - } - - -fallthrough: - //ok, ACPI detection failed proceed with MP table scan - //we simply grab all the info from there as per - //the intel MP spec. - //look at 1K at start of conventional mem. - //look at 1K at top of conventional mem - //look at 1K starting at EBDA and - //look at 64K starting at 0xF0000 - - if( mp_scan_config(0x0, 0x400, &mpfp) || - mp_scan_config(639 * 0x400, 0x400, &mpfp) || - mp_scan_config(mp_getebda(), 0x400, &mpfp) || - mp_scan_config(0xF0000, 0x10000, &mpfp) ){ - - _XDPRINTF_("\nMP table found at: 0x%08x", (uint32_t)mpfp); - _XDPRINTF_("\nMP spec rev=0x%02x", mpfp->spec_rev); - _XDPRINTF_("\nMP feature info1=0x%02x", mpfp->mpfeatureinfo1); - _XDPRINTF_("\nMP feature info2=0x%02x", mpfp->mpfeatureinfo2); - _XDPRINTF_("\nMP Configuration table at 0x%08x", mpfp->paddrpointer); - - HALT_ON_ERRORCOND( mpfp->paddrpointer != 0 ); - mpctable = (MPCONFTABLE *)mpfp->paddrpointer; - HALT_ON_ERRORCOND(mpctable->signature == MPCONFTABLE_SIGNATURE); - - {//debug - int i; - _XDPRINTF_("\nOEM ID: "); - for(i=0; i < 8; i++) - _XDPRINTF_("%c", mpctable->oemid[i]); - _XDPRINTF_("\nProduct ID: "); - for(i=0; i < 12; i++) - _XDPRINTF_("%c", mpctable->productid[i]); - } - - _XDPRINTF_("\nEntry count=%u", mpctable->entrycount); - _XDPRINTF_("\nLAPIC base=0x%08x", mpctable->lapicaddr); - - //now step through CPU entries in the MP-table to determine - //how many CPUs we have - *num_pcpus=0; - - { - int i; - uint32_t addrofnextentry= (uint32_t)mpctable + sizeof(MPCONFTABLE); - - for(i=0; i < mpctable->entrycount; i++){ - MPENTRYCPU *cpu = (MPENTRYCPU *)addrofnextentry; - if(cpu->entrytype != 0) - break; - - if(cpu->cpuflags & 0x1){ - HALT_ON_ERRORCOND( *num_pcpus < MAX_PCPU_ENTRIES); - _XDPRINTF_("\nCPU (0x%08x) #%u: lapic id=0x%02x, ver=0x%02x, cpusig=0x%08x", - (uint32_t)cpu, i, cpu->lapicid, cpu->lapicver, cpu->cpusig); - pcpus[i].lapic_id = cpu->lapicid; - pcpus[i].lapic_ver = cpu->lapicver; - pcpus[i].lapic_base = mpctable->lapicaddr; - pcpus[i].isbsp = cpu->cpuflags & 0x2; - *num_pcpus = *num_pcpus + 1; - } - - addrofnextentry += sizeof(MPENTRYCPU); - } - } - - - return 1; - } - - - return 1; - -} - - -static int mp_checksum(unsigned char *mp, int len){ - int sum = 0; - - while (len--) - sum += *mp++; - - return sum & 0xFF; -} - - -//returns 1 if MP table found and populates mpfp with MP table pointer -//returns 0 if no MP table and makes mpfp=NULL -static uint32_t mp_scan_config(uint32_t base, uint32_t length, MPFP **mpfp){ - uint32_t *bp = (uint32_t *)base; - MPFP *mpf; - - _XDPRINTF_("\n%s: Finding MP table from 0x%08x for %u bytes", - __func__, (uint32_t)bp, length); - - while (length > 0) { - mpf = (MPFP *)bp; - if ((*bp == MPFP_SIGNATURE) && - (mpf->length == 1) && - !mp_checksum((unsigned char *)bp, 16) && - ((mpf->spec_rev == 1) - || (mpf->spec_rev == 4))) { - - _XDPRINTF_("\n%s: found SMP MP-table at 0x%08x", - __func__, (uint32_t)mpf); - - *mpfp = mpf; - return 1; - } - bp += 4; - length -= 16; - } - - *mpfp=0; - return 0; -} - - -uint32_t mp_getebda(void){ - uint16_t ebdaseg; - uint32_t ebdaphys; - //get EBDA segment from 040E:0000h in BIOS data area - ebdaseg= * ((uint16_t *)0x0000040E); - //convert it to its 32-bit physical address - ebdaphys=(uint32_t)(ebdaseg * 16); - return ebdaphys; -} - -//------------------------------------------------------------------------------ -uint32_t _ACPIGetRSDPComputeChecksum(uint32_t spaddr, uint32_t size){ - char *p; - char checksum=0; - uint32_t i; - - p=(char *)spaddr; - - for(i=0; i< size; i++) - checksum+= (char)(*(p+i)); - - return (uint32_t)checksum; -} - -//get the physical address of the root system description pointer (rsdp) -//return 0 if not found -ACPI_RSDP * ACPIGetRSDP(void){ - uint16_t ebdaseg; - uint32_t ebdaphys; - uint32_t i, found=0; - ACPI_RSDP *rsdp; - - //get EBDA segment from 040E:0000h in BIOS data area - ebdaseg= * ((uint16_t *)0x0000040E); - //convert it to its 32-bit physical address - ebdaphys=(uint32_t)(ebdaseg * 16); - //search first 1KB of ebda for rsdp signature (8 bytes long) - for(i=0; i < (1024-8); i+=16){ - rsdp=(ACPI_RSDP *)(ebdaphys+i); - if(rsdp->signature == ACPI_RSDP_SIGNATURE){ - if(!_ACPIGetRSDPComputeChecksum((uint32_t)rsdp, 20)){ - found=1; - break; - } - } - } - - if(found) - return rsdp; - - //search within BIOS areas 0xE0000 to 0xFFFFF - for(i=0xE0000; i < (0xFFFFF-8); i+=16){ - rsdp=(ACPI_RSDP *)i; - if(rsdp->signature == ACPI_RSDP_SIGNATURE){ - if(!_ACPIGetRSDPComputeChecksum((uint32_t)rsdp, 20)){ - found=1; - break; - } - } - } - - if(found) - return rsdp; - - return (ACPI_RSDP *)NULL; -} -//------------------------------------------------------------------------------ - diff --git a/uxmhf/xmhf-bootloader/tpm.c b/uxmhf/xmhf-bootloader/tpm.c deleted file mode 100644 index 4f398feddb..0000000000 --- a/uxmhf/xmhf-bootloader/tpm.c +++ /dev/null @@ -1,468 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * tpm.c: TPM-related support functions - * - * Copyright (c) 2006-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.18 - * - * "Extra" functions unnecessary in SL denoted as such. - */ - -/** - * Adapted for libtpm - generic TPM library - * by Amit Vasudevan amitvasudevan@acm.org - */ -#include -#include -#include -#include - -#include -#include -//#include -//#include -//#include - -#include "_tpm.h" - -#if 0 - -/* - * The _tpm_submit_cmd function comes with 2 global buffers: cmd_buf & rsp_buf. - * Before calling, caller should fill cmd arguements into cmd_buf via - * WRAPPER_IN_BUF macro. After calling, caller should fetch result from - * rsp_buffer via WRAPPER_OUT_BUF macro. - * cmd_buf content: - * 0 1 2 3 4 5 6 7 8 9 10 ... - * ------------------------------------------------------------- - * | TAG | SIZE | ORDINAL | arguments ... - * ------------------------------------------------------------- - * rsp_buf content: - * 0 1 2 3 4 5 6 7 8 9 10 ... - * ------------------------------------------------------------- - * | TAG | SIZE | RETURN CODE | other data ... - * ------------------------------------------------------------- - * - * locality : TPM locality (0 - 4) - * tag : The TPM command tag - * cmd : The TPM command ordinal - * arg_size : Size of argument data. - * out_size : IN/OUT paramter. The IN is the expected size of out data; - * the OUT is the size of output data within out buffer. - * The out_size MUST NOT be NULL. - * return : TPM_SUCCESS for success, for other error code, refer to the .h - */ -/* static */ -uint8_t cmd_buf[TPM_CMD_SIZE_MAX]; -/* static */ -uint8_t rsp_buf[TPM_RSP_SIZE_MAX]; - -/* static */ -uint32_t _tpm_submit_cmd(uint32_t locality, uint16_t tag, uint32_t cmd, - uint32_t arg_size, uint32_t *out_size) -{ - uint32_t ret; - uint32_t cmd_size, rsp_size = 0; - - if ( out_size == NULL ) { - _XDPRINTF_("TPM: invalid param for _tpm_submit_cmd()\n"); - return TPM_BAD_PARAMETER; - } - - /* - * real cmd size should add 10 more bytes: - * 2 bytes for tag - * 4 bytes for size - * 4 bytes for ordinal - */ - cmd_size = CMD_HEAD_SIZE + arg_size; - - if ( cmd_size > TPM_CMD_SIZE_MAX ) { - _XDPRINTF_("TPM: cmd exceeds the max supported size.\n"); - return TPM_BAD_PARAMETER; - } - - /* copy tag, size & ordinal into buf in a reversed byte order */ - reverse_copy(cmd_buf, &tag, sizeof(tag)); - reverse_copy(cmd_buf + CMD_SIZE_OFFSET, &cmd_size, sizeof(cmd_size)); - reverse_copy(cmd_buf + CMD_ORD_OFFSET, &cmd, sizeof(cmd)); - - rsp_size = RSP_HEAD_SIZE + *out_size; - rsp_size = (rsp_size > TPM_RSP_SIZE_MAX) ? TPM_RSP_SIZE_MAX: rsp_size; - ret = tpm_write_cmd_fifo(locality, cmd_buf, cmd_size, rsp_buf, &rsp_size); - - /* - * should subtract 10 bytes from real response size: - * 2 bytes for tag - * 4 bytes for size - * 4 bytes for return code - */ - rsp_size -= (rsp_size > RSP_HEAD_SIZE) ? RSP_HEAD_SIZE : rsp_size; - - if ( ret != TPM_SUCCESS ) - return ret; - - if ( *out_size == 0 || rsp_size == 0 ) - *out_size = 0; - else - *out_size = (rsp_size < *out_size) ? rsp_size : *out_size; - - return ret; -} - -/* from emhf's processor.h */ -//static inline uint64_t rdtsc64(void) -//{ - // uint64_t rv; -// -// __asm__ __volatile__ ("rdtsc" : "=A" (rv)); -// return (rv); -//} - -/*static inline*/ -uint32_t tpm_submit_cmd(uint32_t locality, uint32_t cmd, - uint32_t arg_size, uint32_t *out_size) -{ - uint32_t rv; - uint64_t start, end; - - start = rdtsc64(); - rv = _tpm_submit_cmd(locality, TPM_TAG_RQU_COMMAND, cmd, - arg_size, out_size); - end = rdtsc64(); - _XDPRINTF_("TPM: PERF: Command 0x%08x consumed %lld cycles\n", cmd, end-start); - return rv; -} - -#endif - -uint32_t tpm_pcr_read(uint32_t locality, uint32_t pcr, tpm_pcr_value_t *out) -{ - uint32_t ret, out_size = sizeof(*out); - - if ( out == NULL ) - return TPM_BAD_PARAMETER; - if ( pcr >= TPM_NR_PCRS ) - return TPM_BAD_PARAMETER; - - /* copy pcr into buf in reversed byte order */ - reverse_copy(WRAPPER_IN_BUF, &pcr, sizeof(pcr)); - - ret = tpm_submit_cmd(locality, TPM_ORD_PCR_READ, sizeof(pcr), &out_size); - -#ifdef TPM_TRACE - _XDPRINTF_("TPM: Pcr %d Read return value = %08X\n", pcr, ret); -#endif - if ( ret != TPM_SUCCESS ) { - _XDPRINTF_("TPM: Pcr %d Read return value = %08X\n", pcr, ret); - return ret; - } - - if ( out_size > sizeof(*out) ) - out_size = sizeof(*out); - memcpy((void *)out, WRAPPER_OUT_BUF, out_size); - -#ifdef TPM_TRACE - { - _XDPRINTF_("TPM: "); - //print_hex(NULL, out->digest, out_size); - } -#endif - - return ret; -} - -uint32_t tpm_pcr_extend(uint32_t locality, uint32_t pcr, - const tpm_digest_t* in, tpm_pcr_value_t* out) -{ - uint32_t ret, in_size = 0, out_size; - - if ( in == NULL ) - return TPM_BAD_PARAMETER; - if ( pcr >= TPM_NR_PCRS ) - return TPM_BAD_PARAMETER; - if ( out == NULL ) - out_size = 0; - else - out_size = sizeof(*out); - - /* copy pcr into buf in reversed byte order, then copy in data */ - reverse_copy(WRAPPER_IN_BUF, &pcr, sizeof(pcr)); - in_size += sizeof(pcr); - memcpy(WRAPPER_IN_BUF + in_size, (const void *)in, sizeof(*in)); - in_size += sizeof(*in); - - ret = tpm_submit_cmd(locality, TPM_ORD_PCR_EXTEND, in_size, &out_size); - -#ifdef TPM_TRACE - _XDPRINTF_("TPM: Pcr %d extend, return value = %08X\n", pcr, ret); -#endif - if ( ret != TPM_SUCCESS ) { - _XDPRINTF_("TPM: Pcr %d extend, return value = %08X\n", pcr, ret); - return ret; - } - - if ( out != NULL && out_size > 0 ) { - out_size = (out_size > sizeof(*out)) ? sizeof(*out) : out_size; - memcpy((void *)out, WRAPPER_OUT_BUF, out_size); - } - -#ifdef TPM_TRACE - { - _XDPRINTF_("TPM: "); - //print_hex(NULL, out->digest, out_size); - } -#endif - - return ret; -} - - - -/* get tpm module version */ -uint32_t tpm_get_version(uint8_t *major, uint8_t *minor) -{ - uint32_t ret, in_size = 0, out_size; - uint32_t cap_area = TPM_CAP_VERSION_VAL; - uint32_t sub_cap_size = 0; - uint32_t resp_size = 0; - tpm_cap_version_info_t *cap_version; - - if ( major == NULL || minor == NULL ) - return TPM_BAD_PARAMETER; - - reverse_copy(WRAPPER_IN_BUF, &cap_area, sizeof(cap_area)); - in_size += sizeof(cap_area); - reverse_copy(WRAPPER_IN_BUF+in_size, &sub_cap_size, sizeof(sub_cap_size)); - in_size += sizeof(sub_cap_size); - - out_size = sizeof(resp_size) + sizeof(tpm_cap_version_info_t); - ret = tpm_submit_cmd(0, TPM_ORD_GET_CAPABILITY, in_size, &out_size); - -#ifdef TPM_TRACE - _XDPRINTF_("TPM: get version, return value = %08X\n", ret); -#endif - if ( ret != TPM_SUCCESS ) { - _XDPRINTF_("TPM: get version, return value = %08X\n", ret); - return ret; - } - -#ifdef TPM_TRACE - { - _XDPRINTF_("TPM: "); - //print_hex(NULL, WRAPPER_OUT_BUF, out_size); - } -#endif - - reverse_copy(&resp_size, WRAPPER_OUT_BUF, sizeof(resp_size)); - cap_version = (tpm_cap_version_info_t *) - (WRAPPER_OUT_BUF + sizeof(resp_size)); - *major = cap_version->version.major; - *minor = cap_version->version.minor; - - return ret; -} - - -#if 0 -/* static */ -uint32_t tpm_get_capability( - uint32_t locality, tpm_capability_area_t cap_area, - uint32_t sub_cap_size, const uint8_t *sub_cap, - uint32_t *resp_size, uint8_t *resp) -{ - uint32_t ret, offset, out_size; - - if ( sub_cap == NULL || resp_size == NULL || resp == NULL ) { - _XDPRINTF_("TPM: tpm_get_capability() bad parameter\n"); - return TPM_BAD_PARAMETER; - } - - offset = 0; - UNLOAD_INTEGER(WRAPPER_IN_BUF, offset, cap_area); - UNLOAD_INTEGER(WRAPPER_IN_BUF, offset, sub_cap_size); - UNLOAD_BLOB(WRAPPER_IN_BUF, offset, sub_cap, sub_cap_size); - - out_size = sizeof(*resp_size) + *resp_size; - - ret = tpm_submit_cmd(locality, TPM_ORD_GET_CAPABILITY, offset, &out_size); - -#ifdef TPM_TRACE - _XDPRINTF_("TPM: get capability, return value = %08X\n", ret); -#endif - if ( ret != TPM_SUCCESS ) { - _XDPRINTF_("TPM: get capability, return value = %08X\n", ret); - return ret; - } - - offset = 0; - LOAD_INTEGER(WRAPPER_OUT_BUF, offset, *resp_size); - if ( out_size < sizeof(*resp_size) + *resp_size ) { - _XDPRINTF_("TPM: capability response too small\n"); - return TPM_FAIL; - } - LOAD_BLOB(WRAPPER_OUT_BUF, offset, resp, *resp_size); - - return ret; -} -#endif - -uint32_t tpm_get_random(uint32_t locality, uint8_t *random_data, - uint32_t *data_size) -{ - uint32_t ret, in_size = 0, out_size, requested_size; - static bool first_attempt; - uint32_t second_size; - - if ( random_data == NULL || data_size == NULL ) - return TPM_BAD_PARAMETER; - if ( *data_size == 0 ) - return TPM_BAD_PARAMETER; - - first_attempt = true; - requested_size = *data_size; - - /* copy the *data_size into buf in reversed byte order */ - reverse_copy(WRAPPER_IN_BUF + in_size, data_size, sizeof(*data_size)); - in_size += sizeof(*data_size); - - out_size = *data_size + sizeof(*data_size); - ret = tpm_submit_cmd(locality, TPM_ORD_GET_RANDOM, in_size, &out_size); - -#ifdef TPM_TRACE - _XDPRINTF_("TPM: get random %u bytes, return value = %08X\n", *data_size, ret); -#endif - if ( ret != TPM_SUCCESS ) { - _XDPRINTF_("TPM: get random %u bytes, return value = %08X\n", *data_size, - ret); - return ret; - } - -#ifdef TPM_TRACE - { - _XDPRINTF_("TPM: "); - //print_hex(NULL, WRAPPER_OUT_BUF, out_size); - } -#endif - - if ( out_size <= sizeof(*data_size) ) { - *data_size = 0; - return ret; - } - - out_size -= sizeof(*data_size); - reverse_copy(data_size, WRAPPER_OUT_BUF, sizeof(*data_size)); - if ( *data_size > 0 ) - memcpy(random_data, WRAPPER_OUT_BUF + sizeof(*data_size), *data_size); - - /* data might be used as key, so clear from buffer memory */ - memset(WRAPPER_OUT_BUF + sizeof(*data_size), 0, *data_size); - - /* if TPM doesn't return all requested random bytes, try one more time */ - if ( *data_size < requested_size ) { - _XDPRINTF_("requested %x random bytes but only got %x\n", requested_size, - *data_size); - /* we're only going to try twice */ - if ( first_attempt ) { - first_attempt = false; - second_size = requested_size - *data_size; - _XDPRINTF_("trying one more time to get remaining %x bytes\n", - second_size); - ret = tpm_get_random(locality, random_data + *data_size, - &second_size); - *data_size += second_size; - } - } - - return ret; -} - - - - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/uxmhf/xmhf-bootloader/txt.c b/uxmhf/xmhf-bootloader/txt.c deleted file mode 100644 index 63228aa35d..0000000000 --- a/uxmhf/xmhf-bootloader/txt.c +++ /dev/null @@ -1,708 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * txt.c: Intel(r) TXT support functions, including initiating measured - * launch, post-launch, AP wakeup, etc. - * - * Copyright (c) 2003-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.05 - */ - -/* - * NOTE: (TODO?) Stripped a lot of LCP, sleep, and MP code out of - * tboot's version of this file. Likely some of these are features - * that we would like to have. Look there instead of reinventing the - * wheel when the time comes. - */ - -#include -#include -#include -#include - -#include "_txt_hash.h" -#include "_txt_acmod.h" - -#define MTRR_TYPE_MIXED -1 -#define MMIO_APIC_BASE 0xFEE00000 -#define NR_MMIO_APIC_PAGES 1 -#define NR_MMIO_IOAPIC_PAGES 1 -#define NR_MMIO_PCICFG_PAGES 1 - -/* saved MTRR state or NULL if orig. MTRRs have not been changed */ -static mtrr_state_t *g_saved_mtrrs = NULL; - - -/* - * this must be done for each processor so that all have the same - * memory types - */ -bool set_mtrrs_for_acmod(acm_hdr_t *hdr) -{ - uint32_t eflags; - unsigned long cr0, cr4; - - /* - * need to do some things before we start changing MTRRs - * - * since this will modify some of the MTRRs, they should be saved first - * so that they can be restored once the AC mod is done - */ - - /* disable interrupts */ - eflags = read_eflags(CASM_NOPARAM); - - xmhfhw_cpu_disable_intr(CASM_NOPARAM); - - /* save CR0 then disable cache (CRO.CD=1, CR0.NW=0) */ - cr0 = read_cr0(CASM_NOPARAM); - write_cr0((cr0 & ~CR0_NW) | CR0_CD); - - /* flush caches */ - wbinvd(CASM_NOPARAM); - - /* save CR4 and disable global pages (CR4.PGE=0) */ - cr4 = read_cr4(CASM_NOPARAM); - write_cr4(cr4 & ~CR4_PGE); - - /* disable MTRRs */ - set_all_mtrrs(false); - - /* - * now set MTRRs for AC mod and rest of memory - */ - if ( !set_mem_type(hdr, hdr->size*4, MTRR_TYPE_WRBACK) ) - return false; - - /* - * now undo some of earlier changes and enable our new settings - */ - - /* flush caches */ - wbinvd(CASM_NOPARAM); - - /* enable MTRRs */ - set_all_mtrrs(true); - - /* restore CR0 (cacheing) */ - write_cr0(cr0); - - /* restore CR4 (global pages) */ - write_cr4(cr4); - - /* enable interrupts */ - write_eflags(eflags); - - - - return true; -} - - -//extern SL_PARAMETER_BLOCK *slpb; /* Ugh; ugly global from init.c */ - -bool get_parameters(getsec_parameters_t *params); - -/* - * this is the structure whose addr we'll put in TXT heap - * it needs to be within the MLE pages, so force it to the .text section - */ -static mle_hdr_t g_mle_hdr = { - .uuid = MLE_HDR_UUID, - .length = sizeof(mle_hdr_t), - .version = MLE_HDR_VER, - .entry_point = TEMPORARY_HARDCODED_MLE_ENTRYPOINT, // XXX TODO remove magic number - .first_valid_page = 0, - ///XXX I thnk these should be phys addres - .mle_start_off = 0, /* In MLE address space as accessed via MLE page tables */ - .mle_end_off = TEMPORARY_HARDCODED_MLE_SIZE, // XXX TODO remove magic number - .capabilities = { MLE_HDR_CAPS }, - .cmdline_start_off = 0, - .cmdline_end_off = 0 -}; - -///XXX -static void print_file_info(void) -{ - _XDPRINTF_("file addresses:\n"); - _XDPRINTF_("\t &g_mle_hdr=%p\n", &g_mle_hdr); -} - -static void print_mle_hdr(const mle_hdr_t *mle_hdr) -{ - _XDPRINTF_("MLE header:\n"); - _XDPRINTF_("\t uuid="); print_uuid(&mle_hdr->uuid); _XDPRINTF_("\n"); - _XDPRINTF_("\t length=%x\n", mle_hdr->length); - _XDPRINTF_("\t version=%08x\n", mle_hdr->version); - _XDPRINTF_("\t entry_point=%08x\n", mle_hdr->entry_point); - _XDPRINTF_("\t first_valid_page=%08x\n", mle_hdr->first_valid_page); - _XDPRINTF_("\t mle_start_off=%x\n", mle_hdr->mle_start_off); - _XDPRINTF_("\t mle_end_off=%x\n", mle_hdr->mle_end_off); - print_txt_caps("\t ", mle_hdr->capabilities); -} - -#define MAKE_PDTE(addr) (PAGE_ALIGN_4K((uint32_t)addr) | 0x01) - -/* we assume/know that our image is <2MB and thus fits w/in a single */ -/* PT (512*4KB = 2MB) and thus fixed to 1 pg dir ptr and 1 pgdir and */ -/* 1 ptable = 3 pages and just 1 loop loop for ptable MLE page table */ -/* can only contain 4k pages */ -static void *build_mle_pagetable(uint32_t mle_start, uint32_t mle_size) -{ - void *ptab_base; - uint32_t ptab_size, mle_off; - void *pg_dir_ptr_tab, *pg_dir, *pg_tab; - uint64_t *pte; - - _XDPRINTF_("MLE start=%x, end=%x, size=%x\n", mle_start, mle_start+mle_size, - mle_size); - if ( mle_size > 512*PAGE_SIZE_4K ) { - _XDPRINTF_("MLE size too big for single page table\n"); - return NULL; - } - - /* should start on page boundary */ - if ( PAGE_ALIGN_4K(mle_start) != mle_start ) { - _XDPRINTF_("MLE start is not page-aligned\n"); - return NULL; - } - - /* place ptab_base below MLE */ - ptab_size = 3 * PAGE_SIZE_4K; /* pgdir ptr + pgdir + ptab = 3 */ - ptab_base = (void *)(mle_start - ptab_size); - - /* NB: This memset will clobber the AMD-specific SL header. That - * is okay, as we are launching on an Intel TXT system. */ - memset(ptab_base, 0, ptab_size); - _XDPRINTF_("ptab_size=%x, ptab_base=%p\n", ptab_size, ptab_base); - - pg_dir_ptr_tab = (void *)ptab_base; - pg_dir = (void *)((uint32_t)pg_dir_ptr_tab + PAGE_SIZE_4K); - pg_tab = (void *)((uint32_t)pg_dir + PAGE_SIZE_4K); - - /* only use first entry in page dir ptr table */ - *(uint64_t *)pg_dir_ptr_tab = MAKE_PDTE(pg_dir); - - _XDPRINTF_("*(uint64_t *)pg_dir_ptr_tab = 0x%16llx\n", - *(uint64_t *)pg_dir_ptr_tab); - - /* only use first entry in page dir */ - *(uint64_t *)pg_dir = MAKE_PDTE(pg_tab); - _XDPRINTF_("*(uint64_t *)pg_dir = 0x%16llx\n", - *(uint64_t *)pg_dir); - - - pte = pg_tab; - mle_off = 0; - do { - *pte = MAKE_PDTE(mle_start + mle_off); - _XDPRINTF_("pte = 0x%08x\n*pte = 0x%15llx\n", - (uint32_t)pte, *pte); - - pte++; - mle_off += PAGE_SIZE_4K; - } while ( mle_off < mle_size ); - - return ptab_base; -} - -/* - * will go through all modules to find an SINIT that matches the platform - * (size can be NULL) - */ -static bool check_sinit_module(void *base, size_t size) -{ - txt_didvid_t didvid; - txt_ver_fsbif_emif_t ver; - - if ( base == NULL ) - return false; - - /* display chipset fuse and device and vendor id info */ - unpack_txt_didvid_t(&didvid, read_pub_config_reg(TXTCR_DIDVID)); - _XDPRINTF_("chipset ids: vendor: 0x%x, device: 0x%x, revision: 0x%x\n", - didvid.vendor_id, didvid.device_id, didvid.revision_id); - unpack_txt_ver_fsbif_emif_t(&ver, read_pub_config_reg(TXTCR_VER_FSBIF)); - if ( (pack_txt_ver_fsbif_emif_t(&ver) & 0xffffffff) == 0xffffffff || - (pack_txt_ver_fsbif_emif_t(&ver) & 0xffffffff) == 0x00 ) /* need to use VER.EMIF */ - unpack_txt_ver_fsbif_emif_t(&ver, read_pub_config_reg(TXTCR_VER_EMIF)); - _XDPRINTF_("chipset production fused: %x\n", ver.prod_fused ); - - if ( is_sinit_acmod(base, size, false) && - does_acmod_match_chipset((acm_hdr_t *)base) ) { - _XDPRINTF_("SINIT matches platform\n"); - return true; - } - /* no SINIT found for this platform */ - _XDPRINTF_("no SINIT AC module found\n"); - return false; -} - - -/* - * sets up TXT heap - */ -static txt_heap_t *init_txt_heap(void *ptab_base, acm_hdr_t *sinit, - void *phys_mle_start, size_t mle_size) -{ - txt_heap_t *txt_heap; - uint64_t *size; - os_mle_data_t os_mle_data; - os_sinit_data_t os_sinit_data; - /* uint64_t min_lo_ram, max_lo_ram, min_hi_ram, max_hi_ram; */ - txt_caps_t sinit_caps; - txt_caps_t caps_mask; - -(void)mle_size; - - txt_heap = get_txt_heap(); - - /* - * BIOS data already setup by BIOS - */ - if ( !verify_txt_heap(txt_heap, true) ) - return NULL; - - /* - * OS/loader to MLE data - */ - //os_mle_data =get_os_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)); - //size = (uint64_t *)((uint32_t)os_mle_data - sizeof(uint64_t)); - //*size = sizeof(*os_mle_data) + sizeof(uint64_t); - //memset(os_mle_data, 0, sizeof(*os_mle_data)); - //os_mle_data->version = 0x02; - //os_mle_data->mbi = NULL; - //os_mle_data->saved_misc_enable_msr = rdmsr64(MSR_IA32_MISC_ENABLE); - - - xmhfhw_sysmemaccess_writeu64( - (get_os_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)) - sizeof(uint64_t)), - (uint32_t)(sizeof(os_mle_data) + sizeof(uint64_t)), - (uint32_t)((uint64_t)(sizeof(os_mle_data) + sizeof(uint64_t)) >> 32) ); - - memset(&os_mle_data, 0, sizeof(os_mle_data)); - os_mle_data.version = 0x02; - os_mle_data.mbi = NULL; - os_mle_data.saved_misc_enable_msr = rdmsr64(MSR_IA32_MISC_ENABLE); - - xmhfhw_sysmemaccess_copy(get_os_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - &os_mle_data, sizeof(os_mle_data_t)); - - //_XDPRINTF_("Came %s:%u\n", __func__, __LINE__); - //HALT(); - - - - /* - * OS/loader to SINIT data - */ - - //os_sinit_data = get_os_sinit_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)); - //size = (uint64_t *)((uint32_t)os_sinit_data - sizeof(uint64_t)); - // *size = sizeof(*os_sinit_data) + sizeof(uint64_t); - - xmhfhw_sysmemaccess_writeu64( - (get_os_sinit_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)) - sizeof(uint64_t)), - (uint32_t)(sizeof(os_sinit_data) + sizeof(uint64_t)), - (uint32_t)((uint64_t)(sizeof(os_sinit_data) + sizeof(uint64_t)) >> 32) ); - - - memset(&os_sinit_data, 0, sizeof(os_sinit_data)); - - os_sinit_data.version = 5; - os_sinit_data.mle_ptab = (uint64_t)(unsigned long)ptab_base; - os_sinit_data.mle_size = g_mle_hdr.mle_end_off - g_mle_hdr.mle_start_off; - - HALT_ON_ERRORCOND(sizeof(mle_hdr_t) < TEMPORARY_MAX_MLE_HEADER_SIZE); - memcpy(phys_mle_start, &g_mle_hdr, sizeof(mle_hdr_t)); - _XDPRINTF_("Copied mle_hdr (0x%08x, 0x%x bytes) into SL (0x%08x)\n", - (uint32_t)&g_mle_hdr, sizeof(mle_hdr_t), (uint32_t)phys_mle_start); - - os_sinit_data.mle_hdr_base = 0; // linear addr (offset from MLE base) of mle header, in MLE page tables - - - os_sinit_data.vtd_pmr_lo_base = (uint64_t)__TARGET_BASE_SL; - os_sinit_data.vtd_pmr_lo_size = (uint64_t)__TARGET_SIZE_SL; - _XDPRINTF_("\nvtd_pmr_lo_base=%016llx, size=%016llx", os_sinit_data.vtd_pmr_lo_base, os_sinit_data.vtd_pmr_lo_size); - - sinit_caps = get_sinit_capabilities(sinit); - caps_mask = 0; - caps_mask = TXT_CAPS_T_RLP_WAKE_GETSEC | TXT_CAPS_T_RLP_WAKE_MONITOR; - os_sinit_data.capabilities = MLE_HDR_CAPS & ~caps_mask; - if ( sinit_caps & TXT_CAPS_T_RLP_WAKE_MONITOR ) - os_sinit_data.capabilities |= TXT_CAPS_T_RLP_WAKE_MONITOR; - else if ( sinit_caps & TXT_CAPS_T_RLP_WAKE_GETSEC ){ - os_sinit_data.capabilities |= TXT_CAPS_T_RLP_WAKE_GETSEC; - }else { /* should have been detected in verify_acmod() */ - _XDPRINTF_("SINIT capabilities are icompatible (0x%x)\n", sinit_caps); - return NULL; - } - - os_sinit_data.capabilities &= ~(TXT_CAPS_T_ECX_PGTBL); - - print_os_sinit_data(&os_sinit_data); - - - xmhfhw_sysmemaccess_copy( - get_os_sinit_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - &os_sinit_data, - sizeof(os_sinit_data)); - - - - - - /* - * SINIT to MLE data will be setup by SINIT - */ - - return txt_heap; -} - -void delay(uint64_t cycles) -{ - uint64_t start = rdtsc64(CASM_NOPARAM); - - while ( rdtsc64(CASM_NOPARAM)-start < cycles ) ; -} - - -tb_error_t txt_launch_environment(void *sinit_ptr, size_t sinit_size, - void *phys_mle_start, size_t mle_size) -{ - acm_hdr_t *sinit; - void *mle_ptab_base; - os_mle_data_t os_mle_data; - txt_heap_t *txt_heap; - - if(NULL == sinit_ptr) return TB_ERR_SINIT_NOT_PRESENT; - else sinit = (acm_hdr_t*)sinit_ptr; - - if(!check_sinit_module((void *)sinit, sinit_size)) { - _XDPRINTF_("check_sinit_module failed\n"); - return TB_ERR_SINIT_NOT_PRESENT; - } - /* if it is newer than BIOS-provided version, then copy it to */ - /* BIOS reserved region */ - sinit = copy_sinit(sinit); - if ( sinit == NULL ) - return TB_ERR_SINIT_NOT_PRESENT; - /* do some checks on it */ - if ( !verify_acmod(sinit) ) - return TB_ERR_ACMOD_VERIFY_FAILED; - - /* print some debug info */ - print_file_info(); - print_mle_hdr(&g_mle_hdr); - - /* create MLE page table */ - mle_ptab_base = build_mle_pagetable((uint32_t)phys_mle_start, mle_size); - if ( mle_ptab_base == NULL ) - return TB_ERR_FATAL; - - /* initialize TXT heap */ - txt_heap = init_txt_heap(mle_ptab_base, sinit, - phys_mle_start, mle_size); - if ( txt_heap == NULL ) - return TB_ERR_FATAL; - - /* save MTRRs before we alter them for SINIT launch */ - xmhfhw_sysmemaccess_copy(&os_mle_data, get_os_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(os_mle_data_t)); - xmhfhw_cpu_x86_save_mtrrs(&(os_mle_data.saved_mtrr_state)); - xmhfhw_sysmemaccess_copy( get_os_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), &os_mle_data, - sizeof(os_mle_data_t)); - - /* set MTRRs properly for AC module (SINIT) */ - if ( !set_mtrrs_for_acmod(sinit) ) - return TB_ERR_FATAL; - - _XDPRINTF_("executing GETSEC[SENTER]...\n"); - /* pause before executing GETSEC[SENTER] */ - delay(0x80000000); - -//#ifndef PERF_CRIT -// if(NULL != slpb) { -// __asm__ __volatile__ ( -// "cpuid\r\n" -// "cpuid\r\n" -// "cpuid\r\n" -// "rdtsc\r\n" -// : "=A"(slpb->rdtsc_before_drtm) -// : /* no inputs */ -// : "ebx","ecx"); -// } -//#endif - - __getsec_senter((uint32_t)sinit, (sinit->size)*4); - _XDPRINTF_("ERROR--we should not get here!\n"); - return TB_ERR_FATAL; -} - - -bool txt_prepare_cpu(void) -{ - uint32_t eflags, cr0; - uint64_t mcg_cap, mcg_stat; - getsec_parameters_t params; - unsigned int i; - - /* must be running at CPL 0 => this is implicit in even getting this far */ - /* since our bootstrap code loads a GDT, etc. */ - cr0 = read_cr0(CASM_NOPARAM); - - /* must be in protected mode */ - if ( !(cr0 & CR0_PE) ) { - _XDPRINTF_("ERR: not in protected mode\n"); - return false; - } - - /* cache must be enabled (CR0.CD = CR0.NW = 0) */ - if ( cr0 & CR0_CD ) { - _XDPRINTF_("CR0.CD set; clearing it.\n"); - cr0 &= ~CR0_CD; - } - if ( cr0 & CR0_NW ) { - _XDPRINTF_("CR0.NW set; clearing it.\n"); - cr0 &= ~CR0_NW; - } - - /* native FPU error reporting must be enabled for proper */ - /* interaction behavior */ - if ( !(cr0 & CR0_NE) ) { - _XDPRINTF_("CR0.NE not set; setting it.\n"); - cr0 |= CR0_NE; - } - - write_cr0(cr0); - - /* cannot be in virtual-8086 mode (EFLAGS.VM=1) */ - eflags = read_eflags(CASM_NOPARAM); - - if ( eflags & EFLAGS_VM ) { - _XDPRINTF_("EFLAGS.VM set; clearing it.\n"); - write_eflags(eflags | ~EFLAGS_VM); - - } - - _XDPRINTF_("CR0 and EFLAGS OK\n"); - - /* - * verify that we're not already in a protected environment - */ - if ( txt_is_launched() ) { - _XDPRINTF_("already in protected environment\n"); - return false; - } - - /* - * verify all machine check status registers are clear (unless - * support preserving them) - */ - - /* no machine check in progress (IA32_MCG_STATUS.MCIP=1) */ - mcg_stat = rdmsr64(MSR_MCG_STATUS); - if ( mcg_stat & 0x04 ) { - _XDPRINTF_("machine check in progress\n"); - return false; - } - - if ( !get_parameters(¶ms) ) { - _XDPRINTF_("get_parameters() failed\n"); - return false; - } - - /* check if all machine check regs are clear */ - mcg_cap = rdmsr64(MSR_MCG_CAP); - for ( i = 0; i < (mcg_cap & 0xff); i++ ) { - mcg_stat = rdmsr64(MSR_MC0_STATUS + 4*i); - if ( mcg_stat & (1ULL << 63) ) { - _XDPRINTF_("MCG[%u] = %llx ERROR\n", i, mcg_stat); - if ( !params.preserve_mce ) - return false; - } - } - - if ( params.preserve_mce ) - _XDPRINTF_("supports preserving machine check errors\n"); - else - _XDPRINTF_("no machine check errors\n"); - - if ( params.proc_based_scrtm ) - _XDPRINTF_("CPU support processor-based S-CRTM\n"); - - /* all is well with the processor state */ - _XDPRINTF_("CPU is ready for SENTER\n"); - - return true; -} - - - -#define ACM_MEM_TYPE_UC 0x0100 -#define ACM_MEM_TYPE_WC 0x0200 -#define ACM_MEM_TYPE_WT 0x1000 -#define ACM_MEM_TYPE_WP 0x2000 -#define ACM_MEM_TYPE_WB 0x4000 - -#define DEF_ACM_MAX_SIZE 0x8000 -#define DEF_ACM_VER_MASK 0xffffffff -#define DEF_ACM_VER_SUPPORTED 0x00 -#define DEF_ACM_MEM_TYPES ACM_MEM_TYPE_UC -#define DEF_SENTER_CTRLS 0x00 - -bool get_parameters(getsec_parameters_t *params) -{ - unsigned long cr4; - uint32_t index, eax, ebx, ecx; - int param_type; - - /* sanity check because GETSEC[PARAMETERS] will fail if not set */ - cr4 = read_cr4(CASM_NOPARAM); - if ( !(cr4 & CR4_SMXE) ) { - _XDPRINTF_("SMXE not enabled, can't read parameters\n"); - return false; - } - - memset(params, 0, sizeof(*params)); - params->acm_max_size = DEF_ACM_MAX_SIZE; - params->acm_mem_types = DEF_ACM_MEM_TYPES; - params->senter_controls = DEF_SENTER_CTRLS; - params->proc_based_scrtm = false; - params->preserve_mce = false; - - index = 0; - do { - __getsec_parameters(index++, ¶m_type, &eax, &ebx, &ecx); - /* the code generated for a 'switch' statement doesn't work in this */ - /* environment, so use if/else blocks instead */ - - /* NULL - all reserved */ - if ( param_type == 0 ) - ; - /* supported ACM versions */ - else if ( param_type == 1 ) { - if ( params->n_versions == MAX_SUPPORTED_ACM_VERSIONS ) - _XDPRINTF_("number of supported ACM version exceeds " - "MAX_SUPPORTED_ACM_VERSIONS\n"); - else { - params->acm_versions[params->n_versions].mask = ebx; - params->acm_versions[params->n_versions].version = ecx; - params->n_versions++; - } - } - /* max size AC execution area */ - else if ( param_type == 2 ) - params->acm_max_size = eax & 0xffffffe0; - /* supported non-AC mem types */ - else if ( param_type == 3 ) - params->acm_mem_types = eax & 0xffffffe0; - /* SENTER controls */ - else if ( param_type == 4 ) - params->senter_controls = (eax & 0x00007fff) >> 8; - /* TXT extensions support */ - else if ( param_type == 5 ) { - params->proc_based_scrtm = (eax & 0x00000020) ? true : false; - params->preserve_mce = (eax & 0x00000040) ? true : false; - } - else { - _XDPRINTF_("unknown GETSEC[PARAMETERS] type: %d\n", param_type); - param_type = 0; /* set so that we break out of the loop */ - } - } while ( param_type != 0 ); - - if ( params->n_versions == 0 ) { - params->acm_versions[0].mask = DEF_ACM_VER_MASK; - params->acm_versions[0].version = DEF_ACM_VER_SUPPORTED; - params->n_versions = 1; - } - - return true; -} - - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/uxmhf/xmhf-bootloader/txt_acmod.c b/uxmhf/xmhf-bootloader/txt_acmod.c deleted file mode 100644 index f46fb3e4f5..0000000000 --- a/uxmhf/xmhf-bootloader/txt_acmod.c +++ /dev/null @@ -1,677 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * acmod.c: support functions for use of Intel(r) TXT Authenticated - * Code (AC) Modules - * - * Copyright (c) 2003-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.04 - */ - -#include -#include -#include -#include - -#include "_txt_hash.h" -#include "_txt_acmod.h" - -static acm_info_table_t *get_acmod_info_table(acm_hdr_t* hdr) -{ - uint32_t user_area_off; - - /* overflow? */ - if ( plus_overflow_u32(hdr->header_len, hdr->scratch_size) ) { - _XDPRINTF_("ACM header length plus scratch size overflows\n"); - return NULL; - } - - if ( multiply_overflow_u32((hdr->header_len + hdr->scratch_size), 4) ) { - _XDPRINTF_("ACM header length and scratch size in bytes overflows\n"); - return NULL; - } - - /* this fn assumes that the ACM has already passed at least the initial */ - /* is_acmod() checks */ - - user_area_off = (hdr->header_len + hdr->scratch_size) * 4; - - /* overflow? */ - if ( plus_overflow_u32(user_area_off, sizeof(acm_info_table_t)) ) { - _XDPRINTF_("user_area_off plus acm_info_table_t size overflows\n"); - return NULL; - } - - /* check that table is within module */ - if ( user_area_off + sizeof(acm_info_table_t) > hdr->size*4 ) { - _XDPRINTF_("ACM info table size too large: %x\n", - user_area_off + (uint32_t)sizeof(acm_info_table_t)); - return NULL; - } - - /* overflow? */ - if ( plus_overflow_u32((uint32_t)(uintptr_t)hdr, user_area_off) ) { - _XDPRINTF_("hdr plus user_area_off overflows\n"); - return NULL; - } - - return (acm_info_table_t *)((unsigned long)hdr + user_area_off); -} - -static acm_chipset_id_list_t *get_acmod_chipset_list(acm_hdr_t* hdr) -{ - acm_info_table_t* info_table; - uint32_t size, id_list_off; - acm_chipset_id_list_t *chipset_id_list; - - /* this fn assumes that the ACM has already passed the is_acmod() checks */ - - info_table = get_acmod_info_table(hdr); - if ( info_table == NULL ) - return NULL; - id_list_off = info_table->chipset_id_list; - - size = hdr->size * 4; - - /* overflow? */ - if ( plus_overflow_u32(id_list_off, sizeof(acm_chipset_id_t)) ) { - _XDPRINTF_("id_list_off plus acm_chipset_id_t size overflows\n"); - return NULL; - } - - /* check that chipset id table is w/in ACM */ - if ( id_list_off + sizeof(acm_chipset_id_t) > size ) { - _XDPRINTF_("ACM chipset id list is too big: chipset_id_list=%x\n", - id_list_off); - return NULL; - } - - /* overflow? */ - if ( plus_overflow_u32((uint32_t)(uintptr_t)hdr, id_list_off) ) { - _XDPRINTF_("hdr plus id_list_off overflows\n"); - return NULL; - } - - chipset_id_list = (acm_chipset_id_list_t *) - ((unsigned long)hdr + id_list_off); - - /* overflow? */ - if ( multiply_overflow_u32(chipset_id_list->count, - sizeof(acm_chipset_id_t)) ) { - _XDPRINTF_("size of acm_chipset_id_list overflows\n"); - return NULL; - } - if ( plus_overflow_u32(id_list_off + sizeof(acm_chipset_id_t), - chipset_id_list->count * sizeof(acm_chipset_id_t)) ) { - _XDPRINTF_("size of all entries overflows\n"); - return NULL; - } - - /* check that all entries are w/in ACM */ - if ( id_list_off + sizeof(acm_chipset_id_t) + - chipset_id_list->count * sizeof(acm_chipset_id_t) > size ) { - _XDPRINTF_("ACM chipset id entries are too big:" - " chipset_id_list->count=%x\n", chipset_id_list->count); - return NULL; - } - - return chipset_id_list; -} - -void print_txt_caps(const char *prefix, txt_caps_t caps) -{ - _XDPRINTF_("%scapabilities: 0x%08x\n", prefix, caps); - _XDPRINTF_("%s rlp_wake_getsec: %d\n", prefix, caps & TXT_CAPS_T_RLP_WAKE_GETSEC); - _XDPRINTF_("%s rlp_wake_monitor: %d\n", prefix, caps & TXT_CAPS_T_RLP_WAKE_MONITOR); - _XDPRINTF_("%s ecx_pgtbl: %d\n", prefix, caps & TXT_CAPS_T_ECX_PGTBL); -} - -/* UUID helpers from tboot-20101005/include/uuid.h */ -void print_uuid(const uuid_t *uuid) -{ - _XDPRINTF_("{0x%08x, 0x%04x, 0x%04x, 0x%04x,\n" - "\t\t{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}", - uuid->data1, (uint32_t)uuid->data2, (uint32_t)uuid->data3, - (uint32_t)uuid->data4, (uint32_t)uuid->data5[0], - (uint32_t)uuid->data5[1], (uint32_t)uuid->data5[2], - (uint32_t)uuid->data5[3], (uint32_t)uuid->data5[4], - (uint32_t)uuid->data5[5]); -} - -static inline bool are_uuids_equal(const uuid_t *uuid1, const uuid_t *uuid2) -{ - return (memcmp((const char *)uuid1, (const char *)uuid2, sizeof(*uuid1)) == 0); -} - -static void print_acm_hdr(acm_hdr_t *hdr, const char *mod_name) -{ - acm_info_table_t *info_table; - acm_chipset_id_list_t *chipset_id_list; - unsigned int i; - - _XDPRINTF_("AC module header dump for %s:\n", - (mod_name == NULL) ? "?" : mod_name); - - /* header */ - _XDPRINTF_("\t type: 0x%x ", hdr->module_type); - if ( hdr->module_type == ACM_TYPE_CHIPSET ) - _XDPRINTF_("(ACM_TYPE_CHIPSET)\n"); - else - _XDPRINTF_("(unknown)\n"); - _XDPRINTF_("\t length: 0x%x (%u)\n", hdr->header_len, hdr->header_len); - _XDPRINTF_("\t version: %u\n", hdr->header_ver); - _XDPRINTF_("\t chipset_id: 0x%x\n", (uint32_t)hdr->chipset_id); - _XDPRINTF_("\t flags: 0x%x\n", (uint32_t)hdr->flags); - _XDPRINTF_("\t\t pre_production: %d\n", (int)hdr->flags & ACM_FLAGS_T_PRE_PRODUCTION); - _XDPRINTF_("\t\t debug_signed: %d\n", (int)hdr->flags & ACM_FLAGS_T_DEBUG_SIGNED); - _XDPRINTF_("\t vendor: 0x%x\n", hdr->module_vendor); - _XDPRINTF_("\t date: 0x%08x\n", hdr->date); - _XDPRINTF_("\t size*4: 0x%x (%u)\n", hdr->size*4, hdr->size*4); - _XDPRINTF_("\t code_control: 0x%x\n", hdr->code_control); - _XDPRINTF_("\t error_entry_point: 0x%x\n", hdr->error_entry_point); - _XDPRINTF_("\t gdt_limit 0x%x, gdt_base 0x%x\n", hdr->gdt_limit, - hdr->gdt_base); - _XDPRINTF_("\t entry point (seg_sel:entry_point): 0x%08x:%08x\n", hdr->seg_sel, - hdr->entry_point); - _XDPRINTF_("\t scratch_size: 0x%x (%u)", hdr->scratch_size, - hdr->scratch_size); - - /* GDT */ - //print_hex("\t\t SINIT GDT: ", (void *)((uint32_t)hdr+hdr->gdt_base), hdr->gdt_limit); - /* info table */ - _XDPRINTF_("\t info_table:\n"); - info_table = get_acmod_info_table(hdr); - if ( info_table == NULL ) { - _XDPRINTF_("\t\t \n"); - return; - } - _XDPRINTF_("\t\t uuid: "); print_uuid(&info_table->uuid); _XDPRINTF_("\n"); - if ( are_uuids_equal(&(info_table->uuid), &((uuid_t)ACM_UUID_V3)) ) - _XDPRINTF_("\t\t ACM_UUID_V3\n"); - else - _XDPRINTF_("\t\t unknown\n"); - _XDPRINTF_("\t\t chipset_acm_type: 0x%x ", - (uint32_t)info_table->chipset_acm_type); - if ( info_table->chipset_acm_type == ACM_CHIPSET_TYPE_SINIT ) - _XDPRINTF_("(SINIT)\n"); - else if ( info_table->chipset_acm_type == ACM_CHIPSET_TYPE_BIOS ) - _XDPRINTF_("(BIOS)\n"); - else - _XDPRINTF_("(unknown)\n"); - _XDPRINTF_("\t\t version: %u\n", (uint32_t)info_table->version); - _XDPRINTF_("\t\t length: 0x%x (%u)\n", (uint32_t)info_table->length, - (uint32_t)info_table->length); - _XDPRINTF_("\t\t chipset_id_list: 0x%x\n", info_table->chipset_id_list); - _XDPRINTF_("\t\t os_sinit_data_ver: 0x%x\n", info_table->os_sinit_data_ver); - _XDPRINTF_("\t\t min_mle_hdr_ver: 0x%08x\n", info_table->min_mle_hdr_ver); - print_txt_caps("\t\t ", info_table->capabilities); - _XDPRINTF_("\t\t acm_ver: %u\n", (uint32_t)info_table->acm_ver); - - /* chipset list */ - _XDPRINTF_("\t chipset list:\n"); - chipset_id_list = get_acmod_chipset_list(hdr); - if ( chipset_id_list == NULL ) { - _XDPRINTF_("\t\t \n"); - return; - } - _XDPRINTF_("\t\t count: %u\n", chipset_id_list->count); - for ( i = 0; i < chipset_id_list->count; i++ ) { - acm_chipset_id_t *chipset_id; - _XDPRINTF_("\t\t entry %u:\n", i); - chipset_id = &(chipset_id_list->chipset_ids[i]); - _XDPRINTF_("\t\t flags: 0x%x\n", chipset_id->flags); - _XDPRINTF_("\t\t vendor_id: 0x%x\n", (uint32_t)chipset_id->vendor_id); - _XDPRINTF_("\t\t device_id: 0x%x\n", (uint32_t)chipset_id->device_id); - _XDPRINTF_("\t\t revision_id: 0x%x\n", - (uint32_t)chipset_id->revision_id); - _XDPRINTF_("\t\t extended_id: 0x%x\n", chipset_id->extended_id); - } -} - -uint32_t get_supported_os_sinit_data_ver(acm_hdr_t* hdr) -{ - /* assumes that it passed is_sinit_acmod() */ - - acm_info_table_t *info_table = get_acmod_info_table(hdr); - if ( info_table == NULL ) - return 0; - - return info_table->os_sinit_data_ver; -} - -// return type changed from txt_caps_t due to -Waggregate-return -uint32_t get_sinit_capabilities(acm_hdr_t* hdr) -{ - /* assumes that it passed is_sinit_acmod() */ - - acm_info_table_t *info_table = get_acmod_info_table(hdr); - if ( info_table == NULL || info_table->version < 3 ) - return 0; - - return info_table->capabilities; -} - -static bool is_acmod(void *acmod_base, size_t acmod_size, uint8_t *type, - bool quiet) -{ - acm_hdr_t *acm_hdr; - acm_info_table_t *info_table; - - acm_hdr = (acm_hdr_t *)acmod_base; - - /* first check size */ - if ( acmod_size < sizeof(acm_hdr_t) ) { - if ( !quiet ) - _XDPRINTF_("\t ACM size is too small: acmod_size=%x," - " sizeof(acm_hdr)=%x\n", (uint32_t)acmod_size, - (uint32_t)sizeof(acm_hdr) ); - return false; - } - - /* then check overflow */ - if ( multiply_overflow_u32(acm_hdr->size, 4) ) { - if ( !quiet ) - _XDPRINTF_("\t ACM header size in bytes overflows\n"); - return false; - } - - /* then check size equivalency */ - if ( acmod_size != acm_hdr->size * 4 ) { - if ( !quiet ) - _XDPRINTF_("\t ACM size is too small: acmod_size=%x," - " acm_hdr->size*4=%x\n", (uint32_t)acmod_size, - acm_hdr->size*4); - return false; - } - - /* then check type and vendor */ - if ( (acm_hdr->module_type != ACM_TYPE_CHIPSET) || - (acm_hdr->module_vendor != ACM_VENDOR_INTEL) ) { - if ( !quiet ) - _XDPRINTF_("\t ACM type/vendor mismatch: module_type=%x," - " module_vendor=%x\n", acm_hdr->module_type, - acm_hdr->module_vendor); - return false; - } - - info_table = get_acmod_info_table(acm_hdr); - if ( info_table == NULL ) - return false; - - /* check if ACM UUID is present */ - if ( !are_uuids_equal(&(info_table->uuid), &((uuid_t)ACM_UUID_V3)) ) { - if ( !quiet ) { - _XDPRINTF_("\t unknown UUID: "); print_uuid(&info_table->uuid); - _XDPRINTF_("\n"); - } - return false; - } - - if ( type != NULL ) - *type = info_table->chipset_acm_type; - - if ( info_table->version < 3 ) { - if ( !quiet ) - _XDPRINTF_("\t ACM info_table version unsupported (%u)\n", - (uint32_t)info_table->version); - return false; - } - /* there is forward compatibility, so this is just a warning */ - else if ( info_table->version > 3 ) { - if ( !quiet ) - _XDPRINTF_("\t ACM info_table version mismatch (%u)\n", - (uint32_t)info_table->version); - } - - return true; -} - -bool is_sinit_acmod(void *acmod_base, size_t acmod_size, bool quiet) -{ - uint8_t type; - - if ( !is_acmod(acmod_base, acmod_size, &type, quiet) ) - return false; - - if ( type != ACM_CHIPSET_TYPE_SINIT ) { - _XDPRINTF_("ACM is not an SINIT ACM (%x)\n", type); - return false; - } - - return true; -} - -bool does_acmod_match_chipset(acm_hdr_t* hdr) -{ - /* this fn assumes that the ACM has already passed the is_acmod() checks */ - acm_chipset_id_list_t *chipset_id_list; - txt_didvid_t didvid; - unsigned int i; - /* - * check if fusing is same - */ - txt_ver_fsbif_emif_t ver; - unpack_txt_ver_fsbif_emif_t(&ver, read_pub_config_reg(TXTCR_VER_FSBIF)); - if ( (pack_txt_ver_fsbif_emif_t(&ver) & 0xffffffff) == 0xffffffff || - (pack_txt_ver_fsbif_emif_t(&ver) & 0xffffffff) == 0x00 ) /* need to use VER.EMIF */ - unpack_txt_ver_fsbif_emif_t(&ver, read_pub_config_reg(TXTCR_VER_EMIF)); - if ( ver.prod_fused != !(hdr->flags & ACM_FLAGS_T_DEBUG_SIGNED) ) { - _XDPRINTF_("\t production/debug mismatch between chipset and ACM\n"); - return false; - } - - /* - * check if vendor/device/revision IDs match - */ - chipset_id_list = get_acmod_chipset_list(hdr); - if ( chipset_id_list == NULL ) - return false; - - /* get chipset device and vendor id info */ - unpack_txt_didvid_t(&didvid, read_pub_config_reg(TXTCR_DIDVID)); - - _XDPRINTF_("\t %x ACM chipset id entries:\n", chipset_id_list->count); - for ( i = 0; i < chipset_id_list->count; i++ ) { - acm_chipset_id_t *chipset_id = &(chipset_id_list->chipset_ids[i]); - _XDPRINTF_("\t vendor: 0x%x, device: 0x%x, flags: 0x%x, " - "revision: 0x%x, extended: 0x%x\n", - (uint32_t)chipset_id->vendor_id, - (uint32_t)chipset_id->device_id, chipset_id->flags, - (uint32_t)chipset_id->revision_id, chipset_id->extended_id); - - if ( (didvid.vendor_id == chipset_id->vendor_id ) && - (didvid.device_id == chipset_id->device_id ) && - ( ( ( (chipset_id->flags & 0x1) == 0) && - (didvid.revision_id == chipset_id->revision_id) ) || - ( ( (chipset_id->flags & 0x1) == 1) && - ((didvid.revision_id & chipset_id->revision_id) != 0 ) ) ) ) - return true; - } - - _XDPRINTF_("\t ACM does not match chipset\n"); - - return false; -} - -acm_hdr_t *copy_sinit(acm_hdr_t *sinit) -{ - void *sinit_region_base; - uint32_t sinit_region_size; - txt_heap_t *txt_heap; - bios_data_t bios_data; - - /* get BIOS-reserved region from LT.SINIT.BASE config reg */ - sinit_region_base = - (void*)(unsigned long)read_pub_config_reg(TXTCR_SINIT_BASE); - sinit_region_size = (uint32_t)read_pub_config_reg(TXTCR_SINIT_SIZE); - - /* - * check if BIOS already loaded an SINIT module there - */ - txt_heap = get_txt_heap(); - xmhfhw_sysmemaccess_copy(&bios_data, - get_bios_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(bios_data_t)); - /* BIOS has loaded an SINIT module, so verify that it is valid */ - if ( bios_data.bios_sinit_size != 0 ) { - _XDPRINTF_("BIOS has already loaded an SINIT module\n"); - /* is it a valid SINIT module? */ - if ( is_sinit_acmod(sinit_region_base, bios_data.bios_sinit_size, false) && - does_acmod_match_chipset((acm_hdr_t *)sinit_region_base) ) { - /* no other SINIT was provided so must use one BIOS provided */ - if ( sinit == NULL ) - return (acm_hdr_t *)sinit_region_base; - - /* is it newer than the one we've been provided? */ - if ( ((acm_hdr_t *)sinit_region_base)->date >= sinit->date ) { - _XDPRINTF_("BIOS-provided SINIT is newer, so using it\n"); - return (acm_hdr_t *)sinit_region_base; /* yes */ - } - else - _XDPRINTF_("BIOS-provided SINIT is older: date=%x\n", - ((acm_hdr_t *)sinit_region_base)->date); - } - } - /* our SINIT is newer than BIOS's (or BIOS did not have one) */ - - /* BIOS SINIT not present or not valid and none provided */ - if ( sinit == NULL ) - return NULL; - - /* overflow? */ - if ( multiply_overflow_u32(sinit->size, 4) ) { - _XDPRINTF_("sinit size in bytes overflows\n"); - return NULL; - } - - /* make sure our SINIT fits in the reserved region */ - if ( (sinit->size * 4) > sinit_region_size ) { - _XDPRINTF_("BIOS-reserved SINIT size (%x) is too small for loaded " - "SINIT (%x)\n", sinit_region_size, sinit->size*4); - return NULL; - } - - /* copy it there */ - memcpy(sinit_region_base, sinit, sinit->size*4); - - _XDPRINTF_("copied SINIT (size=%x) to %p\n", sinit->size*4, - sinit_region_base); - - return (acm_hdr_t *)sinit_region_base; -} - - -/* - * Do some AC module sanity checks because any violations will cause - * an TXT.RESET. Instead detect these, print a desriptive message, - * and skip SENTER/ENTERACCS - */ -bool verify_acmod(acm_hdr_t *acm_hdr) -{ - getsec_parameters_t params; - uint32_t size; - acm_info_table_t *info_table; - txt_caps_t caps_mask = { 0 }; - - /* assumes this already passed is_acmod() test */ - - size = acm_hdr->size * 4; /* hdr size is in dwords, we want bytes */ - - /* - * AC mod must start on 4k page boundary - */ - - if ( (unsigned long)acm_hdr & 0xfff ) { - _XDPRINTF_("AC mod base not 4K aligned (%p)\n", acm_hdr); - return false; - } - _XDPRINTF_("AC mod base alignment OK\n"); - - /* AC mod size must: - * - be multiple of 64 - * - greater than ??? - * - less than max supported size for this processor - */ - - if ( (size == 0) || ((size % 64) != 0) ) { - _XDPRINTF_("AC mod size %x bogus\n", size); - return false; - } - - /// XXX TODO bring in txt.c stuff -/* if ( !get_parameters(¶ms) ) { */ -/* _XDPRINTF_("get_parameters() failed\n"); */ -/* return false; */ -/* } */ - - //TODO: need to see if this check needs to be in place - /*if ( size > params.acm_max_size ) { - _XDPRINTF_("AC mod size too large: %x (max=%x)\n", size, - params.acm_max_size); - return false; - } - - _XDPRINTF_("AC mod size OK\n");*/ - - - /* - * perform checks on AC mod structure - */ - - /* print it for debugging */ - print_acm_hdr(acm_hdr, "SINIT"); - - /* entry point is offset from base addr so make sure it is within module */ - if ( acm_hdr->entry_point >= size ) { - _XDPRINTF_("AC mod entry (%08x) >= AC mod size (%08x)\n", - acm_hdr->entry_point, size); - return false; - } - - /* overflow? */ - if ( plus_overflow_u32(acm_hdr->seg_sel, 8) ) { - _XDPRINTF_("seg_sel plus 8 overflows\n"); - return false; - } - - if ( !acm_hdr->seg_sel || /* invalid selector */ - (acm_hdr->seg_sel & 0x07) || /* LDT, PL!=0 */ - (acm_hdr->seg_sel + 8 > acm_hdr->gdt_limit) ) { - _XDPRINTF_("AC mod selector [%04x] bogus\n", acm_hdr->seg_sel); - return false; - } - - /* - * check for compatibility with this MLE - */ - - info_table = get_acmod_info_table(acm_hdr); - if ( info_table == NULL ) - return false; - - /* check MLE header versions */ - if ( info_table->min_mle_hdr_ver > MLE_HDR_VER ) { - _XDPRINTF_("AC mod requires a newer MLE (0x%08x)\n", - info_table->min_mle_hdr_ver); - return false; - } - - /* check capabilities */ - /* we need to match one of rlp_wake_{getsec, monitor} */ - //caps_mask.rlp_wake_getsec = caps_mask.rlp_wake_monitor = 1; - caps_mask = TXT_CAPS_T_RLP_WAKE_GETSEC | TXT_CAPS_T_RLP_WAKE_MONITOR; - - if ( ( ( MLE_HDR_CAPS & caps_mask ) & - ( info_table->capabilities & caps_mask) ) == 0 ) { - _XDPRINTF_("SINIT and MLE not support compatible RLP wake mechanisms\n"); - return false; - } - /* we also expect ecx_pgtbl to be set */ - if ( !info_table->capabilities & TXT_CAPS_T_ECX_PGTBL ) { - _XDPRINTF_("SINIT does not support launch with MLE pagetable in ECX\n"); - /* TODO when SINIT ready - * return false; - */ - } - - /* check for version of OS to SINIT data */ - /* we don't support old versions */ - if ( info_table->os_sinit_data_ver < 4 ) { - _XDPRINTF_("SINIT's os_sinit_data version unsupported (%u)\n", - info_table->os_sinit_data_ver); - return false; - } - /* only warn if SINIT supports more recent version than us */ - else if ( info_table->os_sinit_data_ver > 5 ) { - _XDPRINTF_("SINIT's os_sinit_data version unsupported (%u)\n", - info_table->os_sinit_data_ver); - } - - return true; -} - - -/* - * Local variables: - * mode: C - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/uxmhf/xmhf-bootloader/txt_hash.c b/uxmhf/xmhf-bootloader/txt_hash.c deleted file mode 100644 index 571f50887c..0000000000 --- a/uxmhf/xmhf-bootloader/txt_hash.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * hash.c: support functions for tb_hash_t type - * - * Copyright (c) 2006-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.04 - */ - -#include -#include -#include -#include - -#include "_txt_hash.h" -#include "_txt_acmod.h" - - -/* - * are_hashes_equal - * - * compare whether two hash values are equal. - * - */ -bool are_hashes_equal(const tb_hash_t *hash1, const tb_hash_t *hash2, - uint8_t hash_alg) -{ - if ( ( hash1 == NULL ) || ( hash2 == NULL ) ) { - _XDPRINTF_("Error: hash pointer is zero.\n"); - return false; - } - - if ( hash_alg == TB_HALG_SHA1 ) - return (memcmp((const char*)hash1, (const char*)hash2, SHA1_LENGTH) == 0); - else { - _XDPRINTF_("unsupported hash alg (%u)\n", hash_alg); - return false; - } -} - -/* - * hash_buffer - * - * hash the buffer according to the algorithm - * - */ -bool hash_buffer(const unsigned char* buf, size_t size, tb_hash_t *hash, - uint8_t hash_alg) -{ - if ( hash == NULL ) { - _XDPRINTF_("Error: There is no space for output hash.\n"); - return false; - } - - if ( hash_alg == TB_HALG_SHA1 ) { - sha1(buf, size, hash->sha1); - return true; - } - else { - _XDPRINTF_("unsupported hash alg (%u)\n", hash_alg); - return false; - } -} - -/* - * extend_hash - * - * perform "extend" of two hashes (i.e. hash1 = SHA(hash1 || hash2) - * - */ -/*bool extend_hash(tb_hash_t *hash1, const tb_hash_t *hash2, uint8_t hash_alg) -{ - uint8_t buf[2*get_hash_size(hash_alg)]; - - if ( hash1 == NULL || hash2 == NULL ) { - _XDPRINTF_("Error: There is no space for output hash.\n"); - return false; - } - - if ( hash_alg == TB_HALG_SHA1 ) { - memcpy(buf, &(hash1->sha1), sizeof(hash1->sha1)); - memcpy(buf + sizeof(hash1->sha1), &(hash2->sha1), sizeof(hash1->sha1)); - sha1(buf, 2*sizeof(hash1->sha1), hash1->sha1); - return true; - } - else { - _XDPRINTF_("unsupported hash alg (%u)\n", hash_alg); - return false; - } -}*/ - -void print_hash(const tb_hash_t *hash, uint8_t hash_alg) -{ - if ( hash == NULL ) { - _XDPRINTF_("NULL"); - return; - } - - if ( hash_alg == TB_HALG_SHA1 ){ - //print_hex(NULL, (const uint8_t *)hash->sha1, sizeof(hash->sha1)); - }else { - _XDPRINTF_("unsupported hash alg (%u)\n", hash_alg); - return; - } -} - -void copy_hash(tb_hash_t *dest_hash, const tb_hash_t *src_hash, - uint8_t hash_alg) -{ - if ( dest_hash == NULL || dest_hash == NULL ) { - _XDPRINTF_("hashes are NULL\n"); - return; - } - - if ( hash_alg == TB_HALG_SHA1 ) - memcpy(dest_hash, src_hash, SHA1_LENGTH); - else - _XDPRINTF_("unsupported hash alg (%u)\n", hash_alg); -} - - - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/uxmhf/xmhf-bootloader/txt_heap.c b/uxmhf/xmhf-bootloader/txt_heap.c deleted file mode 100644 index a90def8f8a..0000000000 --- a/uxmhf/xmhf-bootloader/txt_heap.c +++ /dev/null @@ -1,435 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * heap.c: fns for verifying and printing the Intel(r) TXT heap data structs - * - * Copyright (c) 2003-2010, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.04 - */ - -#include -#include -#include -#include - -#include "_txt_hash.h" -#include "_txt_acmod.h" - -static inline void print_heap_hash(sha1_hash_t hash) -{ - print_hash((const tb_hash_t *)hash, TB_HALG_SHA1); -} - -static void print_bios_data(bios_data_t *bios_data) -{ - _XDPRINTF_("bios_data (@%p, %llx):\n", bios_data, - *((uint64_t *)bios_data - 1)); - _XDPRINTF_("\t version: %u\n", bios_data->version); - _XDPRINTF_("\t bios_sinit_size: 0x%x (%u)\n", bios_data->bios_sinit_size, - bios_data->bios_sinit_size); - _XDPRINTF_("\t lcp_pd_base: 0x%llx\n", bios_data->lcp_pd_base); - _XDPRINTF_("\t lcp_pd_size: 0x%llx (%llu)\n", bios_data->lcp_pd_size, - bios_data->lcp_pd_size); - _XDPRINTF_("\t num_logical_procs: %u\n", bios_data->num_logical_procs); - if ( bios_data->version >= 3 ) - _XDPRINTF_("\t flags: 0x%08llx\n", bios_data->flags); -} - -bool verify_bios_data(txt_heap_t *txt_heap) -{ - uint64_t size, heap_size; - bios_data_t bios_data; - - /* check size */ - heap_size = read_pub_config_reg(TXTCR_HEAP_SIZE); - size = get_bios_data_size(txt_heap, (uint32_t)heap_size); - if ( size == 0 ) { - _XDPRINTF_("BIOS data size is 0\n"); - return false; - } - if ( size > heap_size ) { - _XDPRINTF_("BIOS data size is larger than heap size " - "(%llx, heap size=%llx)\n", size, heap_size); - return false; - } - - xmhfhw_sysmemaccess_copy(&bios_data, - get_bios_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(bios_data_t)); - - /* check version */ - if ( bios_data.version < 2 ) { - _XDPRINTF_("unsupported BIOS data version (%u)\n", bios_data.version); - return false; - } - /* we assume backwards compatibility but print a warning */ - if ( bios_data.version > 3 ) - _XDPRINTF_("unsupported BIOS data version (%u)\n", bios_data.version); - - /* all TXT-capable CPUs support at least 2 cores */ - if ( bios_data.num_logical_procs < 2 ) { - _XDPRINTF_("BIOS data has incorrect num_logical_procs (%u)\n", - bios_data.num_logical_procs); - return false; - } -#define NR_CPUS 8 // XXX arbitrary value; use something sane - else if ( bios_data.num_logical_procs > NR_CPUS ) { - _XDPRINTF_("BIOS data specifies too many CPUs (%u)\n", - bios_data.num_logical_procs); - return false; - } - - print_bios_data(&bios_data); - - return true; -} - -static void print_os_mle_data(os_mle_data_t *os_mle_data) -{ - _XDPRINTF_("os_mle_data (@%p, %llx):\n", os_mle_data, - *((uint64_t *)os_mle_data - 1)); - _XDPRINTF_("\t version: %u\n", os_mle_data->version); - /* TBD: perhaps eventually print saved_mtrr_state field */ - _XDPRINTF_("\t mbi: %p\n", os_mle_data->mbi); -} - -static bool verify_os_mle_data(txt_heap_t *txt_heap) -{ - uint64_t size, heap_size; - os_mle_data_t os_mle_data; - - /* check size */ - heap_size = read_pub_config_reg(TXTCR_HEAP_SIZE); - size = get_os_mle_data_size(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)); - if ( size == 0 ) { - _XDPRINTF_("OS to MLE data size is 0\n"); - return false; - } - if ( size > heap_size ) { - _XDPRINTF_("OS to MLE data size is larger than heap size " - "(%llx, heap size=%llx)\n", size, heap_size); - return false; - } - if ( size != (sizeof(os_mle_data_t) + sizeof(size)) ) { - _XDPRINTF_("OS to MLE data size (%llx) is not equal to " - "os_mle_data_t size (%x)\n", size, sizeof(os_mle_data_t)); - return false; - } - - xmhfhw_sysmemaccess_copy(&os_mle_data, get_os_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(os_mle_data_t)); - - /* check version */ - /* since this data is from our pre-launch to post-launch code only, it */ - /* should always be this */ - if ( os_mle_data.version != 2 ) { - _XDPRINTF_("unsupported OS to MLE data version (%u)\n", - os_mle_data.version); - return false; - } - - /* field checks */ - if ( os_mle_data.mbi == NULL ) { - _XDPRINTF_("OS to MLE data mbi field is NULL\n"); - return false; - } - - print_os_mle_data(&os_mle_data); - - return true; -} - -void print_os_sinit_data(os_sinit_data_t *os_sinit_data) -{ - _XDPRINTF_("os_sinit_data (@%p, %llx):\n", os_sinit_data, - *((uint64_t *)os_sinit_data - 1)); - _XDPRINTF_("\t version: %u\n", os_sinit_data->version); - _XDPRINTF_("\t mle_ptab: 0x%llx\n", os_sinit_data->mle_ptab); - _XDPRINTF_("\t mle_size: 0x%llx (%llu)\n", os_sinit_data->mle_size, - os_sinit_data->mle_size); - _XDPRINTF_("\t mle_hdr_base: 0x%llx\n", os_sinit_data->mle_hdr_base); - _XDPRINTF_("\t vtd_pmr_lo_base: 0x%llx\n", os_sinit_data->vtd_pmr_lo_base); - _XDPRINTF_("\t vtd_pmr_lo_size: 0x%llx\n", os_sinit_data->vtd_pmr_lo_size); - _XDPRINTF_("\t vtd_pmr_hi_base: 0x%llx\n", os_sinit_data->vtd_pmr_hi_base); - _XDPRINTF_("\t vtd_pmr_hi_size: 0x%llx\n", os_sinit_data->vtd_pmr_hi_size); - _XDPRINTF_("\t lcp_po_base: 0x%llx\n", os_sinit_data->lcp_po_base); - _XDPRINTF_("\t lcp_po_size: 0x%llx (%llu)\n", os_sinit_data->lcp_po_size, - os_sinit_data->lcp_po_size); - print_txt_caps("\t ", os_sinit_data->capabilities); - if ( os_sinit_data->version >= 5 ) - _XDPRINTF_("\t efi_rsdt_ptr: 0x%llx\n", os_sinit_data->efi_rsdt_ptr); -} - -static bool verify_os_sinit_data(txt_heap_t *txt_heap) -{ - uint64_t size, heap_size; - os_sinit_data_t os_sinit_data; - - /* check size */ - heap_size = read_pub_config_reg(TXTCR_HEAP_SIZE); - size = get_os_sinit_data_size(txt_heap, (uint32_t)heap_size); - if ( size == 0 ) { - _XDPRINTF_("OS to SINIT data size is 0\n"); - return false; - } - if ( size > heap_size ) { - _XDPRINTF_("OS to SINIT data size is larger than heap size " - "(%llx, heap size=%llx)\n", size, heap_size); - return false; - } - - xmhfhw_sysmemaccess_copy(&os_sinit_data, - get_os_sinit_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(os_sinit_data_t)); - - /* check version (but since we create this, it should always be OK) */ - if ( os_sinit_data.version < 4 || os_sinit_data.version > 5 ) { - _XDPRINTF_("unsupported OS to SINIT data version (%u)\n", - os_sinit_data.version); - return false; - } - - if ( (os_sinit_data.version == 4 && - size != offsetof(os_sinit_data_t, efi_rsdt_ptr) + sizeof(uint64_t)) - || (os_sinit_data.version == 5 && - size != sizeof(os_sinit_data_t) + sizeof(uint64_t)) ) { - _XDPRINTF_("OS to SINIT data size (%llx) does not match for version (%x)\n", - size, sizeof(os_sinit_data_t)); - return false; - } - - print_os_sinit_data(&os_sinit_data); - - return true; -} - -static void print_sinit_mdrs(sinit_mdr_t mdrs[], uint32_t num_mdrs) -{ - static const char *mem_types[] = {"GOOD", "SMRAM OVERLAY", - "SMRAM NON-OVERLAY", - "PCIE EXTENDED CONFIG", "PROTECTED"}; - unsigned int i; - - _XDPRINTF_("\t sinit_mdrs:\n"); - for ( i = 0; i < num_mdrs; i++ ) { - _XDPRINTF_("\t\t %016llx - %016llx ", mdrs[i].base, - mdrs[i].base + mdrs[i].length); - if ( mdrs[i].mem_type < sizeof(mem_types)/sizeof(mem_types[0]) ) - _XDPRINTF_("(%s)\n", mem_types[mdrs[i].mem_type]); - else - _XDPRINTF_("(%d)\n", (int)mdrs[i].mem_type); - } -} - -static void print_sinit_mle_data(sinit_mle_data_t *sinit_mle_data) -{ - _XDPRINTF_("sinit_mle_data (@%p, %llx):\n", sinit_mle_data, - *((uint64_t *)sinit_mle_data - 1)); - _XDPRINTF_("\t version: %u\n", sinit_mle_data->version); - _XDPRINTF_("\t bios_acm_id: \n\t"); - print_heap_hash(sinit_mle_data->bios_acm_id); - _XDPRINTF_("\t edx_senter_flags: 0x%08x\n", - sinit_mle_data->edx_senter_flags); - _XDPRINTF_("\t mseg_valid: 0x%llx\n", sinit_mle_data->mseg_valid); - _XDPRINTF_("\t sinit_hash:\n\t"); print_heap_hash(sinit_mle_data->sinit_hash); - _XDPRINTF_("\t mle_hash:\n\t"); print_heap_hash(sinit_mle_data->mle_hash); - _XDPRINTF_("\t stm_hash:\n\t"); print_heap_hash(sinit_mle_data->stm_hash); - _XDPRINTF_("\t lcp_policy_hash:\n\t"); - print_heap_hash(sinit_mle_data->lcp_policy_hash); - _XDPRINTF_("\t lcp_policy_control: 0x%08x\n", - sinit_mle_data->lcp_policy_control); - _XDPRINTF_("\t rlp_wakeup_addr: 0x%x\n", sinit_mle_data->rlp_wakeup_addr); - _XDPRINTF_("\t num_mdrs: %u\n", sinit_mle_data->num_mdrs); - _XDPRINTF_("\t mdrs_off: 0x%x\n", sinit_mle_data->mdrs_off); - _XDPRINTF_("\t num_vtd_dmars: %u\n", sinit_mle_data->num_vtd_dmars); - _XDPRINTF_("\t vtd_dmars_off: 0x%x\n", sinit_mle_data->vtd_dmars_off); - print_sinit_mdrs((sinit_mdr_t *) - (((uint32_t)sinit_mle_data - (uint32_t)sizeof(uint64_t)) + - (uint32_t)sinit_mle_data->mdrs_off), sinit_mle_data->num_mdrs); - if ( sinit_mle_data->version >= 8 ) - _XDPRINTF_("\t proc_scrtm_status: 0x%08x\n", - sinit_mle_data->proc_scrtm_status); -} - -static bool verify_sinit_mle_data(txt_heap_t *txt_heap) -{ - uint64_t size, heap_size; - sinit_mle_data_t sinit_mle_data; - - /* check size */ - heap_size = read_pub_config_reg(TXTCR_HEAP_SIZE); - size = get_sinit_mle_data_size(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)); - if ( size == 0 ) { - _XDPRINTF_("SINIT to MLE data size is 0\n"); - return false; - } - if ( size > heap_size ) { - _XDPRINTF_("SINIT to MLE data size is larger than heap size\n" - "(%llx, heap size=%llx)\n", size, heap_size); - return false; - } - - xmhfhw_sysmemaccess_copy(&sinit_mle_data, - get_sinit_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(sinit_mle_data_t)); - - /* check version */ - if ( sinit_mle_data.version < 6 ) { - _XDPRINTF_("unsupported SINIT to MLE data version (%u)\n", - sinit_mle_data.version); - return false; - } - else if ( sinit_mle_data.version > 8 ) { - _XDPRINTF_("unsupported SINIT to MLE data version (%u)\n", - sinit_mle_data.version); - } - - /* this data is generated by SINIT and so is implicitly trustworthy, */ - /* so we don't need to validate it's fields */ - - print_sinit_mle_data(&sinit_mle_data); - - return true; -} - -bool verify_txt_heap(txt_heap_t *txt_heap, bool bios_data_only) -{ - uint64_t size1, size2, size3, size4, heap_size; - - /* verify BIOS to OS data */ - if ( !verify_bios_data(txt_heap) ) - return false; - - if ( bios_data_only ) - return true; - - /* check that total size is within the heap */ - heap_size = read_pub_config_reg(TXTCR_HEAP_SIZE); - - size1 = get_bios_data_size(txt_heap, (uint32_t)heap_size); - size2 = get_os_mle_data_size(txt_heap, (uint32_t)heap_size); - size3 = get_os_sinit_data_size(txt_heap, (uint32_t)heap_size); - size4 = get_sinit_mle_data_size(txt_heap, (uint32_t)heap_size); - - /* overflow? */ - if ( plus_overflow_u64(size1, size2) ) { - _XDPRINTF_("TXT heap data size overflows\n"); - return false; - } - if ( plus_overflow_u64(size3, size4) ) { - _XDPRINTF_("TXT heap data size overflows\n"); - return false; - } - if ( plus_overflow_u64(size1 + size2, size3 + size4) ) { - _XDPRINTF_("TXT heap data size overflows\n"); - return false; - } - - if ( (size1 + size2 + size3 + size4) > - read_pub_config_reg(TXTCR_HEAP_SIZE) ) { - _XDPRINTF_("TXT heap data sizes (%llx, %llx, %llx, %llx) are larger than\n" - "heap total size (%llx)\n", size1, size2, size3, size4, - read_pub_config_reg(TXTCR_HEAP_SIZE)); - return false; - } - - /* verify OS to MLE data */ - if ( !verify_os_mle_data(txt_heap) ) - return false; - - /* verify OS to SINIT data */ - if ( !verify_os_sinit_data(txt_heap) ) - return false; - - /* verify SINIT to MLE data */ - if ( !verify_sinit_mle_data(txt_heap) ) - return false; - - return true; -} - - -/* - * Local variables: - * mode: C - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/Makefile b/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/Makefile deleted file mode 100644 index d5f33e09fa..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -#top-level Makefile for rich guest app, aprvexec (rgapp-aprvexec) -# author: amit vasudevan (amitvasudevan@acm.org) - -.PHONY: all -all: - gcc -m32 rgapp-aprvexec.c rgapp-aprvexecsup.S -o rgapp-aprvexec - -.PHONY: clean -clean: - rm -f rgapp-aprvexec - rm -f *.o - \ No newline at end of file diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/rgapp-aprvexec.c b/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/rgapp-aprvexec.c deleted file mode 100644 index 8b1fe7a3dd..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/rgapp-aprvexec.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * XMHF rich guest app for aprvexec hypapp - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////// -// base types - -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - - -#define PAGE_SHIFT 12 -#define PAGEMAP_LENGTH 8 - - -////// -// vmcall interface -////// -static void __vmcall(uint32_t eax, uint32_t ebx, uint32_t edx){ - asm volatile ( - "movl %0, %%eax \r\n" - "movl %1, %%ebx \r\n" - "movl %2, %%edx \r\n" - "vmcall \r\n" - : /*no output*/ - : "g" (eax), "g" (ebx), "g" (edx) - : "%eax", "%ebx", "%edx" - ); -} - - -////// -// va_to_pa: virtual to physical address mapping -////// -static uint64_t va_to_pa(void *vaddr) { - FILE *pagemap; - unsigned long offset; - uint64_t page_frame_number = 0; - - // open the pagemap file for the current process - pagemap = fopen("/proc/self/pagemap", "rb"); - if(pagemap == NULL){ - printf("\n%s: unable to open pagemap file. exiting!", __FUNCTION__); - exit(1); - } - - // seek to the page that vaddr is on - offset = (unsigned long)vaddr / getpagesize() * PAGEMAP_LENGTH; - if(fseek(pagemap, (unsigned long)offset, SEEK_SET) != 0) { - printf("\n%s: Failed to seek pagemap to proper location", __FUNCTION__); - exit(1); - } - - // The page frame number is in bits 0-54 so read the first 7 bytes and clear the 55th bit - fread(&page_frame_number, 1, PAGEMAP_LENGTH-1, pagemap); - - page_frame_number &= 0x7FFFFFFFFFFFFF; - - fclose(pagemap); - - return (page_frame_number << PAGE_SHIFT); -} - - - - -////// -// aprvexec test harness -////// - - -extern void do_testxhapprovexec_functoprotect(void); - - - -#define APRVEXEC_LOCK 0xD0 -#define APRVEXEC_UNLOCK 0xD1 - -void do_testxhapprovexec(void){ - uint32_t fva = &do_testxhapprovexec_functoprotect; - uint32_t fpa; - - printf("\n%s: Target function virtual-address=0x%08x\n", __FUNCTION__, fva); - - printf("\n%s: Proceeding to lock function in memory...", __FUNCTION__); - - if(mlock(fva, 4096) == -1) { - printf("\nFailed to lock page in memory: %s\n", strerror(errno)); - exit(1); - } - if(mprotect(fva, 4096, (PROT_READ | PROT_WRITE | PROT_EXEC)) != 0){ - printf("\n%s: Could not change page protections: %s\n", __FUNCTION__, strerror(errno)); - exit(1); - } - - printf("\n%s: Locked function in memory", __FUNCTION__); - - fpa= va_to_pa(&do_testxhapprovexec_functoprotect); - - printf("\n%s: Target function physical-address=0x%08x\n", __FUNCTION__, fpa); - - - printf("\n%s: proceeding to approve function...", __FUNCTION__); - - __vmcall(APRVEXEC_LOCK, 0, fpa); - - printf("\n%s: Approved function\n", __FUNCTION__); - - printf("\n%s: Calling function..\n", __FUNCTION__); - do_testxhapprovexec_functoprotect(); - printf("\n%s: returned back\n", __FUNCTION__); - - ////// - //code modification test attack - ////// - //printf("\n%s: Preparing to execute code modification attack...\n", __FUNCTION__); - // - //{ - // *((uint8_t *)&do_testxhapprovexec_functoprotect) = 0xAB; - //} - //printf("\n%s: Code modification attack successful\n", __FUNCTION__); - - ////// - - - - printf("\n%s: Going to release approved execution at fn va=%08x, pa=%08x\n", __FUNCTION__, fva, fpa); - - __vmcall(APRVEXEC_UNLOCK, 0, fpa ); - - printf("\n%s: Released approved execution", __FUNCTION__); - - printf("\n%s: Proceeding to unlock function in memory...", __FUNCTION__); - - if(munlock(fva, 4096) == -1) { - printf("\nFailed to unlock page in memory: %s\n", strerror(errno)); - exit(1); - } - - printf("\n%s: unlocked function in memory", __FUNCTION__); - - -} - - - - - -void main(void){ - printf("\n%s: Proceeding with aprvexec test...", __FUNCTION__); - - do_testxhapprovexec(); - - printf("\n%s: aprvexec test done", __FUNCTION__); - printf("\n\n"); -} - -////// -// building pieces -////// - -//__attribute__((aligned(4096))) static uint8_t testxhhyperdep_page[4096]; - - -//printf("\n%s: DEP page unlocked", __FUNCTION__); - -//if(munlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { -// printf("\nFailed to unlock page in memory: %s\n", strerror(errno)); -// exit(1); -//} - -//if(mlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { -// printf("\nFailed to lock page in memory: %s\n", strerror(errno)); -// exit(1); -//} - -// if(mprotect(&testxhhyperdep_page, sizeof(testxhhyperdep_page), (PROT_READ | PROT_WRITE | PROT_EXEC)) != 0){ -// printf("\n%s: Could not change page protections: %s\n", __FUNCTION__, strerror(errno)); -// exit(1); -// } - diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/rgapp-aprvexecsup.S b/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/rgapp-aprvexecsup.S deleted file mode 100644 index 9ad082664d..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-aprvexec/rgapp-aprvexecsup.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * XMHF rich guest app for aprvexec hypapp; low-level support functions - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -.section .text - -// xhapprovexec test - -.align 2097152 -.global do_testxhapprovexec_functoprotect -do_testxhapprovexec_functoprotect: - ret -.balign 2097152, 0x90 - diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-hyperdep/Makefile b/uxmhf/xmhf-rgapps/linux/rgapp-hyperdep/Makefile deleted file mode 100644 index a4e007dd0c..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-hyperdep/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -#top-level Makefile for rich guest app, hyperdep (rgapp-hyperdep) -# author: amit vasudevan (amitvasudevan@acm.org) - -.PHONY: all -all: - gcc -m32 rgapp-hyperdep.c -o rgapp-hyperdep - -.PHONY: clean -clean: - rm -f rgapp-hyperdep - rm -f *.o - \ No newline at end of file diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-hyperdep/rgapp-hyperdep.c b/uxmhf/xmhf-rgapps/linux/rgapp-hyperdep/rgapp-hyperdep.c deleted file mode 100644 index ecfc1d6074..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-hyperdep/rgapp-hyperdep.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * XMHF rich guest app for hyperdep hypapp - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - - -#define PAGE_SHIFT 12 -#define PAGEMAP_LENGTH 8 - - -////// -// hyperdep test harness - -////////////////////////////////////////////////////////////////////////////// -// xhhyperdep test - -__attribute__((aligned(4096))) static uint8_t testxhhyperdep_page[4096]; - -#define HYPERDEP_ACTIVATEDEP 0xC0 -#define HYPERDEP_DEACTIVATEDEP 0xC1 - -typedef void (*DEPFN)(void); - -static void __vmcall(uint32_t eax, uint32_t ebx, uint32_t edx){ - asm volatile ( - "movl %0, %%eax \r\n" - "movl %1, %%ebx \r\n" - "movl %2, %%edx \r\n" - "vmcall \r\n" - : /*no output*/ - : "g" (eax), "g" (ebx), "g" (edx) - : "%eax", "%ebx", "%edx" - ); -} - - -static uint64_t va_to_pa(void *vaddr) { - FILE *pagemap; - unsigned long offset; - uint64_t page_frame_number = 0; - - // open the pagemap file for the current process - pagemap = fopen("/proc/self/pagemap", "rb"); - if(pagemap == NULL){ - printf("\n%s: unable to open pagemap file. exiting!", __FUNCTION__); - exit(1); - } - - // seek to the page that vaddr is on - offset = (unsigned long)vaddr / getpagesize() * PAGEMAP_LENGTH; - if(fseek(pagemap, (unsigned long)offset, SEEK_SET) != 0) { - printf("\n%s: Failed to seek pagemap to proper location", __FUNCTION__); - exit(1); - } - - // The page frame number is in bits 0-54 so read the first 7 bytes and clear the 55th bit - fread(&page_frame_number, 1, PAGEMAP_LENGTH-1, pagemap); - - page_frame_number &= 0x7FFFFFFFFFFFFF; - - fclose(pagemap); - - return (page_frame_number << PAGE_SHIFT); -} - - - -void do_testxhhyperdep(uint32_t gpa){ - DEPFN fn = (DEPFN)&testxhhyperdep_page; - uint32_t i; - - testxhhyperdep_page[0] = 0xC3; //ret instruction - - printf("\n%s: Going to activate DEP on page %x", __FUNCTION__, gpa); - - __vmcall(HYPERDEP_ACTIVATEDEP, 0, gpa); - - printf("\n%s: Activated DEP", __FUNCTION__); - - /*////// - //test attack - ////// - { - printf("\n%s: Proceeding with DEP attack...\n", __FUNCTION__); - if(mprotect(&testxhhyperdep_page, sizeof(testxhhyperdep_page), (PROT_READ | PROT_WRITE | PROT_EXEC)) != 0){ - printf("\n%s: Could not change page protections: %s\n", __FUNCTION__, strerror(errno)); - exit(1); - } - fn(); - printf("\n%s: DEP attack worked\n", __FUNCTION__); - }*/ - - //write some stuff to the data page - printf("\n%s: Writing data to buffer...", __FUNCTION__); - for(i=0; i < 255; i++) - testxhhyperdep_page[i]=(uint8_t)i; - printf("\n%s: data written successfully", __FUNCTION__); - - - printf("\n%s: Going to de-activate DEP on page %x", __FUNCTION__, gpa); - - __vmcall(HYPERDEP_DEACTIVATEDEP, 0, gpa); - - printf("\n%s: Deactivated DEP", __FUNCTION__); - -} - - - -void main(void){ - printf("\n%s: DEP buffer at 0x%08x", __FUNCTION__, &testxhhyperdep_page); - - printf("\n%s: proceeding to lock DEP page...", __FUNCTION__); - - //lock the DEP page in memory so we have it pinned down - if(mlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { - printf("\nFailed to lock page in memory: %s\n", strerror(errno)); - exit(1); - } - - printf("\n%s: DEP page locked", __FUNCTION__); - - printf("\n%s: DEP buffer at paddr=%08x", __FUNCTION__, va_to_pa(&testxhhyperdep_page)); - - - - do_testxhhyperdep(va_to_pa(&testxhhyperdep_page)); - - printf("\n%s: proceeding to unlock DEP page...", __FUNCTION__); - - //unlock the DEP page - if(munlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { - printf("\nFailed to unlock page in memory: %s\n", strerror(errno)); - exit(1); - } - - printf("\n%s: DEP page unlocked", __FUNCTION__); - - - printf("\n\n"); -} diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-ssteptrace/Makefile b/uxmhf/xmhf-rgapps/linux/rgapp-ssteptrace/Makefile deleted file mode 100644 index 148f697bc2..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-ssteptrace/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -#top-level Makefile for rich guest app, ssteptrace (rgapp-ssteptrace) -# author: amit vasudevan (amitvasudevan@acm.org) - -.PHONY: all -all: - gcc -m32 rgapp-ssteptrace.c -o rgapp-ssteptrace - -.PHONY: clean -clean: - rm -f rgapp-ssteptrace - rm -f *.o - \ No newline at end of file diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-ssteptrace/rgapp-ssteptrace.c b/uxmhf/xmhf-rgapps/linux/rgapp-ssteptrace/rgapp-ssteptrace.c deleted file mode 100644 index 5504aa8068..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-ssteptrace/rgapp-ssteptrace.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * XMHF rich guest app for ssteptrace hypapp - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////// -// base types - -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - - -#define PAGE_SHIFT 12 -#define PAGEMAP_LENGTH 8 - - -////// -// vmcall interface -////// -__attribute__ ((always_inline)) static inline void __vmcall(uint32_t eax, uint32_t ebx, uint32_t edx){ - asm volatile ( - "movl %0, %%eax \r\n" - "movl %1, %%ebx \r\n" - "movl %2, %%edx \r\n" - "vmcall \r\n" - : /*no output*/ - : "g" (eax), "g" (ebx), "g" (edx) - : "%eax", "%ebx", "%edx" - ); -} - - -////// -// va_to_pa: virtual to physical address mapping -////// -static uint64_t va_to_pa(void *vaddr) { - FILE *pagemap; - unsigned long offset; - uint64_t page_frame_number = 0; - - // open the pagemap file for the current process - pagemap = fopen("/proc/self/pagemap", "rb"); - if(pagemap == NULL){ - printf("\n%s: unable to open pagemap file. exiting!", __FUNCTION__); - exit(1); - } - - // seek to the page that vaddr is on - offset = (unsigned long)vaddr / getpagesize() * PAGEMAP_LENGTH; - if(fseek(pagemap, (unsigned long)offset, SEEK_SET) != 0) { - printf("\n%s: Failed to seek pagemap to proper location", __FUNCTION__); - exit(1); - } - - // The page frame number is in bits 0-54 so read the first 7 bytes and clear the 55th bit - fread(&page_frame_number, 1, PAGEMAP_LENGTH-1, pagemap); - - page_frame_number &= 0x7FFFFFFFFFFFFF; - - fclose(pagemap); - - return (page_frame_number << PAGE_SHIFT); -} - - - -////// -// ssteptrace test harness -////// - -#define SSTEPTRACE_REGISTER 0xE0 -#define SSTEPTRACE_ON 0xE1 -#define SSTEPTRACE_OFF 0xE2 - -__attribute__((aligned(4096))) void do_testssteptrace(void){ - uint32_t fva = &do_testssteptrace; - uint32_t fpa; - - printf("\n%s: Proceeding to lock test function at va=0x%08x...", __FUNCTION__, fva); - - if(mlock(fva, 4096) == -1) { - printf("\nFailed to lock page in memory: %s\n", strerror(errno)); - exit(1); - } - - fpa = va_to_pa(fva); - - printf("\n%s: Locked test function at va=0x%08x ==> pa=0x%08x", __FUNCTION__, fva, fpa); - - printf("\n%s: Registering test function...", __FUNCTION__); - __vmcall(SSTEPTRACE_REGISTER, 0, fpa); - printf("\n%s: test function registered", __FUNCTION__); - - printf("\n%s: Turning on tracing...\n", __FUNCTION__); - - __vmcall(SSTEPTRACE_ON, 0, 0); - - __vmcall(SSTEPTRACE_OFF, 0 , 0); - - printf("\n%s: Tracing off\n", __FUNCTION__); - - asm volatile( - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - ".byte 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 \r\n" - : - : - : - ); - - printf("\n%s: Proceeding to unlock test function at va=0x%08x...", __FUNCTION__, fva); - - if(munlock(fva, 4096) == -1) { - printf("\nFailed to unlock page in memory: %s\n", strerror(errno)); - exit(1); - } - - printf("\n%s: unlocked test function", __FUNCTION__); - -} - - - -void main(void){ - printf("\n%s: Proceeding with ssteptrace test...", __FUNCTION__); - - do_testssteptrace(); - - printf("\n%s: ssteptrace test done", __FUNCTION__); - printf("\n\n"); -} - -////// -// building pieces -////// - -//__attribute__((aligned(4096))) static uint8_t testxhhyperdep_page[4096]; - - -//printf("\n%s: DEP page unlocked", __FUNCTION__); - -//if(munlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { -// printf("\nFailed to unlock page in memory: %s\n", strerror(errno)); -// exit(1); -//} - -//if(mlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { -// printf("\nFailed to lock page in memory: %s\n", strerror(errno)); -// exit(1); -//} - -// if(mprotect(&testxhhyperdep_page, sizeof(testxhhyperdep_page), (PROT_READ | PROT_WRITE | PROT_EXEC)) != 0){ -// printf("\n%s: Could not change page protections: %s\n", __FUNCTION__, strerror(errno)); -// exit(1); -// } - diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-syscalllog/Makefile b/uxmhf/xmhf-rgapps/linux/rgapp-syscalllog/Makefile deleted file mode 100644 index bd6e4d6bd3..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-syscalllog/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -#top-level Makefile for rich guest app, syscalllog (rgapp-syscalllog) -# author: amit vasudevan (amitvasudevan@acm.org) - -.PHONY: all -all: - gcc -m32 rgapp-syscalllog.c -o rgapp-syscalllog - -.PHONY: clean -clean: - rm -f rgapp-syscalllog - rm -f *.o - \ No newline at end of file diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-syscalllog/rgapp-syscalllog.c b/uxmhf/xmhf-rgapps/linux/rgapp-syscalllog/rgapp-syscalllog.c deleted file mode 100644 index cd75d99484..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-syscalllog/rgapp-syscalllog.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * XMHF rich guest app for syscalllog hypapp - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// base types - -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - - -#define PAGE_SHIFT 12 -#define PAGEMAP_LENGTH 8 - - -////// -// vmcall interface -////// -__attribute__ ((always_inline)) static inline void __vmcall(uint32_t eax, uint32_t ebx, uint32_t edx, uint32_t ecx){ - asm volatile ( - "movl %0, %%eax \r\n" - "movl %1, %%ebx \r\n" - "movl %2, %%edx \r\n" - "movl %3, %%ecx \r\n" - "vmcall \r\n" - : /*no output*/ - : "g" (eax), "g" (ebx), "g" (edx), "g" (ecx) - : "%eax", "%ebx", "%edx", "%ecx" - ); -} - - -////// -// va_to_pa: virtual to physical address mapping -////// -static uint64_t va_to_pa(void *vaddr) { - FILE *pagemap; - unsigned long offset; - uint64_t page_frame_number = 0; - - // open the pagemap file for the current process - pagemap = fopen("/proc/self/pagemap", "rb"); - if(pagemap == NULL){ - printf("\n%s: unable to open pagemap file. exiting!", __FUNCTION__); - exit(1); - } - - // seek to the page that vaddr is on - offset = (unsigned long)vaddr / getpagesize() * PAGEMAP_LENGTH; - if(fseek(pagemap, (unsigned long)offset, SEEK_SET) != 0) { - printf("\n%s: Failed to seek pagemap to proper location", __FUNCTION__); - exit(1); - } - - // The page frame number is in bits 0-54 so read the first 7 bytes and clear the 55th bit - fread(&page_frame_number, 1, PAGEMAP_LENGTH-1, pagemap); - - page_frame_number &= 0x7FFFFFFFFFFFFF; - - fclose(pagemap); - - return (page_frame_number << PAGE_SHIFT); -} - - -////// -// get syscall page -// return 0 on failure, else the 32-bit virtual address of the syscall page -////// -static uint32_t getsyscallvaddr(char **envp) { - Elf32_auxv_t *auxv; - - // walk past all env pointers - while (*envp++ != NULL) - ; - - //and find ELF auxiliary vectors - auxv = (Elf32_auxv_t *) envp; - - for ( ; auxv->a_type != AT_NULL; auxv++) - if (auxv->a_type == AT_SYSINFO) - return auxv->a_un.a_val; - - printf("\n%s: warning: no AT_SYSINFO auxv entry found\n", __FUNCTION__); - return 0; -} - - - -////// -// syscalllog test harness -////// -#define SYSCALLLOG_REGISTER 0xF0 -#define SYSCALL_GETPID 0x1 - -typedef uint32_t (*SYSCALLFPTR)(uint32_t syscallnum); - -uint32_t orig_vsyscall_entry_point; -uint32_t syscall_vaddr; -uint32_t shadow_syscall_vaddr; -uint32_t syscall_page_vaddr, syscall_page_paddr; -uint32_t syscall_shadowpage_vaddr, syscall_shadowpage_paddr; - -__attribute__ ((aligned(4096))) uint8_t syscall_shadowpage[4096]; - - -__attribute__ ((aligned(4096))) uint32_t ksyscall(uint32_t syscallnum){ - uint32_t pid; - switch(syscallnum){ - case SYSCALL_GETPID: - asm volatile ( - "movl %1, %%eax \r\n" - "movl %2, %%edx \r\n" - "call *%%edx \r\n" - "movl %%eax, %0\r\n" - : "=g" (pid) // output - : "i" (SYS_getpid), "g" (orig_vsyscall_entry_point) // input - : "%eax", "%edx" - ); - - return pid; - default: - return 0; - } - - asm volatile ( - ".balign 4096, 0x90 \r\n" - : // output - : // input - : - ); - -} - - -__attribute__ ((aligned(4096))) void do_testsyscalllog(char **envp){ - uint32_t pid; - SYSCALLFPTR psyscall = NULL; - - orig_vsyscall_entry_point = getsyscallvaddr(envp); - - if(orig_vsyscall_entry_point == 0){ - printf("\n%s: unable to obtain system call entry point. exiting\n", __FUNCTION__); - exit(1); - } - - syscall_shadowpage_vaddr = &syscall_shadowpage; - syscall_vaddr = &ksyscall; - syscall_page_vaddr = syscall_vaddr & 0xFFFFF000UL; - shadow_syscall_vaddr = syscall_shadowpage_vaddr | (syscall_vaddr & 0x00000FFFUL); - - - if(mlock(syscall_page_vaddr, 4096) == -1) { - printf("\nFailed to lock syscall page in memory: %s\n", strerror(errno)); - exit(1); - } - - - if(mlock(syscall_shadowpage_vaddr, 4096) == -1) { - printf("\nFailed to lock syscall shadow page in memory: %s\n", strerror(errno)); - exit(1); - } - - - memcpy(syscall_shadowpage_vaddr, syscall_page_vaddr, 4096); - - if(mprotect(syscall_shadowpage_vaddr, 4096, (PROT_READ | PROT_EXEC)) != 0){ - printf("\n%s: Could not change syscall shadow page protections: %s\n", __FUNCTION__, strerror(errno)); - exit(1); - } - - - syscall_page_paddr= va_to_pa(syscall_page_vaddr); - syscall_shadowpage_paddr =va_to_pa(syscall_shadowpage_vaddr); - - printf("\n%s: syscall page-base vaddr=0x%08x, paddr=0x%08x\n", __FUNCTION__, syscall_page_vaddr, syscall_page_paddr); - printf("\n%s: syscall shadow page-base vaddr=0x%08x, paddr=0x%08x\n", __FUNCTION__, syscall_shadowpage_vaddr, syscall_shadowpage_paddr); - printf("\n%s: syscall entry-point at 0x%08x\n", __FUNCTION__, syscall_vaddr); - printf("\n%s: syscall shadow entry-point at 0x%08x\n", __FUNCTION__, shadow_syscall_vaddr); - - - __vmcall(SYSCALLLOG_REGISTER, syscall_page_paddr, syscall_shadowpage_vaddr, syscall_shadowpage_paddr); - - - ////// - // the following will be logged - ////// - psyscall = syscall_vaddr; - pid = psyscall(SYSCALL_GETPID); - printf("\n%s: result via syscall-getpid() = %x\n", __FUNCTION__, pid); - pid = psyscall(SYSCALL_GETPID); - printf("\n%s: result via syscall-getpid() = %x\n", __FUNCTION__, pid); - pid = psyscall(SYSCALL_GETPID); - printf("\n%s: result via syscall-getpid() = %x\n", __FUNCTION__, pid); - pid = psyscall(SYSCALL_GETPID); - printf("\n%s: result via syscall-getpid() = %x\n", __FUNCTION__, pid); - - ////// - -} - - - -__attribute__ ((aligned(4096))) int main(int argc, char **argv, char **envp) { - printf("\n%s: Proceeding with syscalllog test...", __FUNCTION__); - - do_testsyscalllog(envp); - - printf("\n%s: syscalllog test done", __FUNCTION__); - printf("\n\n"); - - return 0; -} - -////// -// building pieces -////// - -//__attribute__((aligned(4096))) static uint8_t testxhhyperdep_page[4096]; - - -//printf("\n%s: DEP page unlocked", __FUNCTION__); - -//if(munlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { -// printf("\nFailed to unlock page in memory: %s\n", strerror(errno)); -// exit(1); -//} - -//if(mlock(&testxhhyperdep_page, sizeof(testxhhyperdep_page)) == -1) { -// printf("\nFailed to lock page in memory: %s\n", strerror(errno)); -// exit(1); -//} - -// if(mprotect(&testxhhyperdep_page, sizeof(testxhhyperdep_page), (PROT_READ | PROT_WRITE | PROT_EXEC)) != 0){ -// printf("\n%s: Could not change page protections: %s\n", __FUNCTION__, strerror(errno)); -// exit(1); -// } - -//printf("\n%s: result via syscall_getpid() = %x\n", __FUNCTION__, syscall(SYS_getpid)); -/*asm volatile ( - "movl %1, %%eax \r\n" - "movl %2, %%edx \r\n" - "call *%%edx \r\n" - "movl %%eax, %0\r\n" - : "=g" (pid) // output - : "i" (SYS_getpid), "g" (syscall_vaddr) // input - : "%eax", "%edx" -); - -printf("\n%s: result via vsyscall-getpid() = %x\n", __FUNCTION__, pid); -*/ diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-uhcalltest/Makefile b/uxmhf/xmhf-rgapps/linux/rgapp-uhcalltest/Makefile deleted file mode 100644 index e873f3e402..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-uhcalltest/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -#top-level Makefile for rich guest app, uhcalltest (rgapp-uhcalltest) -# provides quick test functionality of hypervisor. -# author: amit vasudevan (amitvasudevan@acm.org) -# author: matt mccormack (matthew.mccormack@live.com) - -.PHONY: all -all: - gcc -m32 rgapp-uhcalltest.c -o rgapp-uhcalltest - -.PHONY: clean -clean: - rm -f rgapp-uhcalltest - rm -f *.o diff --git a/uxmhf/xmhf-rgapps/linux/rgapp-uhcalltest/rgapp-uhcalltest.c b/uxmhf/xmhf-rgapps/linux/rgapp-uhcalltest/rgapp-uhcalltest.c deleted file mode 100644 index f8e5dfff80..0000000000 --- a/uxmhf/xmhf-rgapps/linux/rgapp-uhcalltest/rgapp-uhcalltest.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * XMHF rich guest app for uhcalltest hypapp - * author: amit vasudevan (amitvasudevan@acm.org) - * author: matt mccormack (matthew.mccormack@live.com) - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// base types - -typedef unsigned char uint8_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - - -#define PAGE_SHIFT 12 -#define PAGEMAP_LENGTH 8 - - -////// -// vmcall interface -////// -__attribute__ ((always_inline)) static inline void __vmcall(uint32_t eax, uint32_t ebx, uint32_t edx){ - asm volatile ( - "movl %0, %%eax \r\n" - "movl %1, %%ebx \r\n" - "movl %2, %%edx \r\n" - "vmcall \r\n" - : /*no output*/ - : "g" (eax), "g" (ebx), "g" (edx) - : "%eax", "%ebx", "%edx" - ); -} - - -////// -// va_to_pa: virtual to physical address mapping -////// -static uint64_t va_to_pa(void *vaddr) { - FILE *pagemap; - unsigned long offset; - uint64_t page_frame_number = 0; - - // open the pagemap file for the current process - pagemap = fopen("/proc/self/pagemap", "rb"); - if(pagemap == NULL){ - printf("\n%s: unable to open pagemap file. exiting!", __FUNCTION__); - exit(1); - } - - // seek to the page that vaddr is on - offset = (unsigned long)vaddr / getpagesize() * PAGEMAP_LENGTH; - if(fseek(pagemap, (unsigned long)offset, SEEK_SET) != 0) { - printf("\n%s: Failed to seek pagemap to proper location", __FUNCTION__); - exit(1); - } - - // The page frame number is in bits 0-54 so read the first 7 bytes and clear the 55th bit - fread(&page_frame_number, 1, PAGEMAP_LENGTH-1, pagemap); - - page_frame_number &= 0x7FFFFFFFFFFFFF; - - fclose(pagemap); - - return (page_frame_number << PAGE_SHIFT); -} - - -////// -// uhcall -////// -bool uhcall(uint32_t uhcall_function, void *uhcall_buffer, uint32_t uhcall_buffer_len){ - uint64_t uhcall_buffer_paddr; - if(uhcall_buffer==NULL && uhcall_buffer_len!=0){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - if(uhcall_buffer!=NULL){ - if((((uint32_t)uhcall_buffer % 4096) + uhcall_buffer_len)>4096){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - } - uhcall_buffer_paddr=va_to_pa(uhcall_buffer); - if(mlock(uhcall_buffer, uhcall_buffer_len)==-1){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - __vmcall(uhcall_function, 0, uhcall_buffer_paddr); - if(munlock(uhcall_buffer, uhcall_buffer_len)==-1){ - printf("%s: error: line %u\n", __FUNCTION__, __LINE__); - return false; - } - return true; -} - - -////// -// uhcalltest test harness -////// -#define UAPP_UHCALLTEST_FUNCTION_TEST 0x22 - -typedef struct{ - uint8_t in[16]; - uint8_t out[16]; -}uhcalltest_param_t; - -__attribute__ ((aligned(4096))) __attribute__((section(".data"))) uhcalltest_param_t uhctp; - -void do_uhcalltest(void *bufptr){ - uhcalltest_param_t *ptr_uhctp = (uhcalltest_param_t *)bufptr; - uint32_t i; - uint8_t ch='a'; - - printf("%s: start\n", __FUNCTION__); - printf("%s: populating in[] and out[]...\n", __FUNCTION__); - for(i=0;i<16;i++) - ptr_uhctp->in[i] = ch+i; - memset(&ptr_uhctp->out, 0, 16); - printf("dumping in[]...\n"); - for(i=0;i<16;i++) - printf("%c", ptr_uhctp->in[i]); - printf("\n"); - //make hypcall - if(!uhcall(UAPP_UHCALLTEST_FUNCTION_TEST, ptr_uhctp, sizeof(uhcalltest_param_t))) - printf("hypercall FAILED\n"); - else - printf("hypercall SUCCESS\n"); - printf("dumping out[]...\n"); - for(i=0;i<16;i++) - printf("%c", ptr_uhctp->out[i]); - printf("\n"); - printf("%s: end\n", __FUNCTION__); -} - - - -__attribute__ ((aligned(4096))) int main(){ - uhcalltest_param_t *ptr_uhctp; - printf("starting uhcalltest (with static buffer)...\n"); - do_uhcalltest((void *)&uhctp); - printf("end uhcalltest (with static buffer)...\n"); - printf("starting uhcalltest (with dynamic buffer)...\n"); - if(posix_memalign(&ptr_uhctp, 4096, sizeof(uhcalltest_param_t))!=0){ - printf("%s: error: \n", __FUNCTION__); - exit(1); - } - do_uhcalltest((void *)ptr_uhctp); - free(ptr_uhctp); - printf("end uhcalltest (with dynamic buffer)...\n"); - return 0; -} diff --git a/uxmhf/xmhf-uobjs/UOBJLIST b/uxmhf/xmhf-uobjs/UOBJLIST deleted file mode 100644 index 11968ec6ee..0000000000 --- a/uxmhf/xmhf-uobjs/UOBJLIST +++ /dev/null @@ -1,20 +0,0 @@ -{ - "uobj-list": " - geec_sentinel - geec_prime - xc_init - xc_exhub - xc_ihub - xc_nwlog - uapi_gcpustate - uapi_hcpustate - uapi_slabmempgtbl - uapi_sysdata - uapi_iotbl - uapi_uhmpgtbl - xh_syscalllog - xh_hyperdep - xh_ssteptrace - xg_richguest - " -} diff --git a/uxmhf/xmhf-uobjs/UOBJLIST.in b/uxmhf/xmhf-uobjs/UOBJLIST.in deleted file mode 100644 index 2694d384e7..0000000000 --- a/uxmhf/xmhf-uobjs/UOBJLIST.in +++ /dev/null @@ -1,20 +0,0 @@ -{ - "uobj-list": " - geec_sentinel - geec_prime - xc_init - xc_exhub - xc_ihub - xc_nwlog - uapi_gcpustate - uapi_hcpustate - uapi_slabmempgtbl - uapi_sysdata - uapi_iotbl - uapi_uhmpgtbl - xh_syscalllog - xh_hyperdep - xh_ssteptrace - xg_richguest - " -} \ No newline at end of file diff --git a/uxmhf/xmhf-uobjs/geec_prime/geec_prime.gsm b/uxmhf/xmhf-uobjs/geec_prime/geec_prime.gsm deleted file mode 100644 index afab117062..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/geec_prime.gsm +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -{ - "uobj-name": "geec_prime", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "PRIME", - - "uobj-uapifunctions":[], - - "uobj-callees": " geec_sentinel - uapi_slabmempgtbl - xc_init - uapi_sysdata - xc_ihub - xc_exhub - ", - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_sysdata", - "uobj-uapifunctionid": USMF_STR(UXMHF_UAPI_SYSDATA_E820ADDENTRY), - "opt1" : "(void)0;", - "opt2" : "(1)" - } - ], - - - "uobj-resource-devices":[ - { - "type": "include", - "opt1" : USMF_STR(PCI_VENDOR_ID_XMHFGEEC), - "opt2" : USMF_STR(PCI_DEVICE_ID_XMHFGEEC_LAPIC) - }, - { - "type": "include", - "opt1" : USMF_STR(PCI_VENDOR_ID_XMHFGEEC), - "opt2" : USMF_STR(PCI_DEVICE_ID_XMHFGEEC_TXT) - }, - { - "type": "include", - "opt1" : USMF_STR(PCI_VENDOR_ID_XMHFGEEC), - "opt2" : USMF_STR(PCI_DEVICE_ID_XMHFGEEC_TPM) - }, - { - "type": "include", - "opt1" : USMF_STR(PCI_VENDOR_ID_XMHFGEEC), - "opt2" : USMF_STR(PCI_DEVICE_ID_XMHFGEEC_IOMMU) - } - ], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x3800000" - }, - { - "section-name": "stack", - "section-size": "0xe00000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_data.c b/uxmhf/xmhf-uobjs/geec_prime/gp_data.c deleted file mode 100644 index bebccf3363..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_data.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -#include -#include - -#include -#include - -/* - * data used by HIC - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - -__attribute__(( section(".rwdatahdr") )) __attribute__(( aligned(4096) )) gp_rwdatahdr_t gp_rwdatahdr = { - .xcbootinfo_store.magic = RUNTIME_PARAMETER_BLOCK_MAGIC, -}; - -//static XMHF_BOOTINFO xcbootinfo_store __attribute__(( section(".rwdatahdr") )) = { -// .magic= RUNTIME_PARAMETER_BLOCK_MAGIC, -//}; - -// XMHF boot information block -__attribute__(( section(".data") )) XMHF_BOOTINFO *xcbootinfo= &gp_rwdatahdr.xcbootinfo_store; - -__attribute__((section(".slab_codehdr"))) x86vmx_mle_header_t mleheader = { 0 }; - - -// initialization BSP stack -__attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _init_bsp_cpustack[MAX_PLATFORM_CPUSTACK_SIZE]; - - - -////// -// (SMP) CPU state setup data -////// -/* -extern void __xmhf_exception_handler_0(void); -extern void __xmhf_exception_handler_1(void); -extern void __xmhf_exception_handler_2(void); -extern void __xmhf_exception_handler_3(void); -extern void __xmhf_exception_handler_4(void); -extern void __xmhf_exception_handler_5(void); -extern void __xmhf_exception_handler_6(void); -extern void __xmhf_exception_handler_7(void); -extern void __xmhf_exception_handler_8(void); -extern void __xmhf_exception_handler_9(void); -extern void __xmhf_exception_handler_10(void); -extern void __xmhf_exception_handler_11(void); -extern void __xmhf_exception_handler_12(void); -extern void __xmhf_exception_handler_13(void); -extern void __xmhf_exception_handler_14(void); -extern void __xmhf_exception_handler_15(void); -extern void __xmhf_exception_handler_16(void); -extern void __xmhf_exception_handler_17(void); -extern void __xmhf_exception_handler_18(void); -extern void __xmhf_exception_handler_19(void); -extern void __xmhf_exception_handler_20(void); -extern void __xmhf_exception_handler_21(void); -extern void __xmhf_exception_handler_22(void); -extern void __xmhf_exception_handler_23(void); -extern void __xmhf_exception_handler_24(void); -extern void __xmhf_exception_handler_25(void); -extern void __xmhf_exception_handler_26(void); -extern void __xmhf_exception_handler_27(void); -extern void __xmhf_exception_handler_28(void); -extern void __xmhf_exception_handler_29(void); -extern void __xmhf_exception_handler_30(void); -extern void __xmhf_exception_handler_31(void); - -#define XMHF_EXCEPTION_HANDLER_ADDROF(vector) &__xmhf_exception_handler_##vector - -uint32_t __xmhfhic_exceptionstubs[] = { XMHF_EXCEPTION_HANDLER_ADDROF(0), - XMHF_EXCEPTION_HANDLER_ADDROF(1), - XMHF_EXCEPTION_HANDLER_ADDROF(2), - XMHF_EXCEPTION_HANDLER_ADDROF(3), - XMHF_EXCEPTION_HANDLER_ADDROF(4), - XMHF_EXCEPTION_HANDLER_ADDROF(5), - XMHF_EXCEPTION_HANDLER_ADDROF(6), - XMHF_EXCEPTION_HANDLER_ADDROF(7), - XMHF_EXCEPTION_HANDLER_ADDROF(8), - XMHF_EXCEPTION_HANDLER_ADDROF(9), - XMHF_EXCEPTION_HANDLER_ADDROF(10), - XMHF_EXCEPTION_HANDLER_ADDROF(11), - XMHF_EXCEPTION_HANDLER_ADDROF(12), - XMHF_EXCEPTION_HANDLER_ADDROF(13), - XMHF_EXCEPTION_HANDLER_ADDROF(14), - XMHF_EXCEPTION_HANDLER_ADDROF(15), - XMHF_EXCEPTION_HANDLER_ADDROF(16), - XMHF_EXCEPTION_HANDLER_ADDROF(17), - XMHF_EXCEPTION_HANDLER_ADDROF(18), - XMHF_EXCEPTION_HANDLER_ADDROF(19), - XMHF_EXCEPTION_HANDLER_ADDROF(20), - XMHF_EXCEPTION_HANDLER_ADDROF(21), - XMHF_EXCEPTION_HANDLER_ADDROF(22), - XMHF_EXCEPTION_HANDLER_ADDROF(23), - XMHF_EXCEPTION_HANDLER_ADDROF(24), - XMHF_EXCEPTION_HANDLER_ADDROF(25), - XMHF_EXCEPTION_HANDLER_ADDROF(26), - XMHF_EXCEPTION_HANDLER_ADDROF(27), - XMHF_EXCEPTION_HANDLER_ADDROF(28), - XMHF_EXCEPTION_HANDLER_ADDROF(29), - XMHF_EXCEPTION_HANDLER_ADDROF(30), - XMHF_EXCEPTION_HANDLER_ADDROF(31), -}; -*/ -// CASM module supporting data structures - - - -// following two data structures used for SMP bootup -__attribute__(( aligned(16) )) uint64_t _xcsmp_ap_init_gdt_start[] = { - 0x0000000000000000ULL, //NULL descriptor - 0x00af9b000000ffffULL, //CPL-0 64-bit code descriptor (CS64) - 0x00af93000000ffffULL, //CPL-0 64-bit data descriptor (DS/SS/ES/FS/GS) -}; - -__attribute__(( aligned(16) )) arch_x86_gdtdesc_t _xcsmp_ap_init_gdt = { - .size=sizeof(_xcsmp_ap_init_gdt_start)-1, - .base=&_xcsmp_ap_init_gdt_start, -}; - - - -//static bool CASM_FUNCCALL(__xmhfhic_ap_entry,void) __attribute__((naked)); -void __xmhfhic_smp_cpu_x86_smpinitialize_commonstart(void); - - -// GDT -__attribute__((section(".data"))) __attribute__(( aligned(16) )) uint64_t __xmhfhic_x86vmx_gdt_start[XMHFGEEC_MAX_GDT_CODEDATA_DESCRIPTORS + MAX_PLATFORM_CPUS] = { - 0x0000000000000000ULL, //NULL descriptor - 0x00cf9a000000ffffULL, //CPL-0 32-bit code descriptor (CS64) - 0x00cf92000000ffffULL, //CPL-0 32-bit data descriptor (DS/SS/ES/FS/GS) - 0x00cffa000000ffffULL, //TODO: CPL-3 32-bit code descriptor (CS64) - 0x00cff2000000ffffULL, //TODO: CPL-3 32-bit data descriptor (DS/SS/ES/FS/GS) - 0x00cffa000000ffffULL, //TODO: CPL-3 32-bit code descriptor (CS64) - 0x00cff2000000ffffULL, //TODO: CPL-3 32-bit data descriptor (DS/SS/ES/FS/GS) - 0x0000000000000000ULL, //TSS descriptors (64-bits each) -}; -// GDT descriptor -__attribute__((section(".data"))) __attribute__(( aligned(16) )) arch_x86_gdtdesc_t __xmhfhic_x86vmx_gdt = { - .size=sizeof(__xmhfhic_x86vmx_gdt_start)-1, - .base=(uint32_t)&__xmhfhic_x86vmx_gdt_start, -}; - - -////// -// per-CPU data structures -////// - - -// initialization phase CPU stacks -__attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _init_cpustacks[MAX_PLATFORM_CPUS][MAX_PLATFORM_CPUSTACK_SIZE]; -// TSS -//__attribute__((section(".data"))) __attribute__(( aligned(4096) )) uint8_t __xmhfhic_x86vmx_tss[MAX_PLATFORM_CPUS][4*PAGE_SIZE_4K] = { 0 }; -__attribute__((section(".data"))) __attribute__(( aligned(4096) )) geec_prime_tss_t __xmhfhic_x86vmx_tss[MAX_PLATFORM_CPUS] = { 0 }; -// TSS stacks -__attribute__((section(".stack"))) __attribute__(( aligned(4096) )) uint8_t __xmhfhic_x86vmx_tss_stack[MAX_PLATFORM_CPUS][PAGE_SIZE_4K]; - -//// sysenter CPU stacks -//__attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _geec_primesmp_sysenter_stack[MAX_PLATFORM_CPUS][MAX_PLATFORM_CPUSTACK_SIZE]; - -// archdata -__attribute__((section(".data"))) __attribute__(( aligned(4096) )) xc_cpuarchdata_x86vmx_t __xmhfhic_x86vmx_archdata[MAX_PLATFORM_CPUS]; -//cpuidtable -//__attribute__((section(".data"))) __attribute__(( aligned(4) )) uint32_t __xmhfhic_x86vmx_cpuidtable[MAX_X86_APIC_ID]; - - -////// -// verified hypervisor slab memory page-tables -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl3t[PAE_MAXPTRS_PER_PDPT]; -//__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl2t[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl2t[PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -//__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl1t[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT][PAE_PTRS_PER_PT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl1t[PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; - -#if 1 -////// -// unverified hypervisor slab memory page-tables - -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_uhslabmempgtbl_lvl3t[XMHFGEEC_TOTAL_UHSLABS][PAE_MAXPTRS_PER_PDPT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_uhslabmempgtbl_lvl2t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_uhslabmempgtbl_lvl1t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; -#endif - - -////// -// bootstrap unity mapped page-tables -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _xcprimeon_init_pdt[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _xcprimeon_init_pdpt[PAE_MAXPTRS_PER_PDPT]; - - -__attribute__((section(".data"))) slab_devicemap_t _sda_slab_devicemap[XMHFGEEC_TOTAL_SLABS]; - -__attribute__((section(".data"))) sysdev_memioregions_t sysdev_memioregions[MAX_PLATFORM_DEVICES]; -__attribute__((section(".data"))) uint32_t numentries_sysdev_memioregions=0; - - -__attribute__((section(".data"))) struct _memorytype _vmx_ept_memorytypes[MAX_MEMORYTYPE_ENTRIES]; //EPT memory types array - -__attribute__((section(".data"))) mtrr_state_t _mtrrs; -__attribute__((section(".data"))) mtrr_state_t sinit2mle_mtrrs; - -__attribute__((section(".data"))) uint32_t gp_state4_smplock = 1; - - -//DMA Remapping Hardware Unit Definitions -__attribute__((section(".data"))) VTD_DRHD vtd_drhd[VTD_MAX_DRHD]; -__attribute__((section(".data"))) uint32_t vtd_num_drhd=0; //total number of DMAR h/w units -__attribute__((section(".data"))) bool vtd_drhd_scanned=false; //set to true once DRHD units have been scanned in the system - -__attribute__((section(".data"))) vtd_drhd_handle_t vtd_drhd_maxhandle=0; -__attribute__((section(".data"))) uint32_t vtd_dmar_table_physical_address=0; -__attribute__((section(".data"))) uint32_t vtd_ret_address=0; - - -//DMA page tables -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_ret_entry_t _slabdevpgtbl_vtd_ret[VTD_RET_MAXPTRS]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_cet_entry_t _slabdevpgtbl_vtd_cet[VTD_RET_MAXPTRS][VTD_CET_MAXPTRS]; - -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pml4te_t _slabdevpgtbl_pml4t[XMHFGEEC_TOTAL_SLABS][PAE_MAXPTRS_PER_PML4T]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pdpte_t _slabdevpgtbl_pdpt[XMHFGEEC_TOTAL_SLABS][PAE_MAXPTRS_PER_PDPT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pdte_t _slabdevpgtbl_pdt[XMHFGEEC_TOTAL_SLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pte_t _slabdevpgtbl_pt[XMHFGEEC_TOTAL_SLABS][MAX_SLAB_DMADATA_PDT_ENTRIES][PAE_PTRS_PER_PT]; - -//rich-guest DMA page-tables -__attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pte_t _slabdevpgtbl_pt_rg[VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT]; - - - -__attribute__((section(".data"))) _slabdevpgtbl_infotable_t _slabdevpgtbl_infotable[XMHFGEEC_TOTAL_SLABS]; -__attribute__((section(".data"))) uint32_t vtd_pagewalk_level; - - -//SMP -__attribute__((section(".data"))) x86smp_apbootstrapdata_t apdata; diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstack.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstack.c deleted file mode 100644 index f16b9ac65f..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstack.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -//#include -//#include -//#include - - -//@ghost bool gp_s1_bspstack_invoke_bspstkactivate = false; -//@ghost uint64_t gflags[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -/*@ - assigns _xcprimeon_init_pdpt[0..(PAE_MAXPTRS_PER_PDPT-1)]; - assigns _xcprimeon_init_pdt[0..(PAE_PTRS_PER_PDPT-1)][0..(PAE_PTRS_PER_PDT-1)]; - assigns gflags[0..(PAE_PTRS_PER_PDPT-1)][0..(PAE_PTRS_PER_PDT-1)]; - assigns gp_s1_bspstack_invoke_bspstkactivate; - ensures gp_s1_bspstack_invoke_bspstkactivate == true; - ensures \forall integer x; 0 <= x < PAE_PTRS_PER_PDPT ==> ( _xcprimeon_init_pdpt[x] == (pae_make_pdpe((uint32_t)&_xcprimeon_init_pdt[x][0], (_PAGE_PRESENT))) ); - ensures \forall integer x; PAE_PTRS_PER_PDPT <= x < PAE_MAXPTRS_PER_PDPT ==> ( _xcprimeon_init_pdpt[x] == 0 ); - ensures \forall integer x, y; 0 <= x < PAE_PTRS_PER_PDPT && 0 <= y < PAE_PTRS_PER_PDT ==> ( _xcprimeon_init_pdt[x][y] == (pae_make_pde_big((uint32_t)((x*(PAGE_SIZE_2M * PAE_PTRS_PER_PDT)) + (PAGE_SIZE_2M * y)), gflags[x][y])) ); -@*/ -void gp_s1_bspstack(void){ - uint32_t i, j; - uint64_t flags; - - //clear PDPT - /*@ - loop invariant a1: 0 <= i <= PAE_MAXPTRS_PER_PDPT; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( _xcprimeon_init_pdpt[x] == 0); - loop assigns _xcprimeon_init_pdpt[0..(PAE_MAXPTRS_PER_PDPT-1)]; - loop assigns i; - loop variant PAE_MAXPTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_MAXPTRS_PER_PDPT; i++) - _xcprimeon_init_pdpt[i] = 0; - - /*@ - loop invariant a3: 0 <= i <= PAE_PTRS_PER_PDPT; - loop invariant a4: \forall integer x; 0 <= x < i ==> ( _xcprimeon_init_pdpt[x] == (pae_make_pdpe((uint32_t)&_xcprimeon_init_pdt[x][0], (_PAGE_PRESENT))) ); - loop invariant a41: \forall integer x, y; 0 <= x < i && 0 <= y < PAE_PTRS_PER_PDT ==> ( _xcprimeon_init_pdt[x][y] == (pae_make_pde_big((uint32_t)((x*(PAGE_SIZE_2M * PAE_PTRS_PER_PDT)) + (PAGE_SIZE_2M * y)), gflags[x][y])) ); - loop assigns _xcprimeon_init_pdpt[0..(PAE_PTRS_PER_PDPT-1)]; - loop assigns _xcprimeon_init_pdt[0..(PAE_PTRS_PER_PDPT-1)][0..(PAE_PTRS_PER_PDT-1)]; - loop assigns gflags[0..(PAE_PTRS_PER_PDPT-1)][0..(PAE_PTRS_PER_PDT-1)]; - loop assigns i; - loop assigns j; - loop assigns flags; - loop variant PAE_PTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_PTRS_PER_PDPT; i++){ - _xcprimeon_init_pdpt[i] = pae_make_pdpe((uint32_t)&_xcprimeon_init_pdt[i][0], (_PAGE_PRESENT)); - - /*@ - loop invariant a5: 0 <= j <= PAE_PTRS_PER_PDT; - loop invariant a6: \forall integer y; 0 <= y < j ==> ( _xcprimeon_init_pdt[i][y] == (pae_make_pde_big((uint32_t)((i*(PAGE_SIZE_2M * PAE_PTRS_PER_PDT)) + (PAGE_SIZE_2M * y)), gflags[i][y])) ); - loop assigns _xcprimeon_init_pdt[i][0..(PAE_PTRS_PER_PDT-1)]; - loop assigns gflags[i][0..(PAE_PTRS_PER_PDT-1)]; - loop assigns j; - loop assigns flags; - loop variant PAE_PTRS_PER_PDT - j; - @*/ - for(j=0; j < PAE_PTRS_PER_PDT; j++){ - flags = _gp_s1_bspstack_getflagsforspa((i*(PAGE_SIZE_2M * PAE_PTRS_PER_PDT)) + (PAGE_SIZE_2M * j)); - //@ghost gflags[i][j] = flags; - - _xcprimeon_init_pdt[i][j] = pae_make_pde_big(((i*(PAGE_SIZE_2M * PAE_PTRS_PER_PDT)) + (PAGE_SIZE_2M * j)), flags); - } - } - - gp_s1_bspstkactivate(); - //@ghost gp_s1_bspstack_invoke_bspstkactivate = true; -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstackgetflags.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstackgetflags.c deleted file mode 100644 index 2ec845c9ca..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstackgetflags.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - behavior txttpm: - assumes (paddr == 0xfee00000 || paddr == 0xfec00000); - ensures (\result == (_PAGE_RW | _PAGE_PSE | _PAGE_PRESENT | _PAGE_PCD)); - - behavior other: - assumes !(paddr == 0xfee00000 || paddr == 0xfec00000); - ensures (\result == (_PAGE_RW | _PAGE_PSE | _PAGE_PRESENT)); - - complete behaviors; - disjoint behaviors; -@*/ -uint64_t _gp_s1_bspstack_getflagsforspa(uint32_t paddr){ - if(paddr == 0xfee00000 || paddr == 0xfec00000) - return (_PAGE_RW | _PAGE_PSE | _PAGE_PRESENT | _PAGE_PCD); - else - return (_PAGE_RW | _PAGE_PSE | _PAGE_PRESENT); -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstkactivate.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstkactivate.c deleted file mode 100644 index a0522f35f4..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_bspstkactivate.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -bool gp_s1_hub_called = false; -uint32_t check_esp, check_eip = CASM_RET_EIP; -slab_params_t test_sp; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void gp_s1_hub(void){ - //@assert xmhfhwm_cpu_state == CPU_STATE_RUNNING; - //@assert (xmhfhwm_cpu_msr_efer & (1ULL << EFER_NXE)); - //@assert (xmhfhwm_cpu_cr4 & CR4_PSE); - //@assert (xmhfhwm_cpu_cr4 & CR4_PAE); - //@assert (xmhfhwm_cpu_cr3 == (uint32_t)&_xcprimeon_init_pdpt); - //@assert (xmhfhwm_cpu_cr0 == (CR0_PE | CR0_PG | CR0_ET | CR0_EM)); - - //indicate s1_hub was invoked from bspstkactivate - gp_s1_hub_called = true; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_s1_bspstkactivate(); - - //@assert gp_s1_hub_called == true; - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -void gp_s1_bspstkactivate(void){ - uint64_t _msrefer; - uint32_t _cr4; - uint32_t _cr0 = (CR0_PE | CR0_PG | CR0_ET | CR0_EM); - - _msrefer = CASM_FUNCCALL(rdmsr64, MSR_EFER); - _msrefer |= (1ULL << EFER_NXE); - CASM_FUNCCALL(wrmsr64, MSR_EFER, (uint32_t)_msrefer, (uint32_t)((uint64_t)_msrefer >> 32) ); - - _XDPRINTF_("EFER=%016llx\n", CASM_FUNCCALL(rdmsr64,MSR_EFER)); - - _cr4 = CASM_FUNCCALL(read_cr4, CASM_NOPARAM); - _cr4 |= (CR4_PSE | CR4_PAE); - CASM_FUNCCALL(write_cr4, _cr4); - - _XDPRINTF_("CR4=%08x\n", CASM_FUNCCALL(read_cr4,CASM_NOPARAM)); - - CASM_FUNCCALL(write_cr3,(uint32_t)&_xcprimeon_init_pdpt); - - _XDPRINTF_("CR3=%08x\n", CASM_FUNCCALL(read_cr3,CASM_NOPARAM)); - - CASM_FUNCCALL(write_cr0, _cr0); - - gp_s1_hub(); -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_chkreq.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_chkreq.c deleted file mode 100644 index 5554e9e0df..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_chkreq.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; - - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_s1_chkreq(); - - //@assert ((xmhfhwm_cpu_state == CPU_STATE_HALT) || ( (xmhfhwm_cpu_state == CPU_STATE_RUNNING) && (xmhfhwm_cpu_gprs_esp == check_esp) && (xmhfhwm_cpu_gprs_eip == check_eip) && (gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES)) ); -} -#endif - -/////////////////////////////////////////////////////////////// -// sanity check HIC (hardware) requirements -void gp_s1_chkreq(void){ - uint32_t cpu_vendor; - - //grab CPU vendor - cpu_vendor = xmhf_baseplatform_arch_getcpuvendor(); - if (cpu_vendor != CPU_VENDOR_INTEL){ - _XDPRINTF_("%s: not an Intel CPU but running VMX backend. Halting!\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //check VMX support - { - uint32_t cpu_features; - uint32_t res0,res1,res2; - - CASM_FUNCCALL(xmhfhw_cpu_cpuid,0x1, &res0, &res1, &cpu_features, &res2); - - if ( ( cpu_features & (1<<5) ) == 0 ){ - _XDPRINTF_("No VMX support. Halting!\n"); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - } - - //we require unrestricted guest and EPT support, bail out if we don't have it - { - uint64_t msr_procctls2 = CASM_FUNCCALL(rdmsr64,IA32_VMX_PROCBASED_CTLS2_MSR); - if( !( (msr_procctls2 >> 32) & 0x80 ) ){ - _XDPRINTF_("%s: need unrestricted guest support but did not find any!\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - if( !( (msr_procctls2 >> 32) & 0x2) ){ - _XDPRINTF_("%s: need EPTt support but did not find any!\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - } - - - - //initialize platform bus - if(!xmhfhw_platform_bus_init()){ - _XDPRINTF_("%s: need PCI type-1 access but did not find any!\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //ensure bootinfo structure sanity - if(!(gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES)){ - _XDPRINTF_("%s: xcbootinfo_store.memmapinfo_numentries (%u) out-of-bounds!\n", __func__, gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //@assert (gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES); -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_entry.cS b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_entry.cS deleted file mode 100644 index 384e9e266e..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_entry.cS +++ /dev/null @@ -1,105 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -////// -// XMHF/GEEC prime state-1 entry -// author: amit vasudevan (amitvasudevan@acm.org) - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -bool gp_s1_bspstack_called = false; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void gp_s1_bspstack(void){ - //@assert xmhfhwm_cpu_gprs_esp == (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE - 4; - //@assert xmhfhwm_cpu_es_selector == xmhfhwm_cpu_ds_selector; - //@assert xmhfhwm_cpu_fs_selector == xmhfhwm_cpu_ds_selector; - //@assert xmhfhwm_cpu_gs_selector == xmhfhwm_cpu_ds_selector; - //@assert xmhfhwm_cpu_ss_selector == xmhfhwm_cpu_ds_selector; - //@assert xmhfhwm_cpu_state == CPU_STATE_RUNNING; - - //indicate bspstack was invoked from entry - gp_s1_bspstack_called = true; - //setup stack back to normal so value can return from the initial call to slab_main - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE - 8; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - - //execute harness - xmhfhwm_cpu_ds_selector = 0x8; - CASM_FUNCCALL(slab_main, CASM_NOPARAM); - //@assert gp_s1_bspstack_called == true; -} -#endif - -CASM_FUNCDEF(void, slab_main, -{ - xmhfhwm_cpu_insn_movw_ds_ax(); - xmhfhwm_cpu_insn_movw_ax_es(); - xmhfhwm_cpu_insn_movw_ax_fs(); - xmhfhwm_cpu_insn_movw_ax_gs(); - xmhfhwm_cpu_insn_movw_ax_ss(); - xmhfhwm_cpu_insn_movl_imm_eax(_init_bsp_cpustack); - xmhfhwm_cpu_insn_addl_imm_eax(MAX_PLATFORM_CPUSTACK_SIZE); - xmhfhwm_cpu_insn_movl_eax_esp(); - xmhfhwm_cpu_insn_call_c(gp_s1_bspstack); - xmhfhwm_cpu_insn_hlt(); - xmhfhwm_cpu_insn_ret() -}, -slab_params_t *sp) - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_hub.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_hub.c deleted file mode 100644 index 7a3c1a8ef6..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_hub.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//@ghost bool gp_s1_hub_called_chkreq = false; -//@ghost bool gp_s1_hub_called_postdrt = false; -//@ghost bool gp_s1_hub_called_scaniommu = false; -//@ghost bool gp_s1_hub_called_iommuinittbl = false; -//@ghost bool gp_s1_hub_called_iommuinit = false; -//@ghost bool gp_s1_hub_called_s2entry = false; -/*@ - assigns gp_s1_hub_called_chkreq; - assigns gp_s1_hub_called_postdrt; - assigns gp_s1_hub_called_scaniommu; - assigns gp_s1_hub_called_iommuinittbl; - assigns gp_s1_hub_called_iommuinit; - assigns gp_s1_hub_called_s2entry; - ensures (gp_s1_hub_called_chkreq == true); - ensures (gp_s1_hub_called_postdrt == true); - ensures (gp_s1_hub_called_scaniommu == true); - ensures (gp_s1_hub_called_iommuinittbl == true); - ensures (gp_s1_hub_called_iommuinit == true); - ensures (gp_s1_hub_called_s2entry == true); -@*/ - -void gp_s1_hub(void){ - - -#if defined (__DEBUG_SERIAL__) - - //initialize debugging early on - xmhf_debug_init((char *)&xcbootinfo->debugcontrol_buffer); - - - //[debug] print relevant startup info. - _XDPRINTF_("%s: alive and starting...\n", __func__); - - _XDPRINTF_(" xcbootinfo at = 0x%08x\n", (uint32_t)xcbootinfo); - _XDPRINTF_(" numE820Entries=%u\n", xcbootinfo->memmapinfo_numentries); - _XDPRINTF_(" system memory map buffer at 0x%08x\n", (uint32_t)&xcbootinfo->memmapinfo_buffer); - _XDPRINTF_(" numCPUEntries=%u\n", xcbootinfo->cpuinfo_numentries); - _XDPRINTF_(" cpuinfo buffer at 0x%08x\n", (uint32_t)&xcbootinfo->cpuinfo_buffer); - _XDPRINTF_(" XMHF size= %u bytes\n", __TARGET_SIZE_XMHF); - _XDPRINTF_(" OS bootmodule at 0x%08x, size=%u bytes\n", - xcbootinfo->richguest_bootmodule_base, xcbootinfo->richguest_bootmodule_size); - _XDPRINTF_("\tcmdline = \"%s\"\n", xcbootinfo->cmdline_buffer); - _XDPRINTF_("SL: runtime at 0x%08x; size=0x%08x bytes\n", __TARGET_BASE_XMHF, __TARGET_SIZE_XMHF); - _XDPRINTF_("SL: XMHF_BOOTINFO at 0x%08x, magic=0x%08x\n", (uint32_t)xcbootinfo, xcbootinfo->magic); - HALT_ON_ERRORCOND(xcbootinfo->magic == RUNTIME_PARAMETER_BLOCK_MAGIC); - _XDPRINTF_("\nNumber of E820 entries = %u", xcbootinfo->memmapinfo_numentries); - { - uint32_t i; - for(i=0; i < (uint32_t)xcbootinfo->memmapinfo_numentries; i++){ - _XDPRINTF_("\n0x%08x%08x, size=0x%08x%08x (%u)", - xcbootinfo->memmapinfo_buffer[i].baseaddr_high, xcbootinfo->memmapinfo_buffer[i].baseaddr_low, - xcbootinfo->memmapinfo_buffer[i].length_high, xcbootinfo->memmapinfo_buffer[i].length_low, - xcbootinfo->memmapinfo_buffer[i].type); - } - } - - //print out slab table - { - uint32_t i, j; - - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - _XDPRINTF_("slab %u: dumping slab header\n", i); - _XDPRINTF_(" slabtype=%08x\n", xmhfgeec_slab_info_table[i].slabtype); - _XDPRINTF_(" slab_inuse=%s\n", ( xmhfgeec_slab_info_table[i].slab_inuse ? "true" : "false") ); - _XDPRINTF_(" slab_callcaps=%08x\n", xmhfgeec_slab_info_table[i].slab_callcaps); - //_XDPRINTF_(" slab_devices=%s\n", ( xmhfgeec_slab_info_table[i].slab_devices.desc_valid ? "true" : "false") ); - _XDPRINTF_(" incl_devices_count=%u\n", xmhfgeec_slab_info_table[i].incl_devices_count ); - for(j=0; j < xmhfgeec_slab_info_table[i].incl_devices_count; j++) - _XDPRINTF_(" vendor_id=%x, device_id=%x\n", - xmhfgeec_slab_info_table[i].incl_devices[j].vendor_id, - xmhfgeec_slab_info_table[i].incl_devices[j].device_id); - _XDPRINTF_(" excl_devices_count=%u\n", xmhfgeec_slab_info_table[i].excl_devices_count ); - for(j=0; j < xmhfgeec_slab_info_table[i].excl_devices_count; j++) - _XDPRINTF_(" vendor_id=%x, device_id=%x\n", - xmhfgeec_slab_info_table[i].excl_devices[j].vendor_id, - xmhfgeec_slab_info_table[i].excl_devices[j].device_id); - - _XDPRINTF_(" slab_code(%08x-%08x)\n", xmhfgeec_slab_info_table[i].slab_physmem_extents[0].addr_start, xmhfgeec_slab_info_table[i].slab_physmem_extents[0].addr_end); - _XDPRINTF_(" slab_data(%08x-%08x)\n", xmhfgeec_slab_info_table[i].slab_physmem_extents[1].addr_start, xmhfgeec_slab_info_table[i].slab_physmem_extents[1].addr_end); - _XDPRINTF_(" slab_stack(%08x-%08x)\n", xmhfgeec_slab_info_table[i].slab_physmem_extents[2].addr_start, xmhfgeec_slab_info_table[i].slab_physmem_extents[2].addr_end); - _XDPRINTF_(" slab_dmadata(%08x-%08x)\n", xmhfgeec_slab_info_table[i].slab_physmem_extents[3].addr_start, xmhfgeec_slab_info_table[i].slab_physmem_extents[3].addr_end); - _XDPRINTF_(" slab_entrystub=%08x\n", xmhfgeec_slab_info_table[i].entrystub); - - } - } - -#endif // __DEBUG_SERIAL__ - - - //sanity check hardware requirements - gp_s1_chkreq(); - //@ghost gp_s1_hub_called_chkreq = true; - - //post DRT cleanup first - gp_s1_postdrt(); - //@ghost gp_s1_hub_called_postdrt = true; - - - //scan for IOMMU and halt if one is not present - gp_s1_scaniommu(); - //@ghost gp_s1_hub_called_scaniommu = true; - - - // (zero) initialize RET and CET - gp_s1_iommuinittbl(); - //@ghost gp_s1_hub_called_iommuinittbl = true; - - - //initialize IOMMU - gp_s1_iommuinit(); - //@ghost gp_s1_hub_called_iommuinit = true; - - - //move on to phase-2 - gp_s2_entry(); - //@ghost gp_s1_hub_called_s2entry = true; - -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinit.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinit.c deleted file mode 100644 index 1dcee8568f..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinit.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - vtd_drhd_maxhandle = 2; - vtd_drhd_scanned = true; - vtd_dmar_table_physical_address =XMHFHWM_BIOS_VTDDMARTABLEBASE; - vtd_ret_address = 0xDEADB000; - vtd_drhd[0].regbaseaddr =0x00000000fed90000ULL; - vtd_drhd[0].iotlb_regaddr = 0x00000000fed90108ULL; - vtd_drhd[0].iva_regaddr = 0x00000000fed90100ULL; - vtd_drhd[1].regbaseaddr =0x00000000fed91000ULL; - vtd_drhd[1].iotlb_regaddr = 0x00000000fed91108ULL; - vtd_drhd[1].iva_regaddr = 0x00000000fed91100ULL; - gp_s1_iommuinit(); - //@assert xmhfhwm_vtd_drhd_state[0].reg_rtaddr_lo == vtd_ret_address; - //@assert xmhfhwm_vtd_drhd_state[0].reg_rtaddr_hi == 0; - //@assert xmhfhwm_vtd_drhd_state[1].reg_rtaddr_lo == vtd_ret_address; - //@assert xmhfhwm_vtd_drhd_state[1].reg_rtaddr_hi == 0; - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -void gp_s1_iommuinit(void){ - vtd_drhd_handle_t drhd_handle; - vtd_slpgtbl_handle_t vtd_slpgtbl_handle; - //uint32_t i, b, d, f; - - vtd_pagewalk_level = VTD_PAGEWALK_NONE; - - //initialize all DRHD units - for(drhd_handle=0; drhd_handle < vtd_drhd_maxhandle; drhd_handle++){ - VTD_CAP_REG cap; - - _XDPRINTF_("%s: Setting up DRHD unit %u...\n", __func__, drhd_handle); - - - if(!xmhfhw_platform_x86pc_vtd_drhd_initialize(&vtd_drhd[drhd_handle]) ){ - _XDPRINTF_("%s: error setting up DRHD unit %u. halting!\n", __func__, drhd_handle); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - - //read and store DRHD supported page-walk length - unpack_VTD_CAP_REG(&cap, _vtd_reg_read(&vtd_drhd[drhd_handle], VTD_CAP_REG_OFF)); - if(cap.sagaw & 0x2){ - if(vtd_pagewalk_level == VTD_PAGEWALK_NONE || vtd_pagewalk_level == VTD_PAGEWALK_3LEVEL){ - vtd_pagewalk_level = VTD_PAGEWALK_3LEVEL; - _XDPRINTF_("%s: DRHD unit %u - 3-level page-walk\n", __func__, drhd_handle); - }else{ - _XDPRINTF_("%s: Halting: mixed hardware supported page-walk lengths\n", - __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - } - - - - if(cap.sagaw & 0x4){ - if(vtd_pagewalk_level == VTD_PAGEWALK_NONE || vtd_pagewalk_level == VTD_PAGEWALK_4LEVEL){ - vtd_pagewalk_level = VTD_PAGEWALK_4LEVEL; - _XDPRINTF_("%s: DRHD unit %u - 4-level page-walk\n", __func__, drhd_handle); - }else{ - _XDPRINTF_("%s: Halting: mixed hardware supported page-walk lengths\n", - __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - } - - _XDPRINTF_("%s: DRHD unit %u - ND capability = %x\n", __func__, drhd_handle, cap.nd); - - - - //set DRHD root entry table - if(!xmhfhw_platform_x86pc_vtd_drhd_set_root_entry_table(&vtd_drhd[drhd_handle], vtd_ret_address)){ - _XDPRINTF_("%s: Halting: error in setting DRHD RET\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - - - //invalidate caches - if(!xmhfhw_platform_x86pc_vtd_drhd_invalidatecaches(&vtd_drhd[drhd_handle])){ - _XDPRINTF_("%s: Halting: error in invalidating caches\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - - - //enable VT-d translation -#if 1 - xmhfhw_platform_x86pc_vtd_drhd_enable_translation(&vtd_drhd[drhd_handle]); -#endif - - - //disable PMRs now (since DMA protection is active via translation) - xmhfhw_platform_x86pc_vtd_drhd_disable_pmr(&vtd_drhd[drhd_handle]); - - - _XDPRINTF_("%s: Successfully setup DRHD unit %u\n", __func__, drhd_handle); - } - - //zap VT-d presence in ACPI table... - //TODO: we need to be a little elegant here. eventually need to setup - //EPT/NPTs such that the DMAR pages are unmapped for the guest - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu32, vtd_dmar_table_physical_address, 0UL); - - - _XDPRINTF_("%s: final page-walk level=%u\n", __func__, vtd_pagewalk_level); -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinittbl.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinittbl.c deleted file mode 100644 index 305db10693..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinittbl.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//@ghost bool invoked_clearcet[VTD_RET_MAXPTRS]; -/*@ - assigns _slabdevpgtbl_vtd_ret[0..(VTD_RET_MAXPTRS-1)].qwords[0]; - assigns _slabdevpgtbl_vtd_ret[0..(VTD_RET_MAXPTRS-1)].qwords[1]; - assigns invoked_clearcet[0..(VTD_RET_MAXPTRS-1)]; - assigns vtd_ret_address; - ensures \forall integer x; 0 <= x < VTD_RET_MAXPTRS ==> ( _slabdevpgtbl_vtd_ret[x].qwords[0] == (vtd_make_rete((uint64_t)&_slabdevpgtbl_vtd_cet[x], VTD_RET_PRESENT)) ); - ensures \forall integer x; 0 <= x < VTD_RET_MAXPTRS ==> ( _slabdevpgtbl_vtd_ret[x].qwords[1] == 0 ); - ensures \forall integer x; 0 <= x < VTD_RET_MAXPTRS ==> ( invoked_clearcet[x] == true ); - ensures vtd_ret_address == (uint32_t)&_slabdevpgtbl_vtd_ret; -@*/ -void gp_s1_iommuinittbl(void){ - uint32_t i, j; - - /*@ - loop invariant a1: 0 <= i <= VTD_RET_MAXPTRS; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( _slabdevpgtbl_vtd_ret[x].qwords[0] == (vtd_make_rete((uint64_t)&_slabdevpgtbl_vtd_cet[x], VTD_RET_PRESENT)) ); - loop invariant a3: \forall integer x; 0 <= x < i ==> ( _slabdevpgtbl_vtd_ret[x].qwords[1] == 0 ); - loop invariant a4: \forall integer x; 0 <= x < i ==> ( invoked_clearcet[x] == true ); - loop assigns _slabdevpgtbl_vtd_ret[0..(VTD_RET_MAXPTRS-1)].qwords[0]; - loop assigns _slabdevpgtbl_vtd_ret[0..(VTD_RET_MAXPTRS-1)].qwords[1]; - loop assigns i; - loop assigns invoked_clearcet[0..(VTD_RET_MAXPTRS-1)]; - loop variant VTD_RET_MAXPTRS - i; - @*/ - for(i=0; i< VTD_RET_MAXPTRS; i++){ - _slabdevpgtbl_vtd_ret[i].qwords[0] = - vtd_make_rete((uint64_t)&_slabdevpgtbl_vtd_cet[i], VTD_RET_PRESENT); - _slabdevpgtbl_vtd_ret[i].qwords[1] = 0ULL; - - gp_s1_iommuinittbl_clearcet(i); - //@ghost invoked_clearcet[i] = true; - } - - vtd_ret_address = (uint32_t)&_slabdevpgtbl_vtd_ret; -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinittblclearcet.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinittblclearcet.c deleted file mode 100644 index 6350742c7e..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_iommuinittblclearcet.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= retindex < VTD_RET_MAXPTRS; - assigns _slabdevpgtbl_vtd_cet[retindex][0..(VTD_CET_MAXPTRS-1)].qwords[0]; - assigns _slabdevpgtbl_vtd_cet[retindex][0..(VTD_CET_MAXPTRS-1)].qwords[1]; - ensures \forall integer y; 0 <= y < VTD_CET_MAXPTRS ==> ( _slabdevpgtbl_vtd_cet[retindex][y].qwords[0] == 0 ); - ensures \forall integer y; 0 <= y < VTD_CET_MAXPTRS ==> ( _slabdevpgtbl_vtd_cet[retindex][y].qwords[1] == 0 ); - -@*/ -void gp_s1_iommuinittbl_clearcet(uint32_t retindex){ - uint32_t j; - - /*@ - loop invariant b1: 0 <= j <= VTD_CET_MAXPTRS; - loop invariant b2: \forall integer y; 0 <= y < j ==> ( _slabdevpgtbl_vtd_cet[retindex][y].qwords[0] == 0 ); - loop invariant b3: \forall integer y; 0 <= y < j ==> ( _slabdevpgtbl_vtd_cet[retindex][y].qwords[1] == 0 ); - loop assigns _slabdevpgtbl_vtd_cet[retindex][0..(VTD_CET_MAXPTRS-1)].qwords[0]; - loop assigns _slabdevpgtbl_vtd_cet[retindex][0..(VTD_CET_MAXPTRS-1)].qwords[1]; - loop assigns j; - loop variant VTD_CET_MAXPTRS - j; - @*/ - for(j=0; j < VTD_CET_MAXPTRS; j++){ - _slabdevpgtbl_vtd_cet[retindex][j].qwords[0] = 0ULL; - _slabdevpgtbl_vtd_cet[retindex][j].qwords[1] = 0ULL; - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_postdrt.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_postdrt.c deleted file mode 100644 index 20fa90947c..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_postdrt.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - // //@assert (xmhfhwm_txt_heap.biosdatasize == sizeof(bios_data_t)); - // //@assert (xmhfhwm_txt_heap.osmledatasize == PAGE_SIZE_4K); - // //@assert (xmhfhwm_txt_heap.ossinitdatasize == sizeof(os_sinit_data_t)); - // //@assert (xmhfhwm_txt_heap.sinitmledatasize == sizeof(sinit_mle_data_t)); - - //execute harness - gp_s1_postdrt(); - - //@assert xmhfhwm_cpu_state == CPU_STATE_RUNNING || xmhfhwm_cpu_state == CPU_STATE_HALT; - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -void gp_s1_postdrt(void){ - txt_heap_t *txt_heap; - os_mle_data_t os_mle_data; - uint32_t txt_heap_size; - uint32_t os_mle_data_paddr; - - //save SINIT to MLE MTRR mappings - xmhfhw_cpu_x86_save_mtrrs(&sinit2mle_mtrrs); - - os_mle_data.saved_mtrr_state.num_var_mtrrs=0; - - txt_heap = get_txt_heap(); - _XDPRINTF_("SL: txt_heap = 0x%08x\n", (uint32_t)txt_heap); - - txt_heap_size = (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE); - os_mle_data_paddr = get_os_mle_data_start((txt_heap_t*)((uint32_t)txt_heap), txt_heap_size); - //@assert (os_mle_data_paddr == (XMHFHWM_TXT_SYSMEM_HEAPBASE+0x8+sizeof(bios_data_t)+0x8)); - - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, (uint32_t)&os_mle_data, - os_mle_data_paddr, sizeof(os_mle_data_t)); - - _XDPRINTF_("SL: os_mle_data = 0x%08x, size=%u bytes\n", (uint32_t)&os_mle_data, - sizeof(os_mle_data)); - - if(os_mle_data.saved_mtrr_state.num_var_mtrrs < MAX_VARIABLE_MTRRS){ - // restore pre-SENTER MTRRs that were overwritten for SINIT launch - if(!validate_mtrrs(&os_mle_data.saved_mtrr_state)) { - _XDPRINTF_("Error: validate_mtrrs() failed.\n"); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - _XDPRINTF_("SL: Validated MTRRs\n"); - - xmhfhw_cpu_x86_restore_mtrrs(&(os_mle_data.saved_mtrr_state)); - - _XDPRINTF_("SL: Restored MTRRs\n"); - - }else{ - _XDPRINTF_("%s:%u num_var_mtrrs >= MAX_VARIABLE_MTRRS\n", - __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_scaniommu.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s1_scaniommu.c deleted file mode 100644 index 2fe122e102..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s1_scaniommu.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//scan for IOMMU and halt if not present -//global variables set: -//vtd_drhd[] (struct representing a DRHD unit) -//vtd_num_drhd (number of DRHD units detected) -//vtd_dmar_table_physical_address (physical address of the DMAR table) - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_s1_scaniommu(); - - //@assert (vtd_drhd_maxhandle == 2); - //@assert (vtd_drhd_scanned == true); - //@assert (vtd_drhd[0].regbaseaddr ==0x00000000fed90000ULL); - //@assert (vtd_drhd[0].iotlb_regaddr == 0x00000000fed90108ULL); - //@assert (vtd_drhd[0].iva_regaddr == 0x00000000fed90100ULL); - //@assert (vtd_drhd[1].regbaseaddr ==0x00000000fed91000ULL); - //@assert (vtd_drhd[1].iotlb_regaddr == 0x00000000fed91108ULL); - //@assert (vtd_drhd[1].iva_regaddr == 0x00000000fed91100ULL); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -void gp_s1_scaniommu(void){ - ACPI_RSDP rsdp = {0}; - ACPI_RSDT rsdt = {0}; - uint32_t num_rsdtentries=0; - uint32_t rsdtentries[ACPI_MAX_RSDT_ENTRIES]; - uint32_t status; - VTD_DMAR dmar = {0}; - uint32_t i, dmarfound; - uint32_t remappingstructuresaddrphys; - - //set maxhandle to 0 to start with. if we have any errors before - //we finalize maxhandle we can just bail out - vtd_drhd_maxhandle=0; - - //get ACPI RSDP - status=xmhfhw_platform_x86pc_acpi_getRSDP(&rsdp); - if(status == 0){ - _XDPRINTF_("%s:%u unable to get ACPI RSDP. Halting!\n", __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - -#if defined (__DEBUG_SERIAL__) - _XDPRINTF_("rdsp.signature=%016llx\n", rsdp.signature); - _XDPRINTF_("rdsp.checksum=%02x\n", rsdp.checksum); - _XDPRINTF_("rdsp.oemid=%02x %02x %02x %02x %02x %02x\n", - rsdp.oemid[0], rsdp.oemid[1], rsdp.oemid[2], - rsdp.oemid[3], rsdp.oemid[4], rsdp.oemid[5]); - _XDPRINTF_("rdsp.revision=%02x\n", rsdp.revision); - _XDPRINTF_("rdsp.rsdtaddress=%08x\n", rsdp.rsdtaddress); - _XDPRINTF_("rdsp.length=%08x\n", rsdp.length); - _XDPRINTF_("rdsp.xsdtaddress=%016llx\n", rsdp.xsdtaddress); - _XDPRINTF_("rdsp.xchecksum=%02x\n", rsdp.xchecksum); - _XDPRINTF_("rdsp.rsvd0=%02x %02x %02x\n", - rsdp.oemid[0], rsdp.oemid[1], rsdp.oemid[2]); -#endif //__DEBUG_SERIAL__ - - - //grab ACPI RSDT - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, (uint8_t *)&rsdt, (uint8_t *)rsdp.rsdtaddress, sizeof(ACPI_RSDT)); - _XDPRINTF_("%s:%u RSDT at %08x, len=%u bytes, hdrlen=%u bytes\n", - __func__, __LINE__, rsdp.rsdtaddress, rsdt.length, sizeof(ACPI_RSDT)); - - - #if defined (__DEBUG_SERIAL__) - _XDPRINTF_("rsdt.signature=%016llx\n", rsdt.signature); - _XDPRINTF_("rsdt.length=%08x\n", rsdt.length); - _XDPRINTF_("rsdt.revision=%02x\n", rsdt.revision); - _XDPRINTF_("rsdt.checksum=%02x\n", rsdt.checksum); - _XDPRINTF_("rsdt.oemid=%02x %02x %02x %02x %02x %02x\n", - rsdt.oemid[0], rsdt.oemid[1], rsdt.oemid[2], - rsdt.oemid[3], rsdt.oemid[4], rsdt.oemid[5]); - _XDPRINTF_("rsdt.oemtableid=%016llx\n", rsdt.oemtableid); - _XDPRINTF_("rsdt.oemrevision=%08x\n", rsdt.oemrevision); - _XDPRINTF_("rsdt.creatorid=%08x\n", rsdt.creatorid); - _XDPRINTF_("rsdt.creatorrevision=%08x\n", rsdt.creatorrevision); - #endif //__DEBUG_SERIAL__ - - - - - //get the RSDT entry list - num_rsdtentries = (rsdt.length - sizeof(ACPI_RSDT))/ sizeof(uint32_t); - if(num_rsdtentries >= ACPI_MAX_RSDT_ENTRIES){ - _XDPRINTF_("%s:%u num_rsdtentries(%u) > ACPI_MAX_RSDT_ENTRIES (%u). Halting!\n", - __func__, __LINE__, num_rsdtentries, ACPI_MAX_RSDT_ENTRIES); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - _XDPRINTF_("%s:%u RSDT entry list at %08x, len=%u", __func__, __LINE__, - (rsdp.rsdtaddress + sizeof(ACPI_RSDT)), num_rsdtentries); - - - - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, (uint8_t *)&rsdtentries, (uint8_t *)(rsdp.rsdtaddress + sizeof(ACPI_RSDT)), - sizeof(uint32_t)*num_rsdtentries); - - - //find the VT-d DMAR table in the list (if any) - for(i=0; i< num_rsdtentries; i++){ - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, (uint8_t *)&dmar, (uint8_t *)rsdtentries[i], sizeof(VTD_DMAR)); - if(dmar.signature == VTD_DMAR_SIGNATURE){ - dmarfound=1; - #if defined (__DEBUG_SERIAL__) - _XDPRINTF_("dmar.signature=%016llx\n", dmar.signature); - _XDPRINTF_("dmar.length=%08x\n", dmar.length); - _XDPRINTF_("dmar.revision=%02x\n", dmar.revision); - _XDPRINTF_("dmar.checksum=%02x\n", dmar.checksum); - _XDPRINTF_("dmar.oemid=%02x %02x %02x %02x %02x %02x\n", - dmar.oemid[0], dmar.oemid[1], dmar.oemid[2], - dmar.oemid[3], dmar.oemid[4], dmar.oemid[5]); - _XDPRINTF_("dmar.oemtableid=%016llx\n", dmar.oemtableid); - _XDPRINTF_("dmar.oemrevision=%08x\n", dmar.oemrevision); - _XDPRINTF_("dmar.creatorid=%08x\n", dmar.creatorid); - _XDPRINTF_("dmar.creatorrevision=%08x\n", dmar.creatorrevision); - _XDPRINTF_("dmar.hostaddresswidth=%02x\n", dmar.hostaddresswidth); - _XDPRINTF_("dmar.flags=%02x\n", dmar.flags); - _XDPRINTF_("dmar.rsvd0=%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", - dmar.oemid[0], dmar.oemid[1], dmar.oemid[2], - dmar.oemid[3], dmar.oemid[4], dmar.oemid[5], - dmar.oemid[6], dmar.oemid[7], dmar.oemid[8], - dmar.oemid[9]); - #endif //__DEBUG_SERIAL__ - - break; - } - } - - - - - //if no DMAR table, bail out - if(!dmarfound){ - _XDPRINTF_("%s:%u Error No DMAR table. Halting!", __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - vtd_dmar_table_physical_address = rsdtentries[i]; //DMAR table physical memory address; - _XDPRINTF_("%s:%u DMAR at %08x", __func__, __LINE__, vtd_dmar_table_physical_address); - - - - - //detect DRHDs in the DMAR table - i=0; - remappingstructuresaddrphys=vtd_dmar_table_physical_address+sizeof(VTD_DMAR); - - while(i < (dmar.length-sizeof(VTD_DMAR))){ - uint16_t type, length; - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj,(uint8_t *)&type, (uint8_t *)(remappingstructuresaddrphys+i), sizeof(uint16_t)); - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj,(uint8_t *)&length, (uint8_t *)(remappingstructuresaddrphys+i+sizeof(uint16_t)), sizeof(uint16_t)); - - switch(type){ - case 0: //DRHD - if(vtd_num_drhd >= VTD_MAX_DRHD){ - _XDPRINTF_("%s:%u vtd_num_drhd (%u) > VTD_MAX_DRHD (%u). Halting!", __func__, - __LINE__, vtd_num_drhd, VTD_MAX_DRHD); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, (uint8_t *)&vtd_drhd[vtd_num_drhd], (uint8_t *)(remappingstructuresaddrphys+i), length); - vtd_num_drhd++; - i+=(uint32_t)length; - break; - - default: //unknown type, we skip this - i += (uint32_t)length; - break; - } - } - _XDPRINTF_("%s:%u total DRHDs detected= %u units\n", __func__, __LINE__, vtd_num_drhd); - - - - //populate IVA and IOTLB register addresses within all the DRHD unit - //structures - for(i=0; i < vtd_num_drhd; i++){ - VTD_ECAP_REG ecap; - - unpack_VTD_ECAP_REG(&ecap, _vtd_reg_read(&vtd_drhd[i], VTD_ECAP_REG_OFF)); - vtd_drhd[i].iotlb_regaddr= vtd_drhd[i].regbaseaddr+(ecap.iro*16)+0x8; - vtd_drhd[i].iva_regaddr= vtd_drhd[i].regbaseaddr+(ecap.iro*16); - } - - -#if defined (__DEBUG_SERIAL__) - //[DEBUG]: be a little verbose about what we found - _XDPRINTF_("%s: DMAR Devices:\n", __func__); - for(i=0; i < vtd_num_drhd; i++){ - VTD_CAP_REG cap; - VTD_ECAP_REG ecap; - _XDPRINTF_(" Device %u type=%04x, length=%04x, flags=%02x, rsvdz0=%02x\n", i, - vtd_drhd[i].type, vtd_drhd[i].length, vtd_drhd[i].flags, vtd_drhd[i].rsvdz0); - _XDPRINTF_(" Device %u on PCI seg %04x; base=0x%016llx\n", i, - vtd_drhd[i].pcisegment, vtd_drhd[i].regbaseaddr); - unpack_VTD_CAP_REG(&cap, _vtd_reg_read(&vtd_drhd[i], VTD_CAP_REG_OFF)); - _XDPRINTF_(" cap=0x%016llx\n", pack_VTD_CAP_REG(&cap)); - //ecap.value = _vtd_reg_read(&vtd_drhd[i], VTD_ECAP_REG_OFF); - unpack_VTD_ECAP_REG(&ecap, _vtd_reg_read(&vtd_drhd[i], VTD_ECAP_REG_OFF)); - _XDPRINTF_(" ecap=0x%016llx\n", (uint64_t)pack_VTD_ECAP_REG(&ecap)); - _XDPRINTF_(" iotlb_regaddr=%08x, iva_regaddr=%08x\n", - vtd_drhd[i].iotlb_regaddr, vtd_drhd[i].iva_regaddr); - - } -#endif // __DEBUG_SERIAL__ - - vtd_drhd_maxhandle = vtd_num_drhd; - vtd_drhd_scanned = true; - - _XDPRINTF_("%s: Vt-d: maxhandle = %u, dmar table addr=0x%08x\n", __func__, - (uint32_t)vtd_drhd_maxhandle, (uint32_t)vtd_dmar_table_physical_address); - -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_entry.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_entry.c deleted file mode 100644 index f9a07f63a3..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_entry.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - - - -//@ghost bool cor_gp_s2_initsysmemmap = false; -//@ghost bool cor_gp_s2_sdmenumsysdevices = false; -//@ghost bool cor_gp_s2_sdminitdevmap = false; -//@ghost bool cor_gp_s2_sda = false; -//@ghost bool cor_gp_s2_gathersysmemtypes = false; -//@ghost bool cor_gp_s2_setupiotbl = false; -//@ghost bool cor_gp_s2_setupmpgtblv = false; -//@ghost bool cor_gp_s2_setupmpgtblu = false; -//@ghost bool cor_gp_s2_setupgdt = false; -//@ghost bool cor_gp_s2_setupidt = false; -//@ghost bool cor_gp_s2_setuptss = false; -//@ghost bool cor_gp_s3_entry = false; -/*@ - requires (gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES); - requires 0 <= vtd_drhd_maxhandle <= VTD_MAX_DRHD; - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (0 <= xmhfgeec_slab_info_table[x].incl_devices_count <= XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES); - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (0 <= xmhfgeec_slab_info_table[x].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES); - - assigns cor_gp_s2_initsysmemmap; - assigns cor_gp_s2_sdmenumsysdevices; - assigns cor_gp_s2_sdminitdevmap; - assigns cor_gp_s2_sda; - assigns cor_gp_s2_gathersysmemtypes; - assigns cor_gp_s2_setupiotbl; - assigns cor_gp_s2_setupmpgtblv; - assigns cor_gp_s2_setupmpgtblu; - assigns cor_gp_s2_setupgdt; - assigns cor_gp_s2_setupidt; - assigns cor_gp_s2_setuptss; - assigns cor_gp_s3_entry; - - ensures (cor_gp_s2_initsysmemmap == true); - ensures (cor_gp_s2_sdmenumsysdevices == true); - ensures (cor_gp_s2_sdminitdevmap == true); - ensures (cor_gp_s2_sda == true); - ensures (cor_gp_s2_gathersysmemtypes == true); - ensures (cor_gp_s2_setupiotbl == true); - ensures (cor_gp_s2_setupmpgtblv == true); - ensures (cor_gp_s2_setupmpgtblu == true); - ensures (cor_gp_s2_setupgdt == true); - ensures (cor_gp_s2_setupidt == true); - ensures (cor_gp_s2_setuptss == true); - ensures (cor_gp_s3_entry == true); -@*/ -void gp_s2_entry(void){ - - //intialize system memory map - gp_s2_initsysmemmap(); - //@ghost cor_gp_s2_initsysmemmap = true; - - - //enumerate system devices - //@assert cor_gp_s2_initsysmemmap == true; - gp_s2_sdmenumsysdevices(); - //@ghost cor_gp_s2_sdmenumsysdevices = true; - - - //initialize uobj device mapping - //@assert cor_gp_s2_initsysmemmap == true; - //@assert cor_gp_s2_sdmenumsysdevices == true; - gp_s2_sdminitdevmap(); - //@ghost cor_gp_s2_sdminitdevmap = true; - - - //setup slab system device allocation and device page tables - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - gp_s2_sda(); - //@ghost cor_gp_s2_sda = true; - - //gather memory types for EPT (for guest slabs) - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - gp_s2_gathersysmemtypes(); - //@ghost cor_gp_s2_gathersysmemtypes = true; - - //setup (unverified) slab iotbl - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - gp_s2_setupiotbl(); - //@ghost cor_gp_s2_setupiotbl = true; - - //setup verified uobj memory page tables - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - //@assert (cor_gp_s2_setupiotbl == true); - gp_s2_setupmpgtblv(); - //@ghost cor_gp_s2_setupmpgtblv = true; - - - //setup unverified uobj memory page tables - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - //@assert (cor_gp_s2_setupiotbl == true); - //@assert (cor_gp_s2_setupmpgtblv == true); - gp_s2_setupmpgtblu(); - //@ghost cor_gp_s2_setupmpgtblu = true; - - //initialize GDT - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - //@assert (cor_gp_s2_setupiotbl == true); - //@assert (cor_gp_s2_setupmpgtblv == true); - //@assert (cor_gp_s2_setupmpgtblu == true); - gp_s2_setupgdt(); - //@ghost cor_gp_s2_setupgdt = true; - - - //initialize IDT - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - //@assert (cor_gp_s2_setupiotbl == true); - //@assert (cor_gp_s2_setupmpgtblv == true); - //@assert (cor_gp_s2_setupmpgtblu == true); - //@assert (cor_gp_s2_setupgdt == true); - gp_s2_setupidt(); - //@ghost cor_gp_s2_setupidt = true; - - - //initialize TSS - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - //@assert (cor_gp_s2_setupiotbl == true); - //@assert (cor_gp_s2_setupmpgtblv == true); - //@assert (cor_gp_s2_setupmpgtblu == true); - //@assert (cor_gp_s2_setupgdt == true); - //@assert (cor_gp_s2_setupidt == true); - gp_s2_setuptss(); - //@ghost cor_gp_s2_setuptss = true; - - - //move on to stage-3 - //@assert (cor_gp_s2_initsysmemmap == true); - //@assert cor_gp_s2_sdmenumsysdevices == true; - //@assert (cor_gp_s2_sdminitdevmap == true); - //@assert (cor_gp_s2_sda == true); - //@assert (cor_gp_s2_gathersysmemtypes == true); - //@assert (cor_gp_s2_setupiotbl == true); - //@assert (cor_gp_s2_setupmpgtblv == true); - //@assert (cor_gp_s2_setupmpgtblu == true); - //@assert (cor_gp_s2_setupgdt == true); - //@assert (cor_gp_s2_setupidt == true); - //@assert (cor_gp_s2_setuptss == true); - gp_s3_entry(); - //@ghost cor_gp_s3_entry = true; - - -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_gathersysmemtypes.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_gathersysmemtypes.c deleted file mode 100644 index 29d068f5df..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_gathersysmemtypes.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_s2_gathersysmemtypes(); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -//---gather memory types for system physical memory------------------------------ -void gp_s2_gathersysmemtypes(void){ - uint32_t eax, ebx, ecx, edx; - uint32_t index=0; - uint32_t num_vmtrrs=0; //number of variable length MTRRs supported by the CPU - uint64_t msr_value; - - //0. sanity check - //check MTRR support - eax=0x00000001; - ecx=0x00000000; - CASM_FUNCCALL(xmhfhw_cpu_cpuid,0x00000001, &eax, &ebx, &ecx, &edx); - - if( !(edx & (uint32_t)(1 << 12)) ){ - _XDPRINTF_("\n%s: CPU does not support MTRRs!", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //check MTRR caps - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRRCAP); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - num_vmtrrs = (uint8_t)eax; - _XDPRINTF_("\nIA32_MTRRCAP: %08x%08x VCNT=%u, FIX=%u, WC=%u, SMRR=%u", - edx, eax, num_vmtrrs, ((eax & (1 << 8)) >> 8), ((eax & (1 << 10)) >> 10), - ((eax & (1 << 11)) >> 11)); - - //sanity check that fixed MTRRs are supported - if( ! ((eax & (1 << 8)) >> 8) ){ - _XDPRINTF_("%s:%u Fixed MTRRs are not supported. Halting!\n", - __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //ensure number of variable MTRRs are within the maximum supported - if( ! (num_vmtrrs <= MAX_VARIABLE_MEMORYTYPE_ENTRIES) ){ - _XDPRINTF_("%s:%u Total variable MTRRs exceeded config. Halting!\n", - __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - - //1. clear memorytypes array - memset((void *)&_vmx_ept_memorytypes, 0, sizeof(struct _memorytype) * MAX_MEMORYTYPE_ENTRIES); - - //2. grab memory types using FIXED MTRRs - //0x00000000-0x0007FFFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX64K_00000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x00000000; _vmx_ept_memorytypes[index].endaddr = 0x0000FFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x00010000; _vmx_ept_memorytypes[index].endaddr = 0x0001FFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x00020000; _vmx_ept_memorytypes[index].endaddr = 0x0002FFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x00030000; _vmx_ept_memorytypes[index].endaddr = 0x0003FFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x00040000; _vmx_ept_memorytypes[index].endaddr = 0x0004FFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x00050000; _vmx_ept_memorytypes[index].endaddr = 0x0005FFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x00060000; _vmx_ept_memorytypes[index].endaddr = 0x0006FFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x00070000; _vmx_ept_memorytypes[index].endaddr = 0x0007FFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x00080000-0x0009FFFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX16K_80000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x00080000; _vmx_ept_memorytypes[index].endaddr = 0x00083FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x00084000; _vmx_ept_memorytypes[index].endaddr = 0x00087FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x00088000; _vmx_ept_memorytypes[index].endaddr = 0x0008BFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x0008C000; _vmx_ept_memorytypes[index].endaddr = 0x0008FFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x00090000; _vmx_ept_memorytypes[index].endaddr = 0x00093FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x00094000; _vmx_ept_memorytypes[index].endaddr = 0x00097FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x00098000; _vmx_ept_memorytypes[index].endaddr = 0x0009BFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x0009C000; _vmx_ept_memorytypes[index].endaddr = 0x0009FFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000A0000-0x000BFFFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX16K_A0000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000A0000; _vmx_ept_memorytypes[index].endaddr = 0x000A3FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000A4000; _vmx_ept_memorytypes[index].endaddr = 0x000A7FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000A8000; _vmx_ept_memorytypes[index].endaddr = 0x000ABFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000AC000; _vmx_ept_memorytypes[index].endaddr = 0x000AFFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000B0000; _vmx_ept_memorytypes[index].endaddr = 0x000B3FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000B4000; _vmx_ept_memorytypes[index].endaddr = 0x000B7FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000B8000; _vmx_ept_memorytypes[index].endaddr = 0x000BBFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000BC000; _vmx_ept_memorytypes[index].endaddr = 0x000BFFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000C0000-0x000C7FFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_C0000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000C0000; _vmx_ept_memorytypes[index].endaddr = 0x000C0FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000C1000; _vmx_ept_memorytypes[index].endaddr = 0x000C1FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000C2000; _vmx_ept_memorytypes[index].endaddr = 0x000C2FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000C3000; _vmx_ept_memorytypes[index].endaddr = 0x000C3FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000C4000; _vmx_ept_memorytypes[index].endaddr = 0x000C4FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000C5000; _vmx_ept_memorytypes[index].endaddr = 0x000C5FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000C6000; _vmx_ept_memorytypes[index].endaddr = 0x000C6FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000C7000; _vmx_ept_memorytypes[index].endaddr = 0x000C7FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000C8000-0x000C8FFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_C8000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000C8000; _vmx_ept_memorytypes[index].endaddr = 0x000C8FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000C9000; _vmx_ept_memorytypes[index].endaddr = 0x000C9FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000CA000; _vmx_ept_memorytypes[index].endaddr = 0x000CAFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000CB000; _vmx_ept_memorytypes[index].endaddr = 0x000CBFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000CC000; _vmx_ept_memorytypes[index].endaddr = 0x000CCFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000CD000; _vmx_ept_memorytypes[index].endaddr = 0x000CDFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000CE000; _vmx_ept_memorytypes[index].endaddr = 0x000CEFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000CF000; _vmx_ept_memorytypes[index].endaddr = 0x000CFFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000D0000-0x000D7FFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_D0000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000D0000; _vmx_ept_memorytypes[index].endaddr = 0x000D0FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000D1000; _vmx_ept_memorytypes[index].endaddr = 0x000D1FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000D2000; _vmx_ept_memorytypes[index].endaddr = 0x000D2FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000D3000; _vmx_ept_memorytypes[index].endaddr = 0x000D3FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000D4000; _vmx_ept_memorytypes[index].endaddr = 0x000D4FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000D5000; _vmx_ept_memorytypes[index].endaddr = 0x000D5FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000D6000; _vmx_ept_memorytypes[index].endaddr = 0x000D6FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000D7000; _vmx_ept_memorytypes[index].endaddr = 0x000D7FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000D8000-0x000DFFFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_D8000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000D8000; _vmx_ept_memorytypes[index].endaddr = 0x000D8FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000D9000; _vmx_ept_memorytypes[index].endaddr = 0x000D9FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000DA000; _vmx_ept_memorytypes[index].endaddr = 0x000DAFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000DB000; _vmx_ept_memorytypes[index].endaddr = 0x000DBFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000DC000; _vmx_ept_memorytypes[index].endaddr = 0x000DCFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000DD000; _vmx_ept_memorytypes[index].endaddr = 0x000DDFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000DE000; _vmx_ept_memorytypes[index].endaddr = 0x000DEFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000DF000; _vmx_ept_memorytypes[index].endaddr = 0x000DFFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000E0000-0x000E7FFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_E0000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000E0000; _vmx_ept_memorytypes[index].endaddr = 0x000E0FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000E1000; _vmx_ept_memorytypes[index].endaddr = 0x000E1FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000E2000; _vmx_ept_memorytypes[index].endaddr = 0x000E2FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000E3000; _vmx_ept_memorytypes[index].endaddr = 0x000E3FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000E4000; _vmx_ept_memorytypes[index].endaddr = 0x000E4FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000E5000; _vmx_ept_memorytypes[index].endaddr = 0x000E5FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000E6000; _vmx_ept_memorytypes[index].endaddr = 0x000E6FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000E7000; _vmx_ept_memorytypes[index].endaddr = 0x000E7FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000E8000-0x000EFFFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_E8000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000E8000; _vmx_ept_memorytypes[index].endaddr = 0x000E8FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000E9000; _vmx_ept_memorytypes[index].endaddr = 0x000E9FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000EA000; _vmx_ept_memorytypes[index].endaddr = 0x000EAFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000EB000; _vmx_ept_memorytypes[index].endaddr = 0x000EBFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000EC000; _vmx_ept_memorytypes[index].endaddr = 0x000ECFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000ED000; _vmx_ept_memorytypes[index].endaddr = 0x000EDFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000EE000; _vmx_ept_memorytypes[index].endaddr = 0x000EEFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000EF000; _vmx_ept_memorytypes[index].endaddr = 0x000EFFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000F0000-0x000F7FFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_F0000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000F0000; _vmx_ept_memorytypes[index].endaddr = 0x000F0FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000F1000; _vmx_ept_memorytypes[index].endaddr = 0x000F1FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000F2000; _vmx_ept_memorytypes[index].endaddr = 0x000F2FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000F3000; _vmx_ept_memorytypes[index].endaddr = 0x000F3FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000F4000; _vmx_ept_memorytypes[index].endaddr = 0x000F4FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000F5000; _vmx_ept_memorytypes[index].endaddr = 0x000F5FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000F6000; _vmx_ept_memorytypes[index].endaddr = 0x000F6FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000F7000; _vmx_ept_memorytypes[index].endaddr = 0x000F7FFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - //0x000F8000-0x000FFFFF - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MTRR_FIX4K_F8000); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - _vmx_ept_memorytypes[index].startaddr = 0x000F8000; _vmx_ept_memorytypes[index].endaddr = 0x000F8FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000F9000; _vmx_ept_memorytypes[index].endaddr = 0x000F9FFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000FA000; _vmx_ept_memorytypes[index].endaddr = 0x000FAFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000FB000; _vmx_ept_memorytypes[index].endaddr = 0x000FBFFF; _vmx_ept_memorytypes[index++].type= ((eax & 0xFF000000) >> 24); - _vmx_ept_memorytypes[index].startaddr = 0x000FC000; _vmx_ept_memorytypes[index].endaddr = 0x000FCFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x000000FF) >> 0); - _vmx_ept_memorytypes[index].startaddr = 0x000FD000; _vmx_ept_memorytypes[index].endaddr = 0x000FDFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x0000FF00) >> 8); - _vmx_ept_memorytypes[index].startaddr = 0x000FE000; _vmx_ept_memorytypes[index].endaddr = 0x000FEFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0x00FF0000) >> 16); - _vmx_ept_memorytypes[index].startaddr = 0x000FF000; _vmx_ept_memorytypes[index].endaddr = 0x000FFFFF; _vmx_ept_memorytypes[index++].type= ((edx & 0xFF000000) >> 24); - - - //3. grab memory types using variable length MTRRs - { - uint64_t paddrmask = 0x0000000FFFFFFFFFULL; //36-bits physical address, TODO: need to make this dynamic - uint64_t vMTRR_base, vMTRR_mask; - uint32_t msrval=IA32_MTRR_PHYSBASE0; - uint32_t i; - - for(i=0; i < num_vmtrrs; i++){ - msr_value = CASM_FUNCCALL(rdmsr64, msrval); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - vMTRR_base = ((uint64_t)edx << 32) | (uint64_t)eax; - msrval++; - msr_value = CASM_FUNCCALL(rdmsr64, msrval); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - vMTRR_mask = ((uint64_t)edx << 32) | (uint64_t)eax; - msrval++; - if( (vMTRR_mask & ((uint64_t)1 << 11)) ){ - _vmx_ept_memorytypes[index].startaddr = (vMTRR_base & (uint64_t)0xFFFFFFFFFFFFF000ULL); - _vmx_ept_memorytypes[index].endaddr = (vMTRR_base & (uint64_t)0xFFFFFFFFFFFFF000ULL) + - (uint64_t) (~(vMTRR_mask & (uint64_t)0xFFFFFFFFFFFFF000ULL) & - paddrmask); - _vmx_ept_memorytypes[index++].type = ((uint32_t)vMTRR_base & (uint32_t)0x000000FF); - }else{ - _vmx_ept_memorytypes[index++].invalid = 1; - } - } - } - - _XDPRINTF_("\n%s: gathered MTRR details, number of entries=%u", __func__, index); - - //@assert 1; - //[debug: dump the contents of _vmx_ept_memorytypes] - //{ - // int i; - // for(i=0; i < MAX_MEMORYTYPE_ENTRIES; i++){ - // _XDPRINTF_("\nrange 0x%016llx-0x%016llx (type=%u)", - // _vmx_ept_memorytypes[i].startaddr, _vmx_ept_memorytypes[i].endaddr, _vmx_ept_memorytypes[i].type); - // } - //} -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_initsysmemmap.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_initsysmemmap.c deleted file mode 100644 index 34f1286316..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_initsysmemmap.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries = framac_nondetu32interval(0, (MAX_E820_ENTRIES-1)); - gp_s2_initsysmemmap(); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif -/*@ - requires (gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES); -@*/ -void gp_s2_initsysmemmap(void){ - slab_params_t sp; - uxmhf_uapi_sysdata_e820addentry_t *e820entry = (uxmhf_uapi_sysdata_e820addentry_t *)sp.in_out_params; - uint32_t i; - - memset(&sp, 0, sizeof(sp)); - sp.cpuid = 0; //XXX: fixme need to plugin BSP cpu id - sp.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - sp.dst_slabid = XMHFGEEC_SLAB_UAPI_SYSDATA; - sp.dst_uapifn = UXMHF_UAPI_SYSDATA_E820ADDENTRY; - - for(i=0; i < (uint32_t)gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries; i++){ - e820entry->baseaddr_high = gp_rwdatahdr.xcbootinfo_store.memmapinfo_buffer[i].baseaddr_high; - e820entry->baseaddr_low = gp_rwdatahdr.xcbootinfo_store.memmapinfo_buffer[i].baseaddr_low; - e820entry->length_high = gp_rwdatahdr.xcbootinfo_store.memmapinfo_buffer[i].length_high; - e820entry->length_low = gp_rwdatahdr.xcbootinfo_store.memmapinfo_buffer[i].length_low; - e820entry->type = gp_rwdatahdr.xcbootinfo_store.memmapinfo_buffer[i].type; - XMHF_SLAB_CALLNEW(&sp); - } - -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sda.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sda.c deleted file mode 100644 index 08d7b971f8..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sda.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -//@ghost bool invokedsdasetupdevpgtbl[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool invokedsdasetupdevpgtbl_rg[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool invokedsdadoalloc = true; -/*@ - requires 0 <= numentries_sysdev_memioregions < MAX_PLATFORM_DEVICES; - assigns invokedsdasetupdevpgtbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns invokedsdasetupdevpgtbl_rg[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns _slabdevpgtbl_infotable[0..(XMHFGEEC_TOTAL_SLABS-1)].devpgtbl_initialized; - assigns invokedsdadoalloc; - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ==> (invokedsdasetupdevpgtbl_rg[x] == true) - ); - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - !(xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ==> (invokedsdasetupdevpgtbl[x] == true) - ); - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - (_slabdevpgtbl_infotable[x].devpgtbl_initialized == false) - ); - ensures (invokedsdadoalloc == true); -@*/ -void gp_s2_sda(void){ - uint32_t i; - - /*@ - loop invariant a1: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - (_slabdevpgtbl_infotable[x].devpgtbl_initialized == false) - ); - loop assigns i; - loop assigns _slabdevpgtbl_infotable[0..(XMHFGEEC_TOTAL_SLABS-1)].devpgtbl_initialized; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - _slabdevpgtbl_infotable[i].devpgtbl_initialized=false; - } - - - //initialize all slab device page tables - /*@ - loop invariant a3: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant a4: \forall integer x; 0 <= x < i ==> ( - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ==> (invokedsdasetupdevpgtbl_rg[x] == true) - ); - loop invariant a5: \forall integer x; 0 <= x < i ==> ( - !(xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ==> (invokedsdasetupdevpgtbl[x] == true) - ); - loop assigns i; - loop assigns invokedsdasetupdevpgtbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns invokedsdasetupdevpgtbl_rg[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - if (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST){ - _XDPRINTF_("%s: proceeding to setup rich-guest DMA tables for uobj %u...\n", __func__, i); - gp_s2_sdasetupdevpgtbl_rg(i); - //@ghost invokedsdasetupdevpgtbl_rg[i] = true; - _XDPRINTF_("%s: rich-guest DMA tables setup for uobj %u\n", __func__, i); - }else{ - gp_s2_sdasetupdevpgtbl(i); - //@ghost invokedsdasetupdevpgtbl[i] = true; - } - - } - - _XDPRINTF_("%s: initialized slab device page tables\n", __func__); - - gp_s2_sdadoalloc(); - //@ghost invokedsdadoalloc = true; - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdabinddevice.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdabinddevice.c deleted file mode 100644 index 7ae0cb2bcd..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdabinddevice.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - - behavior setcet4lvl: - assumes ( - ( - !( (slabid == 0) || - (!_slabdevpgtbl_infotable[slabid].devpgtbl_initialized) || - ( !(bus < PCI_BUS_MAX && dev < PCI_DEVICE_MAX && func < PCI_FUNCTION_MAX) ) - ) && (pagewalk_lvl == VTD_PAGEWALK_4LEVEL) - ) - ); - ensures ( _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[0] == - (vtd_make_cete((uint64_t)&_slabdevpgtbl_pml4t[slabid], VTD_CET_PRESENT)) - ); - ensures ( _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[1] == - (vtd_make_cetehigh(2, (slabid))) - ); - ensures (\result == true); - - - behavior setcet3lvl: - assumes ( - ( - !( (slabid == 0) || - (!_slabdevpgtbl_infotable[slabid].devpgtbl_initialized) || - ( !(bus < PCI_BUS_MAX && dev < PCI_DEVICE_MAX && func < PCI_FUNCTION_MAX) ) - ) && (pagewalk_lvl == VTD_PAGEWALK_3LEVEL) - ) - ); - ensures ( _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[0] == - (vtd_make_cete((uint64_t)&_slabdevpgtbl_pdpt[slabid], VTD_CET_PRESENT)) - ); - ensures ( _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[1] == - (vtd_make_cetehigh(1, (slabid))) - ); - ensures (\result == true); - - - behavior invalid: - assumes ( - ( (slabid == 0) || - (!_slabdevpgtbl_infotable[slabid].devpgtbl_initialized) || - ( !(bus < PCI_BUS_MAX && dev < PCI_DEVICE_MAX && func < PCI_FUNCTION_MAX) ) - ) || - - ( - !( (slabid == 0) || - (!_slabdevpgtbl_infotable[slabid].devpgtbl_initialized) || - ( !(bus < PCI_BUS_MAX && dev < PCI_DEVICE_MAX && func < PCI_FUNCTION_MAX) ) - ) && !(pagewalk_lvl == VTD_PAGEWALK_4LEVEL) && - !(pagewalk_lvl == VTD_PAGEWALK_3LEVEL) - ) - - ); - ensures (\result == false); - - complete behaviors; - disjoint behaviors; -@*/ - -bool gp_s2_sdabinddevice(uint32_t slabid, uint32_t pagewalk_lvl, uint32_t bus, uint32_t dev, uint32_t func){ - bool retstatus=false; - - if( (slabid == 0) || - (!_slabdevpgtbl_infotable[slabid].devpgtbl_initialized) || - ( !(bus < PCI_BUS_MAX && dev < PCI_DEVICE_MAX && func < PCI_FUNCTION_MAX) ) - ){ - _XDPRINTF_("%s: Error: slabid (%u) is sentinel, devpgtbl not initialized or b:d:f out of limits\n", __func__, slabid); - retstatus = false; - }else{ - - //b is our index into ret - // (d* PCI_FUNCTION_MAX) + f = index into the cet - if(pagewalk_lvl == VTD_PAGEWALK_4LEVEL){ - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[0] = - vtd_make_cete((uint64_t)&_slabdevpgtbl_pml4t[slabid], VTD_CET_PRESENT); - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[1] = - vtd_make_cetehigh(2, (slabid)); - _XDPRINTF_("%s: CET, 4-lvl[%u][%u]: h=0x%016llx, l=0x%016llx\n", __func__, - bus, - ((dev*PCI_FUNCTION_MAX) + func), - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[1], - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[0]); - - retstatus = true; - }else if (pagewalk_lvl == VTD_PAGEWALK_3LEVEL){ - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[0] = - vtd_make_cete((uint64_t)&_slabdevpgtbl_pdpt[slabid], VTD_CET_PRESENT); - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[1] = - vtd_make_cetehigh(1, (slabid)); - _XDPRINTF_("%s: CET, 3-lvl[%u][%u]: h=0x%016llx, l=0x%016llx\n", __func__, - bus, - ((dev*PCI_FUNCTION_MAX) + func), - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[1], - _slabdevpgtbl_vtd_cet[bus][((dev*PCI_FUNCTION_MAX) + func)].qwords[0]); - - retstatus = true; - }else{ //unknown page walk length, fail - _XDPRINTF_("%s: Error: slabid (%u) unknown pagewalk\n", __func__, slabid); - retstatus = false; - } - - } - - return retstatus; -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdadoalloc.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdadoalloc.c deleted file mode 100644 index 00b9d49978..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdadoalloc.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//@ghost uint32_t uobjfordev[MAX_PLATFORM_DEVICES]; -//@ghost bool invokedgetuobjfordev[MAX_PLATFORM_DEVICES]; -//@ghost bool invokedsdabinddevice[MAX_PLATFORM_DEVICES]; -/*@ - requires 0 <= numentries_sysdev_memioregions < MAX_PLATFORM_DEVICES; - assigns uobjfordev[0..(numentries_sysdev_memioregions-1)]; - assigns invokedgetuobjfordev[0..(numentries_sysdev_memioregions-1)]; - assigns invokedsdabinddevice[0..(numentries_sysdev_memioregions-1)]; - ensures \forall integer x; 0 <= x < numentries_sysdev_memioregions ==> ( - ( - (sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_GENERAL || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN) - )==> (invokedgetuobjfordev[x] == true) ); - ensures \forall integer x; 0 <= x < numentries_sysdev_memioregions ==> ( - ( - (sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_GENERAL || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN) - && - (uobjfordev[x] == 0xFFFFFFFFUL || (uobjfordev[x] >= XMHFGEEC_TOTAL_SLABS)) - )==> (invokedsdabinddevice[x] == false) ); - ensures \forall integer x; 0 <= x < numentries_sysdev_memioregions ==> ( - ( - (sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_GENERAL || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN) - && - !(uobjfordev[x] == 0xFFFFFFFFUL || (uobjfordev[x] >= XMHFGEEC_TOTAL_SLABS)) - )==> (invokedsdabinddevice[x] == true) ); - -@*/ -void gp_s2_sdadoalloc(void){ - uint32_t i; - uint32_t dst_slabid; - - - /*@ - loop invariant a1: 0 <= i <= numentries_sysdev_memioregions; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - ( - (sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_GENERAL || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN) - )==> (invokedgetuobjfordev[x] == true) ); - loop invariant a3: \forall integer x; 0 <= x < i ==> ( - ( - (sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_GENERAL || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN) - && - (uobjfordev[x] == 0xFFFFFFFFUL || (uobjfordev[x] >= XMHFGEEC_TOTAL_SLABS)) - )==> (invokedsdabinddevice[x] == false) ); - loop invariant a4: \forall integer x; 0 <= x < i ==> ( - ( - (sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_GENERAL || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE || - sysdev_memioregions[x].dtype == SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN) - && - !(uobjfordev[x] == 0xFFFFFFFFUL || (uobjfordev[x] >= XMHFGEEC_TOTAL_SLABS)) - )==> (invokedsdabinddevice[x] == true) ); - loop assigns i; - loop assigns dst_slabid; - loop assigns uobjfordev[0..(numentries_sysdev_memioregions-1)]; - loop assigns invokedgetuobjfordev[0..(numentries_sysdev_memioregions-1)]; - loop assigns invokedsdabinddevice[0..(numentries_sysdev_memioregions-1)]; - loop variant numentries_sysdev_memioregions - i; - @*/ - for(i=0; i -#include -#include - -#include - - -/*@ - requires ( \forall integer i, integer j; (0 <= i < XMHFGEEC_TOTAL_SLABS) ==> (_sda_slab_devicemap[i].device_count < MAX_PLATFORM_DEVICES) ); - requires ( \forall integer i, integer j; (0 <= i < XMHFGEEC_TOTAL_SLABS) && (0 <= j < _sda_slab_devicemap[i].device_count) ==> (0 <= _sda_slab_devicemap[i].sysdev_mmioregions_indices[j] < MAX_PLATFORM_DEVICES) ); - - assigns \nothing; - - ensures foundbdf: ( \forall integer i, integer j; (0 <= i < XMHFGEEC_TOTAL_SLABS) && (0 <= j < _sda_slab_devicemap[i].device_count) - && ( - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].b == bus && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].d == dev && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].f == func - ) - ) ==> (0 <= \result < XMHFGEEC_TOTAL_SLABS ); - - ensures notfoundbdf: ( \forall integer i, integer j; (0 <= i < XMHFGEEC_TOTAL_SLABS) && (0 <= j < _sda_slab_devicemap[i].device_count) - && !( - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].b == bus && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].d == dev && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].f == func - ) - ) ==> (\result == 0xFFFFFFFFUL ); - -@*/ -uint32_t gp_s2_sdadoalloc_getuobjfordev(uint32_t bus, uint32_t dev, uint32_t func){ - uint32_t i; - uint32_t j; - - /*@ - loop invariant a1: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant a4: \forall integer x, integer y; 0 <= x < i && 0 <= y < _sda_slab_devicemap[x].device_count ==> ( - !( sysdev_memioregions[ (_sda_slab_devicemap[x].sysdev_mmioregions_indices[y]) ].b == bus && - sysdev_memioregions[ (_sda_slab_devicemap[x].sysdev_mmioregions_indices[y]) ].d == dev && - sysdev_memioregions[ (_sda_slab_devicemap[x].sysdev_mmioregions_indices[y]) ].f == func) - ); - loop assigns i; - loop assigns j; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - /*@ - loop invariant a2: 0 <= j <= _sda_slab_devicemap[i].device_count; - loop invariant a3: \forall integer y; 0 <= y < j ==> ( - !( sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[y]) ].b == bus && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[y]) ].d == dev && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[y]) ].f == func) - ); - loop assigns j; - loop variant (_sda_slab_devicemap[i].device_count) - j; - @*/ - for (j=0; j < _sda_slab_devicemap[i].device_count; j++){ - - if ( sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].b == bus && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].d == dev && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].f == func) - return i; - } - } - - - /*@assert ( \forall integer i, integer j; (0 <= i < XMHFGEEC_TOTAL_SLABS) && (0 <= j < _sda_slab_devicemap[i].device_count) ==> - !( - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].b == bus && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].d == dev && - sysdev_memioregions[ (_sda_slab_devicemap[i].sysdev_mmioregions_indices[j]) ].f == func - ) - ); - @*/ - return 0xFFFFFFFFUL; -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl.c deleted file mode 100644 index 970af30df7..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -//@ghost bool invokedhalt = false; -//@ghost bool invokedsplintpdt = false; -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - behavior initpgtbl: - assumes ( - (xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start) - && - (xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end < (0xFFFFFFFFUL - PAGE_SIZE_2M)) - && - ((xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end - xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start) <= MAX_SLAB_DMADATA_SIZE) - ); - assigns _slabdevpgtbl_pml4t[slabid][0..(VTD_MAXPTRS_PER_PML4T-1)]; - assigns _slabdevpgtbl_pdpt[slabid][0..(VTD_MAXPTRS_PER_PDPT-1)]; - assigns _slabdevpgtbl_infotable[slabid].devpgtbl_initialized; - assigns invokedsplintpdt; - - ensures (_slabdevpgtbl_infotable[slabid].devpgtbl_initialized == true); - ensures (invokedsplintpdt == true); - ensures ( _slabdevpgtbl_pml4t[slabid][0] == - (vtd_make_pml4te((uint64_t)&_slabdevpgtbl_pdpt[slabid], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - ensures \forall integer x; 1 <= x < VTD_MAXPTRS_PER_PML4T ==> ( - (_slabdevpgtbl_pml4t[slabid][x] == 0) - ); - - ensures \forall integer x; 0 <= x < VTD_PTRS_PER_PDPT ==> ( - _slabdevpgtbl_pdpt[slabid][x] == - (vtd_make_pdpte((uint64_t)&_slabdevpgtbl_pdt[slabid][x*VTD_PTRS_PER_PDT], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - - ensures \forall integer x; VTD_PTRS_PER_PDPT <= x < VTD_MAXPTRS_PER_PDPT ==> ( - (_slabdevpgtbl_pdpt[slabid][x] == 0) - ); - - - behavior invalid: - assumes !( - (xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start) - && - (xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end < (0xFFFFFFFFUL - PAGE_SIZE_2M)) - && - ((xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end - xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start) <= MAX_SLAB_DMADATA_SIZE) - ); - ensures (_slabdevpgtbl_infotable[slabid].devpgtbl_initialized == false); - ensures (invokedhalt == true); - - complete behaviors; - disjoint behaviors; -@*/ -void gp_s2_sdasetupdevpgtbl(uint32_t slabid){ - uint32_t i; - - - if( - (xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start) - && - (xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end < (0xFFFFFFFFUL - PAGE_SIZE_2M)) - && - ((xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end - xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start) <= MAX_SLAB_DMADATA_SIZE) - ){ - //initialize lvl1 page table (pml4t) - /*@ - loop invariant a1: 0 <= i <= VTD_MAXPTRS_PER_PML4T; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - (_slabdevpgtbl_pml4t[slabid][x] == 0) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pml4t[slabid][0..(VTD_MAXPTRS_PER_PML4T-1)]; - loop variant VTD_MAXPTRS_PER_PML4T - i; - @*/ - for(i=0; i < VTD_MAXPTRS_PER_PML4T; i++) - _slabdevpgtbl_pml4t[slabid][i] = 0; - - - _slabdevpgtbl_pml4t[slabid][0] = - vtd_make_pml4te((uint64_t)&_slabdevpgtbl_pdpt[slabid], (VTD_PAGE_READ | VTD_PAGE_WRITE)); - - - //initialize lvl2 page table (pdpt) - /*@ - loop invariant a3: 0 <= i <= VTD_MAXPTRS_PER_PDPT; - loop invariant a4: \forall integer x; 0 <= x < i ==> ( - (_slabdevpgtbl_pdpt[slabid][x] == 0) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pdpt[slabid][0..(VTD_MAXPTRS_PER_PDPT-1)]; - loop variant VTD_MAXPTRS_PER_PDPT - i; - @*/ - for(i=0; i < VTD_MAXPTRS_PER_PDPT; i++) - _slabdevpgtbl_pdpt[slabid][i] = 0; - - - /*@ - loop invariant a5: 0 <= i <= VTD_PTRS_PER_PDPT; - loop invariant a6: \forall integer x; 0 <= x < i ==> ( - _slabdevpgtbl_pdpt[slabid][x] == - (vtd_make_pdpte((uint64_t)&_slabdevpgtbl_pdt[slabid][x*VTD_PTRS_PER_PDT], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pdpt[slabid][0..(VTD_PTRS_PER_PDPT-1)]; - loop variant VTD_PTRS_PER_PDPT - i; - @*/ - for(i=0; i < VTD_PTRS_PER_PDPT; i++){ - _slabdevpgtbl_pdpt[slabid][i] = - vtd_make_pdpte((uint64_t)&_slabdevpgtbl_pdt[slabid][i*VTD_PTRS_PER_PDT], (VTD_PAGE_READ | VTD_PAGE_WRITE)); - } - - - gp_s2_sdasetupdevpgtbl_splintpdt(slabid, xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_start, - xmhfgeec_slab_info_table[slabid].slab_physmem_extents[3].addr_end); - //@ghost invokedsplintpdt = true; - - _slabdevpgtbl_infotable[slabid].devpgtbl_initialized = true; - - }else{ - _XDPRINTF_("%s: Error: slab %u dmadata section over limit. bailing out!\n", - __func__, slabid); - _slabdevpgtbl_infotable[slabid].devpgtbl_initialized = false; - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - //@ghost invokedhalt = true; - } - -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_rg.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_rg.c deleted file mode 100644 index 0fd2ec4695..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_rg.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - - assigns _slabdevpgtbl_pml4t[slabid][0..(VTD_MAXPTRS_PER_PML4T-1)]; - assigns _slabdevpgtbl_pdpt[slabid][0..(VTD_MAXPTRS_PER_PDPT-1)]; - assigns _slabdevpgtbl_pdt[slabid][0..((VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT)-1)]; - assigns _slabdevpgtbl_pt_rg[0..((VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT)-1)]; - assigns _slabdevpgtbl_infotable[slabid].devpgtbl_initialized; - - ensures (_slabdevpgtbl_pml4t[slabid][0] == - (vtd_make_pml4te((uint64_t)&_slabdevpgtbl_pdpt[slabid], (VTD_PAGE_READ | VTD_PAGE_WRITE))) ); - - ensures \forall integer x; 1 <= x < VTD_MAXPTRS_PER_PML4T ==> ( - (_slabdevpgtbl_pml4t[slabid][x] == 0) - ); - - ensures \forall integer x; 0 <= x < VTD_PTRS_PER_PDPT ==> ( - _slabdevpgtbl_pdpt[slabid][x] == - (vtd_make_pdpte((uint64_t)&_slabdevpgtbl_pdt[slabid][x*VTD_PTRS_PER_PDT], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - - ensures \forall integer x; VTD_PTRS_PER_PDPT <= x < VTD_MAXPTRS_PER_PDPT ==> ( - (_slabdevpgtbl_pdpt[slabid][x] == 0) - ); - - ensures \forall integer x; 0 <= x < (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT) ==> ( - _slabdevpgtbl_pdt[slabid][x] == - (vtd_make_pdte((uint64_t)&_slabdevpgtbl_pt_rg[x*VTD_PTRS_PER_PT], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - - ensures \forall integer x; 0 <= x < (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT) && - ( ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_end) ) || - ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_end) ) - ) ==> (_slabdevpgtbl_pt_rg[x] == (vtd_make_pte((x * PAGE_SIZE_4K), (VTD_PAGE_READ | VTD_PAGE_WRITE)))); - - ensures \forall integer x; 0 <= x < (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT) && - !( ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_end) ) || - ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_end) ) - ) ==> (_slabdevpgtbl_pt_rg[x] == 0); - - - ensures (_slabdevpgtbl_infotable[slabid].devpgtbl_initialized == true); -@*/ -void gp_s2_sdasetupdevpgtbl_rg(uint32_t slabid){ - uint32_t i,j; - - _XDPRINTF_("%s: _slabdevpgtbl_pml4t[%u] at 0x%08x\n", __func__, slabid, &_slabdevpgtbl_pml4t[slabid]); - - //initialize lvl1 page table (pml4t) - /*@ - loop invariant a1: 0 <= i <= VTD_MAXPTRS_PER_PML4T; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - (_slabdevpgtbl_pml4t[slabid][x] == 0) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pml4t[slabid][0..(VTD_MAXPTRS_PER_PML4T-1)]; - loop variant VTD_MAXPTRS_PER_PML4T - i; - @*/ - for(i=0; i < VTD_MAXPTRS_PER_PML4T; i++) - _slabdevpgtbl_pml4t[slabid][i] = 0; - - _slabdevpgtbl_pml4t[slabid][0] = - vtd_make_pml4te((uint64_t)&_slabdevpgtbl_pdpt[slabid], (VTD_PAGE_READ | VTD_PAGE_WRITE)); - - - //initialize lvl2 page table (pdpt) - /*@ - loop invariant a3: 0 <= i <= VTD_MAXPTRS_PER_PDPT; - loop invariant a4: \forall integer x; 0 <= x < i ==> ( - (_slabdevpgtbl_pdpt[slabid][x] == 0) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pdpt[slabid][0..(VTD_MAXPTRS_PER_PDPT-1)]; - loop variant VTD_MAXPTRS_PER_PDPT - i; - @*/ - for(i=0; i < VTD_MAXPTRS_PER_PDPT; i++) - _slabdevpgtbl_pdpt[slabid][i] = 0; - - - /*@ - loop invariant a5: 0 <= i <= VTD_PTRS_PER_PDPT; - loop invariant a6: \forall integer x; 0 <= x < i ==> ( - _slabdevpgtbl_pdpt[slabid][x] == - (vtd_make_pdpte((uint64_t)&_slabdevpgtbl_pdt[slabid][x*VTD_PTRS_PER_PDT], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pdpt[slabid][0..(VTD_PTRS_PER_PDPT-1)]; - loop variant VTD_PTRS_PER_PDPT - i; - @*/ - for(i=0; i < VTD_PTRS_PER_PDPT; i++){ - _slabdevpgtbl_pdpt[slabid][i] = - vtd_make_pdpte((uint64_t)&_slabdevpgtbl_pdt[slabid][i*VTD_PTRS_PER_PDT], (VTD_PAGE_READ | VTD_PAGE_WRITE)); - } - - - - - //setup PDTs - /*@ - loop invariant a7: 0 <= i <= (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT); - loop invariant a8: \forall integer x; 0 <= x < i ==> ( - _slabdevpgtbl_pdt[slabid][x] == - (vtd_make_pdte((uint64_t)&_slabdevpgtbl_pt_rg[x*VTD_PTRS_PER_PT], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pdt[slabid][0..((VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT)-1)]; - loop variant (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT) - i; - @*/ - for(i=0; i < (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT); i++){ - _slabdevpgtbl_pdt[slabid][i] = - vtd_make_pdte((uint64_t)&_slabdevpgtbl_pt_rg[i*VTD_PTRS_PER_PT], (VTD_PAGE_READ | VTD_PAGE_WRITE)); - } - - - /*@ - loop invariant a9: 0 <= i <= (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT); - loop assigns i; - loop assigns _slabdevpgtbl_pt_rg[0..((VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT)-1)]; - loop invariant a10: \forall integer x; 0 <= x < i && - ( ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_end) ) || - ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_end) ) - ) ==> (_slabdevpgtbl_pt_rg[x] == (vtd_make_pte((x * PAGE_SIZE_4K), (VTD_PAGE_READ | VTD_PAGE_WRITE)))); - loop invariant a11: \forall integer x; 0 <= x < i && - !( ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_end) ) || - ( ((x*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_start) && - ((x*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_end) ) - ) ==> (_slabdevpgtbl_pt_rg[x] == 0); - loop variant (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT) - i; - @*/ - //setup DMA access for rich-guest address space - for(i=0; i < (VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT); i++){ - if( ( ((i*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_start) && - ((i*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[0].addr_end) ) || - ( ((i*PAGE_SIZE_4K) >= xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_start) && - ((i*PAGE_SIZE_4K) < xmhfgeec_slab_info_table[slabid].slab_physmem_extents[1].addr_end) ) - ){ - _slabdevpgtbl_pt_rg[i] = vtd_make_pte((i * PAGE_SIZE_4K), (VTD_PAGE_READ | VTD_PAGE_WRITE)); - }else{ - _slabdevpgtbl_pt_rg[i] = 0; - } - } - - _slabdevpgtbl_infotable[slabid].devpgtbl_initialized = true; - -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_setptentries.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_setptentries.c deleted file mode 100644 index ed0d114129..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_setptentries.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//setup PT entries for a 2M range -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= pd_index < MAX_SLAB_DMADATA_PDT_ENTRIES; - requires (startpaddr < (0xFFFFFFFFUL - PAGE_SIZE_2M)); - - assigns _slabdevpgtbl_pdt[slabid][(startpaddr/PAGE_SIZE_2M)]; - assigns _slabdevpgtbl_pt[slabid][pd_index][0..(VTD_PTRS_PER_PT-1)]; - - ensures ( _slabdevpgtbl_pdt[slabid][(startpaddr/PAGE_SIZE_2M)] == - (vtd_make_pdte((uint64_t)&_slabdevpgtbl_pt[slabid][pd_index], (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - ensures \forall integer x; 0 <= x < VTD_PTRS_PER_PT ==> ( - _slabdevpgtbl_pt[slabid][pd_index][x] == - (vtd_make_pte((startpaddr+(x * PAGE_SIZE_4K)), (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); -@*/ -void gp_s2_sdasetupdevpgtbl_setptentries(uint32_t slabid, uint32_t pd_index, uint32_t startpaddr){ - uint32_t i; - - //stick a pt for the pdt entry - _slabdevpgtbl_pdt[slabid][(startpaddr/PAGE_SIZE_2M)] = - vtd_make_pdte((uint64_t)&_slabdevpgtbl_pt[slabid][pd_index], (VTD_PAGE_READ | VTD_PAGE_WRITE)); - - /*@ - loop invariant a1: 0 <= i <= VTD_PTRS_PER_PT; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - _slabdevpgtbl_pt[slabid][pd_index][x] == - (vtd_make_pte((startpaddr+(x * PAGE_SIZE_4K)), (VTD_PAGE_READ | VTD_PAGE_WRITE))) - ); - loop assigns i; - loop assigns _slabdevpgtbl_pt[slabid][pd_index][0..(VTD_PTRS_PER_PT-1)]; - loop variant VTD_PTRS_PER_PT-i; - @*/ - for(i=0; i < VTD_PTRS_PER_PT; i++){ - _slabdevpgtbl_pt[slabid][pd_index][i] = - vtd_make_pte((startpaddr+(i * PAGE_SIZE_4K)), (VTD_PAGE_READ | VTD_PAGE_WRITE)); - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_splintpdt.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_splintpdt.c deleted file mode 100644 index 94acd6b426..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdasetupdevpgtbl_splintpdt.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -//@ghost bool invokedsetptentries[MAX_SLAB_DMADATA_PDT_ENTRIES]; -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires (paddr_end >= paddr_start); - requires (paddr_end < (0xFFFFFFFFUL - PAGE_SIZE_2M)); - requires (paddr_end - paddr_start) <= MAX_SLAB_DMADATA_SIZE; - - assigns invokedsetptentries[0..(((paddr_end - paddr_start)/PAGE_SIZE_2M)-1)]; - - ensures \forall integer x; 0 <= x < ((paddr_end - paddr_start)/PAGE_SIZE_2M) ==> ( - ( invokedsetptentries[x] == true) - ); -@*/ -void gp_s2_sdasetupdevpgtbl_splintpdt(uint32_t slabid, uint32_t paddr_start, uint32_t paddr_end){ - uint32_t pd_index=0; - - /*@ - loop invariant a1: 0 <= pd_index <= ((paddr_end - paddr_start)/PAGE_SIZE_2M); - loop invariant a2: \forall integer x; 0 <= x < pd_index ==> ( - ( invokedsetptentries[x] == true) - ); - loop assigns pd_index; - loop assigns invokedsetptentries[0..(((paddr_end - paddr_start)/PAGE_SIZE_2M)-1)]; - loop variant ((paddr_end - paddr_start)/PAGE_SIZE_2M)-pd_index; - @*/ - for(pd_index=0; pd_index < ((paddr_end - paddr_start)/PAGE_SIZE_2M); pd_index++){ - //populate pt entries for this 2M range - gp_s2_sdasetupdevpgtbl_setptentries(slabid, pd_index, (paddr_start + (pd_index * PAGE_SIZE_2M)) ); - //@ghost invokedsetptentries[pd_index] = true; - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdmenumsysdevices.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdmenumsysdevices.c deleted file mode 100644 index 2ebf4d11ca..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdmenumsysdevices.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= vtd_drhd_maxhandle <= VTD_MAX_DRHD; - ensures 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; -@*/ -void gp_s2_sdmenumsysdevices(void){ - uint32_t b, d, f, i; - vtd_drhd_handle_t drhd_handle; - uint32_t vendor_id, device_id; - - //as a first step, add several non-PCI system devices to the - //sysdev list using XMHF/GEEC psuedo-PCI vendor and device IDs - //the following are the list of non-PCI system devices: - //LAPIC at X86SMP_LAPIC_MEMORYADDRESS (0xFEE00000) - //TPM at TPM_LOCALITY_BASE (0xfed40000) - //TXT at TXT_PUB_CONFIG_REGS_BASE (0xfed30000) and TXT_PRIV_CONFIG_REGS_BASE (0xfed20000) - //SERIAL0 (used for debugging only) at DEBUG_PORT - //IOMMU as described by vtd_drhd[] - - //add LAPIC device - gp_s2_sdmenumsysdevices_memioextents(PCI_BUS_XMHFGEEC, PCI_DEVICE_XMHFGEEC, 0, PCI_VENDOR_ID_XMHFGEEC, PCI_DEVICE_ID_XMHFGEEC_LAPIC); - - //add TPM - gp_s2_sdmenumsysdevices_memioextents(PCI_BUS_XMHFGEEC, PCI_DEVICE_XMHFGEEC, 0, PCI_VENDOR_ID_XMHFGEEC, PCI_DEVICE_ID_XMHFGEEC_TPM); - - //add TXT - gp_s2_sdmenumsysdevices_memioextents(PCI_BUS_XMHFGEEC, PCI_DEVICE_XMHFGEEC, 0, PCI_VENDOR_ID_XMHFGEEC, PCI_DEVICE_ID_XMHFGEEC_TXT); - - #if defined (__DEBUG_SERIAL__) - //add SERIAL0 - gp_s2_sdmenumsysdevices_memioextents(PCI_BUS_XMHFGEEC, PCI_DEVICE_XMHFGEEC, 0, PCI_VENDOR_ID_XMHFGEEC, PCI_DEVICE_ID_XMHFGEEC_SERIAL0); - #endif - - //add IOMMU - /*@ - loop invariant a1: 0 <= drhd_handle <= vtd_drhd_maxhandle; - loop assigns drhd_handle; - loop variant vtd_drhd_maxhandle - drhd_handle; - @*/ - for(drhd_handle =0; drhd_handle < vtd_drhd_maxhandle; drhd_handle++){ - gp_s2_sdmenumsysdevices_memioextents(PCI_BUS_XMHFGEEC, PCI_DEVICE_XMHFGEEC, drhd_handle, PCI_VENDOR_ID_XMHFGEEC, PCI_DEVICE_ID_XMHFGEEC_IOMMU); - } - - - //enumerate and add rest of the system devices on the PCI bus - /*@ - loop invariant b1: 0 <= b <= PCI_BUS_MAX; - loop assigns b; - loop assigns d; - loop assigns f; - loop assigns vendor_id; - loop assigns device_id; - loop variant PCI_BUS_MAX - b; - @*/ - for(b=0; b < PCI_BUS_MAX; b++){ - - /*@ - loop invariant b2: 0 <= d <= PCI_DEVICE_MAX; - loop assigns d; - loop assigns f; - loop assigns vendor_id; - loop assigns device_id; - loop variant PCI_DEVICE_MAX - d; - @*/ - for(d=0; d < PCI_DEVICE_MAX; d++){ - - /*@ - loop invariant b3: 0 <= f <= PCI_FUNCTION_MAX; - loop assigns f; - loop assigns vendor_id; - loop assigns device_id; - loop variant PCI_FUNCTION_MAX - f; - @*/ - for(f=0; f < PCI_FUNCTION_MAX; f++){ - //read device and vendor ids, if no device then both will be 0xFFFF - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_VENDOR_ID, sizeof(uint16_t), &vendor_id); - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_DEVICE_ID, sizeof(uint16_t), &device_id); - - if( !(vendor_id == 0xFFFF && device_id == 0xFFFF) ){ - gp_s2_sdmenumsysdevices_memioextents(b, d, f, vendor_id, device_id); - } - } - } - } - - -#if defined (__DEBUG_SERIAL__) - - //be verbose about the system devices and their MM(IO) extents - { - uint32_t i, j; - for(i=0; i -#include -#include - -#include - - -//@ghost bool gp_s2_sdmenumsysdevices_memioextents_syshalt = false; -/*@ - - behavior addentry: - assumes (numentries_sysdev_memioregions < MAX_PLATFORM_DEVICES); - - assigns numentries_sysdev_memioregions; - assigns gp_s2_sdmenumsysdevices_memioextents_syshalt; - assigns sysdev_memioregions[\at(numentries_sysdev_memioregions, Pre)]; - - ensures (numentries_sysdev_memioregions == (\at(numentries_sysdev_memioregions, Pre) + 1)); - ensures (0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES); - ensures (gp_s2_sdmenumsysdevices_memioextents_syshalt == false); - - behavior invalidhalt: - assumes (numentries_sysdev_memioregions >= MAX_PLATFORM_DEVICES); - - assigns gp_s2_sdmenumsysdevices_memioextents_syshalt; - - ensures (gp_s2_sdmenumsysdevices_memioextents_syshalt == true); - - complete behaviors; - disjoint behaviors; -@*/ -void gp_s2_sdmenumsysdevices_memioextents(uint32_t b, uint32_t d, uint32_t f, uint32_t vendor_id, uint32_t device_id){ - uint32_t i; - uint32_t bar_value; - uint32_t hdr_type; - uint32_t command; - uint32_t bar_size; - - if( numentries_sysdev_memioregions < MAX_PLATFORM_DEVICES){ - - sysdev_memioregions[numentries_sysdev_memioregions].b=b; - sysdev_memioregions[numentries_sysdev_memioregions].d=d; - sysdev_memioregions[numentries_sysdev_memioregions].f=f; - sysdev_memioregions[numentries_sysdev_memioregions].vendor_id=vendor_id; - sysdev_memioregions[numentries_sysdev_memioregions].device_id=device_id; - - - if(vendor_id == PCI_VENDOR_ID_XMHFGEEC && device_id == PCI_DEVICE_ID_XMHFGEEC_LAPIC){ - sysdev_memioregions[numentries_sysdev_memioregions].dtype = SYSDEV_MEMIOREGIONS_DTYPE_LAPIC; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_MEM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_start=X86SMP_LAPIC_MEMORYADDRESS; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_end=X86SMP_LAPIC_MEMORYADDRESS + PAGE_SIZE_4K; - /*@ - loop invariant a1: 1 <= i <= PCI_CONF_MAX_BARS; - loop assigns i; - loop assigns sysdev_memioregions[numentries_sysdev_memioregions].memioextents[1..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - i; - @*/ - for(i=1; i < PCI_CONF_MAX_BARS; i++){ - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - } - - - }else if(vendor_id == PCI_VENDOR_ID_XMHFGEEC && device_id == PCI_DEVICE_ID_XMHFGEEC_TPM){ - sysdev_memioregions[numentries_sysdev_memioregions].dtype = SYSDEV_MEMIOREGIONS_DTYPE_TPM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_MEM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_start=TPM_LOCALITY_BASE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_end=TPM_LOCALITY_BASE + PAGE_SIZE_4K; - /*@ - loop invariant a2: 1 <= i <= PCI_CONF_MAX_BARS; - loop assigns i; - loop assigns sysdev_memioregions[numentries_sysdev_memioregions].memioextents[1..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - i; - @*/ - for(i=1; i < PCI_CONF_MAX_BARS; i++){ - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - } - - - }else if(vendor_id == PCI_VENDOR_ID_XMHFGEEC && device_id == PCI_DEVICE_ID_XMHFGEEC_TXT){ - sysdev_memioregions[numentries_sysdev_memioregions].dtype = SYSDEV_MEMIOREGIONS_DTYPE_TXT; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_MEM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_start=TXT_PRIV_CONFIG_REGS_BASE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_end=TXT_PRIV_CONFIG_REGS_BASE + PAGE_SIZE_4K; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[1].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_MEM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[1].addr_start=TXT_PUB_CONFIG_REGS_BASE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[1].addr_end=TXT_PUB_CONFIG_REGS_BASE + PAGE_SIZE_4K; - /*@ - loop invariant a3: 2 <= i <= PCI_CONF_MAX_BARS; - loop assigns i; - loop assigns sysdev_memioregions[numentries_sysdev_memioregions].memioextents[2..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - i; - @*/ - for(i=2; i < PCI_CONF_MAX_BARS; i++){ - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - } - - - #if defined (__DEBUG_SERIAL__) - }else if(vendor_id == PCI_VENDOR_ID_XMHFGEEC && device_id == PCI_DEVICE_ID_XMHFGEEC_SERIAL0){ - sysdev_memioregions[numentries_sysdev_memioregions].dtype = SYSDEV_MEMIOREGIONS_DTYPE_SERIAL0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_IO; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_start=DEBUG_PORT; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_end=DEBUG_PORT+0x8; - for(i=1; i < PCI_CONF_MAX_BARS; i++){ - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - } - #endif //__DEBUG_SERIAL - - - }else if(vendor_id == PCI_VENDOR_ID_XMHFGEEC && device_id == PCI_DEVICE_ID_XMHFGEEC_IOMMU){ - sysdev_memioregions[numentries_sysdev_memioregions].dtype = SYSDEV_MEMIOREGIONS_DTYPE_IOMMU; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_MEM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_start=vtd_drhd[f].regbaseaddr; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0].addr_end=vtd_drhd[f].regbaseaddr + PAGE_SIZE_4K; - /*@ - loop invariant a4: 1 <= i <= PCI_CONF_MAX_BARS; - loop assigns i; - loop assigns sysdev_memioregions[numentries_sysdev_memioregions].memioextents[1..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - i; - @*/ - for(i=1; i < PCI_CONF_MAX_BARS; i++){ - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - } - - - }else{ - - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_HEADER_TYPE, sizeof(uint8_t), &hdr_type); - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_COMMAND, sizeof(uint16_t), &command); - - //_XDPRINTF_("Device %x:%x:%x(%x:%x) HDR=%x, CMD=%x\n", - // b, d, f, vendor_id, device_id, hdr_type, command); - - if(hdr_type == 0x80 || hdr_type == 0x0) - sysdev_memioregions[numentries_sysdev_memioregions].dtype=SYSDEV_MEMIOREGIONS_DTYPE_GENERAL; - else if (hdr_type == 0x81 || hdr_type == 0x1) - sysdev_memioregions[numentries_sysdev_memioregions].dtype=SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE; - else - sysdev_memioregions[numentries_sysdev_memioregions].dtype=SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN; - - //disable decode - xmhf_baseplatform_arch_x86_pci_type1_write(b, d, f, PCI_CONF_HDR_IDX_COMMAND, sizeof(uint16_t), (command & ~(0x3)) ) ; - - - //size BARs - /*@ - loop invariant a5: 0 <= i <= PCI_CONF_MAX_BARS; - loop assigns i; - loop assigns bar_size; - loop assigns bar_value; - loop assigns sysdev_memioregions[numentries_sysdev_memioregions].memioextents[0..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - i; - @*/ - for(i=0; i < PCI_CONF_MAX_BARS; i++){ - if(i >= 2 && (hdr_type == 0x81 || hdr_type == 0x1)){ - //for PCI-to-PCI bridge devices only BAR0 and BAR1 are valid BARs - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - }else{ - //for general devices BAR0-BAR5 are valid BARs - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_BAR0+(i*4), sizeof(uint32_t), &bar_value); - if(bar_value){ - if(bar_value & 0x1){ //I/O - xmhf_baseplatform_arch_x86_pci_type1_write(b, d, f, PCI_CONF_HDR_IDX_BAR0+(i*4), sizeof(uint32_t), 0xFFFFFFFFUL); - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_BAR0+(i*4), sizeof(uint32_t), &bar_size); - bar_size = bar_size & ~(0x1); - bar_size = ~(bar_size); - bar_size++; - - //_XDPRINTF_(" BAR-%u, IO, range=%x to %x\n", i, - // (uint16_t)(bar_value & ~(0x1)), (uint16_t)((bar_value & ~(0x1)) + bar_size) ) ; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_IO; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=(uint16_t)(bar_value & ~(0x1)); - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=(uint16_t)((bar_value & ~(0x1)) + bar_size); - - }else{ - //memory - xmhf_baseplatform_arch_x86_pci_type1_write(b, d, f, PCI_CONF_HDR_IDX_BAR0+(i*4), sizeof(uint32_t), 0xFFFFFFFFUL); - xmhf_baseplatform_arch_x86_pci_type1_read(b, d, f, PCI_CONF_HDR_IDX_BAR0+(i*4), sizeof(uint32_t), &bar_size); - bar_size = bar_size & ~(0xF); - bar_size = ~(bar_size); - bar_size++; - - //_XDPRINTF_(" BAR-%u, Mem, range=%x-%x\n", i, - // (bar_value & ~(0xF)), (bar_value & ~(0xF)) + bar_size) ; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_MEM; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=(bar_value & ~(0xF)); - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=(bar_value & ~(0xF)) + bar_size; - - } - - xmhf_baseplatform_arch_x86_pci_type1_write(b, d, f, PCI_CONF_HDR_IDX_BAR0+(i*4), sizeof(uint32_t), bar_value); - }else{ - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].extent_type=_MEMIOREGIONS_EXTENTS_TYPE_NONE; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_start=0; - sysdev_memioregions[numentries_sysdev_memioregions].memioextents[i].addr_end=0; - } - } - } - - - //restore command register - xmhf_baseplatform_arch_x86_pci_type1_write(b, d, f, PCI_CONF_HDR_IDX_COMMAND, sizeof(uint16_t), command); - } - - numentries_sysdev_memioregions++; - //@ghost gp_s2_sdmenumsysdevices_memioextents_syshalt = false; - - }else{ - - _XDPRINTF_("%s: Halting!. numentries_sysdev_memioregions >= MAX_PLATFORM_DEVICES(%u)\n", - __func__, MAX_PLATFORM_DEVICES); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - //@ghost gp_s2_sdmenumsysdevices_memioextents_syshalt = true; - - } -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap.c deleted file mode 100644 index 8d19cb604b..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//@ghost bool gp_s2_sdminitdevmap_coraddalldevstouobj[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_sdminitdevmap_coradddevtouobj[XMHFGEEC_TOTAL_SLABS]; -/*@ - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (0 <= xmhfgeec_slab_info_table[x].incl_devices_count <= XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES); - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (0 <= xmhfgeec_slab_info_table[x].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES); - requires 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; - - assigns _sda_slab_devicemap[0..(XMHFGEEC_TOTAL_SLABS-1)].device_count; - assigns t1: gp_s2_sdminitdevmap_coraddalldevstouobj[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns t2: gp_s2_sdminitdevmap_coradddevtouobj[0..(XMHFGEEC_TOTAL_SLABS-1)]; - - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (_sda_slab_devicemap[x].device_count <= MAX_PLATFORM_DEVICES); - - ensures \exists integer x, integer y; 0 <= x < XMHFGEEC_TOTAL_SLABS && 0 <= y < xmhfgeec_slab_info_table[x].incl_devices_count && - ( xmhfgeec_slab_info_table[x].incl_devices[y].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[x].incl_devices[y].device_id == 0xFFFF) ==> - (gp_s2_sdminitdevmap_coraddalldevstouobj[x] == true && - gp_s2_sdminitdevmap_coradddevtouobj[x] == false); - ensures \exists integer x, integer y; 0 <= x < XMHFGEEC_TOTAL_SLABS && 0 <= y < xmhfgeec_slab_info_table[x].incl_devices_count && - !( xmhfgeec_slab_info_table[x].incl_devices[y].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[x].incl_devices[y].device_id == 0xFFFF) ==> - (gp_s2_sdminitdevmap_coraddalldevstouobj[x] == false && - gp_s2_sdminitdevmap_coradddevtouobj[x] == true); - -@*/ -void gp_s2_sdminitdevmap(void){ - uint32_t i, j, k; - - _XDPRINTF_("%s: numentries_sysdev_mmioregions=%u\n", __func__, numentries_sysdev_memioregions); - - /*@ - loop invariant i1: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant i2: \forall integer x; 0 <= x < i ==> - (_sda_slab_devicemap[x].device_count <= MAX_PLATFORM_DEVICES); - loop invariant i5: \exists integer x, integer y; 0 <= x < i && 0 <= y < xmhfgeec_slab_info_table[x].incl_devices_count && - ( xmhfgeec_slab_info_table[x].incl_devices[y].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[x].incl_devices[y].device_id == 0xFFFF) ==> - (gp_s2_sdminitdevmap_coraddalldevstouobj[x] == true && - gp_s2_sdminitdevmap_coradddevtouobj[x] == false); - loop invariant i6: \exists integer x, integer y; 0 <= x < i && 0 <= y < xmhfgeec_slab_info_table[x].incl_devices_count && - !( xmhfgeec_slab_info_table[x].incl_devices[y].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[x].incl_devices[y].device_id == 0xFFFF) ==> - (gp_s2_sdminitdevmap_coraddalldevstouobj[x] == false && - gp_s2_sdminitdevmap_coradddevtouobj[x] == true); - loop assigns i; - loop assigns j; - loop assigns _sda_slab_devicemap[0..(XMHFGEEC_TOTAL_SLABS-1)].device_count; - loop assigns i3: gp_s2_sdminitdevmap_coraddalldevstouobj[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns i4: gp_s2_sdminitdevmap_coradddevtouobj[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - _sda_slab_devicemap[i].device_count = 0; - - /*@ - loop invariant j1: 0 <= j <= xmhfgeec_slab_info_table[i].incl_devices_count; - loop invariant j4: \exists integer x; 0 <= x < j && - ( xmhfgeec_slab_info_table[i].incl_devices[x].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[i].incl_devices[x].device_id == 0xFFFF) ==> - (gp_s2_sdminitdevmap_coraddalldevstouobj[i] == true && - gp_s2_sdminitdevmap_coradddevtouobj[i] == false); - loop invariant j5: \exists integer x; 0 <= x < j && - !( xmhfgeec_slab_info_table[i].incl_devices[x].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[i].incl_devices[x].device_id == 0xFFFF) ==> - (gp_s2_sdminitdevmap_coraddalldevstouobj[i] == false && - gp_s2_sdminitdevmap_coradddevtouobj[i] == true); - loop assigns j; - loop assigns j2: gp_s2_sdminitdevmap_coraddalldevstouobj[i]; - loop assigns j3: gp_s2_sdminitdevmap_coradddevtouobj[i]; - loop variant xmhfgeec_slab_info_table[i].incl_devices_count - j; - @*/ - for(j=0; j < xmhfgeec_slab_info_table[i].incl_devices_count; j++){ - if( xmhfgeec_slab_info_table[i].incl_devices[j].vendor_id == 0xFFFF && - xmhfgeec_slab_info_table[i].incl_devices[j].device_id == 0xFFFF){ - gp_s2_sdminitdevmap_addalldevstouobj(i); - //@ghost gp_s2_sdminitdevmap_coraddalldevstouobj[i] = true; - //@ghost gp_s2_sdminitdevmap_coradddevtouobj[i] = false; - }else{ - gp_s2_sdminitdevmap_adddevtouobj(i, xmhfgeec_slab_info_table[i].incl_devices[j].vendor_id, - xmhfgeec_slab_info_table[i].incl_devices[j].device_id); - //@ghost gp_s2_sdminitdevmap_coraddalldevstouobj[i] = false; - //@ghost gp_s2_sdminitdevmap_coradddevtouobj[i] = true; - } - } - - #if defined (__DEBUG_SERIAL__) - //add device SERIAL0 to all the slabs if debugging is enabled - gp_s2_sdminitdevmap_adddevtouobj(i, PCI_VENDOR_ID_XMHFGEEC, PCI_DEVICE_ID_XMHFGEEC_SERIAL0); - #endif // defined - - } - - - - #if defined (__DEBUG_SERIAL__) - //debug dump - { - uint32_t i, j; - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - _XDPRINTF_("%s: slab %u...\n", __func__, i); - for(j=0; j < _sda_slab_devicemap[i].device_count; j++){ - _XDPRINTF_(" device idx=%u\n", _sda_slab_devicemap[i].sysdev_mmioregions_indices[j]); - } - } - } - #endif // defined - - -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_addalldevstouobj.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_addalldevstouobj.c deleted file mode 100644 index b9734d0f6f..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_addalldevstouobj.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//@ghost bool gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[MAX_PLATFORM_DEVICES]; -//@ghost bool gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[MAX_PLATFORM_DEVICES]; - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; - requires 0 <= xmhfgeec_slab_info_table[slabid].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES; - - assigns gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[0..(numentries_sysdev_memioregions-1)]; - assigns gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[0..(numentries_sysdev_memioregions-1)]; - - ensures e2: \forall integer x; 0 <= x < numentries_sysdev_memioregions && - (gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[x] == false) ==> - (gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[x] == true); - ensures e3: \forall integer x; 0 <= x < numentries_sysdev_memioregions && - (gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[x] == true) ==> - (gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[x] == false); -@*/ -void gp_s2_sdminitdevmap_addalldevstouobj(uint32_t slabid){ - uint32_t k; - bool isdevinexcl; - - /*@ - loop invariant k1: 0 <= k <= numentries_sysdev_memioregions; - loop invariant k2: \forall integer x; 0 <= x < k && - (gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[x] == false) ==> - (gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[x] == true); - loop invariant k3: \forall integer x; 0 <= x < k && - (gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[x] == true) ==> - (gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[x] == false); - loop assigns k; - loop assigns isdevinexcl; - loop assigns gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[0..(numentries_sysdev_memioregions-1)]; - loop assigns gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[0..(numentries_sysdev_memioregions-1)]; - loop variant numentries_sysdev_memioregions - k; - @*/ - for(k=0; k < numentries_sysdev_memioregions; k++){ - isdevinexcl = gp_s2_sdminitdevmap_isdevinexcl(slabid, sysdev_memioregions[k].vendor_id, sysdev_memioregions[k].device_id); - //@ghost gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[k] = isdevinexcl; - //@assert (gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[k] == true) || (gp_s2_sdminitdevmap_addalldevstouobj_isdevinexcl[k] == false); - - if(!isdevinexcl){ - gp_s2_sdminitdevmap_adddeventry(slabid, k); - //@ghost gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[k] = true; - }else{ - //@ghost gp_s2_sdminitdevmap_addalldevstouobj_coradddeventry[k] = false; - } - } -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_adddeventry.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_adddeventry.c deleted file mode 100644 index aa24eea10f..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_adddeventry.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -/*@ - ghost bool gp_s2_sdminitdevmap_adddeventry_syshalt = false; -@*/ -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - - behavior addentry: - assumes (0 <= _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES); - assigns gp_s2_sdminitdevmap_adddeventry_syshalt; - assigns _sda_slab_devicemap[slabid].sysdev_mmioregions_indices[_sda_slab_devicemap[slabid].device_count]; - assigns _sda_slab_devicemap[slabid].device_count; - ensures gp_s2_sdminitdevmap_adddeventry_syshalt == false; - ensures _sda_slab_devicemap[slabid].sysdev_mmioregions_indices[\at(_sda_slab_devicemap[slabid].device_count, Pre)] == sysdev_mmioregions_index; - ensures (_sda_slab_devicemap[slabid].device_count == (\at(_sda_slab_devicemap[slabid].device_count, Pre) + 1)); - ensures (_sda_slab_devicemap[slabid].device_count <= MAX_PLATFORM_DEVICES); - - behavior invalidhalt: - assumes ( _sda_slab_devicemap[slabid].device_count >= MAX_PLATFORM_DEVICES); - assigns gp_s2_sdminitdevmap_adddeventry_syshalt; - ensures gp_s2_sdminitdevmap_adddeventry_syshalt == true; - - complete behaviors; - disjoint behaviors; -@*/ -void gp_s2_sdminitdevmap_adddeventry(uint32_t slabid, uint32_t sysdev_mmioregions_index){ - - if( _sda_slab_devicemap[slabid].device_count >= MAX_PLATFORM_DEVICES){ - _XDPRINTF_("%s: Halting! device_count >= MAX_PLATFORM_DEVICES\n", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - //@ghost gp_s2_sdminitdevmap_adddeventry_syshalt = true; - }else{ - //@ghost gp_s2_sdminitdevmap_adddeventry_syshalt = false; - _sda_slab_devicemap[slabid].sysdev_mmioregions_indices[_sda_slab_devicemap[slabid].device_count]=sysdev_mmioregions_index; - _sda_slab_devicemap[slabid].device_count++; - } -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_adddevtouobj.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_adddevtouobj.c deleted file mode 100644 index 09de81fde5..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_adddevtouobj.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//@ghost bool gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[MAX_PLATFORM_DEVICES]; -//@ghost bool gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[MAX_PLATFORM_DEVICES]; - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; - requires 0 <= xmhfgeec_slab_info_table[slabid].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES; - - assigns gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[0..(numentries_sysdev_memioregions-1)]; - assigns gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[0..(numentries_sysdev_memioregions-1)]; - - ensures e2: \forall integer x; 0 <= x < numentries_sysdev_memioregions && - ((sysdev_memioregions[x].vendor_id == vendor_id) && - (sysdev_memioregions[x].device_id == device_id) && - (gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[x] == false)) ==> - (gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[x] == true); - ensures e3: \forall integer x; 0 <= x < numentries_sysdev_memioregions && - !((sysdev_memioregions[x].vendor_id == vendor_id) && - (sysdev_memioregions[x].device_id == device_id) && - (gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[x] == false)) ==> - (gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[x] == false); -@*/ -void gp_s2_sdminitdevmap_adddevtouobj(uint32_t slabid, uint32_t vendor_id, uint32_t device_id){ - uint32_t k; - bool isdevinexcl; - - /*@ - loop invariant k1: 0 <= k <= numentries_sysdev_memioregions; - loop invariant k2: \forall integer x; 0 <= x < k && - ((sysdev_memioregions[x].vendor_id == vendor_id) && - (sysdev_memioregions[x].device_id == device_id) && - (gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[x] == false)) ==> - (gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[x] == true); - loop invariant k3: \forall integer x; 0 <= x < k && - !((sysdev_memioregions[x].vendor_id == vendor_id) && - (sysdev_memioregions[x].device_id == device_id) && - (gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[x] == false)) ==> - (gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[x] == false); - loop assigns k; - loop assigns isdevinexcl; - loop assigns gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[0..(numentries_sysdev_memioregions-1)]; - loop assigns gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[0..(numentries_sysdev_memioregions-1)]; - loop variant numentries_sysdev_memioregions - k; - @*/ - - for(k=0; k < numentries_sysdev_memioregions; k++){ - isdevinexcl = gp_s2_sdminitdevmap_isdevinexcl(slabid, vendor_id, device_id); - //@ghost gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[k] = isdevinexcl; - //@assert (gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[k] == true) || (gp_s2_sdminitdevmap_adddevtouobj_isdevinexcl[k] == false); - - if( (sysdev_memioregions[k].vendor_id == vendor_id) && - (sysdev_memioregions[k].device_id == device_id) && - !isdevinexcl - ){ - gp_s2_sdminitdevmap_adddeventry(slabid, k); - //@ghost gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[k] = true; - }else{ - //@ghost gp_s2_sdminitdevmap_adddevtouobj_coradddeventry[k] = false; - } - } - -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_isdevinexcl.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_isdevinexcl.c deleted file mode 100644 index 71f117c125..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_sdminitdevmap_isdevinexcl.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//returns true if a given device vendor_id:device_id is in the slab device exclusion -//list -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= xmhfgeec_slab_info_table[slabid].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES; - - assigns \nothing; - - ensures isinexclres: \exists integer x; 0 <= x < xmhfgeec_slab_info_table[slabid].excl_devices_count && - (xmhfgeec_slab_info_table[slabid].excl_devices[x].vendor_id == vendor_id && - xmhfgeec_slab_info_table[slabid].excl_devices[x].device_id == device_id) ==> - (\result == true); - - ensures isnotinexclres: !(\exists integer x; 0 <= x < xmhfgeec_slab_info_table[slabid].excl_devices_count && - (xmhfgeec_slab_info_table[slabid].excl_devices[x].vendor_id == vendor_id && - xmhfgeec_slab_info_table[slabid].excl_devices[x].device_id == device_id)) ==> - (\result == false); - ensures (\result == true) || (\result == false); -@*/ -bool gp_s2_sdminitdevmap_isdevinexcl(uint32_t slabid, uint32_t vendor_id, uint32_t device_id){ - uint32_t i; - - /*@ - loop invariant a1: 0 <= i <= xmhfgeec_slab_info_table[slabid].excl_devices_count; - loop invariant a2: \forall integer x; 0 <= x < i ==> - !(xmhfgeec_slab_info_table[slabid].excl_devices[x].vendor_id == vendor_id && - xmhfgeec_slab_info_table[slabid].excl_devices[x].device_id == device_id); - loop assigns i; - loop variant xmhfgeec_slab_info_table[slabid].excl_devices_count - i; - @*/ - for(i=0; i < xmhfgeec_slab_info_table[slabid].excl_devices_count; i++){ - if(xmhfgeec_slab_info_table[slabid].excl_devices[i].vendor_id == vendor_id && - xmhfgeec_slab_info_table[slabid].excl_devices[i].device_id == device_id) - return true; - } - - /*@assert a3: \forall integer x; 0 <= x < xmhfgeec_slab_info_table[slabid].excl_devices_count ==> - !(xmhfgeec_slab_info_table[slabid].excl_devices[x].vendor_id == vendor_id && - xmhfgeec_slab_info_table[slabid].excl_devices[x].device_id == device_id); - @*/ - return false; -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupgdt.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupgdt.c deleted file mode 100644 index 2f80455716..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupgdt.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//initialize GDT -//@ghost bool gp_s2_setupgdt_invokehelper[MAX_PLATFORM_CPUS]; -/*@ - requires \valid(xcbootinfo); - requires (xcbootinfo->cpuinfo_numentries < MAX_PLATFORM_CPUS); - ensures \forall integer x; 0 <= x < xcbootinfo->cpuinfo_numentries ==> ( - (xcbootinfo->cpuinfo_buffer[x].lapic_id < MAX_PLATFORM_CPUS) ==> - (gp_s2_setupgdt_invokehelper[x] == true) ); -@*/ -void gp_s2_setupgdt(void){ - uint32_t i; - - /*@ - loop invariant a1: 0 <= i <= xcbootinfo->cpuinfo_numentries; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - (xcbootinfo->cpuinfo_buffer[x].lapic_id < MAX_PLATFORM_CPUS) ==> - (gp_s2_setupgdt_invokehelper[x] == true) - ); - loop assigns gp_s2_setupgdt_invokehelper[0..(xcbootinfo->cpuinfo_numentries-1)]; - loop assigns i; - loop variant xcbootinfo->cpuinfo_numentries - i; - @*/ - for(i=0; i < xcbootinfo->cpuinfo_numentries; i++){ - - if(xcbootinfo->cpuinfo_buffer[i].lapic_id < MAX_PLATFORM_CPUS){ - gp_s2_setupgdt_setgdttssentry( ((__TRSEL/8)+(xcbootinfo->cpuinfo_buffer[i].lapic_id)) , xcbootinfo->cpuinfo_buffer[i].lapic_id); - //@ghost gp_s2_setupgdt_invokehelper[i] = true; - - _XDPRINTF_("%s: setup TSS CPU idx=%u with base address=%x, iobitmap=%x\n, size=%u bytes", __func__, - xcbootinfo->cpuinfo_buffer[i].lapic_id, - (uint32_t)(&__xmhfhic_x86vmx_tss[xcbootinfo->cpuinfo_buffer[i].lapic_id].tss_mainblock), - (uint32_t)&__xmhfhic_x86vmx_tss[xcbootinfo->cpuinfo_buffer[i].lapic_id].tss_iobitmap, - ((4*PAGE_SIZE_4K)-1) ); - - } - } - -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupgdttssentry.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupgdttssentry.c deleted file mode 100644 index de1f4dc5f3..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupgdttssentry.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires (__TRSEL/8) <= gdtindex <= (XMHFGEEC_MAX_GDT_CODEDATA_DESCRIPTORS + MAX_PLATFORM_CPUS); - requires 0 <= tssidx < MAX_PLATFORM_CPUS; - ensures (((TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex])->baseAddr0_15 == ((uint16_t)((uint32_t)&__xmhfhic_x86vmx_tss[tssidx].tss_mainblock & 0x0000FFFF))); - ensures (((TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex])->baseAddr16_23 == ((uint8_t)(((uint32_t)&__xmhfhic_x86vmx_tss[tssidx].tss_mainblock & 0x00FF0000) >> 16))); - ensures (((TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex])->baseAddr24_31 == ((uint8_t)(((uint32_t)&__xmhfhic_x86vmx_tss[tssidx].tss_mainblock & 0xFF000000) >> 24)) ); - ensures (((TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex])->attributes1 == 0xE9); - ensures (((TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex])->limit16_19attributes2 == 0x0); - ensures (((TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex])->limit0_15 == ((4*PAGE_SIZE_4K)-1) ); - -@*/ -void gp_s2_setupgdt_setgdttssentry(uint32_t gdtindex, uint32_t tssidx){ - TSSENTRY *t = (TSSENTRY *)&__xmhfhic_x86vmx_gdt_start[gdtindex]; - uint32_t tss_base = (uint32_t)&__xmhfhic_x86vmx_tss[tssidx].tss_mainblock; - - t->baseAddr0_15= (uint16_t)(tss_base & 0x0000FFFF); - t->baseAddr16_23= (uint8_t)((tss_base & 0x00FF0000) >> 16); - t->baseAddr24_31= (uint8_t)((tss_base & 0xFF000000) >> 24); - t->attributes1= 0xE9; - t->limit16_19attributes2= 0x0; - t->limit0_15=(4*PAGE_SIZE_4K)-1; -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupidt.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupidt.c deleted file mode 100644 index 552965dfad..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupidt.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -//initialize IDT -void gp_s2_setupidt(void){ - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_XC_EXHUB; - spl.cpuid = 0; - spl.dst_uapifn = UAPI_XCEXHUB_SETUPIDT; - - XMHF_SLAB_CALLNEW(&spl); -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotbl.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotbl.c deleted file mode 100644 index 521337209c..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotbl.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include - -//@ghost bool gp_s2_setupiotbl_invokeduhslabiotbl[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupiotbl_invokedugslabiotbl[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupiotbl_invokedug_rg_slabiotbl[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupiotbl_handlevfobjs[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupiotbl_handleinvalidobjs[XMHFGEEC_TOTAL_SLABS]; -/*@ - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (_sda_slab_devicemap[x].device_count < MAX_PLATFORM_DEVICES); - requires \forall integer x, y; 0 <= x < XMHFGEEC_TOTAL_SLABS && 0 <= y < MAX_PLATFORM_DEVICES ==> - (_sda_slab_devicemap[x].device_count < MAX_PLATFORM_DEVICES && - _sda_slab_devicemap[x].sysdev_mmioregions_indices[y] < MAX_PLATFORM_DEVICES - ); - assigns gp_s2_setupiotbl_invokeduhslabiotbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupiotbl_invokedugslabiotbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupiotbl_invokedug_rg_slabiotbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupiotbl_handlevfobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupiotbl_handleinvalidobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - ensures \forall integer x; 0 <= x < (XMHFGEEC_TOTAL_SLABS-1) ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG)) && - ((x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX)) - ) ==> (gp_s2_setupiotbl_invokeduhslabiotbl[x] == true) ); - ensures \forall integer x; 0 <= x < (XMHFGEEC_TOTAL_SLABS-1) ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) ) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) ==> (gp_s2_setupiotbl_invokedugslabiotbl[x] == true) ); - ensures \forall integer x; 0 <= x < (XMHFGEEC_TOTAL_SLABS-1) ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST)) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) ==> (gp_s2_setupiotbl_invokedug_rg_slabiotbl[x] == true) ); - ensures \forall integer x; 0 <= x < (XMHFGEEC_TOTAL_SLABS-1) ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) ==> (gp_s2_setupiotbl_handlevfobjs[x] == true) ); - ensures \forall integer x; 0 <= x < (XMHFGEEC_TOTAL_SLABS-1) ==> ( - ( - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG)) && - ((x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX)) - ) && - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST)) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) && - !( (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) && - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) - ) ==> (gp_s2_setupiotbl_handleinvalidobjs[x] == true) ); -@*/ -void gp_s2_setupiotbl(void){ - uint32_t i, slabtype; - - - - /*@ - loop invariant a1: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG)) && - ((x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX)) - ) ==> (gp_s2_setupiotbl_invokeduhslabiotbl[x] == true) ); - loop invariant a3: \forall integer x; 0 <= x < i ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) ) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) ==> (gp_s2_setupiotbl_invokedugslabiotbl[x] == true) ); - loop invariant a31: \forall integer x; 0 <= x < i ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) ==> (gp_s2_setupiotbl_invokedug_rg_slabiotbl[x] == true) ); - loop invariant a4: \forall integer x; 0 <= x < i ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) ==> (gp_s2_setupiotbl_handlevfobjs[x] == true) ); - loop invariant a5: \forall integer x; 0 <= x < i ==> ( - ( - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG)) && - ((x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX)) - ) && - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) ) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) && - !( (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) && - ((x >= XMHFGEEC_UGSLAB_BASE_IDX && x <= XMHFGEEC_UGSLAB_MAX_IDX)) - ) && - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) - )==> (gp_s2_setupiotbl_handleinvalidobjs[x] == true) ); - loop assigns i; - loop assigns gp_s2_setupiotbl_invokeduhslabiotbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupiotbl_invokedugslabiotbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupiotbl_invokedug_rg_slabiotbl[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupiotbl_handlevfobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupiotbl_handleinvalidobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - if( ((xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG) || - (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG)) && - ((i >= XMHFGEEC_UHSLAB_BASE_IDX && i <= XMHFGEEC_UHSLAB_MAX_IDX)) - ){ - gp_s2_setupiotbluh(i); - //@ghost gp_s2_setupiotbl_invokeduhslabiotbl[i] = true; - _XDPRINTF_("%s: set up iotbl for uV{U,T}_PROG slab with id %u\n", __func__, i); - } - else if ( ((xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST) || - (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) )&& - ((i >= XMHFGEEC_UGSLAB_BASE_IDX && i <= XMHFGEEC_UGSLAB_MAX_IDX)) - ){ - gp_s2_setupiotblug(i); - //@ghost gp_s2_setupiotbl_invokedugslabiotbl[i] = true; - _XDPRINTF_("%s: set up iotbl for uV{U,T}_PROG guest-slab with id %u\n", __func__, i); - - }else if ( (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) && - ((i >= XMHFGEEC_UGSLAB_BASE_IDX && i <= XMHFGEEC_UGSLAB_MAX_IDX)) - ){ - gp_s2_setupiotblug_rg(i); - //@ghost gp_s2_setupiotbl_invokedug_rg_slabiotbl[i] = true; - _XDPRINTF_("%s: set up iotbl for rich-guest with id %u\n", __func__, i); - - }else if ( ((xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ){ - //do nothing for verified slabs - //@ghost gp_s2_setupiotbl_handlevfobjs[i] = true; - - }else{ - //we have no idea what type of slab this is, halt! - _XDPRINTF_("%s:%u no idea of slab %u of type %u. Halting!\n", - __func__, __LINE__, i, xmhfgeec_slab_info_table[i].slabtype); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - //@ghost gp_s2_setupiotbl_handleinvalidobjs[i] = true; - } - - } - - _XDPRINTF_("%s: setup unverified slab legacy I/O permission tables\n", __func__); - - - - - -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotblug.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotblug.c deleted file mode 100644 index 2326b064b9..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotblug.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -//@ghost bool gp_s2_setupiotblug_helper_invokedportaccess[PCI_CONF_MAX_BARS]; -/*@ - requires (slabid >= XMHFGEEC_UGSLAB_BASE_IDX && slabid <= XMHFGEEC_UGSLAB_MAX_IDX); - requires sysdev_memioregions_index < MAX_PLATFORM_DEVICES; - assigns gp_s2_setupiotblug_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - ensures \forall integer x; 0 <= x < (PCI_CONF_MAX_BARS-1) ==> ( - ((sysdev_memioregions[sysdev_memioregions_index].memioextents[x].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_IO && - (sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_start <= sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_end))) ==> - (gp_s2_setupiotblug_helper_invokedportaccess[x] == true) - ); -@*/ -static inline void gp_s2_setupiotblug_helper(uint32_t slabid, uint32_t sysdev_memioregions_index){ - uint32_t k, portnum; - - /*@ - loop invariant b1: 0 <= k <= PCI_CONF_MAX_BARS; - loop invariant b2: \forall integer x; 0 <= x < k ==> ( - ((sysdev_memioregions[sysdev_memioregions_index].memioextents[x].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_IO && - (sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_start <= sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_end))) ==> - (gp_s2_setupiotblug_helper_invokedportaccess[x] == true) - ); - loop assigns k; - loop assigns portnum; - loop assigns gp_s2_setupiotblug_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - k; - @*/ - for(k=0; k < PCI_CONF_MAX_BARS; k++){ - if(sysdev_memioregions[sysdev_memioregions_index].memioextents[k].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_IO && - (sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_start <= sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end)){ - - /*@ - loop invariant c1: sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_start <= portnum <= sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end; - loop assigns portnum; - loop variant sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end - portnum; - @*/ - for(portnum= sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_start; - portnum < sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end; portnum++){ - { - slab_params_t spl; - uapi_iotbl_setupiotblugportaccess_t *ps = (uapi_iotbl_setupiotblugportaccess_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = 0; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_SETUPIOTBLUGPORTACCESS; - - ps->ugslabiobitmap_idx = slabid; - ps->port = portnum; - ps->port_size = 1; - - XMHF_SLAB_CALLNEW(&spl); - } - } - - //@ghost gp_s2_setupiotblug_helper_invokedportaccess[k] = true; - } - } -} - - - -//@ghost bool gp_s2_setupiotblug_invokedhelper[MAX_PLATFORM_DEVICES]; -/*@ - requires (slabid >= XMHFGEEC_UGSLAB_BASE_IDX && slabid <= XMHFGEEC_UGSLAB_MAX_IDX); - requires _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES; - requires \forall integer x; 0 <= x < MAX_PLATFORM_DEVICES ==> (_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); - assigns gp_s2_setupiotblug_invokedhelper[0..(_sda_slab_devicemap[slabid].device_count-1)]; - assigns gp_rwdatahdr.gp_ugslab_iobitmap[(slabid - XMHFGEEC_UGSLAB_BASE_IDX)][0..(3*PAGE_SIZE_4K-1)]; - assigns gp_s2_setupiotblug_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - ensures \forall integer x; 0 <= x < (_sda_slab_devicemap[slabid].device_count-1) ==> - (gp_s2_setupiotblug_invokedhelper[x] == true); -@*/ -void gp_s2_setupiotblug(uint32_t slabid){ - uint32_t i; - - { - slab_params_t spl; - uapi_iotbl_initiotbl_t *ps = (uapi_iotbl_initiotbl_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = 0; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_INITIOTBL; - - ps->dst_slabid = slabid; - - XMHF_SLAB_CALLNEW(&spl); - } - /*@ - loop invariant a1: 0 <= i <= _sda_slab_devicemap[slabid].device_count; - loop invariant a2: \forall integer x; 0 <= x < i ==> - (gp_s2_setupiotblug_invokedhelper[x] == true); - loop assigns i; - loop assigns gp_s2_setupiotblug_invokedhelper[0..(_sda_slab_devicemap[slabid].device_count-1)]; - loop assigns gp_s2_setupiotblug_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - loop variant _sda_slab_devicemap[slabid].device_count - i; - @*/ - for(i=0; i < _sda_slab_devicemap[slabid].device_count; i++){ - gp_s2_setupiotblug_helper(slabid, _sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]); - //@ghost gp_s2_setupiotblug_invokedhelper[i] = true; - } -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotblug_rg.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotblug_rg.c deleted file mode 100644 index fb0ecf5f19..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotblug_rg.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include -#include - -/*@ - requires (slabid >= XMHFGEEC_UGSLAB_BASE_IDX && slabid <= XMHFGEEC_UGSLAB_MAX_IDX); -@*/ -void gp_s2_setupiotblug_rg(uint32_t slabid){ - - { - slab_params_t spl; - uapi_iotbl_initiotbl_t *ps = (uapi_iotbl_initiotbl_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = 0; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_INITIOTBL; - - ps->dst_slabid = slabid; - - XMHF_SLAB_CALLNEW(&spl); - } - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotbluh.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotbluh.c deleted file mode 100644 index a5e818466c..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupiotbluh.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -//@ghost bool gp_s2_setupiotbluh_helper_invokedportaccess[PCI_CONF_MAX_BARS]; -/*@ - requires (slabid >= XMHFGEEC_UHSLAB_BASE_IDX && slabid <= XMHFGEEC_UHSLAB_MAX_IDX); - requires sysdev_memioregions_index < MAX_PLATFORM_DEVICES; - assigns gp_s2_setupiotbluh_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - ensures \forall integer x; 0 <= x < (PCI_CONF_MAX_BARS-1) ==> ( - ((sysdev_memioregions[sysdev_memioregions_index].memioextents[x].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_IO && - (sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_start <= sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_end))) ==> - (gp_s2_setupiotbluh_helper_invokedportaccess[x] == true) - ); -@*/ -static inline void gp_s2_setupiotbluh_helper(uint32_t slabid, uint32_t sysdev_memioregions_index){ - uint32_t k, portnum; - - /*@ - loop invariant b1: 0 <= k <= PCI_CONF_MAX_BARS; - loop invariant b2: \forall integer x; 0 <= x < k ==> ( - ((sysdev_memioregions[sysdev_memioregions_index].memioextents[x].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_IO && - (sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_start <= sysdev_memioregions[sysdev_memioregions_index].memioextents[x].addr_end))) ==> - (gp_s2_setupiotbluh_helper_invokedportaccess[x] == true) - ); - loop assigns k; - loop assigns portnum; - loop assigns gp_s2_setupiotbluh_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - loop variant PCI_CONF_MAX_BARS - k; - @*/ - for(k=0; k < PCI_CONF_MAX_BARS; k++){ - if(sysdev_memioregions[sysdev_memioregions_index].memioextents[k].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_IO && - (sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_start <= sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end)){ - - /*@ - loop invariant c1: sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_start <= portnum <= sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end; - loop assigns portnum; - loop variant sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end - portnum; - @*/ - for(portnum= sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_start; - portnum < sysdev_memioregions[sysdev_memioregions_index].memioextents[k].addr_end; portnum++){ - - { - slab_params_t spl; - uapi_iotbl_setupiotbluhportaccess_t *ps = (uapi_iotbl_setupiotbluhportaccess_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = 0; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_SETUPIOTBLUHPORTACCESS; - - ps->uhslabiobitmap_idx = slabid; - ps->port = portnum; - ps->port_size = 1; - - XMHF_SLAB_CALLNEW(&spl); - } - - } - - //@ghost gp_s2_setupiotbluh_helper_invokedportaccess[k] = true; - } - } -} - - - -//@ghost bool gp_s2_setupiotbluh_invokedhelper[MAX_PLATFORM_DEVICES]; -/*@ - requires (slabid >= XMHFGEEC_UHSLAB_BASE_IDX && slabid <= XMHFGEEC_UHSLAB_MAX_IDX); - requires _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES; - requires \forall integer x; 0 <= x < MAX_PLATFORM_DEVICES ==> (_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); - assigns gp_s2_setupiotbluh_invokedhelper[0..(_sda_slab_devicemap[slabid].device_count-1)]; - assigns gp_rwdatahdr.gp_uhslab_iobitmap[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][0..(3*PAGE_SIZE_4K-1)]; - assigns gp_s2_setupiotbluh_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - ensures \forall integer x; 0 <= x < (_sda_slab_devicemap[slabid].device_count-1) ==> - (gp_s2_setupiotbluh_invokedhelper[x] == true); -@*/ -void gp_s2_setupiotbluh(uint32_t slabid){ - uint32_t i; - - { - slab_params_t spl; - uapi_iotbl_initiotbl_t *ps = (uapi_iotbl_initiotbl_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = 0; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_INITIOTBL; - - ps->dst_slabid = slabid; - - XMHF_SLAB_CALLNEW(&spl); - } - - /*@ - loop invariant a1: 0 <= i <= _sda_slab_devicemap[slabid].device_count; - loop invariant a2: \forall integer x; 0 <= x < i ==> - (gp_s2_setupiotbluh_invokedhelper[x] == true); - loop assigns i; - loop assigns gp_s2_setupiotbluh_invokedhelper[0..(_sda_slab_devicemap[slabid].device_count-1)]; - loop assigns gp_s2_setupiotbluh_helper_invokedportaccess[0..(PCI_CONF_MAX_BARS-1)]; - loop variant _sda_slab_devicemap[slabid].device_count - i; - @*/ - for(i=0; i < _sda_slab_devicemap[slabid].device_count; i++){ - gp_s2_setupiotbluh_helper(slabid, _sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]); - //@ghost gp_s2_setupiotbluh_invokedhelper[i] = true; - } -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatype.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatype.c deleted file mode 100644 index e697b4204f..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatype.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//@ ghost uint32_t gretval; -/*@ - requires 0 <= slab_index < XMHFGEEC_TOTAL_SLABS ; - assigns gretval; - ensures (\forall uint32_t x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> (gretval == _SLAB_SPATYPE_OTHER)) ==> (\result == _SLAB_SPATYPE_OTHER); - ensures (\exists uint32_t x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( !(gretval == _SLAB_SPATYPE_OTHER) && - (( (x == slab_index) || ((xmhfgeec_slab_info_table[x].slab_memgrantreadcaps & XMHFGEEC_SLAB_MEMGRANTREADCAP_MASK(slab_index)) || - (xmhfgeec_slab_info_table[x].slab_memgrantwritecaps & XMHFGEEC_SLAB_MEMGRANTWRITECAP_MASK(slab_index))) )) ) - ==> (\result == (gretval | xmhfgeec_slab_info_table[x].slabtype | _SLAB_SPATYPE_MASK_SAMESLAB)) ); - ensures (\exists uint32_t x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( !(gretval == _SLAB_SPATYPE_OTHER) && - !(( (x == slab_index) || ((xmhfgeec_slab_info_table[x].slab_memgrantreadcaps & XMHFGEEC_SLAB_MEMGRANTREADCAP_MASK(slab_index)) || - (xmhfgeec_slab_info_table[x].slab_memgrantwritecaps & XMHFGEEC_SLAB_MEMGRANTWRITECAP_MASK(slab_index))) )) ) - ==> (\result == (gretval | xmhfgeec_slab_info_table[x].slabtype) ) ); -@*/ -uint32_t gp_s2_setupmpgtbl_getspatype(uint32_t slab_index, uint32_t spa){ - uint32_t i; - uint32_t retval; - - - //slab memory regions - - /*@ - loop invariant b1: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant b2: \forall uint32_t x; 0 <= x < i ==> (gretval == _SLAB_SPATYPE_OTHER); - loop assigns i, retval, gretval; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - retval = gp_s2_setupmpgtbl_getspatypeuobj(i, spa); - //@ghost gretval = retval; - - if(retval != _SLAB_SPATYPE_OTHER){ - if ( (i == slab_index) || ((xmhfgeec_slab_info_table[i].slab_memgrantreadcaps & XMHFGEEC_SLAB_MEMGRANTREADCAP_MASK(slab_index)) || - (xmhfgeec_slab_info_table[i].slab_memgrantwritecaps & XMHFGEEC_SLAB_MEMGRANTWRITECAP_MASK(slab_index))) ) - return retval | xmhfgeec_slab_info_table[i].slabtype | _SLAB_SPATYPE_MASK_SAMESLAB; - else - return retval | xmhfgeec_slab_info_table[i].slabtype; - } - - } - - return _SLAB_SPATYPE_OTHER; -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj.c deleted file mode 100644 index 88da8bae40..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//@ghost bool gisiotbl, gisdevicemmio; -/*@ - requires 0 <= slab_index < XMHFGEEC_TOTAL_SLABS ; - requires \forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (_sda_slab_devicemap[slab_index].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); - requires 0 <= _sda_slab_devicemap[slab_index].device_count < MAX_PLATFORM_DEVICES; - assigns gisiotbl, gisdevicemmio; - ensures ( (\result == _SLAB_SPATYPE_GEEC_PRIME_IOTBL) || - (\result == _SLAB_SPATYPE_SLAB_CODE) || - (\result == _SLAB_SPATYPE_SLAB_DATA) || - (\result == _SLAB_SPATYPE_SLAB_STACK) || - (\result == _SLAB_SPATYPE_SLAB_DMADATA) || - (\result == _SLAB_SPATYPE_SLAB_DEVICEMMIO) || - (\result == _SLAB_SPATYPE_OTHER) ); - ensures ( (gisiotbl == true) ) ==> (\result == _SLAB_SPATYPE_GEEC_PRIME_IOTBL); - ensures ( (gisiotbl == false) && (spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_end)) ==> (\result == _SLAB_SPATYPE_SLAB_CODE); - ensures ( (gisiotbl == false) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_end) && - (spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_end) - ) ==> (\result == _SLAB_SPATYPE_SLAB_DATA); - ensures ( (gisiotbl == false) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_end) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_end) && - (spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_end) - ) ==> (\result == _SLAB_SPATYPE_SLAB_STACK); - ensures ( (gisiotbl == false) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_end) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_end) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_end) && - (spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[3].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[3].addr_end) - ) ==> (\result == _SLAB_SPATYPE_SLAB_DMADATA); - ensures ( (gisiotbl == false) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_end) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_end) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_end) && - !(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[3].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[3].addr_end) && - (gisdevicemmio == true) - ) ==> (\result == _SLAB_SPATYPE_SLAB_DEVICEMMIO); - - -@*/ -uint32_t gp_s2_setupmpgtbl_getspatypeuobj(uint32_t slab_index, uint32_t spa){ - bool isiotbl, isdevicemmio; - - isiotbl = gp_s2_setupmpgtbl_getspatypeuobj_isiotbl(slab_index, spa); - //@ghost gisiotbl = isiotbl; - isdevicemmio = gp_s2_setupmpgtbl_getspatypeuobj_ismmio(slab_index, spa); - //@ghost gisdevicemmio = isdevicemmio; - - if(isiotbl) - return _SLAB_SPATYPE_GEEC_PRIME_IOTBL; - if(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[0].addr_end) - return _SLAB_SPATYPE_SLAB_CODE; - if(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[1].addr_end) - return _SLAB_SPATYPE_SLAB_DATA; - if(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[2].addr_end) - return _SLAB_SPATYPE_SLAB_STACK; - if(spa >= xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[3].addr_start && spa < xmhfgeec_slab_info_table[slab_index].slab_physmem_extents[3].addr_end) - return _SLAB_SPATYPE_SLAB_DMADATA; - if(isdevicemmio) - return _SLAB_SPATYPE_SLAB_DEVICEMMIO; - - return _SLAB_SPATYPE_OTHER; -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj_isiotbl.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj_isiotbl.c deleted file mode 100644 index 4076e50569..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj_isiotbl.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS ; - assigns \nothing; - behavior isiotbl: - assumes (\forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (!(spa >= (uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap && - spa < ((uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap[3*PAGE_SIZE_4K]) )) ); - ensures (\result == false); - behavior isnotiotbl: - assumes !(\forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (!(spa >= (uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap && - spa < ((uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap[3*PAGE_SIZE_4K]) )) ); - ensures (\result == true); - complete behaviors; - disjoint behaviors; - //ensures (\result == true) || (\result == false); - //ensures (\forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (!(spa >= (uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap && - // spa < ((uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap[3*PAGE_SIZE_4K]) )) ) ==> (\result == false); - //ensures !(\forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (!(spa >= (uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap && - // spa < ((uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap[3*PAGE_SIZE_4K]) )) ) ==> (\result == true); -@*/ -bool gp_s2_setupmpgtbl_getspatypeuobj_isiotbl(uint32_t slabid, uint32_t spa){ - uint32_t i; - - /*@ - loop invariant b1: 0 <= i <= MAX_PLATFORM_CPUS; - loop invariant b2: \forall integer x; 0 <= x < i ==> (!(spa >= (uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap && - spa < ((uint32_t)&__xmhfhic_x86vmx_tss[x].tss_iobitmap[3*PAGE_SIZE_4K]) )); - loop assigns i; - loop variant MAX_PLATFORM_CPUS - i; - @*/ - for(i=0; i < MAX_PLATFORM_CPUS; i++){ - if (spa >= (uint32_t)&__xmhfhic_x86vmx_tss[i].tss_iobitmap && - spa < ((uint32_t)&__xmhfhic_x86vmx_tss[i].tss_iobitmap[3*PAGE_SIZE_4K]) ){ - return true; - } - } - - return false; - -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj_ismmio.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj_ismmio.c deleted file mode 100644 index 81df88583c..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbl_getspatypeuobj_ismmio.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS ; - requires \forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); - requires 0 <= _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES; - assigns \nothing; - ensures (\result == true) || (\result == false) ; - ensures (\forall uint32_t x, uint32_t y; ( (0 <= x < _sda_slab_devicemap[slabid].device_count) && - (0 <= y < PCI_CONF_MAX_BARS) ) ==> !(sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x]].memioextents[y].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_MEM && - (spa >= sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x]].memioextents[y].addr_start && - spa < sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x]].memioextents[y].addr_end) )) ==> (\result == false); - -@*/ -bool gp_s2_setupmpgtbl_getspatypeuobj_ismmio(uint32_t slabid, uint32_t spa){ - uint32_t i, j; - - /*@ - loop invariant c1: 0 <= i <= _sda_slab_devicemap[slabid].device_count; - loop assigns i, j; - loop variant _sda_slab_devicemap[slabid].device_count - i; - @*/ - for(i=0; i < _sda_slab_devicemap[slabid].device_count; i++){ - - /*@ - loop invariant c2: 0 <= j <= PCI_CONF_MAX_BARS; - loop invariant c3: \forall integer x; 0 <= x < j ==> (!(sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]].memioextents[x].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_MEM && - (spa >= sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]].memioextents[x].addr_start && - spa < sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]].memioextents[x].addr_end) )); - loop assigns j; - loop variant PCI_CONF_MAX_BARS - j; - @*/ - for(j=0; j < PCI_CONF_MAX_BARS; j++){ - if(sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]].memioextents[j].extent_type == _MEMIOREGIONS_EXTENTS_TYPE_MEM && - (spa >= sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]].memioextents[j].addr_start && - spa < sysdev_memioregions[_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[i]].memioextents[j].addr_end) ) - return true; - } - } - - return false; -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblu.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblu.c deleted file mode 100644 index 4f8d7ac851..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblu.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//@ghost bool gp_s2_setupmpgtblu_invokeduh[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupmpgtblu_invokedug[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupmpgtblu_invokedug_rg[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupmpgtblu_handlevfobjs[XMHFGEEC_TOTAL_SLABS]; -//@ghost bool gp_s2_setupmpgtblu_invokedinvalidobjs[XMHFGEEC_TOTAL_SLABS]; -/*@ - assigns gp_s2_setupmpgtblu_invokeduh[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupmpgtblu_invokedug[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupmpgtblu_invokedug_rg[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupmpgtblu_handlevfobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - assigns gp_s2_setupmpgtblu_invokedinvalidobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - ( (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) && - (x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX)) ==> - (gp_s2_setupmpgtblu_invokeduh[x] == true) ); - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) ==> - (gp_s2_setupmpgtblu_invokedug[x] == true) ); - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ==> - (gp_s2_setupmpgtblu_invokedug_rg[x] == true) ); - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) ==> (gp_s2_setupmpgtblu_handlevfobjs[x] == true) ); - ensures \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> ( - ( - !( (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) && - (x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX) - ) && - !(xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST - ) && - !(xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST - ) && - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) - ) ==> (gp_s2_setupmpgtblu_invokedinvalidobjs[x] == true) ); -@*/ -void gp_s2_setupmpgtblu(void){ - uint32_t i; - - - /*@ - loop invariant a1: 0 <= i <= XMHFGEEC_TOTAL_SLABS; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - ( (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) && - (x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX)) ==> - (gp_s2_setupmpgtblu_invokeduh[x] == true) ); - loop invariant a3: \forall integer x; 0 <= x < i ==> ( - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) ==> - (gp_s2_setupmpgtblu_invokedug[x] == true) ); - loop invariant a31: \forall integer x; 0 <= x < i ==> ( - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) ==> - (gp_s2_setupmpgtblu_invokedug_rg[x] == true) ); - loop invariant a4: \forall integer x; 0 <= x < i ==> ( - ( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) ==> (gp_s2_setupmpgtblu_handlevfobjs[x] == true) ); - loop invariant a5: \forall integer x; 0 <= x < i ==> ( - ( - !( (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) && - (x >= XMHFGEEC_UHSLAB_BASE_IDX && x <= XMHFGEEC_UHSLAB_MAX_IDX) - ) && - !(xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST - ) && - !(xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST - ) && - !( ((xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[x].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ) - ) ==> (gp_s2_setupmpgtblu_invokedinvalidobjs[x] == true) ); - loop assigns i; - loop assigns gp_s2_setupmpgtblu_invokeduh[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupmpgtblu_invokedug[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupmpgtblu_invokedug_rg[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupmpgtblu_handlevfobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop assigns gp_s2_setupmpgtblu_invokedinvalidobjs[0..(XMHFGEEC_TOTAL_SLABS-1)]; - loop variant XMHFGEEC_TOTAL_SLABS - i; - @*/ - for(i=0; i < XMHFGEEC_TOTAL_SLABS; i++){ - - if( (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) && - (i >= XMHFGEEC_UHSLAB_BASE_IDX && i <= XMHFGEEC_UHSLAB_MAX_IDX)){ - - _XDPRINTF_("%s: slab %u --> ppopulating uV{T,U} page-tables...\n", __func__, i); - gp_s2_setupmpgtbluh(i); - //@ghost gp_s2_setupmpgtblu_invokeduh[i] = true; - _XDPRINTF_("%s: slab %u --> uV{T,U}_prog page-tables populated\n", __func__, i); - - - }else if (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST){ - - _XDPRINTF_("%s: slab %u --> ppopulating uV{T,U}_prog_guest page-tables...\n", __func__, i); - gp_s2_setupmpgtblug(i); - //@ghost gp_s2_setupmpgtblu_invokedug[i] = true; - _XDPRINTF_("%s: slab %u --> uV{T,U}_prog_guest page-tables populated\n", __func__, i); - - }else if (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST){ - - _XDPRINTF_("%s: slab %u --> ppopulating rich-guest page-tables...\n", __func__, i); - gp_s2_setupmpgtblug_rg(i); - //@ghost gp_s2_setupmpgtblu_invokedug_rg[i] = true; - _XDPRINTF_("%s: slab %u --> rich-guest page-tables populated\n", __func__, i); - - - }else if ( ((xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_VfT_SENTINEL) || - (xmhfgeec_slab_info_table[i].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG)) - ){ - //do nothing for verified slabs - //@ghost gp_s2_setupmpgtblu_handlevfobjs[i] = true; - - }else{ - //we have no idea what type of slab this is, halt! - _XDPRINTF_("%s:%u no idea of slab %u of type %u. Halting!\n", - __func__, __LINE__, i, xmhfgeec_slab_info_table[i].slabtype); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - //@ghost gp_s2_setupmpgtblu_invokedinvalidobjs[i] = true; - - } - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug.c deleted file mode 100644 index b8fcee2fc6..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - - -//setup unverified guest (ug) slab memory page tables -//@ghost bool gp_s2_setupmpgtblug_invokedmemorytype[1024*1024]; -//@ghost uint64_t gp_s2_setupmpgtblug_invokedflags[1024*1024]; -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - assigns gp_s2_setupmpgtblug_invokedmemorytype[0..((1024*1024)-1)]; - assigns gp_s2_setupmpgtblug_invokedflags[0..((1024*1024)-1)]; -@*/ -void gp_s2_setupmpgtblug(uint32_t slabid){ - uint64_t flags; - uint32_t spatype; - uint32_t memorytype; - uint32_t i; - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = 0; //XXX: fixme, need to plug in BSP cpuid - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL; - spl.in_out_params[0] = slabid; - - //@assert (spl.src_slabid == XMHFGEEC_SLAB_GEEC_PRIME); - //@assert (spl.dst_slabid == XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL); - //@assert (spl.dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL); - //@assert (spl.in_out_params[0] == slabid); - XMHF_SLAB_CALLNEW(&spl); - - - - - /*@ - loop invariant d1: 0 <= i <= (1024*1024); - loop invariant d2: \forall integer x; 0 <= x < i ==> (gp_s2_setupmpgtblug_invokedmemorytype[x] == true); - loop invariant d3: \forall integer x; 0 <= x < i ==> (gp_s2_setupmpgtblug_invokedflags[x] == true); - loop assigns i; - loop assigns memorytype; - loop assigns spatype; - loop assigns flags; - loop assigns gp_s2_setupmpgtblug_invokedmemorytype[0..((1024*1024)-1)]; - loop assigns gp_s2_setupmpgtblug_invokedflags[0..((1024*1024)-1)]; - loop assigns spl.in_out_params[0..4]; - loop assigns spl.dst_uapifn; - //loop assigns memorytype_mask; - loop variant (1024*1024) - i; - @*/ - for(i=0; i < (1024*1024); i++){ - memorytype = gp_s2_setupmpgtblug_getmtype((uint64_t)(i*PAGE_SIZE_4K)); - //@ghost gp_s2_setupmpgtblug_invokedmemorytype[i] = true; - - spatype = gp_s2_setupmpgtbl_getspatype(slabid, (uint32_t)(i*PAGE_SIZE_4K)); - - flags = gp_s2_setupmpgtblug_getflags(slabid, (uint32_t)(i*PAGE_SIZE_4K), spatype); - //@ghost gp_s2_setupmpgtblug_invokedflags[i] = true; - - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - spl.in_out_params[0] = slabid; - spl.in_out_params[1] = (i*PAGE_SIZE_4K); - spl.in_out_params[2] = 0; - spl.in_out_params[3] = (uint32_t) ((i*PAGE_SIZE_4K)) | ((uint32_t)memorytype * 8) | (uint32_t)flags ; //present, UC - spl.in_out_params[4] = 0; - - //@assert (spl.src_slabid == XMHFGEEC_SLAB_GEEC_PRIME); - //@assert (spl.dst_slabid == XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL); - //@assert (spl.dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR); - //@assert (spl.in_out_params[0] == slabid); - //@assert (spl.in_out_params[1] == (i*PAGE_SIZE_4K)); - //@assert (spl.in_out_params[2] == 0); - //@assert (spl.in_out_params[3] == ((uint32_t) ((i*PAGE_SIZE_4K)) | ((uint32_t)memorytype * 8) | (uint32_t)flags)) ; - //@assert (spl.in_out_params[4] == 0); - XMHF_SLAB_CALLNEW(&spl); - } -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_getflags.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_getflags.c deleted file mode 100644 index 48d2a3c28b..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_getflags.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - - behavior code: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_OTHER) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) - ); - ensures (\result == 0x5); - - behavior datammio: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_OTHER) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ); - ensures (\result == 0x3); - - behavior richguestrwx: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - ); - ensures (\result == 0x7); - - behavior richguestrwmmio: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) && - !((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_GEEC_PRIME_IOTBL) && - (spatype & _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ); - ensures (\result == 0x3); - - behavior invalid: - assumes ( - ( - !(xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) && - !(xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ) || - ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) && - !((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_GEEC_PRIME_IOTBL) && - !(spatype & _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ) || - ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) && - !((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_OTHER) - ) || - ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_OTHER) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ) - ); - ensures (\result == 0x0); - - complete behaviors; - disjoint behaviors; -@*/ - -uint64_t gp_s2_setupmpgtblug_getflags(uint32_t slabid, uint32_t spa, uint32_t spatype){ - uint64_t flags=0; - - if(xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST){ - //code=rx, data,stack,dmadata,mmio=rw; - //other slabs = no mapping; other region = no mapping -#if 1 - if((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_OTHER){ - - if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE){ - flags = 0x5; - }else if ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO){ - flags = 0x3; - }else{ - flags = 0; - } - - }else{ - flags=0; - } -#else - flags = 0x7; -#endif - - }else if (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST){ - //code,data,stack,dmadata,mmio=rwx; - //other slabs = no mapping; other region = no mapping - if((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) && (spatype & 0x0000000FUL) != _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - flags = 0x7; - else if ((spatype & _SLAB_SPATYPE_SLAB_DEVICEMMIO)) - flags = 0x3; - else - flags = 0; - - }else{ - flags = 0; - } - - return flags; - -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_getmtype.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_getmtype.c deleted file mode 100644 index fd5d397308..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_getmtype.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//---get memory type for a given physical page address-------------------------- -// -//11.11.4.1 MTRR Precedences -// 0. if MTRRs are not enabled --> MTRR_TYPE_UC -// if enabled then - //if physaddr < 1MB use fixed MTRR ranges return type - //else if within a valid variable range MTRR then - //if a single match, return type - //if two or more and one is UC, return UC - //if two or more and WB and WT, return WT - //else invalid combination - //else - // return default memory type -// - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; -uint64_t p_pagebaseaddr; - -void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - p_pagebaseaddr = framac_nondetu32interval(0, 0xFFFFFFFFUL); - gp_s2_setupmpgtblug_getmtype(p_pagebaseaddr); - - //@assert xmhfhwm_cpu_state == CPU_STATE_RUNNING || xmhfhwm_cpu_state == CPU_STATE_HALT; - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -uint32_t gp_s2_setupmpgtblug_getmtype(uint64_t pagebaseaddr){ - int i; - uint32_t prev_type= MTRR_TYPE_RESV; - - //check if page base address under 1M, if so used FIXED MTRRs - if(pagebaseaddr < (1024*1024)){ - for(i=0; i < MAX_FIXED_MEMORYTYPE_ENTRIES; i++){ - if( pagebaseaddr >= _vmx_ept_memorytypes[i].startaddr && (pagebaseaddr+PAGE_SIZE_4K-1) <= _vmx_ept_memorytypes[i].endaddr ) - return _vmx_ept_memorytypes[i].type; - } - - _XDPRINTF_("\n%s: endaddr < 1M and unmatched fixed MTRR. Halt!", __func__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //page base address is above 1M, use VARIABLE MTRRs - for(i= MAX_FIXED_MEMORYTYPE_ENTRIES; i < MAX_MEMORYTYPE_ENTRIES; i++){ - if( pagebaseaddr >= _vmx_ept_memorytypes[i].startaddr && (pagebaseaddr+PAGE_SIZE_4K-1) <= _vmx_ept_memorytypes[i].endaddr && - (!_vmx_ept_memorytypes[i].invalid) ){ - if(_vmx_ept_memorytypes[i].type == MTRR_TYPE_UC){ - prev_type = MTRR_TYPE_UC; - }else if(_vmx_ept_memorytypes[i].type == MTRR_TYPE_WT && prev_type != MTRR_TYPE_UC){ - prev_type = MTRR_TYPE_WT; - }else{ - if(prev_type != MTRR_TYPE_UC && prev_type != MTRR_TYPE_WT){ - if(prev_type == MTRR_TYPE_RESV){ - prev_type = _vmx_ept_memorytypes[i].type; - }else{ - if(!(prev_type == _vmx_ept_memorytypes[i].type)){ - _XDPRINTF_("%s:%u MTRR type/range unhandled. Halting!\n", - __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - } - } - } - } - } - - if(prev_type == MTRR_TYPE_RESV) - prev_type = MTRR_TYPE_WB; //todo: need to dynamically get the default MTRR (usually WB) - - if(prev_type != MTRR_TYPE_UC) - prev_type = MTRR_TYPE_WB; - - return prev_type; -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_rg.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_rg.c deleted file mode 100644 index 0302e2ff9a..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblug_rg.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - - -//setup unverified rich guest (ug_rg) slab memory page tables -//@ghost bool gp_s2_setupmpgtblug_rg_invokedmemorytype[1024*1024]; -//@ghost uint64_t gp_s2_setupmpgtblug_rg_invokedflags[1024*1024]; -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - assigns gp_s2_setupmpgtblug_rg_invokedmemorytype[0..((1024*1024)-1)]; - assigns gp_s2_setupmpgtblug_rg_invokedflags[0..((1024*1024)-1)]; -@*/ -void gp_s2_setupmpgtblug_rg(uint32_t slabid){ - uint64_t flags; - uint32_t spatype; - uint32_t memorytype; - uint32_t i; - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = 0; //XXX: fixme, need to plug in BSP cpuid - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL; - spl.in_out_params[0] = slabid; - - //@assert (spl.src_slabid == XMHFGEEC_SLAB_GEEC_PRIME); - //@assert (spl.dst_slabid == XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL); - //@assert (spl.dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL); - //@assert (spl.in_out_params[0] == slabid); - XMHF_SLAB_CALLNEW(&spl); - - - /*@ - loop invariant d1: 0 <= i <= (1024*1024); - loop invariant d2: \forall integer x; 0 <= x < i ==> (gp_s2_setupmpgtblug_rg_invokedmemorytype[x] == true); - loop invariant d3: \forall integer x; 0 <= x < i ==> (gp_s2_setupmpgtblug_rg_invokedflags[x] == true); - loop assigns i; - loop assigns memorytype; - loop assigns spatype; - loop assigns flags; - loop assigns gp_s2_setupmpgtblug_rg_invokedmemorytype[0..((1024*1024)-1)]; - loop assigns gp_s2_setupmpgtblug_rg_invokedflags[0..((1024*1024)-1)]; - loop assigns spl.in_out_params[0..4]; - loop assigns spl.dst_uapifn; - //loop assigns memorytype_mask; - loop variant (1024*1024) - i; - @*/ - for(i=0; i < (1024*1024); i++){ - memorytype = gp_s2_setupmpgtblug_getmtype((uint64_t)(i*PAGE_SIZE_4K)); - //@ghost gp_s2_setupmpgtblug_rg_invokedmemorytype[i] = true; - - spatype = gp_s2_setupmpgtbl_getspatype(slabid, (uint32_t)(i*PAGE_SIZE_4K)); - - flags = gp_s2_setupmpgtblug_getflags(slabid, (uint32_t)(i*PAGE_SIZE_4K), spatype); - //@ghost gp_s2_setupmpgtblug_rg_invokedflags[i] = true; - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - spl.in_out_params[0] = slabid; - spl.in_out_params[1] = (i*PAGE_SIZE_4K); - spl.in_out_params[2] = 0; -#if 1 - spl.in_out_params[3] = (uint32_t) ((i*PAGE_SIZE_4K)) | ((uint32_t)memorytype * 8) | (uint32_t)flags ; //present, UC -#else - spl.in_out_params[3] = (uint32_t) ((i*PAGE_SIZE_4K)) | ((uint32_t)memorytype * 8) | (uint32_t)0x7 ; //present, UC -#endif - spl.in_out_params[4] = 0; - - //@assert (spl.src_slabid == XMHFGEEC_SLAB_GEEC_PRIME); - //@assert (spl.dst_slabid == XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL); - //@assert (spl.dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR); - //@assert (spl.in_out_params[0] == slabid); - //@assert (spl.in_out_params[1] == (i*PAGE_SIZE_4K)); - //@assert (spl.in_out_params[2] == 0); - //@assert (spl.in_out_params[3] == ((uint32_t) ((i*PAGE_SIZE_4K)) | ((uint32_t)memorytype * 8) | (uint32_t)flags)) ; - //@assert (spl.in_out_params[4] == 0); - XMHF_SLAB_CALLNEW(&spl); - } - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh.c deleted file mode 100644 index 8e7a2fe14d..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -//setup unverified hypervisor (uh) slab memory page tables -/*@ - requires XMHFGEEC_UHSLAB_BASE_IDX <= slabid <= XMHFGEEC_UHSLAB_MAX_IDX; - - assigns gp_rwdatahdr.gp_uhslabmempgtbl_lvl4t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][0..(PAE_MAXPTRS_PER_PDPT-1)]; - assigns gp_uhslabmempgtbl_lvl2t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][0..((PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT)-1)]; - - ensures \forall integer x; PAE_PTRS_PER_PDPT <= x < PAE_MAXPTRS_PER_PDPT ==> ( - gp_rwdatahdr.gp_uhslabmempgtbl_lvl4t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][x] == 0 - ); - - ensures \forall integer x; 0 <= x < PAE_PTRS_PER_PDPT ==> ( - gp_rwdatahdr.gp_uhslabmempgtbl_lvl4t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][x] == - (pae_make_pdpe(&gp_uhslabmempgtbl_lvl2t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][x * PAE_PTRS_PER_PDT], (uint64_t)(_PAGE_PRESENT))) - ); - - - ensures \forall integer x; 0 <= x < PAE_PTRS_PER_PDT ==> ( - gp_uhslabmempgtbl_lvl2t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][x] == - (pae_make_pde(&gp_uhslabmempgtbl_lvl1t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][(x * PAE_PTRS_PER_PT)], (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER))) - ); -@*/ -void gp_s2_setupmpgtbluh(uint32_t slabid){ - uint64_t flags; - uint32_t spatype; - uint32_t i, j; - slab_params_t spl; - - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_UHMPGTBL; - spl.cpuid = 0; //XXX: fixme, need to plug in BSP cpuid - spl.dst_uapifn = UAPI_UHMPGTBL_INITMEMPGTBL; - spl.in_out_params[0] = slabid; - - XMHF_SLAB_CALLNEW(&spl); - - - //pts - /*@ - loop invariant a6: 0 <= i <= ((PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT)+0x2); - loop assigns i; - loop assigns spatype; - loop assigns flags; - loop variant ((PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT)+0x2) - i; - @*/ - for(i=0; i < (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT); i++){ - spatype = gp_s2_setupmpgtbl_getspatype(slabid, (uint32_t)(i*PAGE_SIZE_4K)); - flags = gp_s2_setupmpgtbluh_getflags(slabid, (uint32_t)(i*PAGE_SIZE_4K), spatype); - - if(!gp_s2_setupmpgtbluh_setentry(slabid, (slabid - XMHFGEEC_UHSLAB_BASE_IDX), spatype, i, flags)) - i+=2; - } -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh_getflags.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh_getflags.c deleted file mode 100644 index 045eee1751..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh_getflags.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - - behavior othermem: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) - ); - ensures (\result == (uint64_t)(_PAGE_PRESENT | _PAGE_RW)); - - behavior vobjcode: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) - ); - ensures (\result == (_PAGE_PRESENT)); - - behavior vobjdata: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL - ) - ); - ensures (\result == (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX)); - - behavior vobjmmio: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL - ) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ); - ensures (\result == (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_PCD)); - - behavior objcode: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) - ); - ensures (\result == (_PAGE_PRESENT | _PAGE_USER)); - - - - behavior objdata: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL - ) - - ); - ensures (\result == (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_USER)); - - behavior objmmio: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL - ) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ); - ensures (\result == (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_PCD | _PAGE_USER)); - - behavior otheruhobj: - assumes ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) - ); - ensures (\result == (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX)); - - - behavior invalid: - assumes ( - !(xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) || - - ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ) || - - ( - (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL - ) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - ) - - ); - ensures (\result == 0); - - complete behaviors; - disjoint behaviors; -@*/ -uint64_t gp_s2_setupmpgtbluh_getflags(uint32_t slabid, uint32_t spa, uint32_t spatype){ - uint64_t flags=0; - - if(xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG){ - //self slab: code=rx, data,stack,dmadata,mmio=rw, perms=USER - //other slab vft: code=rx, data,stack,dmadata,mmio=rw, perms=SUPER - //SPATYPE_OTHER => rw perms=SUPER - //anything else: mapped rw perms=SUPER - if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER){ - flags = (uint64_t)(_PAGE_PRESENT | _PAGE_RW); - }else{ - if((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG){ - //verified obj - if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE){ - flags = (_PAGE_PRESENT); - }else if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL){ - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX); - }else if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO){ - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_PCD); - }else{ - flags = 0; - } - - }else if((spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL){ - //same object or sentinel - if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE){ - flags = (_PAGE_PRESENT | _PAGE_USER); - }else if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL){ - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_USER); - }else if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO){ - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_PCD | _PAGE_USER); - - }else{ - flags = 0; - } - - }else{ - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX); - } - } - }else{ - flags = 0; - } - - return flags; -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh_setentry.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh_setentry.c deleted file mode 100644 index 360b8be58e..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtbluh_setentry.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include - -uint32_t _setupmpgtbluh_setentry_getiotblbase(uint32_t slabid){ - slab_params_t spl; - uapi_iotbl_getiotblbase_t *ps = (uapi_iotbl_getiotblbase_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_GETIOTBLBASE; - spl.cpuid = 0; //TODO: BSP CPU id - - ps->dst_slabid = slabid; - - XMHF_SLAB_CALLNEW(&spl); - - return ps->iotbl_base; -} - - -void _setupmpgtbluh_setentry_helper(uint32_t slabid, uint32_t ptindex, uint64_t entry){ - slab_params_t spl; - uapi_uhmpgtbl_setentryforpaddr_params_t *p = - (uapi_uhmpgtbl_setentryforpaddr_params_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = UOBJ_UAPI_UHMPGTBL; - spl.dst_uapifn = UAPI_UHMPGTBL_SETENTRYFORPADDR; - - p->dst_slabid = slabid; - p->pa = (ptindex * PAGE_SIZE_4K); - p->entry_lo = (uint32_t) entry; - p->entry_hi = (uint32_t)((uint64_t)entry >> 32); - - XMHF_SLAB_CALLNEW(&spl); -} - -//returns true if entry was mapped unchanged -//returns false if entry belonged to iotbl and was mapped with uobj specific iotbl -//@ghost bool gp_s2_setupmpgtbluh_setentry_halted = false; -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= uhslabmempgtbl_idx < XMHFGEEC_TOTAL_UHSLABS; - requires 0 <= ptindex < (1024*1024); - - behavior mapiotbl: - assumes ( - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_PROG && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_SENTINEL - ) && - (ptindex < ((1024*1024)-3)) - ); - //ensures (gp_uhslabmempgtbl_lvl1t[uhslabmempgtbl_idx][ptindex] == - // (pae_make_pte(0, flags))); - //ensures (gp_uhslabmempgtbl_lvl1t[uhslabmempgtbl_idx][ptindex+1] == - // (pae_make_pte(0+PAGE_SIZE_4K, flags))); - //ensures (gp_uhslabmempgtbl_lvl1t[uhslabmempgtbl_idx][ptindex+2] == - // (pae_make_pte((0+2*PAGE_SIZE_4K), flags))); - ensures (gp_s2_setupmpgtbluh_setentry_halted == false); - ensures (\result == false); - - behavior mapentry: - assumes ( - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_PROG && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_SENTINEL - ) - ); - ensures ( gp_uhslabmempgtbl_lvl1t[uhslabmempgtbl_idx][ptindex] == - (pae_make_pte((ptindex*PAGE_SIZE_4K), flags)) ); - ensures (gp_s2_setupmpgtbluh_setentry_halted == false); - ensures (\result == true); - - behavior invalid: - assumes ( - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_PROG && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_SENTINEL - ) && - !(ptindex < ((1024*1024)-3)) - ); - ensures (gp_s2_setupmpgtbluh_setentry_halted == true); - ensures (\result == false); - - complete behaviors; - disjoint behaviors; - -@*/ -bool gp_s2_setupmpgtbluh_setentry(uint32_t slabid, uint32_t uhslabmempgtbl_idx, uint32_t spatype, uint32_t ptindex, uint64_t flags){ - - - if((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_PROG && - xmhfgeec_slab_info_table[slabid].slabtype != XMHFGEEC_SLABTYPE_VfT_SENTINEL){ - if(ptindex < ((1024*1024)-3)){ - //map unverified slab iotbl instead (12K) - _setupmpgtbluh_setentry_helper(slabid, ptindex, - pae_make_pte(_setupmpgtbluh_setentry_getiotblbase(slabid), flags)); - - _setupmpgtbluh_setentry_helper(slabid, ptindex+1, - pae_make_pte(_setupmpgtbluh_setentry_getiotblbase(slabid)+PAGE_SIZE_4K, flags)); - - _setupmpgtbluh_setentry_helper(slabid, ptindex+2, - pae_make_pte(_setupmpgtbluh_setentry_getiotblbase(slabid)+(2*PAGE_SIZE_4K), flags)); - - - //@ghost gp_s2_setupmpgtbluh_setentry_halted = false; - return false; - }else{ - _XDPRINTF_("%s:%u Invalid IOTBL mapping index. Halting!\n", __func__, __LINE__); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - //@ghost gp_s2_setupmpgtbluh_setentry_halted = true; - return false; - } - }else{ - - _setupmpgtbluh_setentry_helper(slabid, ptindex, - pae_make_pte((ptindex*PAGE_SIZE_4K), flags)); - - //@ghost gp_s2_setupmpgtbluh_setentry_halted = false; - return true; - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblv.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblv.c deleted file mode 100644 index 00556bbd32..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblv.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//@ghost uint64_t gflags[PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; -/*@ - assigns gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[0..(PAGE_SIZE_4K-1)]; - assigns gp_vhslabmempgtbl_lvl2t[0..(PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT)-1]; - assigns gp_vhslabmempgtbl_lvl1t[0..(PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT)-1]; - assigns gflags[0..(PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT)-1]; - - - ensures (\forall uint32_t x; PAE_PTRS_PER_PDPT <= x < PAE_MAXPTRS_PER_PDPT ==> - ( ((uint64_t)gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[x] ) == 0 ) - ); - - ensures (\forall uint32_t x; 0 <= x < PAE_PTRS_PER_PDPT ==> - ( ((uint64_t)gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[x] ) == ( ((uint64_t)(&gp_vhslabmempgtbl_lvl2t[x * PAE_PTRS_PER_PDT]) & 0x7FFFFFFFFFFFF000ULL ) | (uint64_t)(_PAGE_PRESENT)) ) - ); - ensures (\forall uint32_t x; 0 <= x < PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT ==> - ( ( (uint64_t)gp_vhslabmempgtbl_lvl2t[x] ) == ( ((uint64_t)(&gp_vhslabmempgtbl_lvl1t[(x * PAE_PTRS_PER_PT)]) & 0x7FFFFFFFFFFFF000ULL ) | (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER)) ) - ); - ensures (\forall uint32_t x; 0 <= x < (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT) ==> - ( (uint64_t)gp_vhslabmempgtbl_lvl1t[x] == ( ((uint64_t)(x * PAGE_SIZE_4K) & 0x7FFFFFFFFFFFF000ULL ) | (uint64_t)(gflags[x]) ) ) - ); -@*/ -void gp_s2_setupmpgtblv(void){ - uint32_t i; - uint64_t flags=0; - uint32_t spatype=0; - uint32_t slabid = XMHFGEEC_SLAB_GEEC_PRIME; - - - //zero out pdpt - /*@ - loop invariant a0: 0 <= i <= PAE_MAXPTRS_PER_PDPT; - loop invariant a01: \forall integer x; 0 <= x < i ==> ( - gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[x] == 0 - ); - loop assigns gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[0..(PAE_MAXPTRS_PER_PDPT-1)]; - loop assigns i; - loop variant PAE_MAXPTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_MAXPTRS_PER_PDPT; i++){ - gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[i] = 0; - } - - - /*@ - loop invariant a1: 0 <= i <= PAE_PTRS_PER_PDPT; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( (uint64_t)gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[x] ) == ( ((uint64_t)(&gp_vhslabmempgtbl_lvl2t[x * PAE_PTRS_PER_PDT]) & 0x7FFFFFFFFFFFF000ULL ) | ((uint64_t)(_PAGE_PRESENT))); - loop assigns gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[0..(PAE_PTRS_PER_PDPT-1)], i; - loop variant PAE_PTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_PTRS_PER_PDPT; i++){ - gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t[i] = - pae_make_pdpe(&gp_vhslabmempgtbl_lvl2t[i * PAE_PTRS_PER_PDT], (uint64_t)(_PAGE_PRESENT)); - } - - - - //pdt setup - /*@ - loop invariant a3: 0 <= i <= (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT); - loop invariant a4: \forall integer x; 0 <= x < i ==> (( (uint64_t)gp_vhslabmempgtbl_lvl2t[x] ) == ( ((uint64_t)(&gp_vhslabmempgtbl_lvl1t[(x * PAE_PTRS_PER_PT)]) & 0x7FFFFFFFFFFFF000ULL ) | ((uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER)))); - loop assigns i, gp_vhslabmempgtbl_lvl2t[0..(PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT)]; - loop variant (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT) - i; - @*/ - for(i=0; i < PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT; i++){ - gp_vhslabmempgtbl_lvl2t[i] = - pae_make_pde(&gp_vhslabmempgtbl_lvl1t[(i * PAE_PTRS_PER_PT)], (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER)); - } - - - - //pt setup - /*@ loop invariant a5: 0 <= i <= (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT); - loop assigns gflags[0..(PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT)], spatype, flags, i, gp_vhslabmempgtbl_lvl1t[0..(PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT)]; - loop invariant a6: \forall integer x; 0 <= x < i ==> ( (uint64_t)gp_vhslabmempgtbl_lvl1t[x]) == ( ((uint64_t)(x * PAGE_SIZE_4K) & 0x7FFFFFFFFFFFF000ULL ) | (uint64_t)(gflags[x]) ); - loop variant (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT) - i; - @*/ - for(i=0; i < (PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT); ++i){ - spatype = gp_s2_setupmpgtbl_getspatype(slabid, (uint32_t)(i * PAGE_SIZE_4K)); - - flags = gp_s2_setupmpgtblv_getflags(slabid, (uint32_t)(i * PAGE_SIZE_4K), spatype); - //@ghost gflags[i] = flags; - - gp_vhslabmempgtbl_lvl1t[i] = pae_make_pte( (i*PAGE_SIZE_4K), flags); - } - - - _XDPRINTF_("%s: populated verified slabs' memory page tables\n", __func__); - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblv_getflags.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblv_getflags.c deleted file mode 100644 index d187c872e7..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setupmpgtblv_getflags.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - assigns \nothing; - behavior memsys: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) - ); - ensures (\result == (uint64_t)(_PAGE_PRESENT | _PAGE_RW) ); - - behavior memcode: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) && - ( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE ) - ); - ensures (\result == (uint64_t)(_PAGE_PRESENT) ); - - behavior memdatastackdmadataiotbl: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) && - !( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE ) && - ( ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - ) - ); - ensures (\result == (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_NX) ); - - behavior memdevice: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) && - !( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE ) && - !( ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - ) && - ( ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) ) - ); - ensures (\result == (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_PCD) ); - - behavior memotheruvslab: - assumes ( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) - ); - ensures (\result == (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_NX) ); - - behavior error: - assumes !( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) - ); - assumes !( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) && - ( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE ) - ); - assumes !( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) && - !( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE ) && - ( ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - ) - ); - assumes !( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - ( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) && - !( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE ) && - !( ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA) || - ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - ) && - ( ((spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) ) - ); - assumes !( (xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG) && - !((spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER) && - !( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG) || - ((spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL) ) - ); - ensures (\result == 0); - - complete behaviors; - disjoint behaviors; - - -@*/ -uint64_t gp_s2_setupmpgtblv_getflags(uint32_t slabid, uint32_t spa, uint32_t spatype){ - uint64_t flags=0; - - - if( xmhfgeec_slab_info_table[slabid].slabtype == XMHFGEEC_SLABTYPE_VfT_PROG){ - - //self slab: code=rx, data,stack,dmadata,mmio=rw, perms=SUPER - //other slab vft: code=rx, data,stack,dmadata,mmio=rw, perms=SUPER - //SPATYPE_OTHER => rw perms=SUPER - //anything else: mapped rw perms=SUPER - if( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_OTHER){ - flags = (uint64_t)(_PAGE_PRESENT | _PAGE_RW); - }else{ - if( (spatype & _SLAB_SPATYPE_MASK_SAMESLAB) || (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_PROG || - (spatype & 0x000000F0UL) == XMHFGEEC_SLABTYPE_VfT_SENTINEL){ - if( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_CODE) - flags = (_PAGE_PRESENT); - else if( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_STACK || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DMADATA || - (spatype & 0x0000000FUL) == _SLAB_SPATYPE_GEEC_PRIME_IOTBL) - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX); - else if ( (spatype & 0x0000000FUL) == _SLAB_SPATYPE_SLAB_DEVICEMMIO) - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX | _PAGE_PCD); - }else{ - flags = (_PAGE_PRESENT | _PAGE_RW | _PAGE_NX); - } - - } - - } - - return flags; -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setuptss.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setuptss.c deleted file mode 100644 index 29a4abe23b..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setuptss.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//initialize TSS -//@ghost bool gp_s2_setuptss_invokehelper[MAX_PLATFORM_CPUS]; -/*@ - requires \valid(xcbootinfo); - requires (xcbootinfo->cpuinfo_numentries < MAX_PLATFORM_CPUS); - ensures \forall integer x; 0 <= x < xcbootinfo->cpuinfo_numentries ==> ( - (xcbootinfo->cpuinfo_buffer[x].lapic_id < MAX_PLATFORM_CPUS) ==> - (gp_s2_setuptss_invokehelper[x] == true) ); -@*/ -void gp_s2_setuptss(void){ - uint32_t i; - - //initialize TSS descriptors for all CPUs - /*@ - loop invariant a1: 0 <= i <= xcbootinfo->cpuinfo_numentries; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( - (xcbootinfo->cpuinfo_buffer[x].lapic_id < MAX_PLATFORM_CPUS) ==> - (gp_s2_setuptss_invokehelper[x] == true) - ); - loop assigns gp_s2_setuptss_invokehelper[0..(xcbootinfo->cpuinfo_numentries-1)]; - loop assigns i; - loop variant xcbootinfo->cpuinfo_numentries - i; - @*/ - for(i=0; i < xcbootinfo->cpuinfo_numentries; i++){ - if(xcbootinfo->cpuinfo_buffer[i].lapic_id < MAX_PLATFORM_CPUS){ - gp_s2_setuptss_inittss(xcbootinfo->cpuinfo_buffer[i].lapic_id); - //@ghost gp_s2_setuptss_invokehelper[i] = true; - } - } -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setuptssinittss.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setuptssinittss.c deleted file mode 100644 index 3ff2b793a2..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s2_setuptssinittss.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -/*@ - requires 0 <= tssidx < MAX_PLATFORM_CPUS; - assigns __xmhfhic_x86vmx_tss[tssidx].tss_mainblock[0..(PAGE_SIZE_4K-1)]; - assigns __xmhfhic_x86vmx_tss[tssidx].tss_iobitmap[0..((3*PAGE_SIZE_4K)-1)]; - ensures (((tss_t *)__xmhfhic_x86vmx_tss[tssidx].tss_mainblock)->esp0 == - (uint32_t) ( &__xmhfhic_x86vmx_tss_stack[tssidx] + sizeof(__xmhfhic_x86vmx_tss_stack[0]) ) - ); - ensures (((tss_t *)__xmhfhic_x86vmx_tss[tssidx].tss_mainblock)->ss0 == __DS_CPL0); - ensures (((tss_t *)__xmhfhic_x86vmx_tss[tssidx].tss_mainblock)->iotbl_addr == PAGE_SIZE_4K); -@*/ -void gp_s2_setuptss_inittss(uint32_t tssidx){ - tss_t *tss= (tss_t *)__xmhfhic_x86vmx_tss[tssidx].tss_mainblock; - - memset(&__xmhfhic_x86vmx_tss[tssidx].tss_mainblock, 0, PAGE_SIZE_4K); - memset(&__xmhfhic_x86vmx_tss[tssidx].tss_iobitmap, 0, (3*PAGE_SIZE_4K)); - - tss->esp0 = (uint32_t) ( &__xmhfhic_x86vmx_tss_stack[tssidx] + sizeof(__xmhfhic_x86vmx_tss_stack[0]) ); - tss->ss0 = __DS_CPL0; - tss->iotbl_addr = PAGE_SIZE_4K; - - _XDPRINTF_("%s: tssidx=%u, iotbl_addr=%x\n", __func__, tssidx, - tss->iotbl_addr); -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s3_entry.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s3_entry.c deleted file mode 100644 index 5d10d970a2..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s3_entry.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -//@ghost bool gp_s3_entry_invoked_writecr3 = false; -//@ghost bool gp_s3_entry_invoked_savemtrrs = false; -//@ghost bool gp_s3_entry_invoked_restoremtrrs = false; -//@ghost bool gp_s3_entry_invoked_startcores = false; -//@ghost bool gp_s3_entry_invoked_gp_s5_entry = false; -/*@ - requires 0 <= sinit2mle_mtrrs.num_var_mtrrs < MAX_VARIABLE_MTRRS; - ensures gp_s3_entry_invoked_writecr3 == true; - ensures gp_s3_entry_invoked_savemtrrs == true; - ensures gp_s3_entry_invoked_restoremtrrs == true; - ensures gp_s3_entry_invoked_startcores == true; - ensures gp_s3_entry_invoked_gp_s5_entry == true; -@*/ -void gp_s3_entry(void){ - - //switch to verified object page tables - CASM_FUNCCALL(write_cr3,(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - //@ghost gp_s3_entry_invoked_writecr3 = true; - - //save cpu MTRR state which we will later replicate on all APs - //@assert gp_s3_entry_invoked_writecr3 == true; - xmhfhw_cpu_x86_save_mtrrs(&_mtrrs); - //@ghost gp_s3_entry_invoked_savemtrrs = true; - - //restore SINIT to MLE MTRR mappings - //@assert gp_s3_entry_invoked_writecr3 == true; - //@assert gp_s3_entry_invoked_savemtrrs == true; - xmhfhw_cpu_x86_restore_mtrrs(&sinit2mle_mtrrs); - //@ghost gp_s3_entry_invoked_restoremtrrs = true; - - //start all cores - //@assert gp_s3_entry_invoked_writecr3 == true; - //@assert gp_s3_entry_invoked_savemtrrs == true; - //@assert gp_s3_entry_invoked_restoremtrrs == true; - gp_s3_startcores(); - //@ghost gp_s3_entry_invoked_startcores = true; - - //move on to state-5 - //@assert gp_s3_entry_invoked_writecr3 == true; - //@assert gp_s3_entry_invoked_savemtrrs == true; - //@assert gp_s3_entry_invoked_restoremtrrs == true; - //@assert gp_s3_entry_invoked_startcores == true; - gp_s5_entry(); - //@ghost gp_s3_entry_invoked_gp_s5_entry = true; - -} - - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s3_startcores.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s3_startcores.c deleted file mode 100644 index 3908bb6af4..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s3_startcores.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) - uint32_t check_esp, check_eip = CASM_RET_EIP; - - void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; - } - - void xmhfhwm_vdriver_cpu_writecr3(uint32_t oldval, uint32_t newval){ - //@assert 0; - } - - void xmhfhwm_vdriver_txt_write_rlp_wakeup_addr(uint32_t oldval, uint32_t newval){ - x86smp_apbootstrapdata_t *apdata = (x86smp_apbootstrapdata_t *)&xmhfhwm_mem_region_apbootstrap_dataseg; - - if(newval != 0){ - //@assert (xmhfhwm_txt_mle_join_hi == 0); - //@assert (xmhfhwm_txt_mle_join_lo == ((uint32_t)(X86SMP_APBOOTSTRAP_DATASEG << 4) + 16)); - //@assert (apdata->ap_eip == (X86SMP_APBOOTSTRAP_CODESEG << 4)); - } - } - - void xmhfhwm_vdriver_mem_copy_to_apbootstrap_codeseg(uint32_t sourceaddr){ - //@assert (sourceaddr == (uint32_t)&gp_s4_entry); - } - - void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_s3_startcores(); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; - } -#endif // __XMHF_VERIFICATION__ - -//start all cores -void gp_s3_startcores(void){ - txt_heap_t *txt_heap; - mle_join_t *mle_join; - sinit_mle_data_t sinit_mle_data; - os_sinit_data_t os_sinit_data; - - //populate apdata structure - apdata.ap_cr3 = CASM_FUNCCALL(read_cr3,CASM_NOPARAM); - apdata.ap_cr4 = CASM_FUNCCALL(read_cr4,CASM_NOPARAM); - apdata.ap_entrypoint = (uint32_t)&gp_s4_apstacks; - apdata.ap_gdtdesc_limit = sizeof(apdata.ap_gdt) - 1; - apdata.ap_gdtdesc_base = (X86SMP_APBOOTSTRAP_DATASEG << 4) + 48; - apdata.ap_cs_selector = __CS_CPL0; - apdata.ap_eip = (X86SMP_APBOOTSTRAP_CODESEG << 4); - apdata.ap_gdt[0] = 0x0000000000000000ULL; - apdata.ap_gdt[1] = 0x00cf9a000000ffffULL; - apdata.ap_gdt[2] = 0x00cf92000000ffffULL; - - //_XDPRINTF_("%s: sizeof(apdata)=%u bytes\n", __func__, sizeof(apdata)); - //_XDPRINTF_(" apdata.ap_gdtdesc_limit at %08x\n", &apdata.ap_gdtdesc_limit); - //_XDPRINTF_(" apdata.ap_gdt at %08x\n", &apdata.ap_gdt); - - //copy apdata to X86SMP_APBOOTSTRAP_DATASEG - CASM_FUNCCALL(xmhfhw_sysmem_copy_obj2sys, (uint32_t)(X86SMP_APBOOTSTRAP_DATASEG << 4), - (void *)&apdata, sizeof(apdata)); - - //copy AP entry code to X86SMP_APBOOTSTRAP_CODESEG - CASM_FUNCCALL(xmhfhw_sysmem_copy_obj2sys, (uint32_t)(X86SMP_APBOOTSTRAP_CODESEG << 4), - (void *)&gp_s4_entry, PAGE_SIZE_4K); - - - //grab sinit2mle and os2sinit data structures from TXT heap - txt_heap = get_txt_heap(); - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, &sinit_mle_data, - get_sinit_mle_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(sinit_mle_data_t)); - - CASM_FUNCCALL(xmhfhw_sysmem_copy_sys2obj, &os_sinit_data, - get_os_sinit_data_start(txt_heap, (uint32_t)read_pub_config_reg(TXTCR_HEAP_SIZE)), - sizeof(os_sinit_data_t)); - - - // enable SMIs on BSP before waking APs (which will enable them on APs) - // because some SMM may take immediate SMI and hang if AP gets in first - //_XDPRINTF_("Enabling SMIs on BSP\n"); - //__getsec_smctrl(); - - //get a pointer to the mle_join data structure within apdata - mle_join = (mle_join_t *)((uint32_t)(X86SMP_APBOOTSTRAP_DATASEG << 4) + 16); - - _XDPRINTF_("\nBSP: mle_join.gdt_limit = %x", mle_join->gdt_limit); - _XDPRINTF_("\nBSP: mle_join.gdt_base = %x", mle_join->gdt_base); - _XDPRINTF_("\nBSP: mle_join.seg_sel = %x", mle_join->seg_sel); - _XDPRINTF_("\nBSP: mle_join.entry_point = %x", mle_join->entry_point); - - //populate TXT MLE_JOIN register - write_priv_config_reg(TXTCR_MLE_JOIN, (uint64_t)(unsigned long)mle_join); - - - //wakeup APs - if (os_sinit_data.capabilities & TXT_CAPS_T_RLP_WAKE_MONITOR) { - _XDPRINTF_("BSP: joining RLPs to MLE with MONITOR wakeup\n"); - _XDPRINTF_("BSP: rlp_wakeup_addr=0x%08x\n", sinit_mle_data.rlp_wakeup_addr); - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu32, sinit_mle_data.rlp_wakeup_addr, 0x01); - }else { - _XDPRINTF_("BSP: joining RLPs to MLE with GETSEC[WAKEUP]\n"); - __getsec_wakeup(); - _XDPRINTF_("BSP: GETSEC[WAKEUP] completed\n"); - } - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s4_apstacks.cS b/uxmhf/xmhf-uobjs/geec_prime/gp_s4_apstacks.cS deleted file mode 100644 index 64851dd73d..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s4_apstacks.cS +++ /dev/null @@ -1,154 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -// GEEC prime SMP assembly language code blobs -// author: amit vasudevan (amitvasudevan@acm.org) - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) - x86smp_apbootstrapdata_t *apdptr = (x86smp_apbootstrapdata_t *)&xmhfhwm_mem_region_apbootstrap_dataseg; - bool invoked_gp_s5_entry = false; - - void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - } - - void xmhfhwm_vdriver_cpu_writecr3(uint32_t oldval, uint32_t newval){ - //@assert (newval ==(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - } - - void xmhfhwm_vdriver_smpcommon(void){ - invoked_gp_s5_entry = true; - //@assert (xmhfhwm_cpu_es_selector == 0x8); - //@assert (xmhfhwm_cpu_fs_selector == 0x8); - //@assert (xmhfhwm_cpu_gs_selector == 0x8); - //@assert (xmhfhwm_cpu_ss_selector == 0x8); - //@assert (xmhfhwm_cpu_cr4 == 0x30); - //@assert (xmhfhwm_cpu_cr3 ==(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - //@assert (xmhfhwm_cpu_msr_efer & 0x800); - //@assert (xmhfhwm_cpu_cr0 == 0x80000015); - //@assert (xmhfhwm_cpu_msr_apic_base == MMIO_APIC_BASE); - } - - void main(void){ - uint32_t i; - - //execute harness - for(i=0; i < (MAX_PLATFORM_CPUS-1); i++){ - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_ds_selector = 0x8; - xmhfhwm_cpu_cr4 = 0; - xmhfhwm_cpu_gprs_ebx = (uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t; - xmhfhwm_lapic_reg_id = i << 24; - CASM_FUNCCALL(gp_s4_apstacks, CASM_NOPARAM); - //@assert (invoked_gp_s5_entry == true); - //@assert (xmhfhwm_cpu_gprs_esp == ((uint32_t)&_init_cpustacks[i+1][8])); - } - } -#endif - - -CASM_FUNCDEF(void, gp_s4_apstacks, -{ - xmhfhwm_cpu_insn_movw_ds_ax(); - xmhfhwm_cpu_insn_movw_ax_es(); - xmhfhwm_cpu_insn_movw_ax_fs(); - xmhfhwm_cpu_insn_movw_ax_gs(); - xmhfhwm_cpu_insn_movw_ax_ss(); - - xmhfhwm_cpu_insn_movl_cr4_eax(); - xmhfhwm_cpu_insn_orl_imm_eax(0x00000030); - xmhfhwm_cpu_insn_movl_eax_cr4(); - - - xmhfhwm_cpu_insn_movl_ebx_cr3(); - - - xmhfhwm_cpu_insn_movl_imm_ecx(0xc0000080); - xmhfhwm_cpu_insn_rdmsr(); - xmhfhwm_cpu_insn_orl_imm_eax(0x00000800); - xmhfhwm_cpu_insn_wrmsr(); - - - xmhfhwm_cpu_insn_movl_cr0_eax(); - xmhfhwm_cpu_insn_orl_imm_eax(0x80000015); - xmhfhwm_cpu_insn_movl_eax_cr0(); - - //TODO: for non-TXT wakeup we need to reload GDT - //"movl %1, %esi \r\n"); - //"lgdt (%esi) \r\n"); - - xmhfhwm_cpu_insn_movl_imm_ecx(0x0000001B); - xmhfhwm_cpu_insn_rdmsr(); - xmhfhwm_cpu_insn_andl_imm_eax(0x00000FFF); - xmhfhwm_cpu_insn_orl_imm_eax(0xFEE00000); - xmhfhwm_cpu_insn_wrmsr(); - - - xmhfhwm_cpu_insn_xorl_eax_eax(); - xmhfhwm_cpu_insn_movl_imm_esi(0xFEE00020); - xmhfhwm_cpu_insn_movl_mesi_eax(0x0); - xmhfhwm_cpu_insn_shr_imm_eax(24); //eax = lapic id (0-255) - - - xmhfhwm_cpu_insn_movl_imm_ecx(16384); - xmhfhwm_cpu_insn_xorl_edx_edx(); - xmhfhwm_cpu_insn_mull_ecx(); - xmhfhwm_cpu_insn_addl_ecx_eax(); - xmhfhwm_cpu_insn_movl_imm_esp(_init_cpustacks); - xmhfhwm_cpu_insn_addl_eax_esp(); - - xmhfhwm_cpu_insn_jmpsmpcommon(); - xmhfhwm_cpu_insn_ret(); -}, -void *noparam) - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s4_entry.cS b/uxmhf/xmhf-uobjs/geec_prime/gp_s4_entry.cS deleted file mode 100644 index efc3eaef7d..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s4_entry.cS +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include -#include - - -// GEEC prime SMP assembly language code blobs -// author: amit vasudevan (amitvasudevan@acm.org) - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) - uint32_t check_esp, check_eip = CASM_RET_EIP; - x86smp_apbootstrapdata_t *apdptr = (x86smp_apbootstrapdata_t *)&xmhfhwm_mem_region_apbootstrap_dataseg; - - void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; - } - - void xmhfhwm_vdriver_cpu_writecr3(uint32_t oldval, uint32_t newval){ - //@assert (newval ==(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - } - - void xmhfhwm_vdriver_apentry(void){ - //@assert (xmhfhwm_cpu_gprs_eax == (uint32_t)&gp_s4_apstacks); - //@assert (xmhfhwm_cpu_gprs_ebx == 0xDEADBEEF); - //@assert (xmhfhwm_cpu_gprs_edi == 0); - } - - void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - apdptr->ap_cr3 = 0xDEADBEEF; - apdptr->ap_entrypoint = (uint32_t)&gp_s4_apstacks; - apdptr->cpuidtable = 0; - - CASM_FUNCCALL(gp_s4_entry, CASM_NOPARAM); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; - } - -#endif - - - -CASM_FUNCDEF(void, gp_s4_entry, -{ - xmhfhwm_cpu_insn_movw_imm_ax(__DS_CPL0); - xmhfhwm_cpu_insn_movw_ax_ds(); - - xmhfhwm_cpu_insn_movl_imm_esi(((X86SMP_APBOOTSTRAP_DATASEG << 4) + 32)) - xmhfhwm_cpu_insn_movl_mesi_eax(0x0); - xmhfhwm_cpu_insn_movl_eax_edi(); - - xmhfhwm_cpu_insn_movl_imm_esi(((X86SMP_APBOOTSTRAP_DATASEG << 4) + 0)); - xmhfhwm_cpu_insn_movl_mesi_eax(0x0); - xmhfhwm_cpu_insn_movl_eax_ebx(); - - xmhfhwm_cpu_insn_movl_imm_esi(((X86SMP_APBOOTSTRAP_DATASEG << 4) + 8)); - xmhfhwm_cpu_insn_movl_mesi_eax(0x0); - - xmhfhwm_cpu_insn_jmpapentry(); - - xmhfhwm_cpu_insn_ret(); - CASM_BALIGN(4096); -}, -void *noparam) - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s5_entry.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s5_entry.c deleted file mode 100644 index 67293d8418..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s5_entry.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - - -//we enter here with SMP enabled -//@ghost bool gp_s5_entry_invokedisbsp = false; -//@ghost bool gp_s5_entry_invokedgetcpulapicid = false; -//@ghost bool gp_s5_entry_invokedspinlock = false; -//@ghost bool gp_s5_entry_invokedsetupcpustate = false; -//@ghost bool gp_s5_entry_invokedspinunlock = false; -//@ghost bool gp_s5_entry_invokedstrt = false; -/*@ - ensures (gp_s5_entry_invokedisbsp == true); - ensures (gp_s5_entry_invokedgetcpulapicid == true); - ensures (gp_s5_entry_invokedspinlock == true); - ensures (gp_s5_entry_invokedsetupcpustate == true); - ensures (gp_s5_entry_invokedspinunlock == true); - ensures (gp_s5_entry_invokedstrt == true); -@*/ -void gp_s5_entry(void){ - uint32_t cpuid; - bool isbsp; - #if defined (__DEBUG_SERIAL__) - static volatile uint32_t cpucount=0; - #endif //__DEBUG_SERIAL__ - - isbsp = xmhfhw_lapic_isbsp(); - //@ghost gp_s5_entry_invokedisbsp = true; - - //@assert gp_s5_entry_invokedisbsp == true; - cpuid = xmhf_baseplatform_arch_x86_getcpulapicid(); - //@ghost gp_s5_entry_invokedgetcpulapicid = true; - - //@assert gp_s5_entry_invokedisbsp == true; - //@assert gp_s5_entry_invokedgetcpulapicid == true; - CASM_FUNCCALL(spin_lock,&gp_state4_smplock); - //@ghost gp_s5_entry_invokedspinlock = true; - - _XDPRINTF_("%s[%u]: ESP=%08x\n", __func__, (uint16_t)cpuid, CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - //@assert gp_s5_entry_invokedisbsp == true; - //@assert gp_s5_entry_invokedgetcpulapicid == true; - //@assert gp_s5_entry_invokedspinlock == true; - gp_s5_setupcpustate((uint16_t)cpuid, isbsp); - //@ghost gp_s5_entry_invokedsetupcpustate = true; - - #if defined (__DEBUG_SERIAL__) - cpucount++; - #endif //__DEBUG_SERIAL__ - - //@assert gp_s5_entry_invokedisbsp == true; - //@assert gp_s5_entry_invokedgetcpulapicid == true; - //@assert gp_s5_entry_invokedspinlock == true; - //@assert gp_s5_entry_invokedsetupcpustate == true; - CASM_FUNCCALL(spin_unlock,&gp_state4_smplock); - //@ghost gp_s5_entry_invokedspinunlock = true; - - #if defined (__DEBUG_SERIAL__) - while(cpucount < __XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS__); - #endif //__DEBUG_SERIAL__ - - //@assert gp_s5_entry_invokedisbsp == true; - //@assert gp_s5_entry_invokedgetcpulapicid == true; - //@assert gp_s5_entry_invokedspinlock == true; - //@assert gp_s5_entry_invokedsetupcpustate == true; - //@assert gp_s5_entry_invokedspinunlock == true; - gp_s5_invokestrt(cpuid); - //@ghost gp_s5_entry_invokedstrt = true; - -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s5_invokestrt.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s5_invokestrt.c deleted file mode 100644 index 611b79629a..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s5_invokestrt.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) - uint32_t check_esp, check_eip = CASM_RET_EIP; - bool gp_s5_entry_invoked = false; - - void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; - } - - void xmhfhwm_vdriver_cpu_writecr3(uint32_t oldval, uint32_t newval){ - //@assert (newval ==(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - } - - void __slab_callsentinel(slab_params_t *sp){ - //@assert (sp->src_slabid == XMHFGEEC_SLAB_GEEC_PRIME); - //@assert (sp->dst_slabid == XMHFGEEC_SLAB_XC_INIT); - //@assert (sp->cpuid >=0 && sp->cpuid <= 255); - //@assert (xmhfhwm_cpu_state == CPU_STATE_RUNNING); - } - - void main(void){ - uint32_t cpuid = framac_nondetu32interval(0, 255); - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - gp_s5_invokestrt(cpuid); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; - } - -#endif - -void gp_s5_invokestrt(uint32_t cpuid){ - slab_params_t sp; - - memset(&sp, 0, sizeof(sp)); - sp.cpuid = cpuid; - sp.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - sp.dst_slabid = XMHFGEEC_SLAB_XC_INIT; - sp.in_out_params[0] = xcbootinfo->richguest_bootmodule_base; - sp.in_out_params[1] = xcbootinfo->richguest_bootmodule_size; - XMHF_SLAB_CALLNEW(&sp); - - _XDPRINTF_("%s[%u]: Should never be here. Halting!\n", - __func__, (uint16_t)cpuid); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); -} diff --git a/uxmhf/xmhf-uobjs/geec_prime/gp_s5_setupcpustate.c b/uxmhf/xmhf-uobjs/geec_prime/gp_s5_setupcpustate.c deleted file mode 100644 index 48b60729e7..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/gp_s5_setupcpustate.c +++ /dev/null @@ -1,494 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -//#include -//#include -#include -#include - -//set IOPl to CPl-3 -static void __xmhfhic_x86vmx_setIOPL3(uint64_t cpuid){ - uint32_t eflags; - eflags = CASM_FUNCCALL(read_eflags,CASM_NOPARAM); - eflags &= ~(EFLAGS_IOPL); //clear out IOPL bits - //eflags |= 0x00000000; //set IOPL to 0 - eflags |= EFLAGS_IOPL; - - CASM_FUNCCALL(write_eflags,eflags); -} - - -//setup VMX state for CPU -static bool __xmhfhic_x86vmx_setupvmxstate(uint64_t cpuid){ - uint32_t cpuindex = (uint32_t)cpuid; - const uint32_t vmx_msr_area_msrs[] = {MSR_EFER, MSR_IA32_PAT}; //critical MSRs that need to be saved/restored across guest VM switches - const unsigned int vmx_msr_area_msrs_count = (sizeof(vmx_msr_area_msrs)/sizeof(vmx_msr_area_msrs[0])); //count of critical MSRs that need to be saved/restored across VM switches - uint32_t lodword, hidword; - uint64_t msr_value; - uint64_t vmcs_phys_addr = __xmhfhic_x86vmx_archdata[cpuindex].vmx_vmcs_region; - - //save contents of VMX MSRs as well as MSR EFER and EFCR - { - uint32_t i; - uint32_t eax, edx; - uint64_t msr_value; - for(i=0; i < IA32_VMX_MSRCOUNT; i++){ - msr_value = CASM_FUNCCALL(rdmsr64, (IA32_VMX_BASIC_MSR + i)); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - __xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[i] = (uint64_t)edx << 32 | (uint64_t) eax; - } - - msr_value = CASM_FUNCCALL(rdmsr64, MSR_EFER); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - __xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_efer = (uint64_t)edx << 32 | (uint64_t) eax; - msr_value = CASM_FUNCCALL(rdmsr64, MSR_EFCR); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - __xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_efcr = (uint64_t)edx << 32 | (uint64_t) eax; - } - - - - CASM_FUNCCALL(write_cr4, CASM_FUNCCALL(read_cr4,CASM_NOPARAM) | CR4_VMXE); - - - //enter VMX root operation using VMXON - { - uint32_t retval=0; - uint64_t vmxonregion_paddr = (uint64_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_vmxon_region; - //set VMCS rev id - *((uint32_t *)__xmhfhic_x86vmx_archdata[cpuindex].vmx_vmxon_region) = (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_BASIC_MSR]; - - if(!CASM_FUNCCALL(__vmx_vmxon,vmxonregion_paddr)){ - _XDPRINTF_("%s(%u): unable to enter VMX root operation\n", __func__, (uint32_t)cpuid); - return false; - } - } - - //@assert 1; - - //clear VMCS - if(!CASM_FUNCCALL(__vmx_vmclear, (uint64_t)vmcs_phys_addr)) - return false; - - //@assert 1; - - - //set VMCS revision id - *((uint32_t *)__xmhfhic_x86vmx_archdata[cpuindex].vmx_vmcs_region) = (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_BASIC_MSR]; - - //load VMPTR - if(!CASM_FUNCCALL(__vmx_vmptrld,(uint64_t)vmcs_phys_addr)) - return false; - - //@assert 1; - - - //setup host state - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_CR0, CASM_FUNCCALL(read_cr0,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_CR4, CASM_FUNCCALL(read_cr4,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_CR3, CASM_FUNCCALL32(read_cr3,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_CS_SELECTOR, CASM_FUNCCALL(read_segreg_cs,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_DS_SELECTOR, CASM_FUNCCALL(read_segreg_ds,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_ES_SELECTOR, CASM_FUNCCALL(read_segreg_es,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_FS_SELECTOR, CASM_FUNCCALL(read_segreg_fs,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_GS_SELECTOR, CASM_FUNCCALL(read_segreg_gs,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_SS_SELECTOR, CASM_FUNCCALL(read_segreg_ss,CASM_NOPARAM)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_TR_SELECTOR, CASM_FUNCCALL(read_tr_sel,CASM_NOPARAM)); - //_XDPRINTF_("%s: read_tr_sel = %08x\n", __func__, CASM_FUNCCALL(read_tr_sel,CASM_NOPARAM)); - //_XDPRINTF_("%s: HOST TR SELECTOR = %08x\n", __func__, CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_HOST_TR_SELECTOR)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_GDTR_BASE, CASM_FUNCCALL32(xmhf_baseplatform_arch_x86_getgdtbase,CASM_NOPARAM)); - - //setup host IDTR - { - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_XC_EXHUB; - spl.cpuid = (uint16_t)cpuid; - spl.dst_uapifn = UAPI_XCEXHUB_LOADHOSTIDTRBASE; - - XMHF_SLAB_CALLNEW(&spl); - } - - - - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_TR_BASE, CASM_FUNCCALL(xmhf_baseplatform_arch_x86_gettssbase,CASM_NOPARAM)); - - //setup intercept handler stub - { - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.cpuid = (uint16_t)cpuid; - spl.dst_uapifn = UAPI_XCIHUB_INSTALLICPTHANDLER; - - XMHF_SLAB_CALLNEW(&spl); - } - - - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_RSP, CASM_FUNCCALL32(read_esp,CASM_NOPARAM)); - - - msr_value = CASM_FUNCCALL(rdmsr64, IA32_SYSENTER_CS_MSR); - lodword = (uint32_t)msr_value; - hidword = (uint32_t)(msr_value >> 32); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_SYSENTER_CS, lodword); - - msr_value = CASM_FUNCCALL(rdmsr64, IA32_SYSENTER_ESP_MSR); - lodword = (uint32_t)msr_value; - hidword = (uint32_t)(msr_value >> 32); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_SYSENTER_ESP, (((uint64_t)hidword << 32) | (uint64_t)lodword)); - - msr_value = CASM_FUNCCALL(rdmsr64, IA32_SYSENTER_EIP_MSR); - lodword = (uint32_t)msr_value; - hidword = (uint32_t)(msr_value >> 32); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_SYSENTER_EIP, (((uint64_t)hidword << 32) | (uint64_t)lodword)); - - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MSR_FS_BASE); - lodword = (uint32_t)msr_value; - hidword = (uint32_t)(msr_value >> 32); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_FS_BASE, (((uint64_t)hidword << 32) | (uint64_t)lodword) ); - - msr_value = CASM_FUNCCALL(rdmsr64, IA32_MSR_GS_BASE); - lodword = (uint32_t)msr_value; - hidword = (uint32_t)(msr_value >> 32); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_GS_BASE, (((uint64_t)hidword << 32) | (uint64_t)lodword) ); - - //setup default VMX controls - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_PIN_BASED, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_PINBASED_CTLS_MSR]); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_CPU_BASED, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_PROCBASED_CTLS_MSR]); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_CONTROLS, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_EXIT_CTLS_MSR]); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_CONTROLS, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_ENTRY_CTLS_MSR]); - - - //IO bitmap support - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_CPU_BASED, (CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VMX_CPU_BASED) | (uint64_t)(1 << 25)) ); - - //activate secondary processor controls - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_SECCPU_BASED, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_PROCBASED_CTLS2_MSR]); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_CPU_BASED, (uint32_t) ((uint64_t)CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VMX_CPU_BASED) | 0x0000000080000000ULL ) ); - - //setup VMCS link pointer - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_GUEST_VMCS_LINK_POINTER_FULL, 0xFFFFFFFFUL); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_GUEST_VMCS_LINK_POINTER_HIGH, 0xFFFFFFFFUL); - - //setup memory protection - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_SECCPU_BASED, (CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VMX_SECCPU_BASED) | (uint64_t)(1 <<1) | (uint64_t)(1 << 5)) ); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VPID, 0); //[need to populate in sentinel] - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_EPT_POINTER_FULL, 0); // [need to populate in sentinel] - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_EPT_POINTER_HIGH, 0); // [need to populate in sentinel] - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_CPU_BASED, ((uint64_t)CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VMX_CPU_BASED) & (uint64_t)~(1 << 15) & (uint64_t)~(1 << 16)) ); - - - //Critical MSR load/store - { - uint32_t i; - msr_entry_t *hmsr = (msr_entry_t *)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_area_host_region; - msr_entry_t *gmsr = (msr_entry_t *)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_area_guest_region; - - //store host and guest initial values of the critical MSRs - for(i=0; i < vmx_msr_area_msrs_count; i++){ - uint32_t msr, eax, edx; - uint64_t msr_value; - msr = vmx_msr_area_msrs[i]; - msr_value = CASM_FUNCCALL(rdmsr64, msr); - eax = (uint32_t)msr_value; - edx = (uint32_t)(msr_value >> 32); - - - //host MSR values will be what we get from RDMSR - hmsr[i].index = msr; - hmsr[i].data = ((uint64_t)edx << 32) | (uint64_t)eax; - - //adjust and populate guest MSR values according to the MSR - gmsr[i].index = msr; - gmsr[i].data = ((uint64_t)edx << 32) | (uint64_t)eax; - - switch(msr){ - case MSR_EFER:{ - gmsr[i].data = gmsr[i].data & (uint64_t)~(1ULL << EFER_LME); - gmsr[i].data = gmsr[i].data & (uint64_t)~(1ULL << EFER_LMA); - gmsr[i].data = gmsr[i].data & (uint64_t)~(1ULL << EFER_SCE); - gmsr[i].data = gmsr[i].data & (uint64_t)~(1ULL << EFER_NXE); - } - break; - - default: - break; - } - } - - //host MSR load on exit, we store it ourselves before entry - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_LOAD_ADDRESS_FULL, __xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_area_host_region); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_LOAD_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_LOAD_COUNT, vmx_msr_area_msrs_count); - - //guest MSR load on entry, store on exit - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_FULL, __xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_area_guest_region); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_COUNT, vmx_msr_area_msrs_count); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_FULL, __xmhfhic_x86vmx_archdata[cpuindex].vmx_msr_area_guest_region); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_COUNT, vmx_msr_area_msrs_count); - } - - - //setup unrestricted guest - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_SECCPU_BASED, (uint32_t)((uint64_t)CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VMX_SECCPU_BASED) | (uint64_t)(1 << 7)) ); - - //enable execution of INVPCID in the event we have that support - #if 1 - { - uint64_t ia32_vmx_procbased_ctls2; - ia32_vmx_procbased_ctls2 = CASM_FUNCCALL(rdmsr64, IA32_VMX_PROCBASED_CTLS2_MSR); - _XDPRINTF_("%s[%u]: IA32_VMX_PROCBASED_CTLS2=0x%016llx\n", - __func__, (uint32_t)cpuid, (uint64_t)ia32_vmx_procbased_ctls2); - - if ( (uint32_t)((ia32_vmx_procbased_ctls2 & 0xFFFFFFFF00000000ULL) >> 32) & - (uint32_t)(0x1UL << 12) ) { - _XDPRINTF_("%s[%u]: Enabling INVPCID execution\n", - __func__, (uint32_t)cpuid); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VMX_SECCPU_BASED, (uint32_t)((uint64_t)CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VMX_SECCPU_BASED) | (uint64_t)(1 << 12)) ); - } - } - #endif - - //setup CR0 and CR0 access - { - _XDPRINTF_("%s[%u]: CR0_ALWAYS1BITS_MASK=0x%08x\n", __func__, (uint32_t)cpuid, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_CR0_FIXED0_MSR]); - uint32_t control_cr0_mask = ~ (CR0_TS); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_CR0_MASK, - // (uint32_t)(((((uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_CR0_FIXED0_MSR] & ~(CR0_PE)) & ~(CR0_PG)) | CR0_CD) | CR0_NW) ); - control_cr0_mask); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_GUEST_CR0, - (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_CR0_FIXED0_MSR]); - } - - //setup CR4 and CR4 access - { - uint32_t control_cr4_mask = ~ (CR4_PVI | CR4_DE | CR4_PCE | CR4_OSFXSR | CR4_OSXMMEXCPT | CR4_TSD | CR4_PGE); - _XDPRINTF_("%s[%u]: CR4_ALWAYS1BITS_MASK=0x%08x\n", __func__, (uint32_t)cpuid, (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_CR4_FIXED0_MSR]); - //trap access to non-guest controlled CR4 fixed bits (this includes the VMXE bit) - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_CR4_MASK, - control_cr4_mask); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_GUEST_CR4, - (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_CR4_FIXED0_MSR]); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_CR4_SHADOW, - (uint32_t)__xmhfhic_x86vmx_archdata[cpuindex].vmx_msrs[INDEX_IA32_VMX_CR4_FIXED0_MSR]); - } - - - return true; -} - - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) - uint32_t check_esp, check_eip = CASM_RET_EIP; - bool gp_s5_entry_invoked = false; - - void xmhfhwm_vdriver_writeesp(uint32_t oldval, uint32_t newval){ - //@assert (newval >= ((uint32_t)&_init_bsp_cpustack + 4)) && (newval <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; - } - - void xmhfhwm_vdriver_cpu_writecr3(uint32_t oldval, uint32_t newval){ - //@assert (newval ==(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - } - - - void main(void){ - uint32_t cpuid = 0; - bool isbsp = true; - - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = (uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //execute harness - xmhfhwm_cpu_cr4 = 0x00000030; - xmhfhwm_cpu_cr0 = 0x80000015; - xmhfhwm_cpu_cr3 =(uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t; - - gp_s5_setupcpustate(cpuid, isbsp); - - //@assert (xmhfhwm_cpu_gdtr_base == (uint32_t)&__xmhfhic_x86vmx_gdt_start); - //@assert (xmhfhwm_cpu_cs_selector == __CS_CPL0); - //@assert (xmhfhwm_cpu_ds_selector == __DS_CPL0); - //@assert (xmhfhwm_cpu_es_selector == __DS_CPL0); - //@assert (xmhfhwm_cpu_fs_selector == __DS_CPL0); - //@assert (xmhfhwm_cpu_gs_selector == __DS_CPL0); - //@assert (xmhfhwm_cpu_ss_selector == __DS_CPL0); - //@assert (xmhfhwm_cpu_tr_selector ==(__TRSEL + ((uint32_t)cpuid * 8) )); - //@assert (xmhfhwm_cpu_eflags & EFLAGS_IOPL); - // //@assert (xmhfhwm_cpu_msr_apic_base == MMIO_APIC_BASE); - //@assert (xmhfhwm_cpu_msr_efer & ((1 << EFER_NXE))); - //@assert (xmhfhwm_cpu_cr4 & CR4_OSXSAVE); - //@assert (xmhfhwm_cpu_cr0 & 0x20); - //@assert (xmhfhwm_cpu_vmcs_host_rsp >= ((uint32_t)&_init_bsp_cpustack + 4)) && (xmhfhwm_cpu_vmcs_host_rsp <= ((uint32_t)&_init_bsp_cpustack + MAX_PLATFORM_CPUSTACK_SIZE)) ; - //@assert (xmhfhwm_cpu_vmcs_host_cr3 == (uint32_t)&gp_rwdatahdr.gp_vhslabmempgtbl_lvl4t); - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; - } -#endif - - -void gp_s5_setupcpustate(uint32_t cpuid, bool isbsp){ - - //replicate common MTRR state on this CPU - xmhfhw_cpu_x86_restore_mtrrs(&_mtrrs); - - //load GDT - CASM_FUNCCALL(xmhfhw_cpu_loadGDT,&__xmhfhic_x86vmx_gdt); - _XDPRINTF_("%s[%u]: GDT loaded\n", __func__, (uint32_t)cpuid); - - - //reload CS - CASM_FUNCCALL(xmhfhw_cpu_reloadcs,__CS_CPL0); - _XDPRINTF_("%s[%u]: Reloaded CS\n", __func__, (uint32_t)cpuid); - - - //reload DS, FS, GS and SS - CASM_FUNCCALL(xmhfhw_cpu_reloaddsregs,__DS_CPL0); - _XDPRINTF_("%s[%u]: Reloaded segment registers\n", __func__, (uint32_t)cpuid); - - - //load TR - CASM_FUNCCALL(xmhfhw_cpu_loadTR, (__TRSEL + ((uint32_t)cpuid * 8) ) ); - _XDPRINTF_("%s[%u]: TR loaded\n", __func__, (uint32_t)cpuid); - - - //load IDT - { - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_XC_EXHUB; - spl.cpuid = (uint16_t)cpuid; - spl.dst_uapifn = UAPI_XCEXHUB_LOADIDT; - - XMHF_SLAB_CALLNEW(&spl); - } - - - ////turn on CR0.WP bit for supervisor mode write protection - //write_cr0(read_cr0() | CR0_WP); - //_XDPRINTF_("%s[%u]: Enabled supervisor mode write protection\n", __func__, (uint32_t)cpuid); - - //set IOPL3 - __xmhfhic_x86vmx_setIOPL3(cpuid); - _XDPRINTF_("%s[%u]: set IOPL to CPL-3\n", __func__, (uint32_t)cpuid); - - - //set LAPIC base address to preferred address - { - uint64_t msrapic = CASM_FUNCCALL(rdmsr64,MSR_APIC_BASE); - uint64_t msrapic_val = ((msrapic & 0x0000000000000FFFULL) | X86SMP_LAPIC_MEMORYADDRESS); - CASM_FUNCCALL(wrmsr64,MSR_APIC_BASE, (uint32_t)msrapic_val, (uint32_t)((uint64_t)msrapic_val >> 32) ); - } - _XDPRINTF_("%s[%u]: set LAPIC base address to %016llx\n", __func__, (uint32_t)cpuid, CASM_FUNCCALL(rdmsr64,MSR_APIC_BASE)); - - - //turn on NX protections - { - uint64_t msrefer_val= (CASM_FUNCCALL(rdmsr64, MSR_EFER) | (1 << EFER_NXE)); - CASM_FUNCCALL(wrmsr64,MSR_EFER, (uint32_t)msrefer_val, (uint32_t)((uint64_t)msrefer_val >> 32) ); - _XDPRINTF_("%s[%u]: NX protections enabled\n", __func__, (uint32_t)cpuid); - - } - - - - //set OSXSAVE bit in CR4 to enable us to pass-thru XSETBV intercepts - //when the CPU supports XSAVE feature - if(xmhf_baseplatform_arch_x86_cpuhasxsavefeature()){ - CASM_FUNCCALL(write_cr4, (CASM_FUNCCALL(read_cr4, CASM_NOPARAM) | CR4_OSXSAVE) ); - _XDPRINTF_("%s[%u]: XSETBV passthrough enabled\n", __func__, (uint32_t)cpuid); - } - - - //set bit 5 (EM) of CR0 to be VMX compatible in case of Intel cores - CASM_FUNCCALL(write_cr0, (CASM_FUNCCALL(read_cr0, CASM_NOPARAM) | 0x20)); - _XDPRINTF_("%s[%u]: Set CR0.EM to be VMX compatible\n", __func__, (uint32_t)cpuid); - - - //setup sysenter syscall stub - { - slab_params_t spl; - - spl.src_slabid = XMHFGEEC_SLAB_GEEC_PRIME; - spl.dst_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - spl.cpuid = cpuid; - spl.dst_uapifn = UAPI_SENTINEL_INSTALLSYSCALLSTUB; - - XMHF_SLAB_CALLNEW(&spl); - } - - //setup VMX state - if(!__xmhfhic_x86vmx_setupvmxstate(cpuid)){ - _XDPRINTF_("%s[%u]: Unable to set VMX state. Halting!\n", __func__, (uint32_t)cpuid); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - _XDPRINTF_("%s[%u]: Setup VMX state\n", __func__, (uint32_t)cpuid); - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_prime/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/geec_prime/xmhfgeecslab.mk.in deleted file mode 100644 index 71617d3c2c..0000000000 --- a/uxmhf/xmhf-uobjs/geec_prime/xmhfgeecslab.mk.in +++ /dev/null @@ -1,109 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := geec_prime -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) -XMHF_SLAB_SOURCES += $(wildcard $(srcdir)/*.cS) - -#export XMHF_SLAB_FULLLINK := n - -export XMHF_SLAB_GLOBAL_SYMS := -######################################################################## - - - - - - -.PHONY: verify -verify: verifybase verif_s1 verif_s2 verif_s3 verif_s4 verif_s5 - -.PHONY: verif_s1 -verif_s1: - @echo Verifying stage-1... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s1_bspstack -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s1_bspstack.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main _gp_s1_bspstack_getflagsforspa -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s1_bspstackgetflags.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s1_bspstkactivate.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s1_chkreq.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s1_entry.cS.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s1_hub -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s1_hub.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s1_iommuinit.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/xmhfhw_vtd*.c.v.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s1_iommuinittbl -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s1_iommuinittbl.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s1_iommuinittblclearcet -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s1_iommuinittblclearcet.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s1_postdrt.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c libxmhfhw/xmhfhw_cpu_txt*.c.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s1_scaniommu.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/xmhfhw_sysmem_getacpirsdp.c.v.c libxmhfhw/xmhfhw_vtd_readreg.c.v.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - - -.PHONY: verif_s2 -verif_s2: - @echo Verifying stage-2... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_entry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_s2_entry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s2_gathersysmemtypes.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s2_initsysmemmap.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sda -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sda.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdabinddevice -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdabinddevice.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdadoalloc_getuobjfordev -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdadoalloc_getuobjfordev.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdadoalloc -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdadoalloc.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdasetupdevpgtbl_rg -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdasetupdevpgtbl_rg.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdasetupdevpgtbl_setptentries -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdasetupdevpgtbl_setptentries.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdasetupdevpgtbl_splintpdt -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdasetupdevpgtbl_splintpdt.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdasetupdevpgtbl -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdasetupdevpgtbl.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdmenumsysdevices_memioextents -lib-entry -wp -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdmenumsysdevices_memioextents.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdmenumsysdevices -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdmenumsysdevices.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdminitdevmap_addalldevstouobj -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdminitdevmap_addalldevstouobj.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdminitdevmap_adddeventry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdminitdevmap_adddeventry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdminitdevmap_adddevtouobj -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdminitdevmap_adddevtouobj.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdminitdevmap_isdevinexcl -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdminitdevmap_isdevinexcl.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_sdminitdevmap -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_sdminitdevmap.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupgdt -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupgdt.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupgdt_setgdttssentry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupgdttssentry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupidt -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupidt.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupiotbl -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupiotbl.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupiotblug_rg -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupiotblug_rg.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupiotblug -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupiotblug.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupiotblug_allowaccesstoport -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupiotblugportaccess.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupiotbluh -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupiotbluh.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupiotbluh_allowaccesstoport -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupiotbluhportaccess.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbl_getspatype -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbl_getspatype.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbl_getspatypeuobj_isiotbl -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbl_getspatypeuobj_isiotbl.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbl_getspatypeuobj_ismmio -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbl_getspatypeuobj_ismmio.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbl_getspatypeuobj -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbl_getspatypeuobj.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtblu -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblu.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtblug_getflags -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblug_getflags.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblug_getmtype.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtblug_rg -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblug_rg.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtblug -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblug.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbluh_getflags -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbluh_getflags.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbluh_setentry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbluh_setentry.c.v.c -# cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtbluh -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtbluh.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtblv_getflags -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblv_getflags.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setupmpgtblv -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setupmpgtblv.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setuptss -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setuptss.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s2_setuptss_inittss -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s2_setuptssinittss.c.v.c - -.PHONY: verif_s3 -verif_s3: - @echo Verifying stage-3... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s3_entry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s3_entry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -pp-annot -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s3_startcores.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/xmhfhw_cpu_txt*.c.v.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - -.PHONY: verif_s4 -verif_s4: - @echo Verifying stage-4... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s4_apstacks.cS.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s4_entry.cS.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - -.PHONY: verif_s5 -verif_s5: - @echo Verifying stage-5... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gp_s5_entry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gp_data.c.v.c gp_s5_entry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s5_invokestrt.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -no-val-show-progress -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) gp_data.c.v.c gp_s5_setupcpustate.c.v.c xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c libxmhfhw/*.c.v.c libxmhfhw/*.cS.v.c $(V_XMHFHWM_MODULES) - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/geec_sentinel.gsm b/uxmhf/xmhf-uobjs/geec_sentinel/geec_sentinel.gsm deleted file mode 100644 index 800a70ffd6..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/geec_sentinel.gsm +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include - -{ - "uobj-name": "geec_sentinel", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "SENTINEL", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - - "uobj-resource-devices":[ - { - "type": "include", - "opt1" : USMF_STR(PCI_VENDOR_ID_XMHFGEEC), - "opt2" : USMF_STR(PCI_DEVICE_ID_XMHFGEEC_LAPIC) - } - ], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x400000" - }, - { - "section-name": "stack", - "section-size": "0xA00000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_calluobj.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_calluobj.cS deleted file mode 100644 index 324868e3c9..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_calluobj.cS +++ /dev/null @@ -1,66 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -CASM_FUNCDEF(void, gs_calluobj, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x8); - xmhfhwm_cpu_insn_jmpslabep(); -}, -slab_params_t *sp, uint32_t entry_point) - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_data.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_data.c deleted file mode 100644 index 3e3be318d6..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_data.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -#include -#include -#include -#include - -__attribute__((section(".data"))) uint32_t gs_siss_indices[MAX_PLATFORM_CPUS] = { 0 }; -__attribute__((section(".data"))) gs_siss_element_t gs_siss[MAX_PLATFORM_CPUS][512]; -// sysenter CPU stacks -__attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _sysenter_stack[MAX_PLATFORM_CPUS][MAX_PLATFORM_CPUSTACK_SIZE]; diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry.c deleted file mode 100644 index 11461bffd7..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - -#include -#include - - -///// -// sentinel hub -///// - -static inline void _geec_sentinel_checkandhalt_callcaps(uint32_t src_slabid, uint32_t dst_slabid, uint32_t dst_uapifn){ - //check call capabilities - if( !(xmhfgeec_slab_info_table[dst_slabid].slab_callcaps & XMHFGEEC_SLAB_CALLCAP_MASK(src_slabid)) ){ - _XDPRINTF_("GEEC_SENTINEL: Halt!. callcap check failed for src(%u)-->dst(%u), dst caps=0x%x\n", - src_slabid, dst_slabid, xmhfgeec_slab_info_table[dst_slabid].slab_callcaps); - HALT(); - } - - //check uapi capabilities - if( xmhfgeec_slab_info_table[dst_slabid].slab_uapisupported){ - if(!(xmhfgeec_slab_info_table[src_slabid].slab_uapicaps[dst_slabid] & XMHFGEEC_SLAB_UAPICAP_MASK(dst_uapifn))) - { - _XDPRINTF_("GEEC_SENTINEL: Halt!. uapicap check failed for src(%u)-->dst(%u), dst_uapifn=%u, dst_uapimask=0x%08x\n", - src_slabid, dst_slabid, dst_uapifn, - (uint32_t)xmhfgeec_slab_info_table[src_slabid].slab_uapicaps[dst_slabid]); - HALT(); - } - } -} - -////// -// process sentinel uobj specific calls -////// -void sentinel_processapicall(slab_params_t *sp, void *caller_stack_frame){ - //sanity check we are only being invoked by prime uobj - if(sp->src_slabid != XMHFGEEC_SLAB_GEEC_PRIME){ - _XDPRINTF_("SENTINEL[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); - } - - switch(sp->dst_uapifn){ - case UAPI_SENTINEL_TEST: - { - slab_params_t spl; - - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - spl.src_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = sp->cpuid; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_TEST; - - CASM_FUNCCALL(gs_calluobj, &spl, - xmhfgeec_slab_info_table[spl.dst_slabid].entrystub); - - } - break; - - case UAPI_SENTINEL_INSTALLSYSCALLSTUB: - _XDPRINTF_("SENTINEL[cpu=%u]: TEST\n", - (uint16_t)sp->cpuid); - - //setup SYSENTER/SYSEXIT mechanism - { - CASM_FUNCCALL(wrmsr64, IA32_SYSENTER_CS_MSR, (uint32_t)__CS_CPL0, 0); - CASM_FUNCCALL(wrmsr64, IA32_SYSENTER_EIP_MSR, - (uint32_t)&gs_syscallstub, 0); - CASM_FUNCCALL(wrmsr64, IA32_SYSENTER_ESP_MSR, - (uint32_t)((uint32_t)_sysenter_stack[(uint16_t)sp->cpuid] + MAX_PLATFORM_CPUSTACK_SIZE), 0); - } - _XDPRINTF_("%s: setup SYSENTER/SYSEXIT mechanism\n", __func__); - _XDPRINTF_("SYSENTER CS=%016llx\n", CASM_FUNCCALL(rdmsr64,IA32_SYSENTER_CS_MSR)); - _XDPRINTF_("SYSENTER RIP=%016llx\n", CASM_FUNCCALL(rdmsr64,IA32_SYSENTER_EIP_MSR)); - _XDPRINTF_("SYSENTER RSP=%016llx\n", CASM_FUNCCALL(rdmsr64,IA32_SYSENTER_ESP_MSR)); - - break; - - default: - _XDPRINTF_("SENTINEL(ln:%u): Unrecognized transition. Halting!\n", __LINE__); - HALT(); - } - - CASM_FUNCCALL(gs_exit_ret2v, - caller_stack_frame); - - _XDPRINTF_("SENTINEL[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); - -} - -void geec_sentinel_main(slab_params_t *sp, void *caller_stack_frame){ - - - - switch(sp->slab_ctype){ - case XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG:{ - - if(sp->dst_slabid == XMHFGEEC_SLAB_GEEC_SENTINEL){ - //this is a sentinel uobj specific initialization call - sentinel_processapicall(sp, caller_stack_frame); - }else{ - - switch (xmhfgeec_slab_info_table[sp->dst_slabid].slabtype){ - - case XMHFGEEC_SLABTYPE_VfT_PROG:{ - //_geec_sentinel_checkandhalt_callcaps(sp->src_slabid, sp->dst_slabid, sp->dst_uapifn); - CASM_FUNCCALL(gs_exit_callv2v, - xmhfgeec_slab_info_table[sp->dst_slabid].entrystub, - caller_stack_frame); - _XDPRINTF_("GEEC_SENTINEL[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); - - } - break; - - - case XMHFGEEC_SLABTYPE_uVT_PROG: - case XMHFGEEC_SLABTYPE_uVU_PROG:{ - //_geec_sentinel_checkandhalt_callcaps(sp->src_slabid, sp->dst_slabid, sp->dst_uapifn); - sp->slab_ctype = XMHFGEEC_SENTINEL_CALL_VfT_PROG_TO_uVT_uVU_PROG; - gs_exit_callv2uv(sp, caller_stack_frame); - _XDPRINTF_("GEEC_SENTINEL[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); - - } - break; - - - case XMHFGEEC_SLABTYPE_uVT_PROG_GUEST: - case XMHFGEEC_SLABTYPE_uVU_PROG_GUEST: - case XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST:{ - uint32_t errorcode; - //_geec_sentinel_checkandhalt_callcaps(sp->src_slabid, sp->dst_slabid, sp->dst_uapifn); - //_XDPRINTF_("GEEC_SENTINEL: launching guest %u...\n", sp->dst_slabid); - sp->slab_ctype = XMHFGEEC_SENTINEL_CALL_VfT_PROG_TO_uVT_uVU_PROG_GUEST; - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VPID, sp->dst_slabid ); - - { - slab_params_t spl; - uapi_ugmpgtbl_getmpgtblbase_params_t *ps = (uapi_ugmpgtbl_getmpgtblbase_params_t *)spl.in_out_params; - - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - spl.src_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = sp->cpuid; - spl.dst_uapifn = UAPI_UGMPGTBL_GETMPGTBLBASE; - - ps->dst_slabid = sp->dst_slabid; - - //_XDPRINTF_("GEEC_SENTINEL: guest: slabid=%u\n", ps->dst_slabid); - - CASM_FUNCCALL(gs_calluobj, &spl, - xmhfgeec_slab_info_table[spl.dst_slabid].entrystub); - - //_XDPRINTF_("GEEC_SENTINEL: guest: eptp base=0x%08x\n", ps->mpgtblbase); - - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_EPT_POINTER_FULL, (ps->mpgtblbase | 0x1E) ); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_EPT_POINTER_HIGH, 0); - } - - - - - { - slab_params_t spl; - uapi_iotbl_getiotblbase_t *ps = (uapi_iotbl_getiotblbase_t *)spl.in_out_params; - - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - spl.src_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - spl.dst_slabid = UOBJ_UAPI_IOTBL; - spl.cpuid = sp->cpuid; - spl.dst_uapifn = UXMHF_UAPI_IOTBL_GETIOTBLBASE; - - ps->dst_slabid = sp->dst_slabid; - - //_XDPRINTF_("GEEC_SENTINEL: guest: slabid=%u\n", ps->dst_slabid); - - CASM_FUNCCALL(gs_calluobj, &spl, - xmhfgeec_slab_info_table[spl.dst_slabid].entrystub); - - //_XDPRINTF_("GEEC_SENTINEL: guest: iotbl_base=0x%08x\n", ps->iotbl_base); - - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_IO_BITMAPA_ADDRESS_FULL, ps->iotbl_base); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_IO_BITMAPA_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_IO_BITMAPB_ADDRESS_FULL, (ps->iotbl_base + PAGE_SIZE_4K)); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_IO_BITMAPB_ADDRESS_HIGH, 0); - } - - if (xmhfgeec_slab_info_table[sp->dst_slabid].slabtype != XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST){ - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_GUEST_RSP, xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_GUEST_RIP, xmhfgeec_slab_info_table[sp->dst_slabid].entrystub); - } - - errorcode = CASM_FUNCCALL(gs_exit_callv2uvg, CASM_NOPARAM); - - switch(errorcode){ - case 0: //no error code, VMCS pointer is invalid - _XDPRINTF_("GEEC_SENTINEL: VMLAUNCH error; VMCS pointer invalid?\n"); - break; - case 1:{//error code available, so dump it - uint32_t code=xmhfhw_cpu_x86vmx_vmread(VMCS_INFO_VMINSTR_ERROR); - _XDPRINTF_("GEEC_SENTINEL: VMLAUNCH error; code=%x\n", code); - break; - } - } - - HALT(); - - } - break; - - default: - _XDPRINTF_("GEEC_SENTINEL(ln:%u): Unrecognized transition. Halting!\n", __LINE__); - HALT(); - } - } //endif - - } - break; - - - - - case XMHFGEEC_SENTINEL_RET_VfT_PROG_TO_uVT_uVU_PROG:{ - gs_exit_retv2uv(sp, caller_stack_frame); - _XDPRINTF_("GEEC_SENTINEL[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); - } - break; - - - - - - case XMHFGEEC_SENTINEL_CALL_uVT_uVU_PROG_TO_VfT_PROG:{ - _geec_sentinel_checkandhalt_callcaps(sp->src_slabid, sp->dst_slabid, sp->dst_uapifn); - gs_exit_calluv2v(sp, caller_stack_frame); - _XDPRINTF_("GEEC_SENTINEL[ln:%u]: halting. should never be here!\n", __LINE__); - HALT(); - } - break; - - - - - case XMHFGEEC_SENTINEL_RET_uVT_uVU_PROG_TO_VfT_PROG:{ - gs_exit_retuv2v(sp, caller_stack_frame); - _XDPRINTF_("GEEC_SENTINEL[ln:%u]: halting. should never be here!\n", __LINE__); - HALT(); - } - break; - - - - - - - - - - - - - - - - - - - - - - - - - - - default: - _XDPRINTF_("GEEC_SENTINEL: unkown call type %x. Halting!\n", sp->slab_ctype); - HALT(); - - } - -} - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_callstub.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_callstub.cS deleted file mode 100644 index f71d4046d2..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_callstub.cS +++ /dev/null @@ -1,309 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - sentinel v2x call entry-point - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include - -#include - -////// -// sentinel [p_call] entry point -////// - - -// C invocation of this function is of type _slab_entrystub(slab_params_t *sp) -// Pre: [esp] = return address to resume the (verified,privileged) caller -// [esp+4] = slab_params_t *sp (pointer to slab_params_t within caller -// memory area) - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -#include -#include -#include - -uint32_t saved_cpu_gprs_ebx=0; -uint32_t saved_cpu_gprs_esi=0; -uint32_t saved_cpu_gprs_edi=0; -uint32_t saved_cpu_gprs_ebp=0; -uint32_t cpuid = 0; //cpu - -void cabi_establish(void){ - xmhfhwm_cpu_gprs_ebx = 5UL; - xmhfhwm_cpu_gprs_esi = 6UL; - xmhfhwm_cpu_gprs_edi = 7UL; - saved_cpu_gprs_ebx = xmhfhwm_cpu_gprs_ebx; - saved_cpu_gprs_esi = xmhfhwm_cpu_gprs_esi; - saved_cpu_gprs_edi = xmhfhwm_cpu_gprs_edi; -} - -void cabi_check(void){ - //@ assert saved_cpu_gprs_ebx == xmhfhwm_cpu_gprs_ebx; - //@ assert saved_cpu_gprs_esi == xmhfhwm_cpu_gprs_esi; - //@ assert saved_cpu_gprs_edi == xmhfhwm_cpu_gprs_edi; -} - -uint32_t check_esp, check_eip = CASM_RET_EIP; - - #if defined (DRV_PATHV2V) - slab_params_t drv_pathv2v_sp; - - void xmhfhwm_vdriver_slabep(void){ - cabi_check(); - //@assert xmhfhwm_cpu_gprs_eip == (uint32_t)xmhfgeec_slab_info_table[XMHFGEEC_SLAB_UAPI_GCPUSTATE].entrystub; - //@assert xmhfhwm_cpu_gprs_esp == check_esp - (2 * sizeof(uint32_t)); - //@assert *((uint32_t *)xmhfhwm_cpu_gprs_esp) == CASM_RET_EIP; - //@assert *((uint32_t *)((uint32_t)xmhfhwm_cpu_gprs_esp+4)) == (unsigned int)&drv_pathv2v_sp; - //@assert false; - } - - void drv_pathv2v(void){ - drv_pathv2v_sp.slab_ctype =XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - drv_pathv2v_sp.src_slabid = XMHFGEEC_SLAB_XC_INIT; - drv_pathv2v_sp.dst_slabid =XMHFGEEC_SLAB_UAPI_GCPUSTATE; - drv_pathv2v_sp.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - drv_pathv2v_sp.cpuid = 0; - - cabi_establish(); - CASM_FUNCCALL(_slab_entrystub, &drv_pathv2v_sp); - //@assert false; - } - #endif // DRV_PATHV2V - - #if defined (DRV_PATHV2UV) - slab_params_t drv_pathv2uv_sp; - - void xmhfhwm_vdriver_slabep(void){ - cabi_check(); - //@assert xmhfhwm_cpu_gprs_eip == (uint32_t)xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].entrystub; - //@assert false; - } - - void drv_pathv2uv(void){ - drv_pathv2uv_sp.slab_ctype =XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - drv_pathv2uv_sp.src_slabid = XMHFGEEC_SLAB_XC_INIT; - drv_pathv2uv_sp.dst_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - drv_pathv2uv_sp.dst_uapifn = 0; - drv_pathv2uv_sp.cpuid = 0; - - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_start = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_start; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_end = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_end; - xmhfhwm_sysmemaccess_physmem_extents_total++; - - cabi_establish(); - CASM_FUNCCALL(_slab_entrystub, &drv_pathv2uv_sp); - //@assert false; - } - #endif // defined - - - #if defined (DRV_PATHV2UG) - slab_params_t drv_path_callv2ug_sp; - - void xmhfhwm_vdriver_slabep(void){ - //@assert false; - } - - void drv_path_callv2ug(void){ - drv_path_callv2ug_sp.slab_ctype = XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - drv_path_callv2ug_sp.src_slabid = XMHFGEEC_SLAB_XC_INIT; - drv_path_callv2ug_sp.dst_slabid = XMHFGEEC_SLAB_XG_RICHGUEST; - drv_path_callv2ug_sp.dst_uapifn = 0; - drv_path_callv2ug_sp.cpuid = 0; - - CASM_FUNCCALL(_slab_entrystub, &drv_path_callv2ug_sp); - //@assert false; - } - #endif // defined - - #if defined (DRV_PATH_RETEXCP) - slab_params_t drv_path_retexcp_sp; - - void xmhfhwm_vdriver_slabep(void){ - //@assert false; - } - - void drv_path_retexcp(void){ - drv_path_retexcp_sp.slab_ctype = XMHFGEEC_SENTINEL_RET_EXCEPTION; - drv_path_retexcp_sp.src_slabid = XMHFGEEC_SLAB_XC_EXHUB; - drv_path_retexcp_sp.dst_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - drv_path_retexcp_sp.dst_uapifn = 0; - drv_path_retexcp_sp.cpuid = 0; - - CASM_FUNCCALL(_slab_entrystub, &drv_path_retexcp_sp); - //@assert false; - } - #endif //defined - - #if defined (DRV_PATH_RETICPT) - slab_params_t drv_path_reticpt_sp; - - void xmhfhwm_vdriver_slabep(void){ - //@assert false; - } - - void drv_path_reticpt(void){ - drv_path_reticpt_sp.slab_ctype = XMHFGEEC_SENTINEL_RET_INTERCEPT; - drv_path_reticpt_sp.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - drv_path_reticpt_sp.dst_slabid = XMHFGEEC_SLAB_XG_RICHGUEST; - drv_path_reticpt_sp.dst_uapifn = 0; - drv_path_reticpt_sp.cpuid = 0; - - CASM_FUNCCALL(_slab_entrystub, &drv_path_reticpt_sp); - //@assert false; - } - #endif // defined - - #if defined (DRV_PATH_RETUH2VH) - slab_params_t drv_path_retuh2vh_calleesp; - uint32_t drv_path_retuh2vh_callerstackframe[6]; - gs_siss_element_t siss_elem; - - void xmhfhwm_vdriver_uhslabretaddr(void){ - // //@assert xmhfhwm_cpu_gprs_eip == CASM_RET_EIP; - // //@assert xmhfhwm_cpu_gprs_esp == _slab_tos[cpuid]; - //@assert false; - } - - void drv_path_retuh2vh(void){ - drv_path_retuh2vh_calleesp.slab_ctype = XMHFGEEC_SENTINEL_RET_uVT_uVU_PROG_TO_VfT_PROG; - drv_path_retuh2vh_calleesp.src_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - drv_path_retuh2vh_calleesp.dst_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - drv_path_retuh2vh_calleesp.dst_uapifn = 0; - drv_path_retuh2vh_calleesp.cpuid = 0; - - //inform hardware model to treat slab stack region as valid memory - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_start = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_start; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_end = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_end; - xmhfhwm_sysmemaccess_physmem_extents_total++; - - //plug in an entry in the SISS corresponding to this RET - siss_elem.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - siss_elem.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - siss_elem.slab_ctype = XMHFGEEC_SENTINEL_CALL_uVT_uVU_PROG_TO_VfT_PROG; - siss_elem.caller_stack_frame = &drv_path_retuh2vh_callerstackframe[0]; - siss_elem.sp = xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slabtos[cpuid]; - - gs_siss_push(cpuid, siss_elem); - - //invoke sentinel - CASM_FUNCCALL(_slab_entrystub, &drv_path_retuh2vh_calleesp); - //@assert false; - } - #endif // defined - - - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - #if defined (DRV_PATHV2V) - drv_pathv2v(); - #endif // DRV_PATHV2V - - #if defined (DRV_PATHV2UV) - drv_pathv2uv(); - #endif - - #if defined (DRV_PATHV2UG) - drv_path_callv2ug(); - #endif // defined - - #if defined (DRV_PATH_RETEXCP) - drv_path_retexcp(); - #endif // DRV_PATH_RETEXCP - - #if defined (DRV_PATH_RETICPT) - drv_path_reticpt(); - #endif // defined - - #if defined (DRV_PATH_RETUH2VH) - drv_path_retuh2vh(); - #endif // defined - -} -#endif - -CASM_FUNCDEF_FULL(.slab_entrystub, 1, void, _slab_entrystub, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - xmhfhwm_cpu_insn_pushl_ebp(); - xmhfhwm_cpu_insn_pushl_edi(); - xmhfhwm_cpu_insn_pushl_esi(); - xmhfhwm_cpu_insn_pushl_ebx(); - xmhfhwm_cpu_insn_movl_esp_edx(); - xmhfhwm_cpu_insn_pushl_edx(); - xmhfhwm_cpu_insn_pushl_eax(); - // stack frame at this point: - // [esp] = slab_params_t *sp - // [esp+4] = &[esp+8] - // [esp+8] = ebx - // [esp+12] = esi - // [esp+16] = edi - // [esp+20] = ebp - // [esp+24] = return address to resume the (verified,privileged) caller - // [esp+28] = slab_params_t *sp - xmhfhwm_cpu_insn_call_c_2p(geec_sentinel_main, slab_params_t *, void *); - - // halt if we ever return back (should never happen) - xmhfhwm_cpu_insn_hlt(); -}, -slab_params_t *sp) - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_syscall.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_syscall.c deleted file mode 100644 index 4b229fb60f..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_syscall.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include -#include - -////// sysenter - -//in general sp->xxx is untrusted and must be sanity checked -void gs_entry_syscall(slab_params_t *sp, void *caller_stack_frame){ - - //sanity check sp - sp->cpuid = xmhf_baseplatform_arch_x86_getcpulapicid(); - - if( !(sp->slab_ctype == XMHFGEEC_SENTINEL_RET_VfT_PROG_TO_uVT_uVU_PROG || - sp->slab_ctype == XMHFGEEC_SENTINEL_CALL_uVT_uVU_PROG_TO_VfT_PROG - ) ){ - _XDPRINTF_("%s[ln:%u]: inconsistent sp->xxx (%x). halting!\n", __func__, - __LINE__, sp->slab_ctype); - HALT(); - } - - { - slab_params_t spl; - uapi_uhmpgtbl_getidxformpgtblbase_params_t *ps = - (uapi_uhmpgtbl_getidxformpgtblbase_params_t *)spl.in_out_params; - - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - spl.src_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - spl.dst_slabid = UOBJ_UAPI_UHMPGTBL; - spl.cpuid = sp->cpuid; - spl.dst_uapifn = UAPI_UHMPGTBL_GETIDXFORMPGTBLBASE; - - ps->mpgtblbase = CASM_FUNCCALL(read_cr3, CASM_NOPARAM) & 0xFFFFF000UL; - - CASM_FUNCCALL(gs_calluobj, &spl, - xmhfgeec_slab_info_table[spl.dst_slabid].entrystub); - - if(!ps->status){ - _XDPRINTF_("%s[ln:%u]: invalid unverified memory page table base (%x). halting!\n", - __func__, __LINE__, ps->mpgtblbase); - HALT(); - } - - sp->src_slabid = ps->mpgtblbase_idx + XMHFGEEC_UHSLAB_BASE_IDX; - } - - _XDPRINTF_("%s: sp=%x, cpuid=%u, src=%u, dst=%u, ctype=%x\n", __func__, - (uint32_t)sp, (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid, sp->slab_ctype); - - geec_sentinel_main(sp, caller_stack_frame); -} - - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_syscallstub.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_syscallstub.cS deleted file mode 100644 index 7bb7028b92..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_entry_syscallstub.cS +++ /dev/null @@ -1,189 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -#include -#include -#include -#include - -uint32_t cpuid = 0; //cpu -uint32_t check_esp, check_eip = CASM_RET_EIP; - - #if defined (DRV_PATH_CALLUH2VH) - slab_params_t drv_path_calluh2vh_callersp; - - void xmhfhwm_vdriver_slabep(void){ - //@assert xmhfhwm_cpu_gprs_eip == (uint32_t)xmhfgeec_slab_info_table[XMHFGEEC_SLAB_UAPI_GCPUSTATE].entrystub; - //@assert false; - } - - void drv_path_calluh2vh(void){ - drv_path_calluh2vh_callersp.slab_ctype = XMHFGEEC_SENTINEL_CALL_uVT_uVU_PROG_TO_VfT_PROG; - drv_path_calluh2vh_callersp.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - drv_path_calluh2vh_callersp.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - drv_path_calluh2vh_callersp.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - drv_path_calluh2vh_callersp.cpuid = 0; - - //inform hardware model to treat slab stack region as valid memory - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_start = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_start; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_end = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_end; - xmhfhwm_sysmemaccess_physmem_extents_total++; - - //setup verified slab stack parameters for parameter marshalling - xmhfhwm_cpu_gprs_esp -= sizeof(slab_params_t); - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_UAPI_GCPUSTATE].slabtos[cpuid] = xmhfhwm_cpu_gprs_esp; - - //invoke syscall sentinel stub - xmhfhwm_cpu_gprs_edx = 0; - xmhfhwm_cpu_gprs_ecx = &drv_path_calluh2vh_callersp; - CASM_FUNCCALL(gs_syscallstub, CASM_NOPARAM); - //@assert false; - } - #endif // defined - - #if defined (DRV_PATH_RETVH2UH) - slab_params_t drv_pathretvh2uh_sp; - slab_params_t drv_pathretvh2uh_callersp; - gs_siss_element_t siss_elem; - - void xmhfhwm_vdriver_vhslabretaddr(void){ - //@assert xmhfhwm_cpu_gprs_eip == CASM_RET_EIP; - //@assert xmhfhwm_cpu_gprs_esp == _slab_tos[cpuid]; - //@assert false; - } - - void drv_path_retvh2uh(void){ - drv_pathretvh2uh_sp.slab_ctype = XMHFGEEC_SENTINEL_RET_VfT_PROG_TO_uVT_uVU_PROG; - drv_pathretvh2uh_sp.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - drv_pathretvh2uh_sp.dst_slabid = XMHFGEEC_SLAB_XC_INIT; - drv_pathretvh2uh_sp.dst_uapifn = 0; - drv_pathretvh2uh_sp.cpuid = 0; - - //inform hardware model to treat slab stack region as valid memory - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_start = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_start; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_end = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XH_SSTEPTRACE].slab_physmem_extents[2].addr_end; - xmhfhwm_sysmemaccess_physmem_extents_total++; - - //setup verified slab stack frame that this slab is returning to - xmhfhwm_cpu_gprs_esp -= sizeof(uint32_t); - *(uint32_t *)xmhfhwm_cpu_gprs_esp = CASM_RET_EIP; - xmhfhwm_cpu_gprs_esp -= sizeof(uint32_t); - *(uint32_t *)xmhfhwm_cpu_gprs_esp = xmhfhwm_cpu_gprs_ebp; - xmhfhwm_cpu_gprs_esp -= sizeof(uint32_t); - *(uint32_t *)xmhfhwm_cpu_gprs_esp = xmhfhwm_cpu_gprs_edi; - xmhfhwm_cpu_gprs_esp -= sizeof(uint32_t); - *(uint32_t *)xmhfhwm_cpu_gprs_esp = xmhfhwm_cpu_gprs_esi; - xmhfhwm_cpu_gprs_esp -= sizeof(uint32_t); - *(uint32_t *)xmhfhwm_cpu_gprs_esp = xmhfhwm_cpu_gprs_ebx; - - //plug in an entry in the SISS corresponding to this RET - siss_elem.src_slabid = XMHFGEEC_SLAB_XC_INIT; - siss_elem.dst_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - siss_elem.slab_ctype = XMHFGEEC_SENTINEL_CALL_VfT_PROG_TO_uVT_uVU_PROG; - siss_elem.caller_stack_frame = xmhfhwm_cpu_gprs_esp; - siss_elem.sp = &drv_pathretvh2uh_callersp; - - gs_siss_push(drv_pathretvh2uh_sp.cpuid, siss_elem); - - //invoke syscall sentinel stub - xmhfhwm_cpu_gprs_edx = 0; - xmhfhwm_cpu_gprs_ecx = &drv_pathretvh2uh_sp; - CASM_FUNCCALL(gs_syscallstub, CASM_NOPARAM); - //@assert false; - } - #endif // DRV_PATH_RETVH2UH - - - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - #if defined (DRV_PATH_CALLUH2VH) - drv_path_calluh2vh(); - #endif // DRV_PATH_CALLUH2VH - - #if defined (DRV_PATH_RETVH2UH) - drv_path_retvh2uh(); - #endif // DRV_PATH_RETVH2UH - -} - -#endif - -////// syscall entry point -CASM_FUNCDEF(void, gs_syscallstub, -{ - xmhfhwm_cpu_insn_pushl_edx(); //original caller_stack_frame - xmhfhwm_cpu_insn_pushl_ecx(); - xmhfhwm_cpu_insn_call_c_2p(gs_entry_syscall, slab_params_t *, void *); - xmhfhwm_cpu_insn_hlt(); -}, -void *noparam) - - - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_calluv2v.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_calluv2v.c deleted file mode 100644 index d30083f6bb..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_calluv2v.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - -void gs_exit_calluv2v(slab_params_t *sp, void *caller_stack_frame){ - slab_params_t *dst_sp; - gs_siss_element_t siss_elem; - - _XDPRINTF_("%s[%u]: src=%u, dst=%u\n", __func__, (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid); - - //save caller stack frame address (esp) - _XDPRINTF_("%s[%u]: src tos before=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->src_slabid].slabtos[(uint16_t)sp->cpuid]); - xmhfgeec_slab_info_table[sp->src_slabid].slabtos[(uint16_t)sp->cpuid] = - (uint32_t)caller_stack_frame; - _XDPRINTF_("%s[%u]: src tos after=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->src_slabid].slabtos[(uint16_t)sp->cpuid]); - - - //make space on destination slab stack for slab_params_t and copy parameters - { - _XDPRINTF_("%s[%u]: dst tos before=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]); - xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid] -= sizeof(slab_params_t); - _XDPRINTF_("%s[%u]: dst tos after=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]); - dst_sp = (slab_params_t *) xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]; - _XDPRINTF_("%s[%u]: copying params to dst_sp=%x from sp=%x\n", __func__, (uint16_t)sp->cpuid, - (uint32_t)dst_sp, (uint32_t)sp); - - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, dst_sp, sp, sizeof(slab_params_t)); - } - - - - //push src_slabid, dst_slabid, hic_calltype, caller_stack_frame and sp - //tuple to safe stack - _XDPRINTF_("%s[%u]: safepush: {cpuid: %u, src: %u, dst: %u, ctype: 0x%x, \ - csf=0x%x, sp=0x%x \n", - __func__, (uint16_t)sp->cpuid, - (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid, sp->slab_ctype, - caller_stack_frame, sp); - - siss_elem.src_slabid = sp->src_slabid; - siss_elem.dst_slabid = sp->dst_slabid; - siss_elem.slab_ctype = sp->slab_ctype; - siss_elem.caller_stack_frame = caller_stack_frame; - siss_elem.sp = sp; - - //gs_siss_push((uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid, - // sp->slab_ctype, caller_stack_frame, sp); - gs_siss_push((uint16_t)sp->cpuid, siss_elem); - - - _XDPRINTF_("%s[%u]: entry=%x, dst_sp=%x, proceeding to xfer...\n", __func__, - (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->dst_slabid].entrystub, (uint32_t)dst_sp); - - - CASM_FUNCCALL(gs_exit_calluv2vstub, - xmhfgeec_slab_info_table[sp->dst_slabid].entrystub, - dst_sp); - - - _XDPRINTF_("%s[%u]: wip. halting!\n", __func__, (uint16_t)sp->cpuid); - HALT(); -} - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_calluv2vstub.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_calluv2vstub.cS deleted file mode 100644 index a07bc93a2a..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_calluv2vstub.cS +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - - -CASM_FUNCDEF(void, gs_exit_calluv2vstub, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - xmhfhwm_cpu_insn_movl_mesp_edx(0x8); - xmhfhwm_cpu_insn_movl_edx_esp(); - xmhfhwm_cpu_insn_pushl_esp(); - xmhfhwm_cpu_insn_pushl_imm(0x0); - xmhfhwm_cpu_insn_jmpslabep(); -}, -uint32_t entry_point, void *callee_stack_frame) - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uv.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uv.c deleted file mode 100644 index 1ca92146e6..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uv.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include -#include - -void gs_exit_callv2uv(slab_params_t *sp, void *caller_stack_frame){ - slab_params_t *dst_sp; - gs_siss_element_t siss_elem; - slab_params_t spl; - uapi_uhmpgtbl_getmpgtblbase_params_t *ps = (uapi_uhmpgtbl_getmpgtblbase_params_t *)spl.in_out_params; - - _XDPRINTF_("%s[%u]: src=%u, dst=%u\n", __func__, (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid); - - - //save caller stack frame address (esp) - _XDPRINTF_("%s[%u]: src tos before=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->src_slabid].slabtos[(uint16_t)sp->cpuid]); - xmhfgeec_slab_info_table[sp->src_slabid].slabtos[(uint16_t)sp->cpuid] = - (uint32_t)caller_stack_frame; - _XDPRINTF_("%s[%u]: src tos after=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->src_slabid].slabtos[(uint16_t)sp->cpuid]); - - - //make space on destination slab stack for slab_params_t and copy parameters - { - _XDPRINTF_("%s[%u]: dst tos before=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]); - //@assert sp->dst_slabid ==XMHFGEEC_SLAB_XH_SSTEPTRACE; - xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid] -= sizeof(slab_params_t); - _XDPRINTF_("%s[%u]: dst tos after=%x\n", __func__, (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]); - dst_sp = (slab_params_t *) xmhfgeec_slab_info_table[sp->dst_slabid].slabtos[(uint16_t)sp->cpuid]; - _XDPRINTF_("%s[%u]: copying params to dst_sp=%x from sp=%x\n", __func__, (uint16_t)sp->cpuid, - (uint32_t)dst_sp, (uint32_t)sp); - //memcpy(dst_sp, sp, sizeof(slab_params_t)); - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, dst_sp, sp, sizeof(slab_params_t)); - - } - - - //push src_slabid, dst_slabid, hic_calltype, caller_stack_frame and sp - //tuple to safe stack - _XDPRINTF_("%s[%u]: safepush: {cpuid: %u, src: %u, dst: %u, ctype: 0x%x, \ - csf=0x%x, sp=0x%x \n", - __func__, (uint16_t)sp->cpuid, - (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid, sp->slab_ctype, - caller_stack_frame, sp); - - siss_elem.src_slabid = sp->src_slabid; - siss_elem.dst_slabid = sp->dst_slabid; - siss_elem.slab_ctype = sp->slab_ctype; - siss_elem.caller_stack_frame = caller_stack_frame; - siss_elem.sp = sp; - - //gs_siss_push((uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid, - // sp->slab_ctype, caller_stack_frame, sp); - gs_siss_push((uint16_t)sp->cpuid, siss_elem); - - - - //switch to destination slab page tables - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_FROM_VfT_PROG; - spl.src_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; - spl.dst_slabid = UOBJ_UAPI_UHMPGTBL; - spl.cpuid = sp->cpuid; - spl.dst_uapifn = UAPI_UHMPGTBL_GETMPGTBLBASE; - - ps->dst_slabid = sp->dst_slabid; - - CASM_FUNCCALL(gs_calluobj, &spl, - xmhfgeec_slab_info_table[spl.dst_slabid].entrystub); - - _XDPRINTF_("%s[%u]: dst mempgtbl base=%x\n", __func__, - (uint16_t)sp->cpuid, - ps->mpgtblbase); - CASM_FUNCCALL(write_cr3,ps->mpgtblbase); - _XDPRINTF_("%s[%u]: swiched to dst mempgtbl\n", __func__, - (uint16_t)sp->cpuid); - - - _XDPRINTF_("%s[%u]: entry=%x, dst_sp=%x, eflags=%08x, proceeding to xfer...\n", __func__, - (uint16_t)sp->cpuid, xmhfgeec_slab_info_table[sp->dst_slabid].entrystub, (uint32_t)dst_sp, - CASM_FUNCCALL(read_eflags, CASM_NOPARAM)); - - - CASM_FUNCCALL(gs_exit_callv2uvstub, - xmhfgeec_slab_info_table[sp->dst_slabid].entrystub, - dst_sp); - - //@assert false; - - - _XDPRINTF_("%s[%u]: wip. halting!\n", __func__, (uint16_t)sp->cpuid); - HALT(); - - -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uvg.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uvg.cS deleted file mode 100644 index 7cbb90b80b..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uvg.cS +++ /dev/null @@ -1,79 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - - -//if we return, we had an error and we return the -//corresponding error code -CASM_FUNCDEF(uint32_t, gs_exit_callv2uvg, -{ - xmhfhwm_cpu_insn_movl_imm_edx(0x80); - xmhfhwm_cpu_insn_vmlaunch(); - xmhfhwm_cpu_insn_jc(__vmx_start_hvm_failinvalid); - xmhfhwm_cpu_insn_jnz(__vmx_start_hvm_undefinedimplementation); - xmhfhwm_cpu_insn_movl_imm_eax(0x1); //VMLAUNCH error, XXX: need to read from VM instruction error field in VMCS - xmhfhwm_cpu_insn_jmplabel(__vmx_start_continue); - CASM_LABEL(__vmx_start_hvm_undefinedimplementation); - xmhfhwm_cpu_insn_movl_imm_eax(0x2); //violation of VMLAUNCH specs., handle it anyways - xmhfhwm_cpu_insn_jmplabel(__vmx_start_continue); - CASM_LABEL(__vmx_start_hvm_failinvalid); - xmhfhwm_cpu_insn_xorl_eax_eax(); //return 0 as we have no error code available - CASM_LABEL(__vmx_start_continue); - xmhfhwm_cpu_insn_retu32(); -}, -void *noparam) - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uvstub.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uvstub.cS deleted file mode 100644 index e855b09c44..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2uvstub.cS +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -CASM_FUNCDEF(void, gs_exit_callv2uvstub, -{ - xmhfhwm_cpu_insn_movl_mesp_edx(0x4); //edx = entry_point - xmhfhwm_cpu_insn_movl_mesp_ecx(0x8); //ecx = callee_stack_frame - xmhfhwm_cpu_insn_jmpuhslabretaddr(); - //xmhfhwm_cpu_insn_sysexit(); //sysexit to ring-3 - //xmhfhwm_cpu_insn_hlt(); - - //xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - //xmhfhwm_cpu_insn_movl_mesp_edx(0x8); - //xmhfhwm_cpu_insn_movl_edx_esp(); - //xmhfhwm_cpu_insn_jmpl_eax(); - //xmhfhwm_cpu_insn_hlt(); - -}, -uint32_t entry_point, void *callee_stack_frame) - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2v.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2v.cS deleted file mode 100644 index 113571c2c0..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_callv2v.cS +++ /dev/null @@ -1,72 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -CASM_FUNCDEF(void, gs_exit_callv2v, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - xmhfhwm_cpu_insn_movl_mesp_edx(0x8); - xmhfhwm_cpu_insn_movl_edx_esp(); - xmhfhwm_cpu_insn_popl_ebx(); - xmhfhwm_cpu_insn_popl_esi(); - xmhfhwm_cpu_insn_popl_edi(); - xmhfhwm_cpu_insn_popl_ebp(); - xmhfhwm_cpu_insn_jmpslabep(); -}, -uint32_t entry_point, void *caller_stack_frame) - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_ret2v.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_ret2v.cS deleted file mode 100644 index b575e284d3..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_ret2v.cS +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - -CASM_FUNCDEF(void, gs_exit_ret2v, -{ - xmhfhwm_cpu_insn_movl_mesp_edx(0x4); - xmhfhwm_cpu_insn_movl_edx_esp(); - xmhfhwm_cpu_insn_popl_ebx(); - xmhfhwm_cpu_insn_popl_esi(); - xmhfhwm_cpu_insn_popl_edi(); - xmhfhwm_cpu_insn_popl_ebp(); - xmhfhwm_cpu_insn_ret(); -}, -void *caller_stack_frame) - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retuv2v.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retuv2v.c deleted file mode 100644 index b39e971cbe..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retuv2v.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - - -void gs_exit_retuv2v(slab_params_t *sp, void *caller_stack_frame){ - slab_params_t *dst_sp; - gs_siss_element_t elem; - - - _XDPRINTF_("%s[%u]: src=%u, dst=%u\n", __func__, (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid); - - //pop tuple from safe stack - //gs_siss_pop((uint16_t)sp->cpuid, &elem.src_slabid, &elem.dst_slabid, &elem.slab_ctype, &elem.caller_stack_frame, - // &elem.sp); - gs_siss_pop((uint16_t)sp->cpuid, &elem); - - - - _XDPRINTF_("%s[%u]: safepop: {cpuid: %u, src: %u, dst: %u, ctype: 0x%x, \ - csf=0x%x, sp=0x%x \n", - __func__, (uint16_t)sp->cpuid, - (uint16_t)sp->cpuid, elem.src_slabid, elem.dst_slabid, elem.slab_ctype, - elem.caller_stack_frame, elem.sp); - - //check to ensure this return is paired with a prior call - if ( !((elem.src_slabid == sp->dst_slabid) && (elem.dst_slabid == sp->src_slabid) && - (elem.slab_ctype == XMHFGEEC_SENTINEL_CALL_uVT_uVU_PROG_TO_VfT_PROG)) ){ - _XDPRINTF_("%s[ln:%u]: Fatal: ret does not match prior call. Halting!\n", - __func__, __LINE__); - HALT(); - } - - - //marshall parameters - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, (elem.sp)->in_out_params, sp->in_out_params, sizeof(sp->in_out_params)); - - - //return back to uVT/uVU_PROG slab - CASM_FUNCCALL(gs_exit_retuv2vstub, - elem.caller_stack_frame); - - - _XDPRINTF_("%s[%u]: wip. halting!\n", __func__, (uint16_t)sp->cpuid); - HALT(); -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retuv2vstub.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retuv2vstub.cS deleted file mode 100644 index 769f9b133d..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retuv2vstub.cS +++ /dev/null @@ -1,75 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - - -CASM_FUNCDEF(void, gs_exit_retuv2vstub, -{ - //caller_stack_frame: - // ebx, esi, edi, ebp, return-eip - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - xmhfhwm_cpu_insn_movl_eax_esp(); - xmhfhwm_cpu_insn_popl_ebx(); - xmhfhwm_cpu_insn_popl_esi(); - xmhfhwm_cpu_insn_popl_edi(); - xmhfhwm_cpu_insn_popl_ebp(); - - xmhfhwm_cpu_insn_popl_edx(); //edx = return-eip - xmhfhwm_cpu_insn_movl_esp_ecx(); //ecx = stack pointer - xmhfhwm_cpu_insn_jmpuhslabretaddr(); -}, -void *caller_stack_frame) diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retv2uv.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retv2uv.c deleted file mode 100644 index d4f71b283e..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retv2uv.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - - - - -void gs_exit_retv2uv(slab_params_t *sp, void *caller_stack_frame){ - slab_params_t *dst_sp; - gs_siss_element_t elem; - - _XDPRINTF_("%s[%u]: src=%u, dst=%u\n", __func__, (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid); - - - //pop tuple from safe stack - //gs_siss_pop((uint16_t)sp->cpuid, &elem.src_slabid, &elem.dst_slabid, &elem.slab_ctype, &elem.caller_stack_frame, - // &elem.sp); - gs_siss_pop((uint16_t)sp->cpuid, &elem); - - - - - _XDPRINTF_("%s[%u]: safepop: {cpuid: %u, src: %u, dst: %u, ctype: 0x%x, csf=0x%x, sp=0x%x \n", - __func__, (uint16_t)sp->cpuid, - (uint16_t)sp->cpuid, elem.src_slabid, elem.dst_slabid, - elem.slab_ctype, - elem.caller_stack_frame, elem.sp); - - //check to ensure this return is paired with a prior call - if( !((elem.src_slabid == sp->dst_slabid) && (elem.dst_slabid == sp->src_slabid) && - (elem.slab_ctype == XMHFGEEC_SENTINEL_CALL_VfT_PROG_TO_uVT_uVU_PROG)) ){ - _XDPRINTF_("%s[ln:%u]: Fatal: ret does not match prior call. Halting!\n", - __func__, __LINE__); - HALT(); - } - - - //marshall parameters - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, (elem.sp)->in_out_params, - sp->in_out_params, sizeof(sp->in_out_params)); - - - //return back to VfT_PROG slab - CASM_FUNCCALL(gs_exit_retv2uvstub, - elem.caller_stack_frame); - - _XDPRINTF_("%s[%u]: wip. halting!\n", __func__, (uint16_t)sp->cpuid); - HALT(); - -} - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retv2uvstub.cS b/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retv2uvstub.cS deleted file mode 100644 index f3069fd0ee..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_exit_retv2uvstub.cS +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -CASM_FUNCDEF(void, gs_exit_retv2uvstub, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - xmhfhwm_cpu_insn_movl_eax_esp(); - xmhfhwm_cpu_insn_popl_ebx(); - xmhfhwm_cpu_insn_popl_esi(); - xmhfhwm_cpu_insn_popl_edi(); - xmhfhwm_cpu_insn_popl_ebp(); - xmhfhwm_cpu_insn_jmpvhslabretaddr(); -}, -void *caller_stack_frame) - - - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_sisspop.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_sisspop.c deleted file mode 100644 index a4a39df902..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_sisspop.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * GEEC sentinel SISS stack pop operation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - - -//void gs_siss_pop(uint32_t cpuid, uint32_t *src_slabid, uint32_t *dst_slabid, uint32_t *hic_calltype, -// void **caller_stack_framep, slab_params_t **spp) -/*@ - requires sissValid (siss_id); - requires \valid(elem); - - behavior not_empty: - assumes !sissEmpty(siss_id); - assigns gs_siss_indices[siss_id]; - assigns elem->src_slabid; - assigns elem->dst_slabid; - assigns elem->slab_ctype; - assigns elem->caller_stack_frame; - assigns elem->sp; - - ensures X:sissValid (siss_id); - ensures Y:sissSize ( siss_id) == sissSize { Old }(siss_id) - 1; - ensures A:!sissFull (siss_id); - ensures sissStorage (siss_id ) == sissStorage {Old }( siss_id) ; - ensures sissCapacity ( siss_id) == sissCapacity { Old }(siss_id) ; - - behavior empty: - assumes sissEmpty (siss_id); - - assigns \nothing; - - ensures sissValid (siss_id); - ensures sissEmpty (siss_id); - ensures sissSize ( siss_id) == sissSize { Old }(siss_id) ; - ensures sissStorage (siss_id ) == sissStorage {Old }( siss_id) ; - ensures sissCapacity ( siss_id) == sissCapacity { Old }(siss_id) ; - - complete behaviors ; - disjoint behaviors ; - -*/ -void gs_siss_pop(uint32_t siss_id, gs_siss_element_t *elem) -{ - uint32_t safestack_index = gs_siss_indices[siss_id]; - - if(safestack_index >0 && safestack_index <= 512){ - safestack_index--; - elem->src_slabid = gs_siss[siss_id][safestack_index].src_slabid; - elem->dst_slabid = gs_siss[siss_id][safestack_index].dst_slabid; - elem->slab_ctype = gs_siss[siss_id][safestack_index].slab_ctype; - elem->caller_stack_frame = gs_siss[siss_id][safestack_index].caller_stack_frame; - elem->sp = gs_siss[siss_id][safestack_index].sp; - - gs_siss_indices[siss_id] = safestack_index; - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/gs_sisspush.c b/uxmhf/xmhf-uobjs/geec_sentinel/gs_sisspush.c deleted file mode 100644 index 85f03c6fd3..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/gs_sisspush.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - -/*@ - requires sissValid (siss_id); - - assigns gs_siss_indices[siss_id]; - assigns gs_siss[siss_id][gs_siss_indices[siss_id]]; - - behavior not_full: - assumes !sissFull(siss_id); - - assigns gs_siss_indices[siss_id]; - assigns gs_siss[siss_id][gs_siss_indices[siss_id]]; - - ensures H:sissValid (siss_id); - ensures I:sissSize (siss_id) == sissSize {Old}(siss_id) + 1; - ensures K:sissUnchanged {Pre ,Here }(sissStorage (siss_id), 0, sissSize{Pre}(siss_id)); - ensures J:sissTop( sissStorage (siss_id), sissSize{Pre}(siss_id), elem); - ensures !sissEmpty (siss_id); - ensures sissStorage (siss_id) == sissStorage {Old }( siss_id) ; - ensures sissCapacity ( siss_id) == sissCapacity { Old }(siss_id) ; - - behavior full : - assumes sissFull ( siss_id); - - assigns \nothing; - - ensures sissValid (siss_id); - ensures sissFull ( siss_id); - ensures sissUnchanged {Pre ,Here }(sissStorage (siss_id ), 0, sissSize(siss_id)); - ensures sissSize ( siss_id ) == sissSize { Old }(siss_id) ; - ensures sissStorage (siss_id ) == sissStorage {Old }( siss_id) ; - ensures sissCapacity ( siss_id ) == sissCapacity { Old }(siss_id) ; - - complete behaviors ; - disjoint behaviors ; -*/ - -void gs_siss_push(uint32_t siss_id, gs_siss_element_t elem) -{ - uint32_t safestack_index = gs_siss_indices[siss_id]; - if(safestack_index >=0 && safestack_index < 512) { - gs_siss[siss_id][safestack_index].src_slabid = elem.src_slabid; - gs_siss[siss_id][safestack_index].dst_slabid = elem.dst_slabid; - gs_siss[siss_id][safestack_index].slab_ctype = elem.slab_ctype; - gs_siss[siss_id][safestack_index].caller_stack_frame = elem.caller_stack_frame; - gs_siss[siss_id][safestack_index].sp = elem.sp; - - safestack_index++; - gs_siss_indices[siss_id] = safestack_index; - } -} - diff --git a/uxmhf/xmhf-uobjs/geec_sentinel/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/geec_sentinel/xmhfgeecslab.mk.in deleted file mode 100644 index c4a3a0b986..0000000000 --- a/uxmhf/xmhf-uobjs/geec_sentinel/xmhfgeecslab.mk.in +++ /dev/null @@ -1,36 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := geec_sentinel -export XMHF_SLAB_MAIN :=_slab_entrystub -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) -XMHF_SLAB_SOURCES += $(wildcard $(srcdir)/*.cS) - -#export XMHF_SLAB_FULLLINK := n - -export XMHF_SLAB_GLOBAL_SYMS := - -######################################################################## - - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATHV2V $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_callstub*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATHV2UV $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_callstub*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATHV2UG $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_callstub*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATH_RETEXCP $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_callstub*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATH_RETICPT $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_callstub*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATH_RETUH2VH $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_callstub*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATH_CALLUH2VH $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_syscall*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -cpp-extra-args=-DDRV_PATH_RETVH2UH $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c gs_entry_syscall*.c gs_data.c.v.c gs_entry.c.v.c gs_exit_*.c gs_siss*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gs_siss_push -lib-entry -wp -wp-rte -wp-model +cint -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gs_data.c.v.c gs_sisspush.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main gs_siss_pop -lib-entry -wp -wp-rte -wp-model +cint -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) gs_data.c.v.c gs_sisspop.c.v.c - - - diff --git a/uxmhf/xmhf-uobjs/include/geec_prime.h b/uxmhf/xmhf-uobjs/include/geec_prime.h deleted file mode 100644 index edab0df1e4..0000000000 --- a/uxmhf/xmhf-uobjs/include/geec_prime.h +++ /dev/null @@ -1,590 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF/GEEC prime header file -//author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __GEEC_PRIME_H_ -#define __GEEC_PRIME_H_ - -//---platform -//VMX MSR indices -#define INDEX_IA32_VMX_BASIC_MSR 0x0 -#define INDEX_IA32_VMX_PINBASED_CTLS_MSR 0x1 -#define INDEX_IA32_VMX_PROCBASED_CTLS_MSR 0x2 -#define INDEX_IA32_VMX_EXIT_CTLS_MSR 0x3 -#define INDEX_IA32_VMX_ENTRY_CTLS_MSR 0x4 -#define INDEX_IA32_VMX_MISC_MSR 0x5 -#define INDEX_IA32_VMX_CR0_FIXED0_MSR 0x6 -#define INDEX_IA32_VMX_CR0_FIXED1_MSR 0x7 -#define INDEX_IA32_VMX_CR4_FIXED0_MSR 0x8 -#define INDEX_IA32_VMX_CR4_FIXED1_MSR 0x9 -#define INDEX_IA32_VMX_VMCS_ENUM_MSR 0xA -#define INDEX_IA32_VMX_PROCBASED_CTLS2_MSR 0xB - - - - -#ifndef __ASSEMBLY__ - -//MTRR memory type structure -struct _memorytype { - uint64_t startaddr; - uint64_t endaddr; - uint32_t type; - uint32_t invalid; - uint32_t reserved[6]; -} __attribute__((packed)); - - -typedef struct { - uint8_t pgtbl[3 * PAGE_SIZE_4K]; - uint8_t mlehdr[0x80]; -} __attribute__((packed)) x86vmx_mle_header_t; - -#define MAX_SLAB_MEMIOREGIONS_MEMEXTENTS (PCI_CONF_MAX_BARS * MAX_PLATFORM_DEVICES) -#define MAX_SLAB_MEMIOREGIONS_IOEXTENTS (PCI_CONF_MAX_BARS * MAX_PLATFORM_DEVICES) - -#define _MEMIOREGIONS_EXTENTS_TYPE_MEM 0 -#define _MEMIOREGIONS_EXTENTS_TYPE_IO 1 -#define _MEMIOREGIONS_EXTENTS_TYPE_NONE 3 - -typedef struct { - uint32_t extent_type; - uint32_t addr_start; - uint32_t addr_end; -} __attribute__((packed)) _memioregions_extents_t; - -typedef struct { - uint32_t num_memextents; - uint32_t num_ioextents; - _memioregions_extents_t memextents[MAX_SLAB_MEMIOREGIONS_MEMEXTENTS]; - _memioregions_extents_t ioextents[MAX_SLAB_MEMIOREGIONS_IOEXTENTS]; -} __attribute__((packed)) slab_memioregions_t; - - -#define SYSDEV_MEMIOREGIONS_DTYPE_GENERAL 0 -#define SYSDEV_MEMIOREGIONS_DTYPE_BRIDGE 1 -#define SYSDEV_MEMIOREGIONS_DTYPE_LAPIC 2 -#define SYSDEV_MEMIOREGIONS_DTYPE_TPM 3 -#define SYSDEV_MEMIOREGIONS_DTYPE_TXT 4 -#define SYSDEV_MEMIOREGIONS_DTYPE_IOMMU 5 -#define SYSDEV_MEMIOREGIONS_DTYPE_SERIAL0 6 - -#define SYSDEV_MEMIOREGIONS_DTYPE_UNKNOWN 0xFF - -typedef struct { - uint32_t b; - uint32_t d; - uint32_t f; - uint16_t vendor_id; - uint16_t device_id; - uint32_t dtype; - _memioregions_extents_t memioextents[PCI_CONF_MAX_BARS]; -} __attribute__((packed)) sysdev_memioregions_t; - - -typedef struct { - uint32_t device_count; - uint32_t sysdev_mmioregions_indices[MAX_PLATFORM_DEVICES]; -} __attribute__((packed)) slab_devicemap_t; - - -typedef struct { - uint8_t tss_mainblock[PAGE_SIZE_4K]; - uint8_t tss_iobitmap[3*PAGE_SIZE_4K]; -} __attribute__((packed)) geec_prime_tss_t; - - - - - -typedef struct { - uint32_t ap_cr3; //0 - uint32_t ap_cr4; //4 - uint32_t ap_entrypoint; //8 - uint32_t _filler0; //12 - uint32_t ap_gdtdesc_limit; //16 - uint32_t ap_gdtdesc_base; //20 - uint32_t ap_cs_selector; //24 - uint32_t ap_eip; //28 - uint32_t cpuidtable; //32 - uint32_t _filler1; - uint32_t _filler2; - uint32_t _filler3; - uint64_t ap_gdt[X86SMP_APBOOTSTRAP_MAXGDTENTRIES]; -}__attribute__((packed)) x86smp_apbootstrapdata_t; - -typedef struct { - uint8_t vmx_vmxon_region[PAGE_SIZE_4K]; - uint8_t vmx_vmcs_region[PAGE_SIZE_4K]; - uint8_t vmx_msr_area_host_region[2*PAGE_SIZE_4K]; - uint8_t vmx_msr_area_guest_region[2*PAGE_SIZE_4K]; - uint8_t vmx_iobitmap_region[2][PAGE_SIZE_4K]; //I/O Bitmap area - uint8_t vmx_msrbitmaps_region[PAGE_SIZE_4K]; //MSR bitmap area - uint64_t vmx_msrs[IA32_VMX_MSRCOUNT]; - uint64_t vmx_msr_efer; - uint64_t vmx_msr_efcr; - x86regs_t vmx_gprs; - uint8_t _filler0[3952]; //page-align the whole structure -} __attribute__((packed)) xc_cpuarchdata_x86vmx_t; - - -typedef struct { - XMHF_BOOTINFO xcbootinfo_store; - uint64_t gp_vhslabmempgtbl_lvl4t[PAE_MAXPTRS_PER_PML4T]; - //uint8_t gp_uhslab_iobitmap[XMHFGEEC_TOTAL_UHSLABS][3*PAGE_SIZE_4K]; - //uint8_t gp_ugslab_iobitmap[XMHFGEEC_TOTAL_UGSLABS][3*PAGE_SIZE_4K]; -} __attribute__((packed)) gp_rwdatahdr_t; - - -typedef struct { - bool devpgtbl_initialized; -}__attribute__((packed)) _slabdevpgtbl_infotable_t; - - - -extern __attribute__(( section(".data") )) XMHF_BOOTINFO *xcbootinfo; - -extern __attribute__(( section(".rwdatahdr") )) gp_rwdatahdr_t gp_rwdatahdr; - -extern __attribute__((section(".data"))) __attribute__(( aligned(16) )) uint64_t __xmhfhic_x86vmx_gdt_start[]; //ro -extern __attribute__((section(".data"))) __attribute__(( aligned(16) )) arch_x86_gdtdesc_t __xmhfhic_x86vmx_gdt; //ro -extern __attribute__((section(".data"))) uint32_t __xmhfhic_exceptionstubs[]; //ro - - -extern __attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _init_cpustacks[MAX_PLATFORM_CPUS][MAX_PLATFORM_CPUSTACK_SIZE]; -//extern __attribute__((section(".data"))) __attribute__(( aligned(4096) )) uint8_t __xmhfhic_x86vmx_tss[MAX_PLATFORM_CPUS][PAGE_SIZE_4K]; //ro -extern __attribute__((section(".data"))) __attribute__(( aligned(4096) )) geec_prime_tss_t __xmhfhic_x86vmx_tss[MAX_PLATFORM_CPUS]; -extern __attribute__((section(".stack"))) __attribute__(( aligned(4096) )) uint8_t __xmhfhic_x86vmx_tss_stack[MAX_PLATFORM_CPUS][PAGE_SIZE_4K]; -//extern __attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _geec_primesmp_sysenter_stack[MAX_PLATFORM_CPUS][MAX_PLATFORM_CPUSTACK_SIZE]; -extern __attribute__((section(".data"))) __attribute__(( aligned(4096) )) xc_cpuarchdata_x86vmx_t __xmhfhic_x86vmx_archdata[MAX_PLATFORM_CPUS]; -extern __attribute__((section(".data"))) __attribute__(( aligned(8) )) uint32_t __xmhfhic_x86vmx_cpuidtable[MAX_X86_APIC_ID]; //ro - -// initialization BSP stack -extern __attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _init_bsp_cpustack[MAX_PLATFORM_CPUSTACK_SIZE]; - - -////// -// verified hypervisor slab memory page-tables -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl3t[PAE_MAXPTRS_PER_PDPT]; -//extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl2t[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl2t[PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -//extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl1t[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT][PAE_PTRS_PER_PT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_vhslabmempgtbl_lvl1t[PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; - -#if 1 -////// -// unverified hypervisor slab memory page-tables -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_uhslabmempgtbl_lvl3t[XMHFGEEC_TOTAL_UHSLABS][PAE_MAXPTRS_PER_PDPT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_uhslabmempgtbl_lvl2t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t gp_uhslabmempgtbl_lvl1t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; -#endif - -////// -// bootstrap unity mapped page-tables -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _xcprimeon_init_pdt[PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _xcprimeon_init_pdpt[PAE_MAXPTRS_PER_PDPT]; - - -extern __attribute__((section(".data"))) slab_devicemap_t _sda_slab_devicemap[XMHFGEEC_TOTAL_SLABS]; - -extern __attribute__((section(".data"))) sysdev_memioregions_t sysdev_memioregions[MAX_PLATFORM_DEVICES]; -extern __attribute__((section(".data"))) uint32_t numentries_sysdev_memioregions; - - -extern __attribute__((section(".data"))) struct _memorytype _vmx_ept_memorytypes[MAX_MEMORYTYPE_ENTRIES]; //EPT memory types array - -extern __attribute__((section(".data"))) mtrr_state_t _mtrrs; -extern __attribute__((section(".data"))) mtrr_state_t sinit2mle_mtrrs; - -extern __attribute__((section(".data"))) uint32_t gp_state4_smplock; - - -//DMA Remapping Hardware Unit Definitions -extern __attribute__((section(".data"))) VTD_DRHD vtd_drhd[VTD_MAX_DRHD]; -extern __attribute__((section(".data"))) uint32_t vtd_num_drhd; //total number of DMAR h/w units -extern __attribute__((section(".data"))) bool vtd_drhd_scanned; //set to true once DRHD units have been scanned in the system - -extern __attribute__((section(".data"))) vtd_drhd_handle_t vtd_drhd_maxhandle; -extern __attribute__((section(".data"))) uint32_t vtd_dmar_table_physical_address; -extern __attribute__((section(".data"))) uint32_t vtd_ret_address; - - -//DMA page tables -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_ret_entry_t _slabdevpgtbl_vtd_ret[VTD_RET_MAXPTRS]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_cet_entry_t _slabdevpgtbl_vtd_cet[VTD_RET_MAXPTRS][VTD_CET_MAXPTRS]; - -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pml4te_t _slabdevpgtbl_pml4t[XMHFGEEC_TOTAL_SLABS][PAE_MAXPTRS_PER_PML4T]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pdpte_t _slabdevpgtbl_pdpt[XMHFGEEC_TOTAL_SLABS][PAE_MAXPTRS_PER_PDPT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pdte_t _slabdevpgtbl_pdt[XMHFGEEC_TOTAL_SLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pte_t _slabdevpgtbl_pt[XMHFGEEC_TOTAL_SLABS][MAX_SLAB_DMADATA_PDT_ENTRIES][PAE_PTRS_PER_PT]; - -//rich-guest DMA page-tables -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) vtd_pte_t _slabdevpgtbl_pt_rg[VTD_PTRS_PER_PDPT * VTD_PTRS_PER_PDT * VTD_PTRS_PER_PT]; - - -extern __attribute__((section(".data"))) _slabdevpgtbl_infotable_t _slabdevpgtbl_infotable[XMHFGEEC_TOTAL_SLABS]; -extern __attribute__((section(".data"))) uint32_t vtd_pagewalk_level; - - -//SMP -extern __attribute__((section(".data"))) x86smp_apbootstrapdata_t apdata; - - - - - -////////////////////////////////////////////////////////////////////////////// -// setup slab memory page tables (smt) - -#define _SLAB_SPATYPE_MASK_SAMESLAB (0x100) - -#define _SLAB_SPATYPE_SLAB_CODE (0x0) -#define _SLAB_SPATYPE_SLAB_DATA (0x1) -#define _SLAB_SPATYPE_SLAB_STACK (0x2) -#define _SLAB_SPATYPE_SLAB_DMADATA (0x3) -#define _SLAB_SPATYPE_SLAB_DEVICEMMIO (0x4) -#define _SLAB_SPATYPE_GEEC_PRIME_IOTBL (0x5) - -#define _SLAB_SPATYPE_OTHER (0x6) - - - -////// -// stage-1 -////// -void gp_s1_bspstack(void); -uint64_t _gp_s1_bspstack_getflagsforspa(uint32_t paddr); -void gp_s1_bspstkactivate(void); -void gp_s1_hub(void); -void gp_s1_chkreq(void); -void gp_s1_postdrt(void); -void gp_s1_scaniommu(void); -void gp_s1_iommuinittbl(void); - -/*@ - requires 0 <= retindex < VTD_RET_MAXPTRS; -@*/ -void gp_s1_iommuinittbl_clearcet(uint32_t retindex); - -void gp_s1_iommuinit(void); - - - -////// -// stage-2 -////// - -/*@ - requires (gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES); -@*/ -void gp_s2_entry(void); - -void gp_s2_gathersysmemtypes(void); - -/*@ - requires (gp_rwdatahdr.xcbootinfo_store.memmapinfo_numentries < MAX_E820_ENTRIES); -@*/ -void gp_s2_initsysmemmap(void); - - -void gp_s2_sda(void); - - - - - - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -bool gp_s2_sdabinddevice(uint32_t slabid, uint32_t pagewalk_lvl, uint32_t bus, uint32_t dev, uint32_t func); - -/*@ - requires 0 <= numentries_sysdev_memioregions < MAX_PLATFORM_DEVICES; -@*/ -void gp_s2_sdadoalloc(void); - -/*@ - assigns \nothing; - ensures (\result == 0xFFFFFFFFUL || (0 <= \result < XMHFGEEC_TOTAL_SLABS)); -@*/ -uint32_t gp_s2_sdadoalloc_getuobjfordev(uint32_t bus, uint32_t dev, uint32_t func); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -void gp_s2_sdasetupdevpgtbl_rg(uint32_t slabid); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -void gp_s2_sdasetupdevpgtbl(uint32_t slabid); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= pd_index < MAX_SLAB_DMADATA_PDT_ENTRIES; - requires (startpaddr < (0xFFFFFFFFUL - PAGE_SIZE_2M)); -@*/ -void gp_s2_sdasetupdevpgtbl_setptentries(uint32_t slabid, uint32_t pd_index, uint32_t startpaddr); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires (paddr_end >= paddr_start); - requires (paddr_end < (0xFFFFFFFFUL - PAGE_SIZE_2M)); - requires (paddr_end - paddr_start) <= MAX_SLAB_DMADATA_SIZE; -@*/ -void gp_s2_sdasetupdevpgtbl_splintpdt(uint32_t slabid, uint32_t paddr_start, uint32_t paddr_end); - - - -/*@ - requires 0 <= vtd_drhd_maxhandle <= VTD_MAX_DRHD; - ensures 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; -@*/ -void gp_s2_sdmenumsysdevices(void); - -/*@ - behavior addentry: - ensures 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; -@*/ -void gp_s2_sdmenumsysdevices_memioextents(uint32_t b, uint32_t d, uint32_t f, uint32_t vendor_id, uint32_t device_id); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; - requires 0 <= xmhfgeec_slab_info_table[slabid].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES; -@*/ -void gp_s2_sdminitdevmap_addalldevstouobj(uint32_t slabid); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - - behavior addentry: - ensures _sda_slab_devicemap[slabid].sysdev_mmioregions_indices[\at(_sda_slab_devicemap[slabid].device_count, Pre)] == sysdev_mmioregions_index; - ensures (_sda_slab_devicemap[slabid].device_count == (\at(_sda_slab_devicemap[slabid].device_count, Pre) + 1)); - ensures (_sda_slab_devicemap[slabid].device_count <= MAX_PLATFORM_DEVICES); -@*/ -void gp_s2_sdminitdevmap_adddeventry(uint32_t slabid, uint32_t sysdev_mmioregions_index); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; - requires 0 <= xmhfgeec_slab_info_table[slabid].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES; -@*/ -void gp_s2_sdminitdevmap_adddevtouobj(uint32_t slabid, uint32_t vendor_id, uint32_t device_id); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= xmhfgeec_slab_info_table[slabid].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES; - - assigns \nothing; - - ensures (\result == true) || (\result == false); -@*/ -bool gp_s2_sdminitdevmap_isdevinexcl(uint32_t slabid, uint32_t vendor_id, uint32_t device_id); - -/*@ - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (0 <= xmhfgeec_slab_info_table[x].incl_devices_count <= XMHF_CONFIG_MAX_INCLDEVLIST_ENTRIES); - requires \forall integer x; 0 <= x < XMHFGEEC_TOTAL_SLABS ==> - (0 <= xmhfgeec_slab_info_table[x].excl_devices_count <= XMHF_CONFIG_MAX_EXCLDEVLIST_ENTRIES); - requires 0 <= numentries_sysdev_memioregions <= MAX_PLATFORM_DEVICES; -@*/ -void gp_s2_sdminitdevmap(void); - - - - -/*@ - requires (slabid >= XMHFGEEC_UHSLAB_BASE_IDX && slabid <= XMHFGEEC_UHSLAB_MAX_IDX); - requires _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES; - requires \forall integer x; 0 <= x < MAX_PLATFORM_DEVICES ==> (_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); -@*/ -void gp_s2_setupiotbluh(uint32_t slabid); - - -/*@ - requires (slabid >= XMHFGEEC_UGSLAB_BASE_IDX && slabid <= XMHFGEEC_UGSLAB_MAX_IDX); - requires _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES; - requires \forall integer x; 0 <= x < MAX_PLATFORM_DEVICES ==> (_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); -@*/ -void gp_s2_setupiotblug(uint32_t slabid); - - -void gp_s2_setupiotblug_rg(uint32_t slabid); - - - -void gp_s2_setupiotbl(void); - - - - -/*@ - assigns \nothing; - ensures 0 <= \result <= 7; -@*/ -uint32_t gp_s2_setupmpgtblug_getmtype(uint64_t pagebaseaddr); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -uint64_t gp_s2_setupmpgtblug_getflags(uint32_t slabid, uint32_t spa, uint32_t spatype); - - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS ; -@*/ -bool gp_s2_setupmpgtbl_getspatypeuobj_isiotbl(uint32_t slabid, uint32_t spa); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS ; - requires \forall uint32_t x; 0 <= x < MAX_PLATFORM_CPUS ==> (_sda_slab_devicemap[slabid].sysdev_mmioregions_indices[x] < MAX_PLATFORM_DEVICES); - requires 0 <= _sda_slab_devicemap[slabid].device_count < MAX_PLATFORM_DEVICES; -@*/ -bool gp_s2_setupmpgtbl_getspatypeuobj_ismmio(uint32_t slabid, uint32_t spa); - -/*@ - requires 0 <= slab_index < XMHFGEEC_TOTAL_SLABS ; -@*/ -uint32_t gp_s2_setupmpgtbl_getspatypeuobj(uint32_t slab_index, uint32_t spa); -//uint32_t gp_slab_getspatype_for_slab(uint32_t slab_index, uint32_t spa); - -/*@ - requires 0 <= slab_index < XMHFGEEC_TOTAL_SLABS ; -@*/ -uint32_t gp_s2_setupmpgtbl_getspatype(uint32_t slab_index, uint32_t spa); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -void gp_s2_setupmpgtblug(uint32_t slabid); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -void gp_s2_setupmpgtblug_rg(uint32_t slabid); - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; - requires 0 <= uhslabmempgtbl_idx < XMHFGEEC_TOTAL_UHSLABS; - requires 0 <= ptindex < (1024*1024); - ensures (\result == true) || (\result == false); -@*/ -bool gp_s2_setupmpgtbluh_setentry(uint32_t slabid, uint32_t uhslabmempgtbl_idx, uint32_t spatype, uint32_t ptindex, uint64_t flags); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -uint64_t gp_s2_setupmpgtbluh_getflags(uint32_t slabid, uint32_t spa, uint32_t spatype); - - -/*@ - requires XMHFGEEC_UHSLAB_BASE_IDX <= slabid <= XMHFGEEC_UHSLAB_MAX_IDX; -@*/ -void gp_s2_setupmpgtbluh(uint32_t slabid); - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_SLABS; -@*/ -uint64_t gp_s2_setupmpgtblv_getflags(uint32_t slabid, uint32_t spa, uint32_t spatype); - -void gp_s2_setupmpgtblv(void); - -void gp_s2_setupmpgtblu(void); - - -void gp_s2_setupgdt(void); - -/*@ - requires (__TRSEL/8) <= gdtindex <= (XMHFGEEC_MAX_GDT_CODEDATA_DESCRIPTORS + MAX_PLATFORM_CPUS); - requires 0 <= tssidx < MAX_PLATFORM_CPUS; -@*/ -void gp_s2_setupgdt_setgdttssentry(uint32_t gdtindex, uint32_t tssidx); - -void gp_s2_setupidt(void); - - -/*@ - requires 0 <= tssidx < MAX_PLATFORM_CPUS; -@*/ -void gp_s2_setuptss_inittss(uint32_t tssidx); - - -void gp_s2_setuptss(void); - - - -void gp_s3_entry(void); -void gp_s3_startcores(void); - - - -CASM_FUNCDECL(void gp_s4_entry(void *noparam)); -CASM_FUNCDECL(void gp_s4_apstacks(void *noparam)); - - -void gp_s5_entry(void); -void gp_s5_setupcpustate(uint32_t cpuid, bool isbsp); -void gp_s5_invokestrt(uint32_t cpuid); - - -#endif // __ASSEMBLY__ - - -#endif /* __GEEC_PRIME_H_ */ diff --git a/uxmhf/xmhf-uobjs/include/geec_sentinel.h b/uxmhf/xmhf-uobjs/include/geec_sentinel.h deleted file mode 100644 index 06fedfc802..0000000000 --- a/uxmhf/xmhf-uobjs/include/geec_sentinel.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF/GEEC sentinel header file -//author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __GEEC_SENTINEL_H_ -#define __GEEC_SENTINEL_H_ - - -#define UAPI_SENTINEL_INSTALLSYSCALLSTUB 0 -#define UAPI_SENTINEL_TEST 1 - - -#ifndef __ASSEMBLY__ - - -extern __attribute__(( section(".stack") )) __attribute__(( aligned(4096) )) uint8_t _sysenter_stack[MAX_PLATFORM_CPUS][MAX_PLATFORM_CPUSTACK_SIZE]; - -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) xmhfgeec_slab_info_t xmhfgeec_slab_info_table[XMHFGEEC_TOTAL_SLABS]; - - -typedef struct { - uint32_t src_slabid; - uint32_t dst_slabid; - uint32_t slab_ctype; - void *caller_stack_frame; - slab_params_t *sp; -}__attribute__((packed)) gs_siss_element_t; - - -extern __attribute__((section(".data"))) uint32_t gs_siss_indices[MAX_PLATFORM_CPUS]; -extern __attribute__((section(".data"))) gs_siss_element_t gs_siss[MAX_PLATFORM_CPUS][512]; - - -//@ logic uint32_t sissCapacity{L}(uint32_t siss_id) = (uint32_t)512; - -//@ logic uint32_t sissSize{L}(uint32_t siss_id) = gs_siss_indices[siss_id]; - -//@ logic gs_siss_element_t * sissStorage{L}(uint32_t siss_id) = &gs_siss[siss_id][0]; - -/*@ - predicate sissTop{L}(gs_siss_element_t * elem, integer index, gs_siss_element_t input) = - (elem[index].src_slabid == input.src_slabid && - elem[index].dst_slabid == input.dst_slabid && - elem[index].slab_ctype == input.slab_ctype && - elem[index].caller_stack_frame == input.caller_stack_frame && - elem[index].sp == input.sp - ); -*/ - -//@ predicate sissEmpty{L}(uint32_t siss_id) = (sissSize(siss_id) == 0); - -//@ predicate sissFull{L}(uint32_t siss_id) = (sissSize(siss_id) == sissCapacity(siss_id)); - -/*@ - predicate - sissUnchanged {A,B } ( gs_siss_element_t * a, integer first, integer last ) = - \forall integer i; first <= i < last - ==> ( (\at (a[i].src_slabid , A) == \at( a[i].src_slabid , B)) && - (\at (a[i].dst_slabid , A) == \at( a[i].dst_slabid , B)) && - (\at (a[i].slab_ctype , A) == \at( a[i].slab_ctype , B)) && - (\at (a[i].caller_stack_frame , A) == \at( a[i].caller_stack_frame , B)) && - (\at (a[i].sp , A) == \at( a[i].sp , B)) - ); -*/ - -/*@ - predicate sissValid{L}(uint32_t siss_id) = - (siss_id < MAX_PLATFORM_CPUS && - 0 < sissCapacity( siss_id) && - 0 <= sissSize (siss_id) <= sissCapacity ( siss_id) && - \valid (sissStorage (siss_id) + (0 .. sissCapacity (siss_id) - 1)) - ); -@*/ - -//void gs_siss_pop(uint32_t cpuid, uint32_t *src_slabid, uint32_t *dst_slabid, uint32_t *hic_calltype, - //void **caller_stack_framep, slab_params_t **spp); - -void gs_siss_pop(uint32_t siss_id, gs_siss_element_t *elem); - //void **caller_stack_framep, slab_params_t **spp); - - - - -/*@ - requires sissValid (siss_id); - - assigns gs_siss_indices[siss_id]; - assigns gs_siss[siss_id][gs_siss_indices[siss_id]]; - - behavior not_full: - assumes !sissFull(siss_id); - - assigns gs_siss_indices[siss_id]; - assigns gs_siss[siss_id][gs_siss_indices[siss_id]]; - - ensures H:sissValid (siss_id); - ensures I:sissSize (siss_id) == sissSize {Old}(siss_id) + 1; - ensures K:sissUnchanged {Pre ,Here }(sissStorage (siss_id), 0, sissSize{Pre}(siss_id)); - ensures J:sissTop( sissStorage (siss_id), sissSize{Pre}(siss_id), elem); - ensures !sissEmpty (siss_id); - ensures sissStorage (siss_id) == sissStorage {Old }( siss_id) ; - ensures sissCapacity ( siss_id) == sissCapacity { Old }(siss_id) ; - - behavior full : - assumes sissFull ( siss_id); - - assigns \nothing; - - ensures sissValid (siss_id); - ensures sissFull ( siss_id); - ensures sissUnchanged {Pre ,Here }(sissStorage (siss_id ), 0, sissSize(siss_id)); - ensures sissSize ( siss_id ) == sissSize { Old }(siss_id) ; - ensures sissStorage (siss_id ) == sissStorage {Old }( siss_id) ; - ensures sissCapacity ( siss_id ) == sissCapacity { Old }(siss_id) ; - - complete behaviors ; - disjoint behaviors ; -*/ -void gs_siss_push(uint32_t siss_id, gs_siss_element_t elem); - - -void geec_sentinel_main(slab_params_t *sp, void *caller_stack_frame); - - - - -//void gs_entry_excp(x86vmx_exception_frame_t *exframe); -//CASM_FUNCDECL(void gs_exit_callexcp(uint32_t entry_point, void *caller_stack_frame)); -//CASM_FUNCDECL(void gs_exit_retexcp(x86vmx_exception_frame_t *exframe)); - -CASM_FUNCDECL(void gs_calluobj(slab_params_t *sp, uint32_t entry_point)); - -CASM_FUNCDECL(void gs_syscallstub(void *noparam)); -void gs_entry_syscall(slab_params_t *sp, void *caller_stack_frame); - -void gs_exit_retv2uv(slab_params_t *sp, void *caller_stack_frame); -CASM_FUNCDECL(void gs_exit_retv2uvstub(void *caller_stack_frame)); - -void gs_exit_calluv2v(slab_params_t *sp, void *caller_stack_frame); -CASM_FUNCDECL(void gs_exit_calluv2vstub(uint32_t entry_point, void *callee_stack_frame)); - - - -void gs_exit_callv2uv(slab_params_t *sp, void *caller_stack_frame); -CASM_FUNCDECL(void gs_exit_callv2uvstub(uint32_t entry_point, void *callee_stack_frame)); - - -void gs_exit_retuv2v(slab_params_t *sp, void *caller_stack_frame); -CASM_FUNCDECL(void gs_exit_retuv2vstub(void *caller_stack_frame)); - - - -CASM_FUNCDECL(void gs_exit_callv2v(uint32_t entry_point, void *caller_stack_frame)); - -CASM_FUNCDECL(void gs_exit_ret2v(void *caller_stack_frame)); - -CASM_FUNCDECL(uint32_t gs_exit_callv2uvg(void *noparam)); - - - - -//CASM_FUNCDECL(void gs_entry_icptstub(void *noparam)); -//void gs_entry_icpt(x86regs_t *r); -//CASM_FUNCDECL(void gs_exit_callicpt(uint32_t entry_point, void *caller_stack_frame)); -//CASM_FUNCDECL(void gs_exit_reticpt(x86regs_t *r)); - - - -//CASM_FUNCDECL(void __xmhf_exception_handler_0(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_1(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_2(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_3(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_4(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_5(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_6(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_7(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_8(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_9(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_10(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_11(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_12(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_13(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_14(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_15(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_16(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_17(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_18(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_19(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_20(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_21(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_22(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_23(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_24(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_25(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_26(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_27(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_28(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_29(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_30(void *noparam)); -//CASM_FUNCDECL(void __xmhf_exception_handler_31(void *noparam)); - - - - - - - -#endif // __ASSEMBLY__ - - -#endif /* __GEEC_SENTINEL_H_ */ diff --git a/uxmhf/xmhf-uobjs/include/uapi_gcpustate.h b/uxmhf/xmhf-uobjs/include/uapi_gcpustate.h deleted file mode 100644 index e03d9c5b48..0000000000 --- a/uxmhf/xmhf-uobjs/include/uapi_gcpustate.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * guest cpu state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __UAPI_GCPUSTATE_H__ -#define __UAPI_GCPUSTATE_H__ - - -#define XMHF_HIC_UAPI_CPUSTATE_VMREAD 0 -#define XMHF_HIC_UAPI_CPUSTATE_VMWRITE 1 -#define XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD 2 -#define XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE 3 -#define XMHFGEEC_UAPI_CPUSTATE_GUESTMSRREAD 4 -#define XMHFGEEC_UAPI_CPUSTATE_GUESTMSRWRITE 5 - - - - -#define GCPUSTATE_MSR_LBR_SELECT 0 - -#define GCPUSTATE_MSR_LASTBRANCH_TOS 1 - -#define GCPUSTATE_MSR_IA32_DEBUGCTL 2 - -#define GCPUSTATE_MSR_LASTBRANCH_0_FROM_IP 3 -#define GCPUSTATE_MSR_LASTBRANCH_1_FROM_IP 4 -#define GCPUSTATE_MSR_LASTBRANCH_2_FROM_IP 5 -#define GCPUSTATE_MSR_LASTBRANCH_3_FROM_IP 6 -#define GCPUSTATE_MSR_LASTBRANCH_4_FROM_IP 7 -#define GCPUSTATE_MSR_LASTBRANCH_5_FROM_IP 8 -#define GCPUSTATE_MSR_LASTBRANCH_6_FROM_IP 9 -#define GCPUSTATE_MSR_LASTBRANCH_7_FROM_IP 10 -#define GCPUSTATE_MSR_LASTBRANCH_8_FROM_IP 11 -#define GCPUSTATE_MSR_LASTBRANCH_9_FROM_IP 12 -#define GCPUSTATE_MSR_LASTBRANCH_10_FROM_IP 13 -#define GCPUSTATE_MSR_LASTBRANCH_11_FROM_IP 14 -#define GCPUSTATE_MSR_LASTBRANCH_12_FROM_IP 15 -#define GCPUSTATE_MSR_LASTBRANCH_13_FROM_IP 16 -#define GCPUSTATE_MSR_LASTBRANCH_14_FROM_IP 17 -#define GCPUSTATE_MSR_LASTBRANCH_15_FROM_IP 18 - - -#define GCPUSTATE_MSR_LASTBRANCH_0_TO_IP 19 -#define GCPUSTATE_MSR_LASTBRANCH_1_TO_IP 20 -#define GCPUSTATE_MSR_LASTBRANCH_2_TO_IP 21 -#define GCPUSTATE_MSR_LASTBRANCH_3_TO_IP 22 -#define GCPUSTATE_MSR_LASTBRANCH_4_TO_IP 23 -#define GCPUSTATE_MSR_LASTBRANCH_5_TO_IP 24 -#define GCPUSTATE_MSR_LASTBRANCH_6_TO_IP 25 -#define GCPUSTATE_MSR_LASTBRANCH_7_TO_IP 26 -#define GCPUSTATE_MSR_LASTBRANCH_8_TO_IP 27 -#define GCPUSTATE_MSR_LASTBRANCH_9_TO_IP 28 -#define GCPUSTATE_MSR_LASTBRANCH_10_TO_IP 29 -#define GCPUSTATE_MSR_LASTBRANCH_11_TO_IP 30 -#define GCPUSTATE_MSR_LASTBRANCH_12_TO_IP 31 -#define GCPUSTATE_MSR_LASTBRANCH_13_TO_IP 32 -#define GCPUSTATE_MSR_LASTBRANCH_14_TO_IP 33 -#define GCPUSTATE_MSR_LASTBRANCH_15_TO_IP 34 - -#define GCPUSTATE_MSR_TOTAL 35 - -#define GCPUSTATE_MSR_MAXCOUNT 128 - -#ifndef __ASSEMBLY__ - - -typedef struct { - uint64_t encoding; - uint64_t value; -}__attribute__((packed)) xmhf_uapi_gcpustate_vmrw_params_t; - -typedef struct { - uint32_t msr; - uint64_t value; -}__attribute__((packed)) xmhf_uapi_gcpustate_msrrw_params_t; - - -typedef struct { - x86regs_t gprs; -}__attribute__((packed)) xmhf_uapi_gcpustate_gprs_params_t; - - -extern __attribute__((section(".data"))) x86regs_t guestgprs[MAX_PLATFORM_CPUS]; -extern __attribute__((section(".data"))) uint64_t guestmsrs[GCPUSTATE_MSR_MAXCOUNT]; - - -/*@ - requires \valid(vmrwp); -@*/ -void ugcpust_vmread(xmhf_uapi_gcpustate_vmrw_params_t *vmrwp); - -/*@ - requires \valid(vmrwp); -@*/ -void ugcpust_vmwrite(uint32_t srcslabid, xmhf_uapi_gcpustate_vmrw_params_t *vmrwp); - -/*@ - requires \valid(gprs); - requires 0 <= cpuid < MAX_PLATFORM_CPUS; -@*/ -void ugcpust_gprsread(uint32_t cpuid, xmhf_uapi_gcpustate_gprs_params_t *gprs); - -/*@ - requires \valid(gprs); - requires 0 <= cpuid < MAX_PLATFORM_CPUS; -@*/ -void ugcpust_gprswrite(uint32_t cpuid, xmhf_uapi_gcpustate_gprs_params_t *gprs); - -/*@ - requires \valid(msrrwp); -@*/ -void ugcpust_msrread(xmhf_uapi_gcpustate_msrrw_params_t *msrrwp); - -/*@ - requires \valid(msrrwp); -@*/ -void ugcpust_msrwrite(xmhf_uapi_gcpustate_msrrw_params_t *msrrwp); - - - -#endif //__ASSEMBLY__ - -#endif //__UAPI_GCPUSTATE_H__ diff --git a/uxmhf/xmhf-uobjs/include/uapi_hcpustate.h b/uxmhf/xmhf-uobjs/include/uapi_hcpustate.h deleted file mode 100644 index 8a6de0ace7..0000000000 --- a/uxmhf/xmhf-uobjs/include/uapi_hcpustate.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * host cpu state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __UAPI_HCPUSTATE_H__ -#define __UAPI_HCPUSTATE_H__ - -#define XMHF_HIC_UAPI_CPUSTATE_WRMSR 0 -#define XMHF_HIC_UAPI_CPUSTATE_RDMSR 1 - - -#ifndef __ASSEMBLY__ - - -typedef struct { - uint32_t msr; - uint64_t value; -}__attribute__((packed)) xmhf_uapi_hcpustate_msr_params_t; - - -/*@ - requires \valid(msrp); -@*/ -void uhcpust_rdmsr(xmhf_uapi_hcpustate_msr_params_t *msrp); - -/*@ - requires \valid(msrp); - requires 0 <= srcslabid < XMHFGEEC_TOTAL_SLABS; -@*/ -void uhcpust_wrmsr(uint32_t srcslabid, xmhf_uapi_hcpustate_msr_params_t *msrp); - - -#endif //__ASSEMBLY__ - -#endif //__UAPI_HCPUSTATE_H__ diff --git a/uxmhf/xmhf-uobjs/include/uapi_iotbl.h b/uxmhf/xmhf-uobjs/include/uapi_iotbl.h deleted file mode 100644 index 0d6bae5d64..0000000000 --- a/uxmhf/xmhf-uobjs/include/uapi_iotbl.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * I/O permission tables uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __UAPI_IOTBL_H__ -#define __UAPI_IOTBL_H__ - - -#define UXMHF_UAPI_IOTBL_TEST 1 -#define UXMHF_UAPI_IOTBL_GETIOTBLBASE 2 -#define UXMHF_UAPI_IOTBL_INITIOTBL 3 -#define UXMHF_UAPI_IOTBL_SETUPIOTBLUGPORTACCESS 4 -#define UXMHF_UAPI_IOTBL_SETUPIOTBLUHPORTACCESS 5 - - -#ifndef __ASSEMBLY__ - -extern uint8_t uiotbl_uhslab_iobitmap[XMHFGEEC_TOTAL_UHSLABS][3*PAGE_SIZE_4K]; -extern uint8_t uiotbl_ugslab_iobitmap[XMHFGEEC_TOTAL_UGSLABS][3*PAGE_SIZE_4K]; - - -typedef struct { - uint32_t dst_slabid; - uint32_t iotbl_base; -}__attribute__((packed)) uapi_iotbl_getiotblbase_t; - - -void uiotbl_getiotblbase(uapi_iotbl_getiotblbase_t *ps); - - -typedef struct { - uint32_t dst_slabid; -}__attribute__((packed)) uapi_iotbl_initiotbl_t; - - -void uiotbl_initiotbl(uapi_iotbl_initiotbl_t *ps); - -typedef struct { - uint32_t ugslabiobitmap_idx; - uint16_t port; - uint16_t port_size; -}__attribute__((packed)) uapi_iotbl_setupiotblugportaccess_t; - -void uiotbl_setupiotblugportaccess(uapi_iotbl_setupiotblugportaccess_t *ps); - - -typedef struct { - uint32_t uhslabiobitmap_idx; - uint16_t port; - uint16_t port_size; -}__attribute__((packed)) uapi_iotbl_setupiotbluhportaccess_t; - -void uiotbl_setupiotbluhportaccess(uapi_iotbl_setupiotbluhportaccess_t *ps); - - -/*@ - requires 0 <= uhslabiobitmap_idx < XMHFGEEC_TOTAL_UHSLABS; - requires 0 <= port < 65536; - requires 0 <= port_size <= 4; -@*/ -void uiotbl_setupiotbluh_allowaccesstoport(uint32_t uhslabiobitmap_idx, uint16_t port, uint16_t port_size); - - -/*@ - requires 0 <= ugslabiobitmap_idx < XMHFGEEC_TOTAL_UGSLABS; - requires 0 <= port < 65536; - requires 0 <= port_size <= 4; -@*/ -void uiotbl_setupiotblug_allowaccesstoport(uint32_t ugslabiobitmap_idx, uint16_t port, uint16_t port_size); - - -#endif //__ASSEMBLY__ - -#endif //__UAPI_IOTBL_H__ diff --git a/uxmhf/xmhf-uobjs/include/uapi_slabmempgtbl.h b/uxmhf/xmhf-uobjs/include/uapi_slabmempgtbl.h deleted file mode 100644 index 6f3a905eda..0000000000 --- a/uxmhf/xmhf-uobjs/include/uapi_slabmempgtbl.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __UAPI_SLABMEMPGTBL_H__ -#define __UAPI_SLABMEMPGTBL_H__ - -#define XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL 0 -#define XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR 1 -#define XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR 2 -#define XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB 3 -#define UAPI_UGMPGTBL_GETMPGTBLBASE 4 - - - - -#ifndef __ASSEMBLY__ - -extern __attribute__((section(".rwdatahdr"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl4t[XMHFGEEC_TOTAL_UGSLABS][PAE_MAXPTRS_PER_PML4T]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl3t[XMHFGEEC_TOTAL_UGSLABS][PAE_MAXPTRS_PER_PDPT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl2t[XMHFGEEC_TOTAL_UGSLABS][PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl1t[XMHFGEEC_TOTAL_UGSLABS][PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT][PAE_PTRS_PER_PT]; - - - -typedef struct { - uint32_t dst_slabid; -}__attribute__((packed)) xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t; - -typedef struct { - uint32_t dst_slabid; - uint64_t gpa; - uint64_t entry; -}__attribute__((packed)) xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t; - -typedef struct { - uint32_t dst_slabid; - uint64_t gpa; - uint64_t result_entry; -}__attribute__((packed)) xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t; - -typedef struct { - uint32_t dst_slabid; -}__attribute__((packed)) xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t; - - -typedef struct { - uint32_t dst_slabid; - uint32_t mpgtblbase; -}__attribute__((packed)) uapi_ugmpgtbl_getmpgtblbase_params_t; - - - -/*@ - requires \valid(p); -@*/ -void _ugmpgtbl_getmpgtblbase(uapi_ugmpgtbl_getmpgtblbase_params_t *p); - - -/*@ - requires \valid(flushtlbp); -@*/ -void _slabmempgtbl_flushtlb(xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *flushtlbp); - - -/*@ - requires \valid(setentryforpaddrp); -@*/ -void _slabmempgtbl_setentryforpaddr(xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp); - - - -/*@ - requires \valid(getentryforpaddrp); -@*/ -void _slabmempgtbl_getentryforpaddr(xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp); - - - -/*@ - requires \valid(initmempgtblp); -@*/ -void _slabmempgtbl_initmempgtbl(xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t *initmempgtblp); - - - - - - -#endif //__ASSEMBLY__ - -#endif //__UAPI_SLABMEMPGTBL_H__ diff --git a/uxmhf/xmhf-uobjs/include/uapi_sysdata.h b/uxmhf/xmhf-uobjs/include/uapi_sysdata.h deleted file mode 100644 index b41e51907f..0000000000 --- a/uxmhf/xmhf-uobjs/include/uapi_sysdata.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * sysdata (E820) state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __UAPI_SYSDATA_H__ -#define __UAPI_SYSDATA_H__ - - -#define UXMHF_UAPI_SYSDATA_E820ADDENTRY 1 -#define UXMHF_UAPI_SYSDATA_E820GETMAXINDEX 2 -#define UXMHF_UAPI_SYSDATA_E820GETENTRYFORINDEX 3 - - -#ifndef __ASSEMBLY__ - -typedef struct { - uint32_t baseaddr_low; - uint32_t baseaddr_high; - uint32_t length_low; - uint32_t length_high; - uint32_t type; -}__attribute__((packed)) uxmhf_uapi_sysdata_e820addentry_t; - - -typedef struct { - uint32_t index; -}__attribute__((packed)) uxmhf_uapi_sysdata_e820getmaxindex_t; - -typedef struct { - uint32_t index; - uint32_t baseaddr_low; - uint32_t baseaddr_high; - uint32_t length_low; - uint32_t length_high; - uint32_t type; -}__attribute__((packed)) uxmhf_uapi_sysdata_e820getentryforindex_t; - - -/*@ - requires \valid(e820entryp); -@*/ -void usysd_e820addentry(uxmhf_uapi_sysdata_e820addentry_t *e820entryp); - -/*@ - requires \valid(gentryp); -@*/ -void usysd_e820getentryforindex(uxmhf_uapi_sysdata_e820getentryforindex_t *gentryp); - -/*@ - requires \valid(indexp); -@*/ -void usysd_e820getmaxindex(uxmhf_uapi_sysdata_e820getmaxindex_t *indexp); - -extern __attribute__((section(".data"))) GRUBE820 usysd_memmapinfo[MAX_E820_ENTRIES]; - -extern __attribute__((section(".data"))) uint32_t usysd_memmapinfo_maxindex; - - - -#endif //__ASSEMBLY__ - -#endif //__UAPI_SYSDATA_H__ diff --git a/uxmhf/xmhf-uobjs/include/uapi_uhmpgtbl.h b/uxmhf/xmhf-uobjs/include/uapi_uhmpgtbl.h deleted file mode 100644 index 9116da3eb0..0000000000 --- a/uxmhf/xmhf-uobjs/include/uapi_uhmpgtbl.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * untrusted hypervisor uobj pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __UAPI_UHMPGTBL_H__ -#define __UAPI_UHMPGTBL_H__ - -#define UAPI_UHMPGTBL_INITMEMPGTBL 0 -#define UAPI_UHMPGTBL_SETENTRYFORPADDR 1 -#define UAPI_UHMPGTBL_GETMPGTBLBASE 2 -#define UAPI_UHMPGTBL_GETIDXFORMPGTBLBASE 3 - -#ifndef __ASSEMBLY__ - -extern __attribute__((section(".rwdatahdr"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl4t[XMHFGEEC_TOTAL_UHSLABS][PAE_MAXPTRS_PER_PML4T]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl3t[XMHFGEEC_TOTAL_UHSLABS][PAE_MAXPTRS_PER_PDPT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl2t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -extern __attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl1t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; - - -typedef struct { - uint32_t dst_slabid; -}__attribute__((packed)) uapi_uhmpgtbl_initmempgtbl_params_t; - -typedef struct { - uint32_t dst_slabid; - uint32_t pa; - uint32_t entry_lo; - uint32_t entry_hi; -}__attribute__((packed)) uapi_uhmpgtbl_setentryforpaddr_params_t; - -typedef struct { - uint32_t dst_slabid; - uint32_t mpgtblbase; -}__attribute__((packed)) uapi_uhmpgtbl_getmpgtblbase_params_t; - - -typedef struct { - uint32_t mpgtblbase; - uint32_t status; - uint32_t mpgtblbase_idx; -}__attribute__((packed)) uapi_uhmpgtbl_getidxformpgtblbase_params_t; - - - - -/*@ - requires \valid(initmempgtblp); -@*/ -void _uhmpgtbl_initmempgtbl(uapi_uhmpgtbl_initmempgtbl_params_t *initmempgtblp); - - -/*@ - requires \valid(setentryforpaddrp); -@*/ -void _uhmpgtbl_setentryforpaddr(uapi_uhmpgtbl_setentryforpaddr_params_t *setentryforpaddrp); - -/*@ - requires \valid(p); -@*/ -void _uhmpgtbl_getmpgtblbase(uapi_uhmpgtbl_getmpgtblbase_params_t *p); - - -/*@ - requires \valid(p); -@*/ -void _uhmpgtbl_getidxformpgtblbase(uapi_uhmpgtbl_getidxformpgtblbase_params_t *p); - - -#endif //__ASSEMBLY__ - -#endif //__UAPI_UHMPGTBL_H__ diff --git a/uxmhf/xmhf-uobjs/include/xc.h b/uxmhf/xmhf-uobjs/include/xc.h deleted file mode 100644 index e490d658a2..0000000000 --- a/uxmhf/xmhf-uobjs/include/xc.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -//xmhf.h - main XMHF core header file -// this orchestrates the inclusion of other core component specific -// headers -//author: amit vasudevan (amitvasudevan@acm.org) -//author: matt mccormack (matthew.mccormack@live.com) -// -#ifndef __XC_H_ -#define __XC_H_ - - -#ifndef __ASSEMBLY__ -#include - -#endif // __ASSEMBLY__ - -#define XC_HYPAPPCB_CHAIN (1) -#define XC_HYPAPPCB_NOCHAIN (2) - -#define XC_HYPAPPCB_INITIALIZE (0) -#define XC_HYPAPPCB_HYPERCALL (1) -#define XC_HYPAPPCB_MEMORYFAULT (2) -#define XC_HYPAPPCB_SHUTDOWN (3) -#define XC_HYPAPPCB_TRAP_IO (4) -#define XC_HYPAPPCB_TRAP_INSTRUCTION (5) -#define XC_HYPAPPCB_TRAP_EXCEPTION (6) - -#define XC_HYPAPPCB_MAXMASK (6) - -#define XC_HYPAPPCB_TRAP_INSTRUCTION_CPUID (0x60) -#define XC_HYPAPPCB_TRAP_INSTRUCTION_WRMSR (0x61) -#define XC_HYPAPPCB_TRAP_INSTRUCTION_RDMSR (0x62) - -#ifndef __ASSEMBLY__ - - -typedef struct { - uint32_t cbtype; - uint32_t cbqual; - uint32_t guest_slab_index; - uint32_t cbresult; -}__attribute__((packed)) xc_hypappcb_params_t; - -typedef struct { - uint32_t xmhfhic_slab_index; - uint32_t cbmask; -} __attribute__((packed)) xc_hypapp_info_t; - - -#define XC_HYPAPPCB_MASK(x) (1 << x) - -static xc_hypapp_info_t _xcihub_hypapp_info_table[] = { - // { - // XMHFGEEC_SLAB_XH_UHCALLTEST, - // (XC_HYPAPPCB_MASK(XC_HYPAPPCB_INITIALIZE) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_HYPERCALL) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_SHUTDOWN) ) - // }, - - { - XMHFGEEC_SLAB_XH_HYPERDEP, - (XC_HYPAPPCB_MASK(XC_HYPAPPCB_INITIALIZE) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_HYPERCALL) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_MEMORYFAULT) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_SHUTDOWN) ) - }, - - //{ - // XMHFGEEC_SLAB_XH_APRVEXEC, - // (XC_HYPAPPCB_MASK(XC_HYPAPPCB_INITIALIZE) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_HYPERCALL) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_MEMORYFAULT) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_SHUTDOWN) ) - //}, - - { - XMHFGEEC_SLAB_XH_SSTEPTRACE, - (XC_HYPAPPCB_MASK(XC_HYPAPPCB_INITIALIZE) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_HYPERCALL) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_TRAP_EXCEPTION) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_SHUTDOWN) ) - }, - - { - XMHFGEEC_SLAB_XH_SYSCALLLOG, - (XC_HYPAPPCB_MASK(XC_HYPAPPCB_INITIALIZE) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_HYPERCALL) | XC_HYPAPPCB_MASK(XC_HYPAPPCB_MEMORYFAULT) ) - } - -}; - -#define HYPAPP_INFO_TABLE_NUMENTRIES (sizeof(_xcihub_hypapp_info_table)/sizeof(_xcihub_hypapp_info_table[0])) - - -#endif //__ASSEMBLY__ - - -#endif /* __XC_H_ */ diff --git a/uxmhf/xmhf-uobjs/include/xc_exhub.h b/uxmhf/xmhf-uobjs/include/xc_exhub.h deleted file mode 100644 index 2b387dd571..0000000000 --- a/uxmhf/xmhf-uobjs/include/xc_exhub.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF slab import library decls./defns. -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XC_EXHUB_H__ -#define __XC_EXHUB_H__ - -#define UAPI_XCEXHUB_DEBUG 1 -#define UAPI_XCEXHUB_SETUPIDT 2 -#define UAPI_XCEXHUB_LOADIDT 3 -#define UAPI_XCEXHUB_LOADHOSTIDTRBASE 4 - -#ifndef __ASSEMBLY__ - -extern __attribute__((section(".data"))) __attribute__(( aligned(16) )) idtentry_t xcexhub_idt_data[EMHF_XCPHANDLER_MAXEXCEPTIONS]; //ro -extern __attribute__((section(".data"))) __attribute__(( aligned(16) )) arch_x86_idtdesc_t xcexhub_idt; //ro -extern __attribute__((section(".data"))) uint32_t xcexhub_excp_handlers[EMHF_XCPHANDLER_MAXEXCEPTIONS]; - - -CASM_FUNCDECL(void __xmhf_exception_handler_0(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_1(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_2(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_3(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_4(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_5(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_6(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_7(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_8(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_9(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_10(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_11(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_12(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_13(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_14(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_15(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_16(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_17(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_18(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_19(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_20(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_21(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_22(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_23(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_24(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_25(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_26(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_27(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_28(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_29(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_30(void *noparam)); -CASM_FUNCDECL(void __xmhf_exception_handler_31(void *noparam)); - -void xcexhub_entryexcp(x86vmx_exception_frame_t *exframe); -CASM_FUNCDECL(void xcexhub_retexcp(x86vmx_exception_frame_t *exframe)); -void xcexhub_excpmain(slab_params_t *sp); - -void xcexhub_setupidt(void); - - -#endif //__ASSEMBLY__ - - -#endif //__XC_EXHUB_H__ diff --git a/uxmhf/xmhf-uobjs/include/xc_ihub.h b/uxmhf/xmhf-uobjs/include/xc_ihub.h deleted file mode 100644 index 774736a307..0000000000 --- a/uxmhf/xmhf-uobjs/include/xc_ihub.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF slab import library decls./defns. -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XC_IHUB_H__ -#define __XC_IHUB_H__ - -#define UAPI_XCIHUB_INSTALLICPTHANDLER 0 - - -#ifndef __ASSEMBLY__ - -CASM_FUNCDECL(void xcihub_entry_icptstub(void *noparam)); -void xcihub_entry_icpt(x86regs_t *r); -CASM_FUNCDECL(void xcihub_reticpt(x86regs_t *r)); - -void xcihub_icptmain(slab_params_t *sp); - - -/*@ - requires 0 <= cbtype <= XC_HYPAPPCB_MAXMASK; -@*/ -uint32_t xc_hcbinvoke(uint32_t src_slabid, uint32_t cpuid, uint32_t cbtype, uint32_t cbqual, uint32_t guest_slab_index); - -void xcihub_icptvmcall(uint32_t cpuid, uint32_t src_slabid); -void xcihub_icptcpuid(uint32_t cpuid); -void xcihub_icptwrmsr(uint32_t cpuid); -void xcihub_icptrdmsr(uint32_t cpuid); -void xcihub_icptcrx(uint32_t cpuid, uint32_t src_slabid); -void xcihub_icptxsetbv(uint32_t cpuid); -void xcihub_icptsipi(uint32_t cpuid); -void xcihub_halt(uint32_t cpuid, uint32_t info_vmexit_reason); - -bool xcihub_rg_e820emulation(uint32_t cpuid, uint32_t src_slabid); - -extern __attribute__(( section(".data") )) volatile uint32_t xcihub_smplock; - - - - -#endif //__ASSEMBLY__ - - -#endif //__XC_IHUB_H__ diff --git a/uxmhf/xmhf-uobjs/include/xc_init.h b/uxmhf/xmhf-uobjs/include/xc_init.h deleted file mode 100644 index d9a1a9d34c..0000000000 --- a/uxmhf/xmhf-uobjs/include/xc_init.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF slab import library decls./defns. -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XC_INIT_H__ -#define __XC_INIT_H__ - - -#ifndef __ASSEMBLY__ - - -extern __attribute__(( section(".data") )) uint32_t __xcinit_smplock; - - -#endif //__ASSEMBLY__ - - -#endif //__XC_INIT_H__ diff --git a/uxmhf/xmhf-uobjs/include/xc_nwlog.h b/uxmhf/xmhf-uobjs/include/xc_nwlog.h deleted file mode 100644 index 2b59bfd43a..0000000000 --- a/uxmhf/xmhf-uobjs/include/xc_nwlog.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF core network logging -// author: amit vasudevan (amitvasudevan@acm.org) - -#ifndef __XC_NWLOG_H__ -#define __XC_NWLOG_H__ - -#define XMHFGEEC_SLAB_XC_NWLOG_INITIALIZE 0 -#define XMHFGEEC_SLAB_XC_NWLOG_LOGDATA 1 - -#define E1000_TIMEOUT_1MS ((0x40000000ULL * 2) / 1000) - - -#ifndef __ASSEMBLY__ - - - - -////// -// general types -///// - -#define XC_NWLOG_BUF_MAXELEM 3 -#define XC_NWLOG_BUF_MAXIDX 1 - -typedef struct { - uint32_t logbuf[16]; -}__attribute__((packed)) xcnwlog_ls_element_t; - - -typedef struct { - uint8_t dst_mac[6]; - uint8_t src_mac[6]; - uint8_t type[2]; - uint8_t reserved[2]; - uint32_t logbuf[48]; -}__attribute__((packed)) xcnwlog_packet_t; - - - - -//extern __attribute__((section(".slab_dmadata"))) xcnwlog_ls_element_t xcnwlog_lsdma[XC_NWLOG_BUF_MAXIDX][XC_NWLOG_BUF_MAXELEM]; - -extern __attribute__((section(".slab_dmadata"))) __attribute__((aligned(4096))) uint8_t xcnwlog_desc[PAGE_SIZE_4K]; - -extern __attribute__((section(".slab_dmadata"))) __attribute__((aligned(4096))) xcnwlog_packet_t xcnwlog_packet; - - -extern __attribute__((section(".data"))) xcnwlog_ls_element_t xcnwlog_ls[XC_NWLOG_BUF_MAXIDX][XC_NWLOG_BUF_MAXELEM]; -extern __attribute__((section(".data"))) uint32_t xcnwlog_ls_index[XC_NWLOG_BUF_MAXIDX]; - - -extern __attribute__((section(".data"))) char e1000_driver_name[]; -extern __attribute__((section(".data"))) char e1000_driver_string[]; -extern __attribute__((section(".data"))) char e1000_driver_version[]; - - -extern __attribute__((section(".data"))) pci_device_t e1000_dev; -extern __attribute__((section(".data"))) struct e1000_adapter e1000_adapt; -extern __attribute__((section(".data"))) unsigned int e1000_irq; - -//------------------------------------------------------------------------------ -//[CONFIGURATION:START] -//this changes according to deployment platform -extern __attribute__((section(".data"))) unsigned char e1000_dst_macaddr[]; -extern __attribute__((section(".data"))) unsigned char e1000_pkt_type[]; - - - -//@ logic uint32_t nwlogCapacity{L}(uint32_t nwlog_id) = (uint32_t)16; - -//@ logic uint32_t nwlogSize{L}(uint32_t nwlog_id) = xcnwlog_ls_index[nwlog_id]; - -//@ logic xcnwlog_ls_element_t * nwlogStorage{L}(uint32_t nwlog_id) = &xcnwlog_ls[nwlog_id][0]; - -/*@ - predicate nwlogTop{L}(xcnwlog_ls_element_t * elem, integer index, xcnwlog_ls_element_t input) = - (elem[index].logbuf[0] == input.logbuf[0] && - elem[index].logbuf[1] == input.logbuf[1] && - elem[index].logbuf[2] == input.logbuf[2] && - elem[index].logbuf[3] == input.logbuf[3] && - elem[index].logbuf[4] == input.logbuf[4] - ); -*/ - -//@ predicate nwlogEmpty{L}(uint32_t nwlog_id) = (nwlogSize(nwlog_id) == 0); - -//@ predicate nwlogFull{L}(uint32_t nwlog_id) = (nwlogSize(nwlog_id) == nwlogCapacity(nwlog_id)); - -/*@ - predicate - nwlogUnchanged {A,B } ( xcnwlog_ls_element_t * a, integer first, integer last ) = - \forall integer i; first <= i < last - ==> ( (\at (a[i].logbuf[0] , A) == \at( a[i].logbuf[0] , B)) && - (\at (a[i].logbuf[1] , A) == \at( a[i].logbuf[1] , B)) && - (\at (a[i].logbuf[2] , A) == \at( a[i].logbuf[2] , B)) && - (\at (a[i].logbuf[3] , A) == \at( a[i].logbuf[3] , B)) && - (\at (a[i].logbuf[4] , A) == \at( a[i].logbuf[4] , B)) - ); -*/ - -/*@ - predicate nwlogValid{L}(uint32_t nwlog_id) = - (nwlog_id < XC_NWLOG_BUF_MAXIDX && - 0 < nwlogCapacity( nwlog_id) && - 0 <= nwlogSize (nwlog_id) <= nwlogCapacity ( nwlog_id) && - \valid (nwlogStorage (nwlog_id) + (0 .. nwlogCapacity (nwlog_id) - 1)) - ); -@*/ - - -uint32_t e1000_init_module(void); -void e1000_xmitack(void); - -void xcnwlog_ls_push(uint32_t nwlog_id, xcnwlog_ls_element_t elem); -void xcnwlog_init(void); -void xcnwlog_logdata(xcnwlog_ls_element_t elem); - - - -#endif //__ASSEMBLY__ - - -#endif //__XC_NWLOG_H__ diff --git a/uxmhf/xmhf-uobjs/include/xg_richguest.h b/uxmhf/xmhf-uobjs/include/xg_richguest.h deleted file mode 100644 index 4f8f4c5261..0000000000 --- a/uxmhf/xmhf-uobjs/include/xg_richguest.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// XMHF slab import library decls./defns. -// author: amit vasudevan (amitvasudevan@acm.org) - - -#ifndef __XG_RICHGUEST_H__ -#define __XG_RICHGUEST_H__ - - - -#ifndef __ASSEMBLY__ - - -#endif //__ASSEMBLY__ - - -#endif //__XG_RICHGUEST_H__ diff --git a/uxmhf/xmhf-uobjs/include/xh_aprvexec.h b/uxmhf/xmhf-uobjs/include/xh_aprvexec.h deleted file mode 100644 index a024a672ca..0000000000 --- a/uxmhf/xmhf-uobjs/include/xh_aprvexec.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * hyperdep hypapp slab decls. - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __XH_APRVEXEC_H__ -#define __XH_APRVEXEC_H__ - - -#ifndef __ASSEMBLY__ - - -//VFM -extern bool ae_activated; -extern uint32_t ae_paddr; - -//void xhapprovexec_inv_xmhf_hic_uapi_mempgtbl_setentry(xmhf_hic_uapi_mempgtbl_desc_t *imdesc); - - -#endif //__ASSEMBLY__ - -#endif //__XH_APRVEXEC_H__ diff --git a/uxmhf/xmhf-uobjs/include/xh_hyperdep.h b/uxmhf/xmhf-uobjs/include/xh_hyperdep.h deleted file mode 100644 index c0bdcd29ab..0000000000 --- a/uxmhf/xmhf-uobjs/include/xh_hyperdep.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * hyperdep hypapp slab decls. - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __XH_HYPERDEP_H__ -#define __XH_HYPERDEP_H__ - -#define HYPERDEP_ACTIVATEDEP 0xC0 -#define HYPERDEP_DEACTIVATEDEP 0xC1 - -#ifndef __ASSEMBLY__ - - - -extern bool hd_activated; -extern uint32_t hd_pageaddr; - - -void hyperdep_hcbshutdown(uint32_t cpuindex, uint32_t guest_slab_index); -void hyperdep_hcbmemfault(uint32_t cpuindex, uint32_t guest_slab_index); -void hyperdep_hcbinit(uint32_t cpuindex); -void hyperdep_hcbhypercall(uint32_t cpuindex, uint32_t guest_slab_index); - -void hyperdep_deactivatedep(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa); -void hyperdep_activatedep(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa); - - - -#endif //__ASSEMBLY__ - -#endif //__XH_HYPERDEP_H__ diff --git a/uxmhf/xmhf-uobjs/include/xh_ssteptrace.h b/uxmhf/xmhf-uobjs/include/xh_ssteptrace.h deleted file mode 100644 index 07c6be5f64..0000000000 --- a/uxmhf/xmhf-uobjs/include/xh_ssteptrace.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * hyperdep hypapp slab decls. - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __XH_SSTEPTRACE_H__ -#define __XH_SSTEPTRACE_H__ - -#define SSTEPTRACE_REGISTER 0xE0 -#define SSTEPTRACE_ON 0xE1 -#define SSTEPTRACE_OFF 0xE2 - - -#ifndef __ASSEMBLY__ - - -//VFM -extern bool ssteptrace_on; -extern uint32_t ssteptrace_codepaddr; - -//void xhssteptrace_inv_xmhf_hic_uapi_cpustate_vmwrite(uint64_t encoding, uint64_t value); -#endif //__ASSEMBLY__ - -#endif //__XH_SSTEPTRACE_H__ diff --git a/uxmhf/xmhf-uobjs/include/xh_syscalllog.h b/uxmhf/xmhf-uobjs/include/xh_syscalllog.h deleted file mode 100644 index cda064c210..0000000000 --- a/uxmhf/xmhf-uobjs/include/xh_syscalllog.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * syscalllog hypapp slab decls. - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#ifndef __XH_SYSCALLLOG_H__ -#define __XH_SYSCALLLOG_H__ - -#define SYSCALLLOG_REGISTER 0xF0 - - -#ifndef __ASSEMBLY__ - - -extern __attribute__((section(".data"))) bool sl_activated; -extern __attribute__((section(".data"))) uint32_t sl_syscall_page_paddr; -extern __attribute__((section(".data"))) uint32_t sl_syscall_shadowpage_vaddr; - - - -void sysclog_hcbhypercall(uint32_t cpuindex, uint32_t guest_slab_index); -void sysclog_hcbinit(uint32_t cpuindex); -uint32_t sysclog_hcbinsntrap(uint32_t cpuindex, uint32_t guest_slab_index, uint32_t insntype); -bool sysclog_hcbmemfault(uint32_t cpuindex, uint32_t guest_slab_index); -void sysclog_hcbshutdown(uint32_t cpuindex, uint32_t guest_slab_index); - -void sysclog_register(uint32_t cpuindex, uint32_t guest_slab_index, uint32_t syscall_page_paddr, uint32_t syscall_shadowpage_vaddr, uint32_t syscall_shadowpage_paddr); -bool sysclog_loginfo(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa, uint64_t gva, uint64_t errorcode); - - - - - - - - -#endif //__ASSEMBLY__ - -#endif //__XH_SYSCALLLOG_H__ diff --git a/uxmhf/xmhf-uobjs/include/xh_uhcalltest.h b/uxmhf/xmhf-uobjs/include/xh_uhcalltest.h deleted file mode 100644 index 36c8c77a75..0000000000 --- a/uxmhf/xmhf-uobjs/include/xh_uhcalltest.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * - * uhcalltest hypapp slab decls. - * - * author: amit vasudevan (amitvasudevan@acm.org) - * author: matt mccormack (matthew.mccormack@live.com) - */ - -#ifndef __XH_UHCALLTEST_H__ -#define __XH_UHCALLTEST_H__ - -#define UAPP_UHCALLTEST_FUNCTION_TEST 0x22 - - -#ifndef __ASSEMBLY__ - -typedef struct { - uint8_t in[16]; - uint8_t out[16]; -}uhcalltest_param_t; - -void uhcalltest_hcbshutdown(uint32_t cpuindex, uint32_t guest_slab_index); -void uhcalltest_hcbinit(uint32_t cpuindex); -void uhcalltest_hcbhypercall(uint32_t cpuindex, uint32_t guest_slab_index); -void uhcalltest_action(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa); - -#endif //__ASSEMBLY__ - -#endif //__XH_UHCALLTEST_H__ diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/uapi_gcpustate.gsm b/uxmhf/xmhf-uobjs/uapi_gcpustate/uapi_gcpustate.gsm deleted file mode 100644 index 6cf0047a09..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/uapi_gcpustate.gsm +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include - -#include - -{ - "uobj-name": "uapi_gcpustate", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "UAPI", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_data.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_data.c deleted file mode 100644 index 779c01b393..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_data.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -__attribute__((section(".data"))) x86regs_t guestgprs[MAX_PLATFORM_CPUS]; - -__attribute__((section(".data"))) uint64_t guestmsrs[GCPUSTATE_MSR_MAXCOUNT]; diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_gprsread.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_gprsread.c deleted file mode 100644 index 84e13c6547..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_gprsread.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include - -#include -#include - - -void ugcpust_gprsread(uint32_t cpuid, xmhf_uapi_gcpustate_gprs_params_t *gprs){ - memcpy(&gprs->gprs, &guestgprs[cpuid], sizeof(x86regs_t)); -} - diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_gprswrite.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_gprswrite.c deleted file mode 100644 index 1f8b0c9409..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_gprswrite.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include - -#include -#include - - -void ugcpust_gprswrite(uint32_t cpuid, xmhf_uapi_gcpustate_gprs_params_t *gprs){ - memcpy(&guestgprs[cpuid], &gprs->gprs, sizeof(x86regs_t)); -} diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_main.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_main.c deleted file mode 100644 index c9bf18d431..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_main.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; -slab_params_t test_sp; -uint32_t cpuid = 0; //cpu id - -void hwm_vdriver_cpu_vmwrite(uint32_t encoding, uint32_t value){ - /*@assert ( (encoding == VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_FULL) || - (encoding == VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_HIGH) || - (encoding == VMCS_CONTROL_VM_ENTRY_MSR_LOAD_COUNT) || - (encoding == VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_FULL) || - (encoding == VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_HIGH) || - (encoding == VMCS_CONTROL_VM_EXIT_MSR_STORE_COUNT)); - @*/ -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.src_slabid = framac_nondetu32interval(0, XMHFGEEC_TOTAL_SLABS-1); - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - //execute harness - test_sp.cpuid = 0; - - test_sp.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - ugcpust_vmread((xmhf_uapi_gcpustate_vmrw_params_t *)test_sp.in_out_params); - - test_sp.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - ugcpust_gprsread((uint16_t)test_sp.cpuid, (xmhf_uapi_gcpustate_gprs_params_t *)test_sp.in_out_params); - - test_sp.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE; - ugcpust_gprswrite((uint16_t)test_sp.cpuid, (xmhf_uapi_gcpustate_gprs_params_t *)test_sp.in_out_params); - - test_sp.dst_uapifn = XMHFGEEC_UAPI_CPUSTATE_GUESTMSRREAD; - ugcpust_msrread((xmhf_uapi_gcpustate_msrrw_params_t *)test_sp.in_out_params); - - test_sp.dst_uapifn = XMHFGEEC_UAPI_CPUSTATE_GUESTMSRWRITE; - ugcpust_msrwrite((xmhf_uapi_gcpustate_msrrw_params_t *)test_sp.in_out_params); - - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - -///// -//@ ghost bool ugcpust_methodcall_vmread = false; -//@ ghost bool ugcpust_methodcall_vmwrite = false; -//@ ghost bool ugcpust_methodcall_gprsread = false; -//@ ghost bool ugcpust_methodcall_gprswrite = false; -//@ ghost bool ugcpust_methodcall_msrread = false; -//@ ghost bool ugcpust_methodcall_msrwrite = false; -//@ ghost bool ugcpust_methodcall_invalid = false; -/*@ - requires \valid(sp); - ensures ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_VMREAD) ==> (ugcpust_methodcall_vmread == true); - ensures ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_VMWRITE && (uint16_t)sp->src_slabid < XMHFGEEC_TOTAL_SLABS ) ==> (ugcpust_methodcall_vmwrite == true); - ensures ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD && (uint16_t)sp->cpuid < MAX_PLATFORM_CPUS) ==> (ugcpust_methodcall_gprsread == true); - ensures ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE && (uint16_t)sp->cpuid < MAX_PLATFORM_CPUS) ==> (ugcpust_methodcall_gprswrite == true); - ensures ( sp->dst_uapifn == XMHFGEEC_UAPI_CPUSTATE_GUESTMSRREAD) ==> (ugcpust_methodcall_msrread == true); - ensures ( sp->dst_uapifn == XMHFGEEC_UAPI_CPUSTATE_GUESTMSRWRITE) ==> (ugcpust_methodcall_msrwrite == true); - ensures !( - ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_VMREAD) || - ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_VMWRITE && (uint16_t)sp->src_slabid < XMHFGEEC_TOTAL_SLABS ) || - ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD && (uint16_t)sp->cpuid < MAX_PLATFORM_CPUS) || - ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE && (uint16_t)sp->cpuid < MAX_PLATFORM_CPUS) || - ( sp->dst_uapifn == XMHFGEEC_UAPI_CPUSTATE_GUESTMSRREAD) || - ( sp->dst_uapifn == XMHFGEEC_UAPI_CPUSTATE_GUESTMSRWRITE) - ) ==> (ugcpust_methodcall_invalid == true); - -@*/ -void slab_main(slab_params_t *sp){ - - if( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_VMREAD){ - ugcpust_vmread((xmhf_uapi_gcpustate_vmrw_params_t *)sp->in_out_params); - //@ghost ugcpust_methodcall_vmread = true; - - }else if( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_VMWRITE && (uint16_t)sp->src_slabid < XMHFGEEC_TOTAL_SLABS ){ - ugcpust_vmwrite(sp->src_slabid, (xmhf_uapi_gcpustate_vmrw_params_t *)sp->in_out_params); - //@ghost ugcpust_methodcall_vmwrite = true; - - }else if( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD && (uint16_t)sp->cpuid < MAX_PLATFORM_CPUS){ - ugcpust_gprsread((uint16_t)sp->cpuid, (xmhf_uapi_gcpustate_gprs_params_t *)sp->in_out_params); - //@ghost ugcpust_methodcall_gprsread = true; - - }else if( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE && (uint16_t)sp->cpuid < MAX_PLATFORM_CPUS){ - ugcpust_gprswrite((uint16_t)sp->cpuid, (xmhf_uapi_gcpustate_gprs_params_t *)sp->in_out_params); - //@ghost ugcpust_methodcall_gprswrite = true; - - }else if( sp->dst_uapifn == XMHFGEEC_UAPI_CPUSTATE_GUESTMSRREAD){ - ugcpust_msrread((xmhf_uapi_gcpustate_msrrw_params_t *)sp->in_out_params); - //@ghost ugcpust_methodcall_msrread = true; - - }else if (sp->dst_uapifn == XMHFGEEC_UAPI_CPUSTATE_GUESTMSRWRITE){ - ugcpust_msrwrite((xmhf_uapi_gcpustate_msrrw_params_t *)sp->in_out_params); - //@ghost ugcpust_methodcall_msrwrite = true; - - }else{ - //_XDPRINTF_("UAPI_GCPUSTATE[%u]: Unknown uAPI function %x. Halting!\n", (uint16_t)sp->cpuid, sp->dst_uapifn); - //@ghost ugcpust_methodcall_invalid = true; - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_msrread.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_msrread.c deleted file mode 100644 index da891be7cc..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_msrread.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include - -#include -#include - -void ugcpust_msrread(xmhf_uapi_gcpustate_msrrw_params_t *msrrwp){ - if(msrrwp->msr < GCPUSTATE_MSR_TOTAL){ - msrrwp->value = guestmsrs[msrrwp->msr]; - - //TODO: make core specific guestmsrs load - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_FULL, guestmsrs); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_COUNT, GCPUSTATE_MSR_TOTAL); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_FULL, guestmsrs); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_COUNT, GCPUSTATE_MSR_TOTAL); - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_msrwrite.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_msrwrite.c deleted file mode 100644 index 84536e072f..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_msrwrite.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include - -#include -#include - - -void ugcpust_msrwrite(xmhf_uapi_gcpustate_msrrw_params_t *msrrwp){ - if(msrrwp->msr < GCPUSTATE_MSR_TOTAL){ - guestmsrs[msrrwp->msr] = msrrwp->value; - - //TODO: make core specific guestmsrs load - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_FULL, guestmsrs); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_ENTRY_MSR_LOAD_COUNT, GCPUSTATE_MSR_TOTAL); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_FULL, guestmsrs); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_ADDRESS_HIGH, 0); - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_CONTROL_VM_EXIT_MSR_STORE_COUNT, GCPUSTATE_MSR_TOTAL); - - } -} - - diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_vmread.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_vmread.c deleted file mode 100644 index 3d1915ff89..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_vmread.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include - -#include -#include - -void ugcpust_vmread(xmhf_uapi_gcpustate_vmrw_params_t *vmrwp){ - vmrwp->value = CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,vmrwp->encoding); -} diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_vmwrite.c b/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_vmwrite.c deleted file mode 100644 index a6375089c6..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/ugcpust_vmwrite.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * guest CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include - -#include - - -//@ghost bool ugcpust_vmwrite_callvmwrite = false; -/*@ - requires \valid(vmrwp); - requires 0 <= srcslabid < XMHFGEEC_TOTAL_SLABS; - - behavior fromprime: - assumes (srcslabid == XMHFGEEC_SLAB_GEEC_PRIME); - ensures (ugcpust_vmwrite_callvmwrite == true); - - - behavior notfromprime_valid: - assumes !(srcslabid == XMHFGEEC_SLAB_GEEC_PRIME); - assumes !(vmrwp->encoding == VMCS_CONTROL_VMX_SECCPU_BASED || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPA_ADDRESS_FULL || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPA_ADDRESS_HIGH || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPB_ADDRESS_FULL || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPB_ADDRESS_HIGH || - vmrwp->encoding == VMCS_CONTROL_EPT_POINTER_FULL || - vmrwp->encoding == VMCS_CONTROL_EPT_POINTER_HIGH || - vmrwp->encoding == VMCS_HOST_CR0 || - vmrwp->encoding == VMCS_HOST_CR3 || - vmrwp->encoding == VMCS_HOST_CR4 || - vmrwp->encoding == VMCS_HOST_FS_BASE || - vmrwp->encoding == VMCS_HOST_GS_BASE || - vmrwp->encoding == VMCS_HOST_TR_BASE || - vmrwp->encoding == VMCS_HOST_GDTR_BASE || - vmrwp->encoding == VMCS_HOST_IDTR_BASE || - vmrwp->encoding == VMCS_HOST_SYSENTER_ESP || - vmrwp->encoding == VMCS_HOST_SYSENTER_EIP || - vmrwp->encoding == VMCS_HOST_RSP || - vmrwp->encoding == VMCS_HOST_RIP || - vmrwp->encoding == VMCS_HOST_SYSENTER_CS || - vmrwp->encoding == VMCS_HOST_IA32_EFER_FULL || - vmrwp->encoding == VMCS_HOST_ES_SELECTOR || - vmrwp->encoding == VMCS_HOST_CS_SELECTOR || - vmrwp->encoding == VMCS_HOST_SS_SELECTOR || - vmrwp->encoding == VMCS_HOST_DS_SELECTOR || - vmrwp->encoding == VMCS_HOST_FS_SELECTOR || - vmrwp->encoding == VMCS_HOST_GS_SELECTOR || - vmrwp->encoding == VMCS_HOST_TR_SELECTOR); - ensures (ugcpust_vmwrite_callvmwrite == true); - - behavior notfromprime_invalid: - assumes !(srcslabid == XMHFGEEC_SLAB_GEEC_PRIME); - assumes (vmrwp->encoding == VMCS_CONTROL_VMX_SECCPU_BASED || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPA_ADDRESS_FULL || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPA_ADDRESS_HIGH || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPB_ADDRESS_FULL || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPB_ADDRESS_HIGH || - vmrwp->encoding == VMCS_CONTROL_EPT_POINTER_FULL || - vmrwp->encoding == VMCS_CONTROL_EPT_POINTER_HIGH || - vmrwp->encoding == VMCS_HOST_CR0 || - vmrwp->encoding == VMCS_HOST_CR3 || - vmrwp->encoding == VMCS_HOST_CR4 || - vmrwp->encoding == VMCS_HOST_FS_BASE || - vmrwp->encoding == VMCS_HOST_GS_BASE || - vmrwp->encoding == VMCS_HOST_TR_BASE || - vmrwp->encoding == VMCS_HOST_GDTR_BASE || - vmrwp->encoding == VMCS_HOST_IDTR_BASE || - vmrwp->encoding == VMCS_HOST_SYSENTER_ESP || - vmrwp->encoding == VMCS_HOST_SYSENTER_EIP || - vmrwp->encoding == VMCS_HOST_RSP || - vmrwp->encoding == VMCS_HOST_RIP || - vmrwp->encoding == VMCS_HOST_SYSENTER_CS || - vmrwp->encoding == VMCS_HOST_IA32_EFER_FULL || - vmrwp->encoding == VMCS_HOST_ES_SELECTOR || - vmrwp->encoding == VMCS_HOST_CS_SELECTOR || - vmrwp->encoding == VMCS_HOST_SS_SELECTOR || - vmrwp->encoding == VMCS_HOST_DS_SELECTOR || - vmrwp->encoding == VMCS_HOST_FS_SELECTOR || - vmrwp->encoding == VMCS_HOST_GS_SELECTOR || - vmrwp->encoding == VMCS_HOST_TR_SELECTOR); - ensures (ugcpust_vmwrite_callvmwrite == false); - - complete behaviors; - disjoint behaviors; -@*/ -void ugcpust_vmwrite(uint32_t srcslabid, xmhf_uapi_gcpustate_vmrw_params_t *vmrwp){ - if(srcslabid == XMHFGEEC_SLAB_GEEC_PRIME){ - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite, vmrwp->encoding, vmrwp->value); - //@ghost ugcpust_vmwrite_callvmwrite = true; - - }else{ - - if( !(vmrwp->encoding == VMCS_CONTROL_VMX_SECCPU_BASED || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPA_ADDRESS_FULL || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPA_ADDRESS_HIGH || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPB_ADDRESS_FULL || - vmrwp->encoding == VMCS_CONTROL_IO_BITMAPB_ADDRESS_HIGH || - vmrwp->encoding == VMCS_CONTROL_EPT_POINTER_FULL || - vmrwp->encoding == VMCS_CONTROL_EPT_POINTER_HIGH || - vmrwp->encoding == VMCS_HOST_CR0 || - vmrwp->encoding == VMCS_HOST_CR3 || - vmrwp->encoding == VMCS_HOST_CR4 || - vmrwp->encoding == VMCS_HOST_FS_BASE || - vmrwp->encoding == VMCS_HOST_GS_BASE || - vmrwp->encoding == VMCS_HOST_TR_BASE || - vmrwp->encoding == VMCS_HOST_GDTR_BASE || - vmrwp->encoding == VMCS_HOST_IDTR_BASE || - vmrwp->encoding == VMCS_HOST_SYSENTER_ESP || - vmrwp->encoding == VMCS_HOST_SYSENTER_EIP || - vmrwp->encoding == VMCS_HOST_RSP || - vmrwp->encoding == VMCS_HOST_RIP || - vmrwp->encoding == VMCS_HOST_SYSENTER_CS || - vmrwp->encoding == VMCS_HOST_IA32_EFER_FULL || - vmrwp->encoding == VMCS_HOST_ES_SELECTOR || - vmrwp->encoding == VMCS_HOST_CS_SELECTOR || - vmrwp->encoding == VMCS_HOST_SS_SELECTOR || - vmrwp->encoding == VMCS_HOST_DS_SELECTOR || - vmrwp->encoding == VMCS_HOST_FS_SELECTOR || - vmrwp->encoding == VMCS_HOST_GS_SELECTOR || - vmrwp->encoding == VMCS_HOST_TR_SELECTOR) - ){ - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite, vmrwp->encoding, vmrwp->value); - //@ghost ugcpust_vmwrite_callvmwrite = true; - - }else{ - //disallowed, do nothing - //@ghost ugcpust_vmwrite_callvmwrite = false; - } - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_gcpustate/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/uapi_gcpustate/xmhfgeecslab.mk.in deleted file mode 100644 index 8caeb137f1..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_gcpustate/xmhfgeecslab.mk.in +++ /dev/null @@ -1,22 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := uapi_gcpustate -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugcpust_data.c.v.c ugcpust_main.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main ugcpust_vmwrite -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugcpust_data.c.v.c ugcpust_vmwrite.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -slevel 2048 -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ $(VFLAGS) *.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - - diff --git a/uxmhf/xmhf-uobjs/uapi_hcpustate/uapi_hcpustate.gsm b/uxmhf/xmhf-uobjs/uapi_hcpustate/uapi_hcpustate.gsm deleted file mode 100644 index 6a90158f77..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_hcpustate/uapi_hcpustate.gsm +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -#include - -{ - "uobj-name": "uapi_hcpustate", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "UAPI", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_data.c b/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_data.c deleted file mode 100644 index a7dadbe484..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_data.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ diff --git a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_main.c b/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_main.c deleted file mode 100644 index b2c7bc5f7d..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_main.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * host CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -///// -//@ ghost bool uhcpust_methodcall_rdmsr = false; -//@ ghost bool uhcpust_methodcall_wrmsr = false; -//@ ghost bool uhcpust_methodcall_invalid = false; -/*@ - requires \valid(sp); - ensures ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_WRMSR && sp->src_slabid < XMHFGEEC_TOTAL_SLABS) ==> (uhcpust_methodcall_wrmsr == true); - ensures ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_RDMSR && sp->src_slabid < XMHFGEEC_TOTAL_SLABS) ==> (uhcpust_methodcall_rdmsr == true); - ensures !( - ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_WRMSR && sp->src_slabid < XMHFGEEC_TOTAL_SLABS) || - ( sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_RDMSR && sp->src_slabid < XMHFGEEC_TOTAL_SLABS) - ) ==> (uhcpust_methodcall_invalid == true); -@*/ - -void slab_main(slab_params_t *sp){ - - if(sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_WRMSR && sp->src_slabid < XMHFGEEC_TOTAL_SLABS){ - uhcpust_wrmsr(sp->src_slabid, (xmhf_uapi_hcpustate_msr_params_t *)sp->in_out_params); - //@ghost uhcpust_methodcall_wrmsr = true; - - }else if(sp->dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_RDMSR && sp->src_slabid < XMHFGEEC_TOTAL_SLABS){ - uhcpust_rdmsr((xmhf_uapi_hcpustate_msr_params_t *)sp->in_out_params); - //@ghost uhcpust_methodcall_rdmsr = true; - - }else { - //_XDPRINTF_("UAPI_HCPUSTATE[%u]: Unknown uAPI function %x. Halting!\n",(uint16_t)sp->cpuid, sp->dst_uapifn); - //@ghost uhcpust_methodcall_invalid = true; - - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_rdmsr.c b/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_rdmsr.c deleted file mode 100644 index beb185a3c0..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_rdmsr.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * host CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -//@ghost uint64_t rdmsr_val; -/*@ - requires \valid(msrp); - assigns msrp->value; - assigns rdmsr_val; - ensures (msrp->value == rdmsr_val); -@*/ -void uhcpust_rdmsr(xmhf_uapi_hcpustate_msr_params_t *msrp){ - //@ghost rdmsr_val = CASM_FUNCCALL(rdmsr64, msrp->msr); - msrp->value = CASM_FUNCCALL(rdmsr64, msrp->msr); -} diff --git a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_wrmsr.c b/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_wrmsr.c deleted file mode 100644 index 1ece2f69eb..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_hcpustate/uhcpust_wrmsr.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * host CPU state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -//@ghost bool uhcpust_wrmsr_callwrmsr = false; -/*@ - requires \valid(msrp); - requires 0 <= srcslabid < XMHFGEEC_TOTAL_SLABS; - - behavior fromprime: - assumes (srcslabid == XMHFGEEC_SLAB_GEEC_PRIME); - ensures (uhcpust_wrmsr_callwrmsr == true); - - behavior notfromprime_valid: - assumes !(srcslabid == XMHFGEEC_SLAB_GEEC_PRIME); - assumes (msrp->msr != MSR_EFER); - ensures (uhcpust_wrmsr_callwrmsr == true); - - behavior notfromprime_invalid: - assumes !(srcslabid == XMHFGEEC_SLAB_GEEC_PRIME); - assumes (msrp->msr == MSR_EFER); - ensures (uhcpust_wrmsr_callwrmsr == false); - - complete behaviors; - disjoint behaviors; -@*/ -void uhcpust_wrmsr(uint32_t srcslabid, xmhf_uapi_hcpustate_msr_params_t *msrp){ - if(srcslabid == XMHFGEEC_SLAB_GEEC_PRIME){ - CASM_FUNCCALL(wrmsr64, msrp->msr, (uint32_t)msrp->value, (uint32_t)((uint64_t)msrp->value >> 32) ); - //@ghost uhcpust_wrmsr_callwrmsr = true; - }else{ - if(msrp->msr != MSR_EFER){ - CASM_FUNCCALL(wrmsr64, msrp->msr, (uint32_t)msrp->value, (uint32_t)((uint64_t)msrp->value >> 32) ); - //@ghost uhcpust_wrmsr_callwrmsr = true; - }else{ - //invalid write - //@ghost uhcpust_wrmsr_callwrmsr = false; - } - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_hcpustate/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/uapi_hcpustate/xmhfgeecslab.mk.in deleted file mode 100644 index cc4f430606..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_hcpustate/xmhfgeecslab.mk.in +++ /dev/null @@ -1,20 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := uapi_hcpustate -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) uhcpust_data.c.v.c uhcpust_main.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main uhcpust_rdmsr -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) uhcpust_data.c.v.c uhcpust_rdmsr.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main uhcpust_wrmsr -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) uhcpust_data.c.v.c uhcpust_wrmsr.c.v.c - diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uapi_iotbl.gsm b/uxmhf/xmhf-uobjs/uapi_iotbl/uapi_iotbl.gsm deleted file mode 100644 index a11d6b86e9..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uapi_iotbl.gsm +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -#include - -{ - "uobj-name": "uapi_iotbl", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "UAPI", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_data.c b/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_data.c deleted file mode 100644 index a231eccb00..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_data.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -//__attribute__((section(".data"))) -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint8_t uiotbl_uhslab_iobitmap[XMHFGEEC_TOTAL_UHSLABS][3*PAGE_SIZE_4K]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint8_t uiotbl_ugslab_iobitmap[XMHFGEEC_TOTAL_UGSLABS][3*PAGE_SIZE_4K]; diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_getiotblbase.c b/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_getiotblbase.c deleted file mode 100644 index b6a10ebaa9..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_getiotblbase.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * I/O permission tables uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -void uiotbl_getiotblbase(uapi_iotbl_getiotblbase_t *ps){ - //uh - if( xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) { - ps->iotbl_base = (uint32_t)&uiotbl_ugslab_iobitmap[(ps->dst_slabid - XMHFGEEC_UHSLAB_BASE_IDX)]; - - //ug - }else if ( - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST - ){ - ps->iotbl_base = (uint32_t)&uiotbl_ugslab_iobitmap[(ps->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)]; - - //v - }else{ - ps->iotbl_base = 0; - } - - //_XDPRINTF_("%s: dst_slabid=%u, iotbl_base=0x%08x\n", __func__, - // ps->dst_slabid, ps->iotbl_base); -} - diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_initiotbl.c b/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_initiotbl.c deleted file mode 100644 index 699cd50f96..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_initiotbl.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * I/O permission tables uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -void uiotbl_initiotbl(uapi_iotbl_initiotbl_t *ps){ - //uh - if( xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG || - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG) { - memset(&uiotbl_uhslab_iobitmap[(ps->dst_slabid - XMHFGEEC_UHSLAB_BASE_IDX)], 0xFFFFFFFFUL, sizeof(uiotbl_uhslab_iobitmap[0])); - - //ug - }else if ( - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST - ){ - memset(&uiotbl_ugslab_iobitmap[(ps->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)], 0xFFFFFFFFUL, sizeof(uiotbl_ugslab_iobitmap[0])); - - //ug_rg - }else if ( - xmhfgeec_slab_info_table[ps->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST - ){ - memset(&uiotbl_ugslab_iobitmap[(ps->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)], 0UL, sizeof(uiotbl_ugslab_iobitmap[0])); - - //v - }else{ - - } - - -} - diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_main.c b/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_main.c deleted file mode 100644 index 9885ad2215..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_main.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * I/O permission tables uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - - -void slab_main(slab_params_t *sp){ - - if(sp->dst_uapifn == UXMHF_UAPI_IOTBL_GETIOTBLBASE && - sp->src_slabid < XMHFGEEC_TOTAL_SLABS){ - uiotbl_getiotblbase((uapi_iotbl_getiotblbase_t *)sp->in_out_params); - - }else if(sp->dst_uapifn == UXMHF_UAPI_IOTBL_INITIOTBL && - sp->src_slabid < XMHFGEEC_TOTAL_SLABS){ - uiotbl_initiotbl((uapi_iotbl_initiotbl_t *)sp->in_out_params); - - }else if(sp->dst_uapifn == UXMHF_UAPI_IOTBL_SETUPIOTBLUGPORTACCESS && - sp->src_slabid < XMHFGEEC_TOTAL_SLABS){ - uiotbl_setupiotblugportaccess((uapi_iotbl_setupiotblugportaccess_t *)sp->in_out_params); - - }else if(sp->dst_uapifn == UXMHF_UAPI_IOTBL_SETUPIOTBLUHPORTACCESS && - sp->src_slabid < XMHFGEEC_TOTAL_SLABS){ - uiotbl_setupiotbluhportaccess((uapi_iotbl_setupiotbluhportaccess_t *)sp->in_out_params); - - }else { - //unknown uapi - } - -} diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_setupiotblugportaccess.c b/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_setupiotblugportaccess.c deleted file mode 100644 index 06a3d59d14..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_setupiotblugportaccess.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= objidx < XMHFGEEC_TOTAL_UGSLABS; - requires 0 <= bitmapidx < (3*PAGE_SIZE_4K); - assigns uiotbl_ugslab_iobitmap[objidx][bitmapidx]; - ensures (uiotbl_ugslab_iobitmap[objidx][bitmapidx] == (\at(uiotbl_ugslab_iobitmap[objidx][bitmapidx], Pre) & mask)); -@*/ -static inline void uiotbl_setupiotblug_allowaccesstoport_setmask(uint32_t objidx, uint32_t bitmapidx, uint8_t mask){ - uiotbl_ugslab_iobitmap[objidx][bitmapidx] = uiotbl_ugslab_iobitmap[objidx][bitmapidx] & mask; -} - - -//@ghost uint8_t gp_s2_setupiotblug_allowaccesstoport_invokedsetmask[4]; -/*@ - requires 0 <= ugslabiobitmap_idx < XMHFGEEC_TOTAL_UGSLABS; - requires 0 <= port < 65536; - requires 0 <= port_size <= 4; - assigns uiotbl_ugslab_iobitmap[ugslabiobitmap_idx][((port+0)/8)..((port+(port_size-1))/8)]; - assigns gp_s2_setupiotblug_allowaccesstoport_invokedsetmask[0..(port_size-1)]; -@*/ -void uiotbl_setupiotblug_allowaccesstoport(uint32_t ugslabiobitmap_idx, uint16_t port, uint16_t port_size){ - uint32_t i; - uint8_t bitmask; - uint32_t bitmapidx; - - /*@ - loop invariant d1: 0 <= i <= port_size; - loop invariant d2: \forall integer x; 0 <= x < i ==> (gp_s2_setupiotblug_allowaccesstoport_invokedsetmask[x] == true); - loop assigns gp_s2_setupiotblug_allowaccesstoport_invokedsetmask[0..(port_size-1)]; - loop assigns i; - loop assigns bitmask; - loop assigns bitmapidx; - loop assigns uiotbl_ugslab_iobitmap[ugslabiobitmap_idx][((port+0)/8)..((port+(port_size-1))/8)]; - loop variant port_size - i; - @*/ - for(i=0; i < port_size; i++){ - bitmask = ((uint8_t)1 << ((port+i) % 8)); - bitmapidx = ((port+i)/8); - - //@assert as1: (bitmask == ((uint8_t)1 << ((port+i) % 8))); - //@assert as2: (bitmapidx == ((port+i)/8)); - uiotbl_setupiotblug_allowaccesstoport_setmask(ugslabiobitmap_idx, bitmapidx, ~bitmask); - //@ghost gp_s2_setupiotblug_allowaccesstoport_invokedsetmask[i] = true; - } -} - -void uiotbl_setupiotblugportaccess(uapi_iotbl_setupiotblugportaccess_t *ps){ - uiotbl_setupiotblug_allowaccesstoport( - (ps->ugslabiobitmap_idx - XMHFGEEC_UGSLAB_BASE_IDX), - ps->port, - ps->port_size); -} diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_setupiotbluhportaccess.c b/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_setupiotbluhportaccess.c deleted file mode 100644 index 22c87b9604..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/uiotbl_setupiotbluhportaccess.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -/*@ - requires 0 <= objidx < XMHFGEEC_TOTAL_UHSLABS; - requires 0 <= bitmapidx < (3*PAGE_SIZE_4K); - assigns uiotbl_uhslab_iobitmap[objidx][bitmapidx]; - ensures (uiotbl_uhslab_iobitmap[objidx][bitmapidx] == (\at(uiotbl_uhslab_iobitmap[objidx][bitmapidx], Pre) & mask)); -@*/ -static inline void uiotbl_setupiotbluh_allowaccesstoport_setmask(uint32_t objidx, uint32_t bitmapidx, uint8_t mask){ - uiotbl_uhslab_iobitmap[objidx][bitmapidx] = uiotbl_uhslab_iobitmap[objidx][bitmapidx] & mask; -} - -//@ghost uint8_t gp_s2_setupiotbluh_allowaccesstoport_invokedsetmask[4]; -/*@ - requires 0 <= uhslabiobitmap_idx < XMHFGEEC_TOTAL_UHSLABS; - requires 0 <= port < 65536; - requires 0 <= port_size <= 4; - assigns uiotbl_uhslab_iobitmap[uhslabiobitmap_idx][((port+0)/8)..((port+(port_size-1))/8)]; - assigns gp_s2_setupiotbluh_allowaccesstoport_invokedsetmask[0..(port_size-1)]; -@*/ -void uiotbl_setupiotbluh_allowaccesstoport(uint32_t uhslabiobitmap_idx, uint16_t port, uint16_t port_size){ - uint32_t i; - uint8_t bitmask; - uint32_t bitmapidx; - - /*@ - loop invariant d1: 0 <= i <= port_size; - loop invariant d2: \forall integer x; 0 <= x < i ==> (gp_s2_setupiotbluh_allowaccesstoport_invokedsetmask[x] == true); - loop assigns gp_s2_setupiotbluh_allowaccesstoport_invokedsetmask[0..(port_size-1)]; - loop assigns i; - loop assigns bitmask; - loop assigns bitmapidx; - loop assigns uiotbl_uhslab_iobitmap[uhslabiobitmap_idx][((port+0)/8)..((port+(port_size-1))/8)]; - loop variant port_size - i; - @*/ - for(i=0; i < port_size; i++){ - bitmask = ((uint8_t)1 << ((port+i) % 8)); - bitmapidx = ((port+i)/8); - - //@assert as1: (bitmask == ((uint8_t)1 << ((port+i) % 8))); - //@assert as2: (bitmapidx == ((port+i)/8)); - uiotbl_setupiotbluh_allowaccesstoport_setmask(uhslabiobitmap_idx, bitmapidx, ~bitmask); - //@ghost gp_s2_setupiotbluh_allowaccesstoport_invokedsetmask[i] = true; - } -} - -void uiotbl_setupiotbluhportaccess(uapi_iotbl_setupiotbluhportaccess_t *ps){ - uiotbl_setupiotbluh_allowaccesstoport( - (ps->uhslabiobitmap_idx - XMHFGEEC_UHSLAB_BASE_IDX), - ps->port, - ps->port_size); -} diff --git a/uxmhf/xmhf-uobjs/uapi_iotbl/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/uapi_iotbl/xmhfgeecslab.mk.in deleted file mode 100644 index 882e746d90..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_iotbl/xmhfgeecslab.mk.in +++ /dev/null @@ -1,18 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := uapi_iotbl -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Nothing to verify for $(XMHF_SLAB_NAME)... - - diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/uapi_slabmempgtbl.gsm b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/uapi_slabmempgtbl.gsm deleted file mode 100644 index f3f29a78f9..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/uapi_slabmempgtbl.gsm +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include - -{ - "uobj-name": "uapi_slabmempgtbl", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "UAPI", - - "uobj-uapifunctions":[ - { - "uapifunction-id": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL), - "uapifunction-definition" : - "void _slabmempgtbl_initmempgtbl(xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t *initmempgtblp)", - "uapifunction-drivercode" : - "{xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t initmempgtblp; initmempgtblp.dst_slabid = framac_nondetu32(); _slabmempgtbl_initmempgtbl(&initmempgtblp);}" - }, - { - "uapifunction-id": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR), - "uapifunction-definition" : "void _slabmempgtbl_setentryforpaddr(xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp)", - "uapifunction-drivercode" : "{xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t setentryforpaddrp; setentryforpaddrp.dst_slabid = framac_nondetu32(); setentryforpaddrp.gpa = framac_nondetu32(); setentryforpaddrp.entry = framac_nondetu32(); _slabmempgtbl_setentryforpaddr(&setentryforpaddrp);}" - }, - { - "uapifunction-id": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR), - "uapifunction-definition" : "void _slabmempgtbl_getentryforpaddr(xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp)", - "uapifunction-drivercode" : "{xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t getentryforpaddrp; getentryforpaddrp.dst_slabid = framac_nondetu32(); getentryforpaddrp.gpa = framac_nondetu32(); _slabmempgtbl_getentryforpaddr(&getentryforpaddrp);}" - } - ], - - "uobj-callees": " geec_sentinel - ", - - "uobj-uapicallees":[], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x4200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_data.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_data.c deleted file mode 100644 index 7ff400334d..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_data.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - - -//page table data structures for a 4GB system address mapping -__attribute__((section(".rwdatahdr"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl4t[XMHFGEEC_TOTAL_UGSLABS][PAE_MAXPTRS_PER_PML4T]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl3t[XMHFGEEC_TOTAL_UGSLABS][PAE_MAXPTRS_PER_PDPT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl2t[XMHFGEEC_TOTAL_UGSLABS][PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _slabmempgtbl_lvl1t[XMHFGEEC_TOTAL_UGSLABS][PAE_PTRS_PER_PDPT][PAE_PTRS_PER_PDT][PAE_PTRS_PER_PT]; - diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_flushtlb.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_flushtlb.c deleted file mode 100644 index bd30862b31..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_flushtlb.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -//@ghost bool flushtlb_invoke_invept = false; -/*@ - requires \valid(flushtlbp); - - behavior flush: - assumes ( (flushtlbp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (flushtlbp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && flushtlbp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ); - assigns flushtlb_invoke_invept; - ensures (flushtlb_invoke_invept == true); - - behavior invalid: - assumes !( (flushtlbp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (flushtlbp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && flushtlbp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ); - assigns flushtlb_invoke_invept; - ensures (flushtlb_invoke_invept == false); - - complete behaviors; - disjoint behaviors; -@*/ -void _slabmempgtbl_flushtlb(xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *flushtlbp){ - uint32_t status; - - if( (flushtlbp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - ( (flushtlbp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && flushtlbp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[flushtlbp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ) - ) { - status = CASM_FUNCCALL(__vmx_invept, VMX_INVEPT_SINGLECONTEXT, 0, ((uint32_t)&_slabmempgtbl_lvl4t[(flushtlbp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)] | 0x1E), 0); - //@ghost flushtlb_invoke_invept = true; - }else{ - //@ghost flushtlb_invoke_invept = false; - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_getentry.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_getentry.c deleted file mode 100644 index f8856341ed..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_getentry.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -/*@ - requires \valid(getentryforpaddrp); - assigns getentryforpaddrp->result_entry; - ensures ( (getentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (pae_get_pdpt_index(getentryforpaddrp->gpa) < PAE_PTRS_PER_PDPT && pae_get_pdt_index(getentryforpaddrp->gpa) < PAE_PTRS_PER_PDT && pae_get_pt_index(getentryforpaddrp->gpa) < PAE_PTRS_PER_PT) && - ( (getentryforpaddrp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && getentryforpaddrp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[getentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[getentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[getentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ) - ) ==> (getentryforpaddrp->result_entry == _slabmempgtbl_lvl1t[(getentryforpaddrp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)][pae_get_pdpt_index(getentryforpaddrp->gpa)][pae_get_pdt_index(getentryforpaddrp->gpa)][pae_get_pt_index(getentryforpaddrp->gpa)]); - ensures !( (getentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS)) - ==> (getentryforpaddrp->result_entry == 0); -@*/ -void _slabmempgtbl_getentryforpaddr(xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp){ - - if( (getentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS)){ - if(pae_get_pdpt_index(getentryforpaddrp->gpa) < PAE_PTRS_PER_PDPT && pae_get_pdt_index(getentryforpaddrp->gpa) < PAE_PTRS_PER_PDT && pae_get_pt_index(getentryforpaddrp->gpa) < PAE_PTRS_PER_PT){ - if( (getentryforpaddrp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && getentryforpaddrp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[getentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[getentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[getentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ){ - getentryforpaddrp->result_entry = _slabmempgtbl_lvl1t[(getentryforpaddrp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)][pae_get_pdpt_index(getentryforpaddrp->gpa)][pae_get_pdt_index(getentryforpaddrp->gpa)][pae_get_pt_index(getentryforpaddrp->gpa)]; - } - } - }else{ - getentryforpaddrp->result_entry = 0; - } - -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_getmpgtblbase.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_getmpgtblbase.c deleted file mode 100644 index 0ec3319ceb..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_getmpgtblbase.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -void _ugmpgtbl_getmpgtblbase(uapi_ugmpgtbl_getmpgtblbase_params_t *p){ - - if( (p->dst_slabid < XMHFGEEC_TOTAL_SLABS) - && - (p->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && - p->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) - && - ( xmhfgeec_slab_info_table[p->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[p->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[p->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST - ) - ) { - - p->mpgtblbase = (uint32_t)&_slabmempgtbl_lvl4t[(p->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)]; - - }else{ - - p->mpgtblbase = 0; - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_inittable.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_inittable.c deleted file mode 100644 index 05e9136be4..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_inittable.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - - -/*@ - requires 0 <= slabid < XMHFGEEC_TOTAL_UGSLABS; - assigns _slabmempgtbl_lvl4t[slabid][0..(PAE_MAXPTRS_PER_PML4T-1)]; - assigns _slabmempgtbl_lvl3t[slabid][0..(PAE_MAXPTRS_PER_PDPT-1)]; - assigns _slabmempgtbl_lvl2t[slabid][0..(PAE_MAXPTRS_PER_PDPT-1)][0..(PAE_PTRS_PER_PDT-1)]; - ensures (\forall uint32_t x; 0 <= x < PAE_PTRS_PER_PML4T ==> - ( (uint64_t)_slabmempgtbl_lvl4t[slabid][x] ) == ( ((uint64_t)&_slabmempgtbl_lvl3t[slabid] | 0x7) ) - ); - ensures (\forall uint32_t x; 0 <= x < PAE_PTRS_PER_PDPT ==> - ( (uint64_t)_slabmempgtbl_lvl3t[slabid][x] ) == ( ((uint64_t)&_slabmempgtbl_lvl2t[slabid][x] | 0x7 ) ) - ); - - ensures (\forall integer x,y; 0 <= x < (PAE_PTRS_PER_PDPT-1) && 0 <= y < (PAE_PTRS_PER_PDT-1) ==> - ( (uint64_t)_slabmempgtbl_lvl2t[slabid][x][y] == ((uint64_t)&_slabmempgtbl_lvl1t[slabid][x][y] | 0x7 ) ) - ); -@*/ -static void _slabmempgtbl_initmempgtbl_ept4K(uint32_t slabid){ - uint32_t i, j; - - //pml4t zero out - /*@ - loop invariant a1: 0 <= i <= PAE_MAXPTRS_PER_PML4T; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( (uint64_t)_slabmempgtbl_lvl4t[slabid][x] == 0 ); - loop assigns _slabmempgtbl_lvl4t[slabid][0..(PAE_MAXPTRS_PER_PML4T-1)]; - loop assigns i; - loop variant PAE_MAXPTRS_PER_PML4T - i; - @*/ - for(i=0; i < PAE_MAXPTRS_PER_PML4T; i++){ - _slabmempgtbl_lvl4t[slabid][i] = 0; - } - //memset(&_slabmempgtbl_lvl4t[slabid], 0, PAGE_SIZE_4K); - - //pdpt zero out - //memset(&_slabmempgtbl_lvl3t[slabid], 0, PAGE_SIZE_4K); - /*@ - loop invariant a1: 0 <= i <= PAE_MAXPTRS_PER_PDPT; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( (uint64_t)_slabmempgtbl_lvl3t[slabid][x] == 0 ); - loop assigns _slabmempgtbl_lvl3t[slabid][0..(PAE_MAXPTRS_PER_PDPT-1)]; - loop assigns i; - loop variant PAE_MAXPTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_MAXPTRS_PER_PDPT; i++){ - _slabmempgtbl_lvl3t[slabid][i] = 0; - } - - - //pml4t setup - /*@ - loop invariant a1: 0 <= i <= PAE_PTRS_PER_PML4T; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( (uint64_t)_slabmempgtbl_lvl4t[slabid][x] == ((uint64_t)&_slabmempgtbl_lvl3t[slabid] | 0x7) ); - loop assigns _slabmempgtbl_lvl4t[slabid][0..(PAE_PTRS_PER_PML4T-1)]; - loop assigns i; - loop variant PAE_PTRS_PER_PML4T - i; - @*/ - for(i=0; i < PAE_PTRS_PER_PML4T; i++){ - _slabmempgtbl_lvl4t[slabid][i] = ((uint64_t)&_slabmempgtbl_lvl3t[slabid] | 0x7); - } - - //pdpt setup - /*@ - loop invariant a1: 0 <= i <= PAE_PTRS_PER_PDPT; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( (uint64_t)_slabmempgtbl_lvl3t[slabid][x] == ((uint64_t)&_slabmempgtbl_lvl2t[slabid][x] | 0x7 ) ); - loop assigns _slabmempgtbl_lvl3t[slabid][0..(PAE_PTRS_PER_PDPT-1)]; - loop assigns i; - loop variant PAE_PTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_PTRS_PER_PDPT; i++){ - _slabmempgtbl_lvl3t[slabid][i] = ((uint64_t)&_slabmempgtbl_lvl2t[slabid][i] | 0x7 ); - } - - //pt setup - /*@ - loop invariant z1: 0 <= i <= PAE_PTRS_PER_PDPT; - loop invariant o1: \forall integer x,y; 0 <= x < i && 0 <= y < (PAE_PTRS_PER_PDT-1) ==> ( (uint64_t)_slabmempgtbl_lvl2t[slabid][x][y] == ((uint64_t)&_slabmempgtbl_lvl1t[slabid][x][y] | 0x7 ) ); - loop assigns i; - loop assigns j; - loop assigns _slabmempgtbl_lvl2t[slabid][0..(PAE_MAXPTRS_PER_PDPT-1)][0..(PAE_PTRS_PER_PDT-1)]; - loop variant PAE_PTRS_PER_PDPT - i; - @*/ - for(i=0; i < PAE_PTRS_PER_PDPT; i++){ - /*@ - loop invariant z2: 0 <= j <= PAE_PTRS_PER_PDT; - loop assigns j; - loop invariant o2: \forall integer x; 0 <= x < j ==> ( (uint64_t)_slabmempgtbl_lvl2t[slabid][i][x] == ((uint64_t)&_slabmempgtbl_lvl1t[slabid][i][x] | 0x7 ) ); - loop assigns _slabmempgtbl_lvl2t[slabid][i][0..(PAE_PTRS_PER_PDT-1)]; - loop variant PAE_PTRS_PER_PDT - j; - @*/ - for(j=0; j < PAE_PTRS_PER_PDT; j++){ - _slabmempgtbl_lvl2t[slabid][i][j] = ((uint64_t)&_slabmempgtbl_lvl1t[slabid][i][j] | 0x7 ); - } - } - - -} - - - -//@ghost bool inittable_invokeept4K=false; -/*@ - requires \valid(initmempgtblp); - - behavior inittable_do: - assumes ( - (initmempgtblp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (initmempgtblp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && initmempgtblp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ); - assigns inittable_invokeept4K; - ensures (inittable_invokeept4K == true); - - behavior inittable_invalid: - assumes !( - (initmempgtblp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (initmempgtblp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && initmempgtblp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ); - - assigns inittable_invokeept4K; - ensures (inittable_invokeept4K == false); - - complete behaviors; - disjoint behaviors; - -@*/ -void _slabmempgtbl_initmempgtbl(xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t *initmempgtblp){ - - if( (initmempgtblp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (initmempgtblp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && initmempgtblp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ){ - - _slabmempgtbl_initmempgtbl_ept4K((initmempgtblp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)); - //@ghost inittable_invokeept4K = true; - - _XDPRINTF_("%s: setup slab %u with ept4K\n", __func__, initmempgtblp->dst_slabid); - - }else{ - //_XDPRINTF_("%s: Halting. Unknown slab type %u\n", __func__, slabtype); - //@ghost inittable_invokeept4K = false; - } -} - diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_main.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_main.c deleted file mode 100644 index 7f15c45f03..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_main.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -///// -//@ ghost bool ugmpgtbl_methodcall_inittable = false; -//@ ghost bool ugmpgtbl_methodcall_setentry = false; -//@ ghost bool ugmpgtbl_methodcall_getentry = false; -//@ ghost bool ugmpgtbl_methodcall_flushtlb = false; -//@ ghost bool ugmpgtbl_methodcall_invalid = false; -/*@ - requires \valid(sp); - assigns sp->in_out_params[0..15]; - assigns ugmpgtbl_methodcall_inittable, ugmpgtbl_methodcall_setentry, ugmpgtbl_methodcall_getentry, ugmpgtbl_methodcall_flushtlb, ugmpgtbl_methodcall_invalid; - ensures (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL) ==> (ugmpgtbl_methodcall_inittable == true); - ensures (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR) ==> (ugmpgtbl_methodcall_setentry == true); - ensures (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR) ==> (ugmpgtbl_methodcall_getentry == true); - ensures (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB) ==> (ugmpgtbl_methodcall_flushtlb == true); - ensures !( sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL || - sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR || - sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR || - sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB) ==> (ugmpgtbl_methodcall_invalid == true); -@*/ -void slab_main(slab_params_t *sp){ - - if(sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_INITMEMPGTBL){ - xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t *initmempgtblp = - (xmhfgeec_uapi_slabmempgtbl_initmempgtbl_params_t *)sp->in_out_params; - - //@ ghost ugmpgtbl_methodcall_inittable = true; - _slabmempgtbl_initmempgtbl(initmempgtblp); - - }else if (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR){ - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)sp->in_out_params; - - //@ ghost ugmpgtbl_methodcall_setentry = true; - _slabmempgtbl_setentryforpaddr(setentryforpaddrp); - - }else if (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR){ - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)sp->in_out_params; - - - //@ ghost ugmpgtbl_methodcall_getentry = true; - _slabmempgtbl_getentryforpaddr(getentryforpaddrp); - - - }else if (sp->dst_uapifn == XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB){ - xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *flushtlbp = - (xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *)sp->in_out_params; - - //@ ghost ugmpgtbl_methodcall_flushtlb = true; - _slabmempgtbl_flushtlb(flushtlbp); - - }else if (sp->dst_uapifn == UAPI_UGMPGTBL_GETMPGTBLBASE){ - uapi_ugmpgtbl_getmpgtblbase_params_t *p = - (uapi_ugmpgtbl_getmpgtblbase_params_t *)sp->in_out_params; - - _ugmpgtbl_getmpgtblbase(p); - - - }else{ - - //@ ghost ugmpgtbl_methodcall_invalid = true; - //_XDPRINTF_("UAPI_SLABMEMPGTBL[%u]: Unknown uAPI function %x. Halting!\n", - // (uint16_t)sp->cpuid, sp->dst_uapifn); - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_setentry.c b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_setentry.c deleted file mode 100644 index a220c27ed8..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/ugmpgtbl_setentry.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -//@ghost uint64_t setentry_fullentry=0; -/*@ - requires \valid(setentryforpaddrp); - - behavior setit: - assumes ( (setentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (pae_get_pdpt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PDPT && pae_get_pdt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PDT && pae_get_pt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PT) && - ( (setentryforpaddrp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && setentryforpaddrp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ) && - !(setentryforpaddrp->gpa >= __TARGET_BASE_XMHF && setentryforpaddrp->gpa < 0x15a00000) - ); - assigns _slabmempgtbl_lvl1t[(setentryforpaddrp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)][pae_get_pdpt_index(setentryforpaddrp->gpa)][pae_get_pdt_index(setentryforpaddrp->gpa)][pae_get_pt_index(setentryforpaddrp->gpa)]; - assigns setentry_fullentry; - ensures (_slabmempgtbl_lvl1t[(setentryforpaddrp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)][pae_get_pdpt_index(setentryforpaddrp->gpa)][pae_get_pdt_index(setentryforpaddrp->gpa)][pae_get_pt_index(setentryforpaddrp->gpa)] == (setentry_fullentry)); - - behavior nosetit: - assumes !( (setentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (pae_get_pdpt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PDPT && pae_get_pdt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PDT && pae_get_pt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PT) && - ( (setentryforpaddrp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && setentryforpaddrp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ) && - !(setentryforpaddrp->gpa >= __TARGET_BASE_XMHF && setentryforpaddrp->gpa < 0x15a00000) - ); - assigns \nothing; - - complete behaviors; - disjoint behaviors; -@*/ -void _slabmempgtbl_setentryforpaddr(xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp){ -#if 1 - if( (setentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (pae_get_pdpt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PDPT && pae_get_pdt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PDT && pae_get_pt_index(setentryforpaddrp->gpa) < PAE_PTRS_PER_PT) && - ( (setentryforpaddrp->dst_slabid >= XMHFGEEC_UGSLAB_BASE_IDX && setentryforpaddrp->dst_slabid <= XMHFGEEC_UGSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG_GUEST || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_GUEST || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG_RICHGUEST) - ) && - !(setentryforpaddrp->gpa >= __TARGET_BASE_XMHF && setentryforpaddrp->gpa < __TARGET_MAX_XMHF) - ) { - //@ghost setentry_fullentry = (setentryforpaddrp->entry); - _slabmempgtbl_lvl1t[(setentryforpaddrp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)][pae_get_pdpt_index(setentryforpaddrp->gpa)][pae_get_pdt_index(setentryforpaddrp->gpa)][pae_get_pt_index(setentryforpaddrp->gpa)] = - setentryforpaddrp->entry; - }else{ - //nothing - } -#else - _slabmempgtbl_lvl1t[(setentryforpaddrp->dst_slabid - XMHFGEEC_UGSLAB_BASE_IDX)][pae_get_pdpt_index(setentryforpaddrp->gpa)][pae_get_pdt_index(setentryforpaddrp->gpa)][pae_get_pt_index(setentryforpaddrp->gpa)] = - setentryforpaddrp->entry; -#endif -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/xmhfgeecslab.mk.in deleted file mode 100644 index ae808a4001..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_slabmempgtbl/xmhfgeecslab.mk.in +++ /dev/null @@ -1,22 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := uapi_slabmempgtbl -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main _slabmempgtbl_flushtlb -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugmpgtbl_data.c.v.c ugmpgtbl_flushtlb.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main _slabmempgtbl_getentryforpaddr -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugmpgtbl_data.c.v.c ugmpgtbl_getentry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main _slabmempgtbl_initmempgtbl -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugmpgtbl_data.c.v.c ugmpgtbl_inittable.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main _slabmempgtbl_setentryforpaddr -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugmpgtbl_data.c.v.c ugmpgtbl_setentry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) ugmpgtbl_data.c.v.c ugmpgtbl_main.c.v.c - diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/uapi_sysdata.gsm b/uxmhf/xmhf-uobjs/uapi_sysdata/uapi_sysdata.gsm deleted file mode 100644 index 61e8cf67b5..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/uapi_sysdata.gsm +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -#include - -{ - "uobj-name": "uapi_sysdata", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "UAPI", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_data.c b/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_data.c deleted file mode 100644 index 94587fb1b1..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_data.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -/* - * sysdata (E820) state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - - -__attribute__((section(".data"))) GRUBE820 usysd_memmapinfo[MAX_E820_ENTRIES]; - -__attribute__((section(".data"))) uint32_t usysd_memmapinfo_maxindex=0; diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820addentry.c b/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820addentry.c deleted file mode 100644 index 9374286e62..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820addentry.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * sysdata (E820) state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include -#include - -/*@ - requires \valid(e820entryp); - - behavior addentry: - assumes (usysd_memmapinfo_maxindex < MAX_E820_ENTRIES); - assigns usysd_memmapinfo[usysd_memmapinfo_maxindex]; - assigns usysd_memmapinfo_maxindex; - ensures (usysd_memmapinfo_maxindex <= MAX_E820_ENTRIES); - - behavior invalid: - assumes (usysd_memmapinfo_maxindex == MAX_E820_ENTRIES); - assigns \nothing; - ensures (usysd_memmapinfo_maxindex == MAX_E820_ENTRIES); -@*/ -void usysd_e820addentry(uxmhf_uapi_sysdata_e820addentry_t *e820entryp){ - - if(usysd_memmapinfo_maxindex < MAX_E820_ENTRIES){ - usysd_memmapinfo[usysd_memmapinfo_maxindex].baseaddr_high = e820entryp->baseaddr_high; - usysd_memmapinfo[usysd_memmapinfo_maxindex].baseaddr_low = e820entryp->baseaddr_low; - usysd_memmapinfo[usysd_memmapinfo_maxindex].length_high = e820entryp->length_high; - usysd_memmapinfo[usysd_memmapinfo_maxindex].length_low = e820entryp->length_low; - usysd_memmapinfo[usysd_memmapinfo_maxindex].type = e820entryp->type; - usysd_memmapinfo_maxindex++; - }else{ - //we have reached the max. permissible entries; no more additions - } - -} - - diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820getentryforindex.c b/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820getentryforindex.c deleted file mode 100644 index 01ab552f9e..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820getentryforindex.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * sysdata (E820) state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include -#include - - -/*@ - requires \valid(gentryp); - - behavior returnentry: - assumes (usysd_memmapinfo_maxindex <= MAX_E820_ENTRIES && gentryp->index < usysd_memmapinfo_maxindex); - assigns gentryp->baseaddr_high; - assigns gentryp->baseaddr_low; - assigns gentryp->length_high; - assigns gentryp->length_low; - assigns gentryp->type; - - behavior invalid: - assumes !(usysd_memmapinfo_maxindex <= MAX_E820_ENTRIES && gentryp->index < usysd_memmapinfo_maxindex); - assigns \nothing; -@*/ -void usysd_e820getentryforindex(uxmhf_uapi_sysdata_e820getentryforindex_t *gentryp){ - - if(usysd_memmapinfo_maxindex <= MAX_E820_ENTRIES && gentryp->index < usysd_memmapinfo_maxindex){ - gentryp->baseaddr_high = usysd_memmapinfo[gentryp->index].baseaddr_high; - gentryp->baseaddr_low = usysd_memmapinfo[gentryp->index].baseaddr_low; - gentryp->length_high = usysd_memmapinfo[gentryp->index].length_high; - gentryp->length_low = usysd_memmapinfo[gentryp->index].length_low; - gentryp->type = usysd_memmapinfo[gentryp->index].type; - }else{ - //invalid index, so return nothing - } - -} - - diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820getmaxindex.c b/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820getmaxindex.c deleted file mode 100644 index 91c03f6df4..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_e820getmaxindex.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * sysdata (E820) state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include -#include - -/*@ - requires \valid(indexp); - assigns indexp->index; - ensures indexp->index == usysd_memmapinfo_maxindex; -@*/ -void usysd_e820getmaxindex(uxmhf_uapi_sysdata_e820getmaxindex_t *indexp){ - //_XDPRINTF_("%s: came in, usysd_memmapinfo_maxindex=%u\n", __func__, usysd_memmapinfo_maxindex); - indexp->index = usysd_memmapinfo_maxindex; -} - - diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_main.c b/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_main.c deleted file mode 100644 index 60697cf63b..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/usysd_main.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * sysdata (E820) state uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - - -//@ ghost bool usysd_methodcall_e820addentry = false; -//@ ghost bool usysd_methodcall_e820getmaxindex = false; -//@ ghost bool usysd_methodcall_e820getentryforindex = false; -//@ ghost bool usysd_methodcall_invalid = false; -/*@ - requires \valid(sp); - assigns sp->in_out_params[0..15]; - assigns usysd_methodcall_e820addentry; - assigns usysd_methodcall_e820getmaxindex; - assigns usysd_methodcall_e820getentryforindex; - assigns usysd_methodcall_invalid; - ensures (sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820ADDENTRY) ==> (usysd_methodcall_e820addentry == true); - ensures (sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820GETMAXINDEX) ==> (usysd_methodcall_e820getmaxindex == true); - ensures (sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820GETENTRYFORINDEX) ==> (usysd_methodcall_e820getentryforindex == true); - ensures !( sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820ADDENTRY || - sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820GETMAXINDEX || - sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820GETENTRYFORINDEX) ==> (usysd_methodcall_invalid == true); -@*/ -void slab_main(slab_params_t *sp){ - - if( sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820ADDENTRY){ - usysd_e820addentry((uxmhf_uapi_sysdata_e820addentry_t *)sp->in_out_params); - //@ghost usysd_methodcall_e820addentry = true; - }else if( sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820GETMAXINDEX ){ - usysd_e820getmaxindex((uxmhf_uapi_sysdata_e820getmaxindex_t *)sp->in_out_params); - //@ghost usysd_methodcall_e820getmaxindex = true; - }else if( sp->dst_uapifn == UXMHF_UAPI_SYSDATA_E820GETENTRYFORINDEX){ - usysd_e820getentryforindex((uxmhf_uapi_sysdata_e820getentryforindex_t *)sp->in_out_params); - //@ghost usysd_methodcall_e820getentryforindex = true; - }else{ - //_XDPRINTF_("UAPI_SYSDATA[%u]: Unknown uAPI function %x. Halting!\n", (uint16_t)sp->cpuid, sp->dst_uapifn); - //@ghost usysd_methodcall_invalid = true; - } - -} diff --git a/uxmhf/xmhf-uobjs/uapi_sysdata/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/uapi_sysdata/xmhfgeecslab.mk.in deleted file mode 100644 index 3a71e1ae30..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_sysdata/xmhfgeecslab.mk.in +++ /dev/null @@ -1,22 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := uapi_sysdata -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main usysd_e820addentry -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) usysd_data.c.v.c usysd_e820addentry.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main usysd_e820getentryforindex -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) usysd_data.c.v.c usysd_e820getentryforindex.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main usysd_e820getmaxindex -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) usysd_data.c.v.c usysd_e820getmaxindex.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) usysd_data.c.v.c usysd_main.c.v.c - - diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uapi_uhmpgtbl.gsm b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uapi_uhmpgtbl.gsm deleted file mode 100644 index f28b4bcaee..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uapi_uhmpgtbl.gsm +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include -#include - -{ - "uobj-name": "uapi_uhmpgtbl", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "UAPI", - - "uobj-uapifunctions":[ - { - "uapifunction-id": USMF_STR(UAPI_UHMPGTBL_INITMEMPGTBL), - "uapifunction-definition" : - "void _uhmpgtbl_initmempgtbl(uapi_uhmpgtblmempgtbl_initmempgtbl_params_t *initmempgtblp)", - "uapifunction-drivercode" : - "{uapi_uhmpgtblmempgtbl_initmempgtbl_params_t initmempgtblp; initmempgtblp.dst_slabid = framac_nondetu32(); _uhmpgtbl_initmempgtbl(&initmempgtblp);}" - }, - { - "uapifunction-id": USMF_STR(UAPI_UHMPGTBL_SETENTRYFORPADDR), - "uapifunction-definition" : "void _uhmpgtbl_setentryforpaddr(uapi_uhmpgtbl_setentryforpaddr_params_t *setentryforpaddrp)", - "uapifunction-drivercode" : "{uapi_uhmpgtbl_setentryforpaddr_params_t setentryforpaddrp; setentryforpaddrp.dst_slabid = framac_nondetu32(); setentryforpaddrp.gpa = framac_nondetu32(); setentryforpaddrp.entry = framac_nondetu32(); _uhmpgtbl_setentryforpaddr(&setentryforpaddrp);}" - } - ], - - "uobj-callees": " geec_sentinel - ", - - "uobj-uapicallees":[], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0xA00000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_data.c b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_data.c deleted file mode 100644 index de7f5cfd2a..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_data.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -//page table data structure for untrusted hypervisor uobjs -__attribute__((section(".rwdatahdr"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl4t[XMHFGEEC_TOTAL_UHSLABS][PAE_MAXPTRS_PER_PML4T]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl3t[XMHFGEEC_TOTAL_UHSLABS][PAE_MAXPTRS_PER_PDPT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl2t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT]; -__attribute__((section(".data"))) __attribute__((aligned(4096))) uint64_t _uhslabmempgtbl_lvl1t[XMHFGEEC_TOTAL_UHSLABS][PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT * PAE_PTRS_PER_PT]; diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_getidxformpgtblbase.c b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_getidxformpgtblbase.c deleted file mode 100644 index 9c53772f28..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_getidxformpgtblbase.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * uhmpgtbl uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -void _uhmpgtbl_getidxformpgtblbase(uapi_uhmpgtbl_getidxformpgtblbase_params_t *p){ - uint32_t idx; - - idx = ((uint32_t)p->mpgtblbase - (uint32_t)&_uhslabmempgtbl_lvl4t[0])/PAE_MAXPTRS_PER_PML4T; - if (idx < XMHFGEEC_TOTAL_UHSLABS){ - p->mpgtblbase_idx = idx; - p->status=1; - }else{ - p->mpgtblbase_idx = 0; - p->status = 0; - } -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_getmpgtblbase.c b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_getmpgtblbase.c deleted file mode 100644 index afa656622e..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_getmpgtblbase.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -void _uhmpgtbl_getmpgtblbase(uapi_uhmpgtbl_getmpgtblbase_params_t *p){ - if( (p->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - ( (p->dst_slabid >= XMHFGEEC_UHSLAB_BASE_IDX && - p->dst_slabid <= XMHFGEEC_UHSLAB_MAX_IDX - ) && - (xmhfgeec_slab_info_table[p->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG || - xmhfgeec_slab_info_table[p->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG - ) - ) - ) { - - p->mpgtblbase = (uint32_t)&_uhslabmempgtbl_lvl4t[(p->dst_slabid - XMHFGEEC_UHSLAB_BASE_IDX)]; - }else{ - //nothing - } -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_inittable.c b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_inittable.c deleted file mode 100644 index 81e51b19a1..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_inittable.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * hypervisor untrusted uobj pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -static void _uhmpgtbl_initmempgtbl_pae(uint32_t slabid){ - uint32_t i, j; - - for(i=0; i < PAE_MAXPTRS_PER_PDPT; i++){ - _uhslabmempgtbl_lvl4t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][i] = 0; - } - - //assign 4GB pdpt entries - for(i=0; i < PAE_PTRS_PER_PDPT; i++){ - _uhslabmempgtbl_lvl4t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][i] = - pae_make_pdpe(&_uhslabmempgtbl_lvl2t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][i * PAE_PTRS_PER_PDT], (uint64_t)(_PAGE_PRESENT)); - } - - //pdt setup - for(i=0; i < PAE_PTRS_PER_PDPT * PAE_PTRS_PER_PDT; i++){ - _uhslabmempgtbl_lvl2t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][i] = - pae_make_pde(&_uhslabmempgtbl_lvl1t[(slabid - XMHFGEEC_UHSLAB_BASE_IDX)][(i * PAE_PTRS_PER_PT)], (uint64_t)(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER)); - } - -} - - -void _uhmpgtbl_initmempgtbl(uapi_uhmpgtbl_initmempgtbl_params_t *initmempgtblp){ - - if( (initmempgtblp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - (initmempgtblp->dst_slabid >= XMHFGEEC_UHSLAB_BASE_IDX && initmempgtblp->dst_slabid <= XMHFGEEC_UHSLAB_MAX_IDX) && - (xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG || - xmhfgeec_slab_info_table[initmempgtblp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG) - ){ - - _uhmpgtbl_initmempgtbl_pae(initmempgtblp->dst_slabid); - - _XDPRINTF_("%s: setup slab %u with PAE\n", __func__, - initmempgtblp->dst_slabid); - - }else{ - //_XDPRINTF_("%s: Halting. Unknown slab type %u\n", __func__, slabtype); - } -} - diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_main.c b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_main.c deleted file mode 100644 index 7d66e3ade2..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_main.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * untrusted hypervisoe memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - - -void slab_main(slab_params_t *sp){ - - if(sp->dst_uapifn == UAPI_UHMPGTBL_INITMEMPGTBL){ - uapi_uhmpgtbl_initmempgtbl_params_t *initmempgtblp = - (uapi_uhmpgtbl_initmempgtbl_params_t *)sp->in_out_params; - - _uhmpgtbl_initmempgtbl(initmempgtblp); - - }else if (sp->dst_uapifn == UAPI_UHMPGTBL_SETENTRYFORPADDR){ - uapi_uhmpgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (uapi_uhmpgtbl_setentryforpaddr_params_t *)sp->in_out_params; - - _uhmpgtbl_setentryforpaddr(setentryforpaddrp); - - }else if (sp->dst_uapifn == UAPI_UHMPGTBL_GETMPGTBLBASE){ - uapi_uhmpgtbl_getmpgtblbase_params_t *p = - (uapi_uhmpgtbl_getmpgtblbase_params_t *)sp->in_out_params; - - _XDPRINTF_("uapi_uhmpgtbl[%u]: GETMPGTBLBASE\n", - (uint16_t)sp->cpuid); - - _uhmpgtbl_getmpgtblbase(p); - - }else if (sp->dst_uapifn == UAPI_UHMPGTBL_GETIDXFORMPGTBLBASE){ - uapi_uhmpgtbl_getidxformpgtblbase_params_t *p = - (uapi_uhmpgtbl_getidxformpgtblbase_params_t *)sp->in_out_params; - - _uhmpgtbl_getidxformpgtblbase(p); - - }else{ - //_XDPRINTF_("uapi_uhmpgtbl[%u]: Unknown uAPI function %x. Halting!\n", - // (uint16_t)sp->cpuid, sp->dst_uapifn); - } -} diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_setentry.c b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_setentry.c deleted file mode 100644 index a069f304c2..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/uhmpgtbl_setentry.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * slab memory pagetable uAPI - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include - -void _uhmpgtbl_setentryforpaddr(uapi_uhmpgtbl_setentryforpaddr_params_t *setentryforpaddrp){ - if( (setentryforpaddrp->dst_slabid < XMHFGEEC_TOTAL_SLABS) && - ( (setentryforpaddrp->dst_slabid >= XMHFGEEC_UHSLAB_BASE_IDX && - setentryforpaddrp->dst_slabid <= XMHFGEEC_UHSLAB_MAX_IDX - ) && - (xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVU_PROG || - xmhfgeec_slab_info_table[setentryforpaddrp->dst_slabid].slabtype == XMHFGEEC_SLABTYPE_uVT_PROG - ) - ) - ) { - _uhslabmempgtbl_lvl1t[(setentryforpaddrp->dst_slabid - XMHFGEEC_UHSLAB_BASE_IDX)][(setentryforpaddrp->pa/PAGE_SIZE_4K)] = - ((uint64_t)setentryforpaddrp->entry_hi << 32) | (uint64_t)setentryforpaddrp->entry_lo; - }else{ - _XDPRINTF_("%s: error in setentryforpaddr\n", __func__); - - //nothing - } -} - - - - diff --git a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/xmhfgeecslab.mk.in deleted file mode 100644 index 2bc3439f78..0000000000 --- a/uxmhf/xmhf-uobjs/uapi_uhmpgtbl/xmhfgeecslab.mk.in +++ /dev/null @@ -1,18 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - - -export XMHF_SLAB_NAME := uapi_uhmpgtbl -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Nothing to verify for $(XMHF_SLAB_NAME)... - - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xc_exhub.gsm b/uxmhf/xmhf-uobjs/xc_exhub/xc_exhub.gsm deleted file mode 100644 index 9315447562..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xc_exhub.gsm +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include - -#include - -{ - "uobj-name": "xc_exhub", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "EXCEPTION", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_data.c b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_data.c deleted file mode 100644 index 2ef426dba1..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_data.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -#include -#include -#include -#include - -// IDT -__attribute__((section(".data"))) __attribute__(( aligned(16) )) idtentry_t xcexhub_idt_data[EMHF_XCPHANDLER_MAXEXCEPTIONS] ; -// IDT descriptor -__attribute__((section(".data"))) __attribute__(( aligned(16) )) arch_x86_idtdesc_t xcexhub_idt = { - .size=sizeof(xcexhub_idt_data)-1, - .base=(uint32_t)&xcexhub_idt_data, -}; - - -//list of exception handlers -__attribute__((section(".data"))) uint32_t xcexhub_excp_handlers[EMHF_XCPHANDLER_MAXEXCEPTIONS] = { - (uint32_t)&__xmhf_exception_handler_0, - (uint32_t)&__xmhf_exception_handler_1, - (uint32_t)&__xmhf_exception_handler_2, - (uint32_t)&__xmhf_exception_handler_3, - (uint32_t)&__xmhf_exception_handler_4, - (uint32_t)&__xmhf_exception_handler_5, - (uint32_t)&__xmhf_exception_handler_6, - (uint32_t)&__xmhf_exception_handler_7, - (uint32_t)&__xmhf_exception_handler_8, - (uint32_t)&__xmhf_exception_handler_9, - (uint32_t)&__xmhf_exception_handler_10, - (uint32_t)&__xmhf_exception_handler_11, - (uint32_t)&__xmhf_exception_handler_12, - (uint32_t)&__xmhf_exception_handler_13, - (uint32_t)&__xmhf_exception_handler_14, - (uint32_t)&__xmhf_exception_handler_15, - (uint32_t)&__xmhf_exception_handler_16, - (uint32_t)&__xmhf_exception_handler_17, - (uint32_t)&__xmhf_exception_handler_18, - (uint32_t)&__xmhf_exception_handler_19, - (uint32_t)&__xmhf_exception_handler_20, - (uint32_t)&__xmhf_exception_handler_21, - (uint32_t)&__xmhf_exception_handler_22, - (uint32_t)&__xmhf_exception_handler_23, - (uint32_t)&__xmhf_exception_handler_24, - (uint32_t)&__xmhf_exception_handler_25, - (uint32_t)&__xmhf_exception_handler_26, - (uint32_t)&__xmhf_exception_handler_27, - (uint32_t)&__xmhf_exception_handler_28, - (uint32_t)&__xmhf_exception_handler_29, - (uint32_t)&__xmhf_exception_handler_30, - (uint32_t)&__xmhf_exception_handler_31 -}; - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_entryexcp.c b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_entryexcp.c deleted file mode 100644 index 07d68e2816..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_entryexcp.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - -/*static void _geec_sentinel_dump_exframe(x86vmx_exception_frame_t *exframe){ - //dump relevant info - _XDPRINTF_("%s: [START]\n\n", __func__); - _XDPRINTF_("exception %x\n", exframe->vector); - _XDPRINTF_("errorcode=0x%08x\n", exframe->error_code); - _XDPRINTF_("CS:EIP:EFLAGS = 0x%08x:0x%08x:0x%08x\n", exframe->orig_cs, exframe->orig_rip, exframe->orig_rflags); - _XDPRINTF_("SS:ESP = 0x%08x:0x%08x\n", exframe->orig_ss, exframe->orig_rsp); - _XDPRINTF_("EAX=0x%08x, EBX=0x%08x\n", exframe->eax, exframe->ebx); - _XDPRINTF_("ECX=0x%08x, EDX=0x%08x\n", exframe->ecx, exframe->edx); - _XDPRINTF_("ESI=0x%08x, EDI=0x%08x\n", exframe->esi, exframe->edi); - _XDPRINTF_("EBP=0x%08x, ESP=0x%08x\n", exframe->ebp, exframe->esp); - _XDPRINTF_("%s: [END]\n\n", __func__); -}*/ - -////// exceptions - -void xcexhub_entryexcp(x86vmx_exception_frame_t *exframe){ - slab_params_t spl; - - memset(&spl, 0, sizeof(spl)); - - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_EXCEPTION; - spl.src_slabid = XMHFGEEC_SLAB_GEEC_SENTINEL; //XXX: TODO: grab src_slabid based on exframe->orig_rip - spl.dst_slabid = XMHFGEEC_SLAB_XC_EXHUB; - spl.dst_uapifn = 0; - spl.cpuid = xmhf_baseplatform_arch_x86_getcpulapicid(); - memcpy(&spl.in_out_params[0], exframe, - sizeof(x86vmx_exception_frame_t)); - - //invoke exception processing - xcexhub_excpmain(&spl); - - //return from exception - CASM_FUNCCALL(xcexhub_retexcp, - &spl.in_out_params[0]); - _XDPRINTF_("GEEC_SENTINEL[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); -} - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_excpmain.c b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_excpmain.c deleted file mode 100644 index 0fe0698033..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_excpmain.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * uXMHF core exception handling uobj - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -#include -#include - - -static void _xcexhub_unhandled(x86vmx_exception_frame_t *exframe){ - //dump relevant info - _XDPRINTF_("exception %x\n", exframe->vector); - _XDPRINTF_("state dump:\n\n"); - _XDPRINTF_("errorcode=0x%08x\n", exframe->error_code); - _XDPRINTF_("CS:EIP:EFLAGS = 0x%08x:0x%08x:0x%08x\n", exframe->orig_cs, exframe->orig_rip, exframe->orig_rflags); - _XDPRINTF_("SS:ESP = 0x%08x:0x%08x\n", exframe->orig_ss, exframe->orig_rsp); - _XDPRINTF_("CR0=0x%08x, CR2=0x%08x\n", CASM_FUNCCALL(read_cr0,CASM_NOPARAM), CASM_FUNCCALL(read_cr2,CASM_NOPARAM)); - _XDPRINTF_("CR3=0x%08x, CR4=0x%08x\n", CASM_FUNCCALL(read_cr3,CASM_NOPARAM), CASM_FUNCCALL(read_cr4,CASM_NOPARAM)); - _XDPRINTF_("CS=0x%04x, DS=0x%04x, ES=0x%04x, SS=0x%04x\n", - (uint16_t)read_segreg_cs(CASM_NOPARAM), (uint16_t)read_segreg_ds(CASM_NOPARAM), - (uint16_t)read_segreg_es(CASM_NOPARAM), (uint16_t)read_segreg_ss(CASM_NOPARAM)); - _XDPRINTF_("FS=0x%04x, GS=0x%04x\n", (uint16_t)read_segreg_fs(CASM_NOPARAM), (uint16_t)read_segreg_gs(CASM_NOPARAM)); - _XDPRINTF_("TR=0x%04x\n", (uint16_t)read_tr_sel(CASM_NOPARAM)); - _XDPRINTF_("EAX=0x%08x, EBX=0x%08x\n", exframe->eax, exframe->ebx); - _XDPRINTF_("ECX=0x%08x, EDX=0x%08x\n", exframe->ecx, exframe->edx); - _XDPRINTF_("ESI=0x%08x, EDI=0x%08x\n", exframe->esi, exframe->edi); - _XDPRINTF_("EBP=0x%08x, ESP=0x%08x\n", exframe->ebp, exframe->esp); - - ////do a stack dump in the hopes of getting more info. - //{ - // uint64_t i; - // uint64_t stack_start = exframe->orig_rsp; - // _XDPRINTF_("\n-----stack dump (8 entries)-----\n"); - // for(i=stack_start; i < stack_start+(8*sizeof(uint64_t)); i+=sizeof(uint64_t)){ - // _XDPRINTF_("Stack(0x%016llx) -> 0x%016llx\n", i, *(uint64_t *)i); - // } - // _XDPRINTF_("\n-----stack dump end-------------\n"); - //} - -} - - - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; -slab_params_t test_sp; -uint32_t cpuid = 0; //cpu id - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.slab_ctype = framac_nondetu32(); - test_sp.src_slabid = framac_nondetu32(); - test_sp.dst_slabid = framac_nondetu32(); - test_sp.dst_uapifn = framac_nondetu32(); - test_sp.cpuid = framac_nondetu32(); - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - xcexhub_excpmain(&test_sp); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ -} -#endif - -void xcexhub_excpmain(slab_params_t *sp){ - x86vmx_exception_frame_t *exframe = (x86vmx_exception_frame_t *)&sp->in_out_params[0]; - - _XDPRINTF_("XC_EXHUB[%u]: Got control: ESP=%08x, src_slabid=%u, dst_slabid=%u\n", - (uint16_t)sp->cpuid, CASM_FUNCCALL(read_esp,CASM_NOPARAM), sp->src_slabid, sp->dst_slabid); - - if(exframe->vector == 0x3){ - _xcexhub_unhandled(exframe); - _XDPRINTF_("%s: exception 3, returning\n", __func__); - }else{ - _xcexhub_unhandled(exframe); - _XDPRINTF_("\nHalting System!\n"); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - return; -} - - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_excpstub.cS b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_excpstub.cS deleted file mode 100644 index 221bccf3ee..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_excpstub.cS +++ /dev/null @@ -1,185 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - sentinel exception entry point - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -#include - -uint32_t saved_cpu_gprs_ebx=0; -uint32_t saved_cpu_gprs_esi=0; -uint32_t saved_cpu_gprs_edi=0; -uint32_t saved_cpu_gprs_ebp=0; -uint32_t cpuid = 0; //cpu - -void cabi_establish(void){ - xmhfhwm_cpu_gprs_ebx = 5UL; - xmhfhwm_cpu_gprs_esi = 6UL; - xmhfhwm_cpu_gprs_edi = 7UL; - saved_cpu_gprs_ebx = xmhfhwm_cpu_gprs_ebx; - saved_cpu_gprs_esi = xmhfhwm_cpu_gprs_esi; - saved_cpu_gprs_edi = xmhfhwm_cpu_gprs_edi; -} - -void cabi_check(void){ - //@ assert saved_cpu_gprs_ebx == xmhfhwm_cpu_gprs_ebx; - //@ assert saved_cpu_gprs_esi == xmhfhwm_cpu_gprs_esi; - //@ assert saved_cpu_gprs_edi == xmhfhwm_cpu_gprs_edi; -} - -uint32_t check_esp, check_eip = CASM_RET_EIP; - - #if defined (DRV_PATH_CALLEXCP) - x86vmx_exception_frame_t drv_path_callexcp_excpframe; - - void xmhfhwm_vdriver_slabep(void){ - //@assert xmhfhwm_cpu_gprs_eip == (uint32_t)xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XC_EXHUB].entrystub; - //@assert false; - } - - void drv_path_callexcp(void){ - xmhfhwm_cpu_gprs_esp -= sizeof(x86vmx_exception_frame_t); - - //invoke sentinel exception stub - CASM_FUNCCALL(__xmhf_exception_handler_8, CASM_NOPARAM); - //@assert false; - } - #endif // defined - - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - #if defined (DRV_PATH_CALLEXCP) - drv_path_callexcp(); - #endif // DRV_PATH_CALLEXCP - -} - -#endif -////// exceptions entry stubs - -#define XMHF_EXCEPTION_HANDLER_DEFINE(vector) \ - CASM_FUNCDEF(void, __xmhf_exception_handler_##vector, \ - { \ - xmhfhwm_cpu_insn_pushl_imm(vector); \ - xmhfhwm_cpu_insn_pushal(); \ - xmhfhwm_cpu_insn_movw_imm_ax(__DS_CPL0); \ - xmhfhwm_cpu_insn_movw_ax_ds();\ - xmhfhwm_cpu_insn_movw_ax_es();\ - xmhfhwm_cpu_insn_pushl_esp(); \ - xmhfhwm_cpu_insn_call_c_1p(xcexhub_entryexcp,x86vmx_exception_frame_t *); \ - xmhfhwm_cpu_insn_hlt(); \ - },\ - void *noparam) \ - -#define XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(vector) \ - CASM_FUNCDEF(void, __xmhf_exception_handler_##vector, \ - {\ - xmhfhwm_cpu_insn_pushl_imm(0x0); \ - xmhfhwm_cpu_insn_pushl_imm(vector); \ - xmhfhwm_cpu_insn_pushal(); \ - xmhfhwm_cpu_insn_movw_imm_ax(__DS_CPL0); \ - xmhfhwm_cpu_insn_movw_ax_ds();\ - xmhfhwm_cpu_insn_movw_ax_es();\ - xmhfhwm_cpu_insn_pushl_esp(); \ - xmhfhwm_cpu_insn_call_c_1p(xcexhub_entryexcp,x86vmx_exception_frame_t *); \ - xmhfhwm_cpu_insn_hlt(); \ - },\ - void *noparam) \ - - - -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(0) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(1) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(2) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(3) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(4) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(5) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(6) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(7) -XMHF_EXCEPTION_HANDLER_DEFINE(8) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(9) -XMHF_EXCEPTION_HANDLER_DEFINE(10) -XMHF_EXCEPTION_HANDLER_DEFINE(11) -XMHF_EXCEPTION_HANDLER_DEFINE(12) -XMHF_EXCEPTION_HANDLER_DEFINE(13) -XMHF_EXCEPTION_HANDLER_DEFINE(14) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(15) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(16) -XMHF_EXCEPTION_HANDLER_DEFINE(17) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(18) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(19) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(20) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(21) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(22) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(23) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(24) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(25) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(26) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(27) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(28) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(29) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(30) -XMHF_EXCEPTION_HANDLER_DEFINE_WITHERRORCODE(31) - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_main.c b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_main.c deleted file mode 100644 index cd138d08a4..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_main.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * uXMHF core exception handling uobj - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include - -//#include -#include - -bool ihub_exit_status = false; -uint32_t ihub_exit_info = 0; - - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; -slab_params_t test_sp; -uint32_t cpuid = 0; //cpu id - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.slab_ctype = framac_nondetu32(); - test_sp.src_slabid = framac_nondetu32(); - test_sp.dst_slabid = framac_nondetu32(); - test_sp.dst_uapifn = framac_nondetu32(); - test_sp.cpuid = framac_nondetu32(); - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - slab_main(&test_sp); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ -} -#endif - -void slab_main(slab_params_t *sp){ - - if( sp->dst_uapifn == UAPI_XCEXHUB_DEBUG){ - - ihub_exit_status = sp->in_out_params[0]; - ihub_exit_info = sp->in_out_params[1]; - - }else if( sp->dst_uapifn == UAPI_XCEXHUB_SETUPIDT){ - - xcexhub_setupidt(); - - }else if( sp->dst_uapifn == UAPI_XCEXHUB_LOADIDT){ - - CASM_FUNCCALL(xmhfhw_cpu_loadIDT,&xcexhub_idt); - _XDPRINTF_("%s[%u]: IDT loaded\n", __func__, (uint16_t)sp->cpuid); - - }else if( sp->dst_uapifn == UAPI_XCEXHUB_LOADHOSTIDTRBASE){ - - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_IDTR_BASE, CASM_FUNCCALL32(xmhf_baseplatform_arch_x86_getidtbase,CASM_NOPARAM)); - - }else{ - //unknown api ignore and return - return; - } - -} - - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_retexcp.cS b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_retexcp.cS deleted file mode 100644 index 021b10a38c..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_retexcp.cS +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - -CASM_FUNCDEF(void, xcexhub_retexcp, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); //eax = exception frame - xmhfhwm_cpu_insn_movl_meax_edi(0x0); - xmhfhwm_cpu_insn_movl_meax_esi(0x4); - xmhfhwm_cpu_insn_movl_meax_ebp(0x8); - xmhfhwm_cpu_insn_movl_meax_esp(0xC); - xmhfhwm_cpu_insn_movl_meax_ebx(0x10); - xmhfhwm_cpu_insn_movl_meax_edx(0x14); - xmhfhwm_cpu_insn_movl_meax_ecx(0x18); - xmhfhwm_cpu_insn_movl_meax_eax(0x1C); - xmhfhwm_cpu_insn_addl_imm_esp(0x8); - xmhfhwm_cpu_insn_iretl(); -}, -x86vmx_exception_frame_t *exframe) - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_setupidt.c b/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_setupidt.c deleted file mode 100644 index 1cc6bf0fc1..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xcexhub_setupidt.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -//initialize IDT -/*@ - assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].isrLow; - assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].isrHigh; - assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].isrSelector; - assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].count; - assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].type; - ensures \forall integer x; 0 <= x < (EMHF_XCPHANDLER_MAXEXCEPTIONS-1) ==> (xcexhub_idt_data[x].type == 0xEE); - ensures \forall integer x; 0 <= x < (EMHF_XCPHANDLER_MAXEXCEPTIONS-1) ==> (xcexhub_idt_data[x].count == 0x0); - ensures \forall integer x; 0 <= x < (EMHF_XCPHANDLER_MAXEXCEPTIONS-1) ==> (xcexhub_idt_data[x].isrSelector == __CS_CPL0); - ensures \forall integer x; 0 <= x < (EMHF_XCPHANDLER_MAXEXCEPTIONS-1) ==> (xcexhub_idt_data[x].isrHigh == (uint16_t) ((uint32_t)xcexhub_excp_handlers[x] >> 16)); - ensures \forall integer x; 0 <= x < (EMHF_XCPHANDLER_MAXEXCEPTIONS-1) ==> (xcexhub_idt_data[x].isrLow == (uint16_t) xcexhub_excp_handlers[x]); -@*/ -void xcexhub_setupidt(void){ - uint32_t i; - - - /*@ - loop invariant a1: 0 <= i <= EMHF_XCPHANDLER_MAXEXCEPTIONS; - loop invariant a2: \forall integer x; 0 <= x < i ==> (xcexhub_idt_data[x].type == 0xEE); - loop invariant a3: \forall integer x; 0 <= x < i ==> (xcexhub_idt_data[x].count == 0x0); - loop invariant a4: \forall integer x; 0 <= x < i ==> (xcexhub_idt_data[x].isrSelector == __CS_CPL0); - loop invariant a5: \forall integer x; 0 <= x < i ==> (xcexhub_idt_data[x].isrHigh == (uint16_t) ((uint32_t)xcexhub_excp_handlers[i] >> 16) ); - loop invariant a6: \forall integer x; 0 <= x < i ==> (xcexhub_idt_data[x].isrLow == (uint16_t) xcexhub_excp_handlers[i]); - loop assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].isrLow; - loop assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].isrHigh; - loop assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].isrSelector; - loop assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].count; - loop assigns xcexhub_idt_data[0..(EMHF_XCPHANDLER_MAXEXCEPTIONS-1)].type; - loop assigns i; - loop variant EMHF_XCPHANDLER_MAXEXCEPTIONS - i; - @*/ - for(i=0; i < EMHF_XCPHANDLER_MAXEXCEPTIONS; i++){ - xcexhub_idt_data[i].isrLow= (uint16_t)xcexhub_excp_handlers[i]; - xcexhub_idt_data[i].isrHigh= (uint16_t)((uint32_t)xcexhub_excp_handlers[i] >> 16); - xcexhub_idt_data[i].isrSelector = __CS_CPL0; - xcexhub_idt_data[i].count=0x0; - xcexhub_idt_data[i].type=0xEE; //32-bit interrupt gate - //present=1, DPL=11b, system=0, type=1110b - - } -} - diff --git a/uxmhf/xmhf-uobjs/xc_exhub/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xc_exhub/xmhfgeecslab.mk.in deleted file mode 100644 index 9ec3358286..0000000000 --- a/uxmhf/xmhf-uobjs/xc_exhub/xmhfgeecslab.mk.in +++ /dev/null @@ -1,18 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xc_exhub -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) -XMHF_SLAB_SOURCES += $(wildcard $(srcdir)/*.cS) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Nothing to verify for $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -slevel 2048 $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c xcexhub*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xc_ihub.gsm b/uxmhf/xmhf-uobjs/xc_ihub/xc_ihub.gsm deleted file mode 100644 index 1a00e82db3..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xc_ihub.gsm +++ /dev/null @@ -1,133 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -{ - "uobj-name": "xc_ihub", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "INTERCEPT", - - "uobj-uapifunctions":[], - - "uobj-callees": " uapi_gcpustate - uapi_hcpustate - uapi_sysdata - uapi_slabmempgtbl - xh_hyperdep - xh_syscalllog - xh_ssteptrace - xc_exhub - ", - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_hcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_WRMSR), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_hcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_RDMSR), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_sysdata", - "uobj-uapifunctionid": USMF_STR(UXMHF_UAPI_SYSDATA_E820GETMAXINDEX), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_sysdata", - "uobj-uapifunctionid": USMF_STR(UXMHF_UAPI_SYSDATA_E820GETENTRYFORINDEX), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB), - "opt1" : "(void)0;", - "opt2" : "(1)" - } - ], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_data.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_data.c deleted file mode 100644 index 518f6cd585..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_data.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ -#include -#include -#include - -#include -#include - -__attribute__(( section(".data") )) volatile uint32_t xcihub_smplock = 1; diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_halt.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_halt.c deleted file mode 100644 index f176fb28ec..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_halt.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -#include - -/* - * xcihub_halt -- halt on unhandled rich guest intercepts - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#if 1 -void xcihub_halt_eptviolation(uint32_t cpuid, uint32_t info_vmexitreason){ - uint64_t errorcode; - uint64_t gpa; - uint64_t gva; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuid; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - - gcpustate_vmrwp->encoding = VMCS_INFO_EXIT_QUALIFICATION; - XMHF_SLAB_CALLNEW(&spl); - errorcode = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_PADDR_FULL; - XMHF_SLAB_CALLNEW(&spl); - gpa = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_LINEAR_ADDRESS; - XMHF_SLAB_CALLNEW(&spl); - gva = gcpustate_vmrwp->value; - - _XDPRINTF_("%s[%u]: EPT violation gpa=0x%016llx\n", __func__, cpuid, gpa); - _XDPRINTF_("%s[%u]: EPT violation gva=0x%016llx\n", __func__, cpuid, gva); - _XDPRINTF_("%s[%u]: EPT violation error_code=0x%016llx\n", __func__, cpuid, errorcode); -} -#endif - - - -void xcihub_halt(uint32_t cpuid, uint32_t info_vmexit_reason){ - _XDPRINTF_("%s[%u]: unhandled intercept %x. Halting!\n", __func__, cpuid, info_vmexit_reason); -#if 1 - if(info_vmexit_reason == 0x30){ - xcihub_halt_eptviolation(cpuid, info_vmexit_reason); - } -#endif - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); -} - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_hcbinvoke.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_hcbinvoke.c deleted file mode 100644 index f37863f212..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_hcbinvoke.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -/* - * xc_ihub hypapp callback invocation - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - -/*@ - requires 0 <= hcbentry < HYPAPP_INFO_TABLE_NUMENTRIES; - requires 0 <= cbtype <= XC_HYPAPPCB_MAXMASK; - - assigns \nothing; - - behavior yes_hypapp_cb: - assumes (_xcihub_hypapp_info_table[hcbentry].cbmask & XC_HYPAPPCB_MASK(cbtype)); - ensures (\result == XC_HYPAPPCB_CHAIN || \result == XC_HYPAPPCB_NOCHAIN); - - behavior no_hypapp_cb: - assumes !(_xcihub_hypapp_info_table[hcbentry].cbmask & XC_HYPAPPCB_MASK(cbtype)); - ensures (\result == XC_HYPAPPCB_CHAIN); - - complete behaviors; - disjoint behaviors; -@*/ -static uint32_t xc_hcbinvoke_helper(uint32_t hcbentry, uint32_t cbtype, uint32_t src_slabid, uint32_t cpuid, uint32_t guest_slab_index, uint32_t cbqual){ - uint32_t status = XC_HYPAPPCB_CHAIN; - slab_params_t spl; - - spl.src_slabid = src_slabid; - spl.cpuid = cpuid; - spl.dst_uapifn = 0; - spl.in_out_params[0]=cbtype; //hcbp->cbtype=cbtype; - spl.in_out_params[1]=cbqual; //hcbp->cbqual=cbqual; - spl.in_out_params[2]=guest_slab_index; //hcbp->guest_slab_index=guest_slab_index; - spl.in_out_params[3]=0; - - if(_xcihub_hypapp_info_table[hcbentry].cbmask & XC_HYPAPPCB_MASK(cbtype)){ - spl.dst_slabid = _xcihub_hypapp_info_table[hcbentry].xmhfhic_slab_index; - XMHF_SLAB_CALLNEW(&spl); - if(spl.in_out_params[3] == XC_HYPAPPCB_NOCHAIN){ - status = XC_HYPAPPCB_NOCHAIN; - } - return status; - }else{ - return status; - } -} - - -//@ghost bool invoke_helper[HYPAPP_INFO_TABLE_NUMENTRIES]; -/*@ - requires 0 <= cbtype <= XC_HYPAPPCB_MAXMASK; - assigns invoke_helper[0..(HYPAPP_INFO_TABLE_NUMENTRIES-1)]; - ensures \result == XC_HYPAPPCB_CHAIN || \result == XC_HYPAPPCB_NOCHAIN; -@*/ -uint32_t xc_hcbinvoke(uint32_t src_slabid, uint32_t cpuid, uint32_t cbtype, uint32_t cbqual, uint32_t guest_slab_index){ - uint32_t status = XC_HYPAPPCB_CHAIN; - bool nochain = false; - uint32_t i; - /*@ - loop invariant a1: 0 <= i <= HYPAPP_INFO_TABLE_NUMENTRIES; - loop invariant a2: \forall integer x; 0 <= x < i ==> ( invoke_helper[x] == true ); - loop assigns i; - loop assigns status; - loop assigns nochain; - loop assigns invoke_helper[0..(HYPAPP_INFO_TABLE_NUMENTRIES-1)]; - loop variant HYPAPP_INFO_TABLE_NUMENTRIES - i; - @*/ - for(i=0; i < HYPAPP_INFO_TABLE_NUMENTRIES; i++){ - status = xc_hcbinvoke_helper(i, cbtype, src_slabid, cpuid, guest_slab_index, cbqual); - //@ghost invoke_helper[i] = true; - if(status == XC_HYPAPPCB_NOCHAIN){ - nochain = true; - break; - } - } - - if(nochain) - return XC_HYPAPPCB_NOCHAIN; - else - return XC_HYPAPPCB_CHAIN; -} - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptcpuid.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptcpuid.c deleted file mode 100644 index 4f656db64b..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptcpuid.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include - -/* - * xcihub_icptcpuid -- rich guest CPUID instruction emulation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -void xcihub_icptcpuid(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - uint32_t guest_rip; - uint32_t info_vmexit_instruction_length; - x86regs_t r; - - //_XDPRINTF_("%s[%u]: VMX_VMEXIT_CPUID\n", __func__, cpuid); - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - memcpy(&r, &gcpustate_gprs->gprs, sizeof(x86regs_t)); - - //invoke actual CPUID instruction - CASM_FUNCCALL(xmhfhw_cpu_cpuid,(uint32_t)r.eax, (uint32_t *)&r.eax, (uint32_t *)&r.ebx, (uint32_t *)&r.ecx, (uint32_t *)&r.edx); - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE; - memcpy(&gcpustate_gprs->gprs, &r, sizeof(x86regs_t)); - XMHF_SLAB_CALLNEW(&spl); - - //set guest RIP to next instruction and resume - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INSTRUCTION_LENGTH; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_instruction_length = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - guest_rip+=info_vmexit_instruction_length; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = guest_rip; - XMHF_SLAB_CALLNEW(&spl); - - //_XDPRINTF_("%s[%u]: adjusted guest_rip=%08x\n", __func__, cpuid, guest_rip); -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptcrx.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptcrx.c deleted file mode 100644 index e7710e36e8..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptcrx.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include - -#include -#include -#include -#include - -#define CR4_SMEP (1UL << 20) -#define CR4_SMAP (1UL << 21) -#define CR4_PKE (1UL << 22) -/* - * xcihub_icptcrx -- rich guest control register access emulation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -static uint32_t _xcihub_icptcrx_getregval(uint32_t gpr, x86regs_t r){ - switch(gpr){ - case 0: return r.eax; - case 1: return r.ecx; - case 2: return r.edx; - case 3: return r.ebx; - case 4: return r.esp; //XXX: TODO: return value from GUEST RSP VMCS register - case 5: return r.ebp; - case 6: return r.esi; - case 7: return r.edi; - default: - //_XDPRINTF_("\n%s: warning, invalid gpr value (%u): returning zero value", __FUNCTION__, gpr); - return 0; - } -} - -uint32_t xcihub_icptcrx_read_cr4(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR4; - XMHF_SLAB_CALLNEW(&spl); - - return (gcpustate_vmrwp->value); -} - -uint32_t xcihub_icptcrx_read_cr0(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR0; - XMHF_SLAB_CALLNEW(&spl); - - return (gcpustate_vmrwp->value); -} - - -uint32_t xcihub_icptcrx_read_cr3(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR3; - XMHF_SLAB_CALLNEW(&spl); - - return (gcpustate_vmrwp->value); -} - - - -uint32_t xcihub_icptcrx_read_cr4_shadow(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_CONTROL_CR4_SHADOW; - XMHF_SLAB_CALLNEW(&spl); - - return (gcpustate_vmrwp->value); -} - - - -bool is_paging_enabled(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR0; - XMHF_SLAB_CALLNEW(&spl); - - if(gcpustate_vmrwp->value & CR0_PG) - return true; - else - return false; -} - -#define CR0_RESERVED_BITS \ - (~(uint32_t)(CR0_PE | CR0_MP | CR0_EM | CR0_TS \ - | CR0_ET | CR0_NE | CR0_WP | CR0_AM \ - | CR0_NW | CR0_CD | CR0_PG)) - -#define GUEST_CR0_MASK (CR0_NW | CR0_CD) - -uint32_t xcihub_icptcrx_handle_cr0(uint32_t cpuid, uint32_t src_slabid, uint32_t cr0){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - uint32_t old_cr0 = xcihub_icptcrx_read_cr0(cpuid); - uint32_t hw_cr0; - uint32_t update_bits = CR0_PG | CR0_WP; - - memset(&spl, 0, sizeof(spl)); - - cr0 |= CR0_ET; - cr0 &= ~CR0_RESERVED_BITS; - - hw_cr0 = (cr0 & ~GUEST_CR0_MASK); - hw_cr0 |= CR0_NE; - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_CONTROL_CR0_SHADOW; - gcpustate_vmrwp->value = cr0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CR0; - gcpustate_vmrwp->value = hw_cr0; - XMHF_SLAB_CALLNEW(&spl); - - if ((cr0 ^ old_cr0) & CR0_PG) { - _XDPRINTF_("%s[%u]: CR0[WRITE]: PG bit set logic\n", __func__, cpuid); - CASM_FUNCCALL(xmhfhw_cpu_invvpid, VMX_INVVPID_SINGLECONTEXT, src_slabid, 0, 0); - - } - - if ((cr0 ^ old_cr0) & update_bits){ - _XDPRINTF_("%s[%u]: CR0[WRITE]: flushing TLB(update bits)\n", __func__, cpuid); - CASM_FUNCCALL(xmhfhw_cpu_invvpid, VMX_INVVPID_SINGLECONTEXT, src_slabid, 0, 0); - } - - //_XDPRINTF_("%s[%u]: CR0[WRITE]: old=0x%08x, new=0x%08x, final=0x%08x\n", - // __func__, cpuid, old_cr0, cr0, hw_cr0); - -} - - -uint32_t xcihub_icptcrx_handle_cr4(uint32_t cpuid, uint32_t src_slabid, uint32_t cr4){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - uint32_t old_cr4 = xcihub_icptcrx_read_cr4(cpuid); - uint32_t pdptr_bits = CR4_PGE | CR4_PSE | CR4_PAE | - CR4_SMEP | CR4_SMAP | CR4_PKE; - uint32_t hw_cr4; - - - memset(&spl, 0, sizeof(spl)); - - _XDPRINTF_("%s[%u]: CR4[WRITE]: old=0x%08x, new=0x%08x\n", - __func__, cpuid, old_cr4, cr4); - - if(is_paging_enabled(cpuid) && (cr4 & CR4_PAE) - && ((cr4 ^ old_cr4) & pdptr_bits) ){ - _XDPRINTF_("%s[%u]: CR4[WRITE]: PAE enabling logic.WiP!\n", __func__, cpuid); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - if ((cr4 & CR4_PCIDE) && !(old_cr4 & CR4_PCIDE)) { - _XDPRINTF_("%s[%u]: CR4[WRITE]: PCIDE logic enabling.WiP!\n", __func__, cpuid); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //set cr4 logic - hw_cr4 = (xcihub_icptcrx_read_cr4_shadow(cpuid) & CR4_MCE) | - (cr4 & ~CR4_MCE); - - hw_cr4 |= CR4_VMXE; - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_CONTROL_CR4_SHADOW; - gcpustate_vmrwp->value = cr4; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CR4; - gcpustate_vmrwp->value = hw_cr4; - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: CR4[WRITE]: old=0x%08x, new=0x%08x, final=0x%08x\n", - __func__, cpuid, old_cr4, cr4, hw_cr4); - - - if (((cr4 ^ old_cr4) & pdptr_bits) || - (!(cr4 & CR4_PCIDE) && (old_cr4 & CR4_PCIDE))){ - _XDPRINTF_("%s[%u]: CR4[WRITE]: flushing TLB\n", __func__, cpuid); - CASM_FUNCCALL(xmhfhw_cpu_invvpid, VMX_INVVPID_SINGLECONTEXT, src_slabid, 0, 0); - } - - if ((cr4 ^ old_cr4) & (CR4_OSXSAVE | CR4_PKE)){ - _XDPRINTF_("%s[%u]: CR4[WRITE]: Should we update cpuid?\n", __func__, cpuid); - //CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - CASM_FUNCCALL(xmhfhw_cpu_invvpid, VMX_INVVPID_SINGLECONTEXT, src_slabid, 0, 0); - } - - return 0; -} - -void xcihub_icptcrx(uint32_t cpuid, uint32_t src_slabid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - - uint32_t guest_rip; - uint32_t info_vmexit_instruction_length; - uint32_t info_exit_qualification; - uint32_t tofrom, gpr, crx; - uint32_t lmsw_op_type, lmsw_src_data; - uint32_t hw_cr0; - x86regs_t r; - - //_XDPRINTF_("%s[%u]: CRX access\n", __func__, cpuid); - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - - //read GPRs - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - memcpy(&r, &gcpustate_gprs->gprs, sizeof(x86regs_t)); - - //read exit qualification - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_EXIT_QUALIFICATION; - XMHF_SLAB_CALLNEW(&spl); - info_exit_qualification = gcpustate_vmrwp->value; - - crx=(uint32_t) ((uint32_t)info_exit_qualification & 0x0000000FUL); - gpr=(uint32_t) (((uint32_t)info_exit_qualification & 0x00000F00UL) >> (uint32_t)8); - tofrom = (uint32_t) (((uint32_t)info_exit_qualification & 0x00000030UL) >> (uint32_t)4); - - - if ( !(gpr >=0 && gpr <= 7) ){ - _XDPRINTF_("%s[%u]: invalid GPR value, gpr=%u\n", __func__, cpuid, gpr); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - if (crx == 0x0 && tofrom == VMX_CRX_ACCESS_TO){ - xcihub_icptcrx_handle_cr0(cpuid, src_slabid, _xcihub_icptcrx_getregval(gpr, r)); - - }else if (crx == 0x0 && tofrom == 0x3){ - //LMSW instruction - lmsw_op_type = (uint32_t) (((uint32_t)info_exit_qualification & 0x00000040UL) >> (uint32_t)6); - lmsw_src_data = (uint32_t) (((uint32_t)info_exit_qualification & 0xFFFF0000UL) >> (uint32_t)16); - lmsw_src_data &= 0x0000000FUL; - hw_cr0 = xcihub_icptcrx_read_cr0((uint32_t)cpuid); - - _XDPRINTF_("%s[%u]: CR0 write via LMSW: hw_cr0=0x%08x, op_type=%u, src_data=0x%08x\n", __func__, cpuid, - hw_cr0, lmsw_op_type, lmsw_src_data); - - hw_cr0 &= 0xFFFFFFF0UL; - hw_cr0 |= lmsw_src_data; - - xcihub_icptcrx_handle_cr0(cpuid, src_slabid, hw_cr0); - - }else if(crx == 0x4 && tofrom == VMX_CRX_ACCESS_TO){ - - xcihub_icptcrx_handle_cr4(cpuid, src_slabid, _xcihub_icptcrx_getregval(gpr, r)); - - }else{ - _XDPRINTF_("%s[%u]: Unhandled CRx access, crx=0x%08x, gpr=%u, tofrom=%u\n", __func__, cpuid, crx, gpr, tofrom); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //skip over CRx instruction by adjusting RIP - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INSTRUCTION_LENGTH; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_instruction_length = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - guest_rip+=info_vmexit_instruction_length; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = guest_rip; - XMHF_SLAB_CALLNEW(&spl); - - //write interruptibility = 0 - gcpustate_vmrwp->encoding = VMCS_GUEST_INTERRUPTIBILITY; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //_XDPRINTF_("%s[%u]: adjusted guest_rip=%08x\n", __func__, cpuid, guest_rip); -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptentry.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptentry.c deleted file mode 100644 index d41657a347..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptentry.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * HIC trampoline and stubs - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include -#include -#include - - -////// intercepts - -void xcihub_entry_icpt(x86regs_t *r){ - slab_params_t spl; - uint32_t eflags; - - eflags = CASM_FUNCCALL(read_eflags,CASM_NOPARAM); - eflags &= ~(EFLAGS_IOPL); //clear out IOPL bits - eflags |= EFLAGS_IOPL; - CASM_FUNCCALL(write_eflags,eflags); - - memset(&spl, 0, sizeof(spl)); - - spl.slab_ctype = XMHFGEEC_SENTINEL_CALL_INTERCEPT; - spl.src_slabid = CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmread,VMCS_CONTROL_VPID); - spl.dst_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.cpuid = xmhf_baseplatform_arch_x86_getcpulapicid(); - - memcpy(&spl.in_out_params[0], r, sizeof(x86regs_t)); - - //invoke processing of intercept - xcihub_icptmain(&spl); - - //exit to guest - CASM_FUNCCALL(xcihub_reticpt, &spl.in_out_params[0]); - _XDPRINTF_("XC_IHUB[ln:%u]: halting. should never be here!\n", - __LINE__); - HALT(); -} - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptmain.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptmain.c deleted file mode 100644 index 65d8cc5d80..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptmain.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include - -/* - * xc_ihub main module - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#if 1 -void update_exhub_withinfo(uint32_t cpuid, bool exit_status, uint32_t info_reason){ - slab_params_t spl; - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_XC_EXHUB; - spl.dst_uapifn = 1; - spl.in_out_params[0] = exit_status; - spl.in_out_params[1] = info_reason; - XMHF_SLAB_CALLNEW(&spl); -} -#endif - - - - -//@ ghost bool xcihub_callhcbinvoke=false; -//@ ghost bool xcihub_callicptvmcall=false; -//@ ghost bool xcihub_callhalt=false; - -/*@ - assigns xcihub_callhcbinvoke; - assigns xcihub_callicptvmcall; - assigns xcihub_callhalt; - - ensures ( vmexit_reason == VMX_VMEXIT_RDMSR) ==> (xcihub_callhcbinvoke == true - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_VMCALL) ==> (xcihub_callhcbinvoke == false - && xcihub_callicptvmcall == true && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_CPUID) ==> (xcihub_callhcbinvoke == true - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_WRMSR) ==> (xcihub_callhcbinvoke == true - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_CRX_ACCESS) ==> (xcihub_callhcbinvoke == false - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_XSETBV) ==> (xcihub_callhcbinvoke == false - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_SIPI) ==> (xcihub_callhcbinvoke == false - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_EPT_VIOLATION) ==> (xcihub_callhcbinvoke == true - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - ensures ( vmexit_reason == VMX_VMEXIT_EXCEPTION) ==> (xcihub_callhcbinvoke == true - && xcihub_callicptvmcall == false && xcihub_callhalt == false); - - ensures !( - ( vmexit_reason == VMX_VMEXIT_RDMSR) || - ( vmexit_reason == VMX_VMEXIT_VMCALL) || - ( vmexit_reason == VMX_VMEXIT_CPUID) || - ( vmexit_reason == VMX_VMEXIT_WRMSR) || - ( vmexit_reason == VMX_VMEXIT_CRX_ACCESS) || - ( vmexit_reason == VMX_VMEXIT_XSETBV) || - ( vmexit_reason == VMX_VMEXIT_SIPI) || - ( vmexit_reason == VMX_VMEXIT_EPT_VIOLATION) || - ( vmexit_reason == VMX_VMEXIT_EXCEPTION) - ) ==> (xcihub_callhcbinvoke == false - && xcihub_callicptvmcall == false && xcihub_callhalt == true); - - -@*/ -static void slab_main_helper(uint32_t vmexit_reason, uint32_t src_slabid, uint32_t cpuid){ - uint32_t hcb_status; - - if (vmexit_reason == VMX_VMEXIT_RDMSR){ - hcb_status = xc_hcbinvoke(XMHFGEEC_SLAB_XC_IHUB, cpuid, XC_HYPAPPCB_TRAP_INSTRUCTION, - XC_HYPAPPCB_TRAP_INSTRUCTION_RDMSR, src_slabid); - //@ghost xcihub_callhcbinvoke=true; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - if(hcb_status == XC_HYPAPPCB_CHAIN) xcihub_icptrdmsr((uint16_t)cpuid); - - }else if(vmexit_reason == VMX_VMEXIT_VMCALL){ - xcihub_icptvmcall((uint16_t)cpuid, src_slabid); - //@ghost xcihub_callicptvmcall=true; - //@ghost xcihub_callhcbinvoke=false; - //@ghost xcihub_callhalt=false; - - }else if (vmexit_reason == VMX_VMEXIT_CPUID){ - hcb_status = xc_hcbinvoke(XMHFGEEC_SLAB_XC_IHUB, cpuid, XC_HYPAPPCB_TRAP_INSTRUCTION, - XC_HYPAPPCB_TRAP_INSTRUCTION_CPUID, src_slabid); - //@ghost xcihub_callhcbinvoke=true; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - if(hcb_status == XC_HYPAPPCB_CHAIN) xcihub_icptcpuid((uint16_t)cpuid); - - - }else if (vmexit_reason == VMX_VMEXIT_WRMSR){ - hcb_status = xc_hcbinvoke(XMHFGEEC_SLAB_XC_IHUB, cpuid, - XC_HYPAPPCB_TRAP_INSTRUCTION, XC_HYPAPPCB_TRAP_INSTRUCTION_WRMSR, src_slabid); - //@ghost xcihub_callhcbinvoke=true; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - if(hcb_status == XC_HYPAPPCB_CHAIN) xcihub_icptwrmsr((uint16_t)cpuid); - - }else if (vmexit_reason == VMX_VMEXIT_CRX_ACCESS){ - xcihub_icptcrx((uint16_t)cpuid, src_slabid); - //@ghost xcihub_callhcbinvoke=false; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - - }else if (vmexit_reason == VMX_VMEXIT_XSETBV){ - xcihub_icptxsetbv((uint16_t)cpuid); - //@ghost xcihub_callhcbinvoke=false; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - - }else if (vmexit_reason == VMX_VMEXIT_SIPI){ - xcihub_icptsipi((uint16_t)cpuid); - //@ghost xcihub_callhcbinvoke=false; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - - }else if (vmexit_reason == VMX_VMEXIT_EPT_VIOLATION){ - hcb_status = xc_hcbinvoke(XMHFGEEC_SLAB_XC_IHUB, cpuid, XC_HYPAPPCB_MEMORYFAULT, 0, src_slabid); - //@ghost xcihub_callhcbinvoke=true; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - if(hcb_status == XC_HYPAPPCB_CHAIN) xcihub_halt((uint16_t)cpuid, vmexit_reason); - - }else if (vmexit_reason == VMX_VMEXIT_EXCEPTION){ - hcb_status = xc_hcbinvoke(XMHFGEEC_SLAB_XC_IHUB, cpuid, XC_HYPAPPCB_TRAP_EXCEPTION, 0, src_slabid); - //@ghost xcihub_callhcbinvoke=true; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=false; - - }else { - xcihub_halt((uint16_t)cpuid, vmexit_reason); - //@ghost xcihub_callhcbinvoke=false; - //@ghost xcihub_callicptvmcall=false; - //@ghost xcihub_callhalt=true; - } - -} - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; -uint32_t cpuid = 0; //cpu id - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //setup main loop input parameters to non-det values - slab_main_helper(framac_nondetu32(), framac_nondetu32(), cpuid); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ -} -#endif - - - -/*@ - requires \valid(sp); - assigns sp->in_out_params[0]; - assigns sp->in_out_params[1]; - assigns sp->in_out_params[2]; - assigns sp->in_out_params[3]; - assigns sp->in_out_params[4]; - assigns sp->in_out_params[5]; - assigns sp->in_out_params[6]; - assigns sp->in_out_params[7]; - assigns xcihub_smplock; - - assigns xcihub_callhcbinvoke; - assigns xcihub_callicptvmcall; - assigns xcihub_callhalt; -@*/ -void xcihub_icptmain(slab_params_t *sp){ - uint32_t info_vmexit_reason; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)&spl.in_out_params[0]; - uint32_t cr4; - - //grab lock - CASM_FUNCCALL(spin_lock,&xcihub_smplock); - - spl.cpuid = sp->cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - - //store GPRs - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE; - spl.in_out_params[0] = sp->in_out_params[0]; - spl.in_out_params[1] = sp->in_out_params[1]; - spl.in_out_params[2] = sp->in_out_params[2]; - spl.in_out_params[3] = sp->in_out_params[3]; - spl.in_out_params[4] = sp->in_out_params[4]; - spl.in_out_params[5] = sp->in_out_params[5]; - spl.in_out_params[6] = sp->in_out_params[6]; - spl.in_out_params[7] = sp->in_out_params[7]; - XMHF_SLAB_CALLNEW(&spl); - - //grab exit reason - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - spl.in_out_params[0] = VMCS_INFO_VMEXIT_REASON; - spl.in_out_params[1] = 0; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_reason = gcpustate_vmrwp->value; - - update_exhub_withinfo((uint16_t)sp->cpuid, true, info_vmexit_reason); - - slab_main_helper(info_vmexit_reason, sp->src_slabid, (uint16_t)sp->cpuid); - - - //load GPRs - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - sp->in_out_params[0] = spl.in_out_params[0]; - sp->in_out_params[1] = spl.in_out_params[1]; - sp->in_out_params[2] = spl.in_out_params[2]; - sp->in_out_params[3] = spl.in_out_params[3]; - sp->in_out_params[4] = spl.in_out_params[4]; - sp->in_out_params[5] = spl.in_out_params[5]; - sp->in_out_params[6] = spl.in_out_params[6]; - sp->in_out_params[7] = spl.in_out_params[7]; - - //_XDPRINTF_("XCIHUB[%u]: Resuming guest, esp=%08x\n", (uint16_t)sp->cpuid, CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - update_exhub_withinfo((uint16_t)sp->cpuid, false, info_vmexit_reason); - - //release lock - CASM_FUNCCALL(spin_unlock,&xcihub_smplock); - - //resume guest slab - return; -} - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptrdmsr.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptrdmsr.c deleted file mode 100644 index 281f18a168..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptrdmsr.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include -#include - -/* - * xcihub_icptrdmsr -- rich guest RDMSR instruction emulation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -void xcihub_icptrdmsr(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - xmhf_uapi_hcpustate_msr_params_t *hcpustate_msrp = (xmhf_uapi_hcpustate_msr_params_t *)spl.in_out_params; - uint32_t guest_rip; - uint64_t msrvalue; - uint32_t info_vmexit_instruction_length; - x86regs_t r; - - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - memcpy(&r, &gcpustate_gprs->gprs, sizeof(x86regs_t)); - - switch((uint32_t)r.ecx){ - case IA32_SYSENTER_CS_MSR: - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_SYSENTER_CS; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - r.edx = 0; - r.eax = gcpustate_vmrwp->value; - break; - case IA32_SYSENTER_EIP_MSR: - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_SYSENTER_EIP; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - r.edx = 0; - r.eax = gcpustate_vmrwp->value; - break; - case IA32_SYSENTER_ESP_MSR: - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_SYSENTER_ESP; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - r.edx = 0; - r.eax = gcpustate_vmrwp->value; - break; - default: - if( (uint32_t)r.ecx != 0xc0010117 && - (uint32_t)r.ecx != 0xd90 ){ - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_HCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_RDMSR; - hcpustate_msrp->msr = r.ecx; - hcpustate_msrp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - r.edx = (uint32_t)((uint64_t)hcpustate_msrp->value >> 32); - r.eax = (uint32_t)hcpustate_msrp->value; - - }else{ - _XDPRINTF_("%s[%u]: VMX_VMEXIT_RDMSR: unsupported. warning!\n", __func__, cpuid); - r.edx = (uint32_t)0; - r.eax = (uint32_t)0; - } - - break; - } - - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE; - memcpy(&gcpustate_gprs->gprs, &r, sizeof(x86regs_t)); - XMHF_SLAB_CALLNEW(&spl); - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INSTRUCTION_LENGTH; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_instruction_length = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - guest_rip+=info_vmexit_instruction_length; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = guest_rip; - XMHF_SLAB_CALLNEW(&spl); - - //_XDPRINTF_("%s[%u]: adjusted guest_rip=%08x\n", __func__, cpuid, guest_rip); -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptsipi.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptsipi.c deleted file mode 100644 index 56cc0734ab..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptsipi.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include -#include - -/* - * xcihub_icptsipi -- rich guest SMP bootup handling - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ -void xcihub_icptsipi(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - uint32_t info_vmexit_instruction_length; - uint32_t info_exit_qualification; - uint32_t sipivector; - - memset(&spl, 0, sizeof(spl)); - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - - //read exit qualification - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_EXIT_QUALIFICATION; - XMHF_SLAB_CALLNEW(&spl); - info_exit_qualification = gcpustate_vmrwp->value; - - //compute SIPI vector - sipivector = (uint8_t)info_exit_qualification; - _XDPRINTF_("%s[%u]: SIPI intercept, vector=0x%08x\n", __func__, cpuid, sipivector); - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - - //set guest CS:RIP to value specified by the SIPI vector - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_SELECTOR; - gcpustate_vmrwp->value = ((sipivector * PAGE_SIZE_4K) >> 4); - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_BASE; - gcpustate_vmrwp->value = (sipivector * PAGE_SIZE_4K); - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //set CPU activity state to active - gcpustate_vmrwp->encoding = VMCS_GUEST_ACTIVITY_STATE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //clear interruptibility - gcpustate_vmrwp->encoding = VMCS_GUEST_INTERRUPTIBILITY; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptstub.cS b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptstub.cS deleted file mode 100644 index 31fc99d988..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptstub.cS +++ /dev/null @@ -1,96 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include - -#include - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -#include -#include - -uint32_t check_eip = CASM_RET_EIP; -uint32_t cpuid = 0; //cpu - -void xmhfhwm_vdriver_slabep(void){ - //@assert xmhfhwm_cpu_gprs_eip == (uint32_t)xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XC_IHUB].entrystub; - //@assert false; -} - -void drv_path_callicpt(void){ - //invoke sentinel intercept stub - CASM_FUNCCALL(gs_entry_icptstub, CASM_NOPARAM); - //@assert false; -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - drv_path_callicpt(); -} -#endif -////// intercept entry point -CASM_FUNCDEF(void, xcihub_entry_icptstub, -{ - xmhfhwm_cpu_insn_pushal(); - xmhfhwm_cpu_insn_pushl_esp(); - xmhfhwm_cpu_insn_call_c_1p(xcihub_entry_icpt, x86regs_t *); - xmhfhwm_cpu_insn_hlt(); -}, -void *noparam) - - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptvmcall.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptvmcall.c deleted file mode 100644 index f44eb7dc5a..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptvmcall.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include - -/* - * xcihub_icptvmcall -- rich guest VMCALL interfacing - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ -void xcihub_icptvmcall(uint32_t cpuid, uint32_t src_slabid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - uint32_t guest_rip; - uint32_t info_vmexit_instruction_length; - - //_XDPRINTF_("%s[%u]: VMX_VMEXIT_VMCALL\n", __func__, cpuid); - - //check to see if we need to handle rich guest E820 emulation, if so handle - //emulation, else rotate through hypapp callbacks - if (!xcihub_rg_e820emulation(cpuid, src_slabid)){ - - xc_hcbinvoke(XMHFGEEC_SLAB_XC_IHUB, cpuid, XC_HYPAPPCB_HYPERCALL, 0, src_slabid); - - //skip over VMCALL by updating guest RIP - //TODO: halt if we don't handle the VMCALL instead of just ignoring it - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INSTRUCTION_LENGTH; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_instruction_length = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - guest_rip+=info_vmexit_instruction_length; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = guest_rip; - XMHF_SLAB_CALLNEW(&spl); - - //write interruptibility = 0 - gcpustate_vmrwp->encoding = VMCS_GUEST_INTERRUPTIBILITY; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //_XDPRINTF_("%s[%u]: no-E820 adjusted guest_rip=%08x\n", __func__, cpuid, guest_rip); - } -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptwrmsr.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptwrmsr.c deleted file mode 100644 index 8febe50341..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptwrmsr.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include -#include - -/* - * xcihub_icptwrmsr -- rich guest WRMSR instruction emulation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ -void xcihub_icptwrmsr(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - xmhf_uapi_hcpustate_msr_params_t *hcpustate_msrp = (xmhf_uapi_hcpustate_msr_params_t *)spl.in_out_params; - uint32_t guest_rip; - uint32_t info_vmexit_instruction_length; - x86regs_t r; - - if((uint32_t)r.ecx == 0xc0010117){ - _XDPRINTF_("%s[%u]: VMX_VMEXIT_WRMSR: unsupported. warning!\n", __func__, cpuid); - } - - memset(&spl, 0, sizeof(spl)); - - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - memcpy(&r, &gcpustate_gprs->gprs, sizeof(x86regs_t)); - - switch((uint32_t)r.ecx){ - case IA32_SYSENTER_CS_MSR: - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_SYSENTER_CS; - gcpustate_vmrwp->value = r.eax; - XMHF_SLAB_CALLNEW(&spl); - break; - case IA32_SYSENTER_EIP_MSR: - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_SYSENTER_EIP; - gcpustate_vmrwp->value = r.eax; - XMHF_SLAB_CALLNEW(&spl); - break; - case IA32_SYSENTER_ESP_MSR: - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_SYSENTER_ESP; - gcpustate_vmrwp->value = r.eax; - XMHF_SLAB_CALLNEW(&spl); - break; - default: - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_HCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_WRMSR; - hcpustate_msrp->msr = r.ecx; - hcpustate_msrp->value = ((uint64_t)r.edx << 32) | (uint64_t)r.eax; - XMHF_SLAB_CALLNEW(&spl); - break; - } - - //adjust guest RIP - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INSTRUCTION_LENGTH; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_instruction_length = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - guest_rip+=info_vmexit_instruction_length; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = guest_rip; - XMHF_SLAB_CALLNEW(&spl); - - //_XDPRINTF_("%s[%u]: adjusted guest_rip=%08x\n", - // __func__, cpuid, guest_rip); -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptxsetbv.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptxsetbv.c deleted file mode 100644 index aa1c4fb14e..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_icptxsetbv.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include -#include - -/* - * xcihub_icptxsetbv -- rich guest XSETBV instruction emulation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ -void xcihub_icptxsetbv(uint32_t cpuid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - uint32_t guest_rip; - uint32_t info_vmexit_instruction_length; - x86regs_t r; - uint64_t xcr_value; - - //_XDPRINTF_("%s[%u]: CRX access\n", __func__, cpuid); - - memset(&spl, 0, sizeof(spl)); - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - - //read GPRs - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - memcpy(&r, &gcpustate_gprs->gprs, sizeof(x86regs_t)); - - xcr_value = ((uint64_t)r.edx << 32) + (uint64_t)r.eax; - - if(r.ecx != XCR_XFEATURE_ENABLED_MASK){ - _XDPRINTF_("%s[%u]: unhandled XCR register %u", __func__, cpuid, r.ecx); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //XXX: TODO: check for invalid states and inject GP accordingly - _XDPRINTF_("%s[%u]: xcr_value=%llx", __func__, cpuid, xcr_value); - - //set XCR with supplied value - CASM_FUNCCALL(xsetbv, XCR_XFEATURE_ENABLED_MASK, r.eax, r.edx); - - //skip over XSETBV instruction by adjusting RIP - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INSTRUCTION_LENGTH; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_instruction_length = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - guest_rip+=info_vmexit_instruction_length; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = guest_rip; - XMHF_SLAB_CALLNEW(&spl); - - //write interruptibility = 0 - gcpustate_vmrwp->encoding = VMCS_GUEST_INTERRUPTIBILITY; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //_XDPRINTF_("%s[%u]: adjusted guest_rip=%08x\n", __func__, cpuid, guest_rip); -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_main.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_main.c deleted file mode 100644 index 41374bdcf6..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_main.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include -#include - -/* - * xc_ihub main module - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - - -/*@ - requires \valid(sp); - assigns sp->in_out_params[0]; - assigns sp->in_out_params[1]; - assigns sp->in_out_params[2]; - assigns sp->in_out_params[3]; - assigns sp->in_out_params[4]; - assigns sp->in_out_params[5]; - assigns sp->in_out_params[6]; - assigns sp->in_out_params[7]; - -@*/ -void slab_main(slab_params_t *sp){ - - switch(sp->dst_uapifn){ - case UAPI_XCIHUB_INSTALLICPTHANDLER: - _XDPRINTF_("XCIHUB[cpu=%u]: intalling icpt handler\n", - (uint16_t)sp->cpuid); - - CASM_FUNCCALL(xmhfhw_cpu_x86vmx_vmwrite,VMCS_HOST_RIP, - &xcihub_entry_icptstub); - - break; - - default: - _XDPRINTF_("XCIHUB[cpu=%u]: unknown uapifn(%u). ignoring!\n", - (uint16_t)sp->cpuid, sp->dst_uapifn); - - break; - - } - - return; -} - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_reticpt.cS b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_reticpt.cS deleted file mode 100644 index 1781a43077..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_reticpt.cS +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - GEEC sentinel low-level support routines - author: amit vasudevan (amitvasudevan@acm.org) -*/ - -#include -#include -#include -#include -#include - - - - - -CASM_FUNCDEF(void, xcihub_reticpt, -{ - xmhfhwm_cpu_insn_movl_mesp_eax(0x4); - xmhfhwm_cpu_insn_movl_meax_edi(0x0); - xmhfhwm_cpu_insn_movl_meax_esi(0x4); - xmhfhwm_cpu_insn_movl_meax_ebp(0x8); - xmhfhwm_cpu_insn_movl_meax_esp(0xC); - xmhfhwm_cpu_insn_movl_meax_ebx(0x10); - xmhfhwm_cpu_insn_movl_meax_edx(0x14); - xmhfhwm_cpu_insn_movl_meax_ecx(0x18); - xmhfhwm_cpu_insn_movl_meax_eax(0x1C); - xmhfhwm_cpu_insn_vmresume(); - xmhfhwm_cpu_insn_hlt(); -}, -x86regs_t *r) - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_rg_e820emulation.c b/uxmhf/xmhf-uobjs/xc_ihub/xcihub_rg_e820emulation.c deleted file mode 100644 index dae25e9608..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xcihub_rg_e820emulation.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ -#include -#include -#include - -#include -#include -#include -#include - -/* - * xcihub_rg_e820emulation -- rich guest E820 memory-map emulation - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ -bool xcihub_rg_e820emulation(uint32_t cpuid, uint32_t src_slabid){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - slab_params_t splusysd; - uxmhf_uapi_sysdata_e820getmaxindex_t *usysd_getmaxindex = (uxmhf_uapi_sysdata_e820getmaxindex_t *)splusysd.in_out_params; - uxmhf_uapi_sysdata_e820getentryforindex_t *usysd_getentryforindex = (uxmhf_uapi_sysdata_e820getentryforindex_t *)splusysd.in_out_params; - uint32_t g_cs_base, g_eip; - uint32_t g_es_base, g_ss_base; - uint32_t g_esp; - uint16_t g_flags; - uint32_t e820_maxindex; - uint16_t orig_int15h_ip, orig_int15h_cs; - x86regs_t r; - - //clear out slab_params - memset(&spl, 0, sizeof(spl)); - memset(&splusysd, 0, sizeof(splusysd)); - - //setup uobj params - spl.cpuid = cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - splusysd.cpuid = cpuid; - splusysd.src_slabid = XMHFGEEC_SLAB_XC_IHUB; - splusysd.dst_slabid = XMHFGEEC_SLAB_UAPI_SYSDATA; - - //read CS base and RIP - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_BASE; - XMHF_SLAB_CALLNEW(&spl); - g_cs_base= gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - XMHF_SLAB_CALLNEW(&spl); - g_eip = gcpustate_vmrwp->value; - - //check if this is a E820 emulation VMCALL, if not return false - if ( !( (g_cs_base == (VMX_UG_E820HOOK_CS << 4)) && (g_eip == VMX_UG_E820HOOK_IP) ) ) - return false; - - //read ES.base, SS.base and ESP - gcpustate_vmrwp->encoding = VMCS_GUEST_ES_BASE; - XMHF_SLAB_CALLNEW(&spl); - g_es_base= gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_SS_BASE; - XMHF_SLAB_CALLNEW(&spl); - g_ss_base= gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RSP; - XMHF_SLAB_CALLNEW(&spl); - g_esp = gcpustate_vmrwp->value; - - //read GPRs - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - memcpy(&r, &gcpustate_gprs->gprs, sizeof(x86regs_t)); - - - //if E820 service then... - if((uint16_t)r.eax == 0xE820){ - //AX=0xE820, EBX=continuation value, 0 for first call - //ES:DI pointer to buffer, ECX=buffer size, EDX='SMAP' - //return value, CF=0 indicated no error, EAX='SMAP' - //ES:DI left untouched, ECX=size returned, EBX=next continuation value - //EBX=0 if last descriptor - _XDPRINTF_("%s[%u]: INT 15(e820): AX=0x%04x, EDX=0x%08x, EBX=0x%08x\n", __func__, cpuid, - (uint16_t)r.eax, (uint32_t)r.edx, (uint32_t)r.ebx); - _XDPRINTF_("%s[%u]: ECX=0x%08x, ES(base)=0x%08x, DI=0x%04x\n", __func__, cpuid, - (uint32_t)r.ecx, g_es_base, (uint16_t)r.edi); - - //read maximum E820 index - splusysd.dst_uapifn = UXMHF_UAPI_SYSDATA_E820GETMAXINDEX; - XMHF_SLAB_CALLNEW(&splusysd); - e820_maxindex = usysd_getmaxindex->index; - - if( (r.edx == 0x534D4150UL) && (r.ebx < e820_maxindex) ){ - - splusysd.dst_uapifn = UXMHF_UAPI_SYSDATA_E820GETENTRYFORINDEX; - usysd_getentryforindex->index = r.ebx; - XMHF_SLAB_CALLNEW(&splusysd); - - CASM_FUNCCALL(xmhfhw_sysmem_copy_obj2sys, (uint32_t)(g_es_base+(uint16_t)r.edi), &(usysd_getentryforindex->baseaddr_low), 20); - - _XDPRINTF_("%s[%u]: base: 0x%08x%08x len=0x%08x%08x, t=0x%08x\n", __func__, cpuid, - usysd_getentryforindex->baseaddr_high, usysd_getentryforindex->baseaddr_low, - usysd_getentryforindex->length_high, usysd_getentryforindex->length_low, - usysd_getentryforindex->type); - - r.ecx=20; - - //set EAX to 'SMAP' as required by the service call - r.eax=r.edx; - - //we need to update carry flag in the guest EFLAGS register - //however since INT 15 would have pushed the guest FLAGS on stack - //we cannot simply reflect the change by modifying vmcb->rflags - //instead we need to make the change to the pushed FLAGS register on - //the guest stack. the real-mode IRET frame looks like the following - //when viewed at top of stack - //guest_ip (16-bits) - //guest_cs (16-bits) - //guest_flags (16-bits) - //... - - //grab guest eflags on guest stack - g_flags = CASM_FUNCCALL(xmhfhw_sysmemaccess_readu16, ((uint32_t)g_ss_base + (uint16_t)g_esp + 0x4)); - - //increment e820 descriptor continuation value - r.ebx=r.ebx+1; - - if(r.ebx > (e820_maxindex-1) ){ - //we have reached the last record, so set CF and make EBX=0 - r.ebx=0; - g_flags |= (uint16_t)EFLAGS_CF; - }else{ - //we still have more records, so clear CF - g_flags &= ~(uint16_t)EFLAGS_CF; - } - - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu16, ((uint32_t)g_ss_base + (uint16_t)g_esp + 0x4), g_flags); - - }else{ //invalid state specified during INT 15 E820, halt - _XDPRINTF_("%s[%u]: INT15 (E820), invalid state specified by guest. Halting!\n", __func__, cpuid); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } - - //update GPRs - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE; - memcpy(&gcpustate_gprs->gprs, &r, sizeof(x86regs_t)); - XMHF_SLAB_CALLNEW(&spl); - - //update RIP to execute the IRET following the VMCALL instruction - //effectively returning from the INT 15 call made by the guest - g_eip+=3; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = g_eip; - XMHF_SLAB_CALLNEW(&spl); - - }else{ - - //ok, this is some other INT 15h service, so simply chain to the original - //INT 15h handler - orig_int15h_ip = CASM_FUNCCALL(xmhfhw_sysmemaccess_readu16, 0x4AC+0x4); - orig_int15h_cs = CASM_FUNCCALL(xmhfhw_sysmemaccess_readu16, 0x4AC+0x6); - - //update VMCS with the CS and IP and let go - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = orig_int15h_ip; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_SELECTOR; - gcpustate_vmrwp->value = orig_int15h_cs; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_BASE; - gcpustate_vmrwp->value = (orig_int15h_cs * 16); - XMHF_SLAB_CALLNEW(&spl); - - } - - //write interruptibility = 0 - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_INTERRUPTIBILITY; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //we handled a VMCALL which was E820 emulation - return true; -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_ihub/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xc_ihub/xmhfgeecslab.mk.in deleted file mode 100644 index 2214b60337..0000000000 --- a/uxmhf/xmhf-uobjs/xc_ihub/xmhfgeecslab.mk.in +++ /dev/null @@ -1,21 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xc_ihub -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) -XMHF_SLAB_SOURCES += $(wildcard $(srcdir)/*.cS) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main xc_hcbinvoke -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xcihub_data.c.v.c xcihub_hcbinvoke.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xcihub_data.c.v.c xcihub_main.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -slevel 2048 $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c xcihub*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - diff --git a/uxmhf/xmhf-uobjs/xc_init/xc_init.gsm b/uxmhf/xmhf-uobjs/xc_init/xc_init.gsm deleted file mode 100644 index 4dc74c664e..0000000000 --- a/uxmhf/xmhf-uobjs/xc_init/xc_init.gsm +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -{ - "uobj-name": "xc_init", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "INIT", - - "uobj-uapifunctions":[], - - "uobj-callees": " geec_sentinel - uapi_gcpustate - xg_richguest - xh_hyperdep - xh_syscalllog - xh_ssteptrace - ", - - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - } - ], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_init/xc_init_data.c b/uxmhf/xmhf-uobjs/xc_init/xc_init_data.c deleted file mode 100644 index b7c272a734..0000000000 --- a/uxmhf/xmhf-uobjs/xc_init/xc_init_data.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include - -#include - -#include - -__attribute__(( section(".data") )) uint32_t __xcinit_smplock = 1; - diff --git a/uxmhf/xmhf-uobjs/xc_init/xc_init_main.c b/uxmhf/xmhf-uobjs/xc_init/xc_init_main.c deleted file mode 100644 index da4e47d8b0..0000000000 --- a/uxmhf/xmhf-uobjs/xc_init/xc_init_main.c +++ /dev/null @@ -1,537 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - - -/* - * XMHF core initialization slab code - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - - - -////// -// call guest uobj -////// -static void xcinit_do_callguest(slab_params_t *sp){ - slab_params_t spl; - - memset(&spl, 0, sizeof(spl)); - spl.cpuid = sp->cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_INIT; - spl.dst_slabid = XMHFGEEC_SLAB_XG_RICHGUEST; - XMHF_SLAB_CALLNEW(&spl); - -} - - - - -////// -// setup guest uobj -////// -static void xcinit_setup_guest(slab_params_t *sp, bool isbsp){ - - //setup guest slab VMCS state - { - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - spl.cpuid = sp->cpuid; - spl.src_slabid = XMHFGEEC_SLAB_XC_INIT; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - - //generic guest VMCS setup - gcpustate_vmrwp->encoding = VMCS_CONTROL_CR4_SHADOW; - gcpustate_vmrwp->value =(uint64_t)CR4_VMXE; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_CONTROL_PAGEFAULT_ERRORCODE_MASK; - gcpustate_vmrwp->value = 0x00000000; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_CONTROL_PAGEFAULT_ERRORCODE_MATCH; - gcpustate_vmrwp->value = 0x00000000; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_CONTROL_EXCEPTION_BITMAP; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_CONTROL_CR3_TARGET_COUNT; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_CONTROL_VM_ENTRY_EXCEPTION_ERRORCODE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_CONTROL_VM_ENTRY_INTERRUPTION_INFORMATION; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //GDTR - gcpustate_vmrwp->encoding = VMCS_GUEST_GDTR_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_GDTR_LIMIT; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //IDTR - gcpustate_vmrwp->encoding = VMCS_GUEST_IDTR_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_IDTR_LIMIT; - gcpustate_vmrwp->value = 0x3ff; - XMHF_SLAB_CALLNEW(&spl); - - //LDTR, unusable - gcpustate_vmrwp->encoding = VMCS_GUEST_LDTR_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_LDTR_LIMIT; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_LDTR_SELECTOR; - gcpustate_vmrwp->value = 0 ; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_LDTR_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x10000; - XMHF_SLAB_CALLNEW(&spl); - - //TR - gcpustate_vmrwp->encoding = VMCS_GUEST_TR_BASE ; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_TR_LIMIT; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_TR_SELECTOR; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_TR_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x83; - XMHF_SLAB_CALLNEW(&spl); - - //CS segment - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_SELECTOR; - gcpustate_vmrwp->value = 0x0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_LIMIT; - gcpustate_vmrwp->value = 0x0000FFFFUL; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_CS_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x0093; - XMHF_SLAB_CALLNEW(&spl); - - //DS segment - gcpustate_vmrwp->encoding = VMCS_GUEST_DS_SELECTOR; - gcpustate_vmrwp->value = 0x0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_DS_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_DS_LIMIT; - gcpustate_vmrwp->value = 0x0000FFFFUL; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_DS_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x0093; - XMHF_SLAB_CALLNEW(&spl); - - //ES segment - gcpustate_vmrwp->encoding = VMCS_GUEST_ES_SELECTOR; - gcpustate_vmrwp->value = 0x0 ; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_ES_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_ES_LIMIT; - gcpustate_vmrwp->value = 0x0000FFFFUL; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_ES_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x0093; - XMHF_SLAB_CALLNEW(&spl); - - //FS segment - gcpustate_vmrwp->encoding = VMCS_GUEST_FS_SELECTOR; - gcpustate_vmrwp->value = 0x0 ; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_FS_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_FS_LIMIT; - gcpustate_vmrwp->value = 0x0000FFFFUL; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_FS_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x0093; - XMHF_SLAB_CALLNEW(&spl); - - //GS segment - gcpustate_vmrwp->encoding = VMCS_GUEST_GS_SELECTOR; - gcpustate_vmrwp->value = 0x0 ; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_GS_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_GS_LIMIT; - gcpustate_vmrwp->value = 0x0000FFFFUL; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_GS_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x0093; - XMHF_SLAB_CALLNEW(&spl); - - //SS segment - gcpustate_vmrwp->encoding = VMCS_GUEST_SS_SELECTOR; - gcpustate_vmrwp->value = 0x0 ; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_SS_BASE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_SS_LIMIT; - gcpustate_vmrwp->value = 0x0000FFFFUL; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_SS_ACCESS_RIGHTS; - gcpustate_vmrwp->value = 0x0093; - XMHF_SLAB_CALLNEW(&spl); - - //guest EIP and activity state - if(isbsp){ - _XDPRINTF_("%s[%u]: BSP: setting RIP and activity state for boot\n", __func__, (uint16_t)sp->cpuid); - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = 0x00007C00; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_ACTIVITY_STATE; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - }else{ - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = 0x00000000; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_ACTIVITY_STATE; - gcpustate_vmrwp->value = 3; //wait-for-SIPI - XMHF_SLAB_CALLNEW(&spl); - } - - //interruptibility - gcpustate_vmrwp->encoding = VMCS_GUEST_INTERRUPTIBILITY; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //guest ESP - gcpustate_vmrwp->encoding = VMCS_GUEST_RSP; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - - //guest RFLAGS - gcpustate_vmrwp->encoding = VMCS_GUEST_RFLAGS; - gcpustate_vmrwp->value = ((((0 & ~((1<<3)|(1<<5)|(1<<15)) ) | (1 <<1)) | (1<<9)) & ~(1<<14)); - XMHF_SLAB_CALLNEW(&spl); - - //other guest GPRS (EAX, EBX, ECX, EDX, ESI, EDI, EBP) - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE; - spl.in_out_params[0] = 0; //EDI - spl.in_out_params[1] = 0; //ESI - spl.in_out_params[2] = 0; //EBP - spl.in_out_params[3] = 0; //Reserved (ESP) - spl.in_out_params[4] = 0; //EBX - spl.in_out_params[5] = 0; //EDX - spl.in_out_params[6] = 0; //ECX - spl.in_out_params[7] = 0; //EAX - XMHF_SLAB_CALLNEW(&spl); - - //guest control registers (CR0, CR3 and CR0_SHADOW) - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR0; - XMHF_SLAB_CALLNEW(&spl); - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR0; - gcpustate_vmrwp->value = gcpustate_vmrwp->value & ~(CR0_PE) & ~(CR0_PG); - XMHF_SLAB_CALLNEW(&spl); - gcpustate_vmrwp->encoding = VMCS_GUEST_CR3; - gcpustate_vmrwp->value = 0; - XMHF_SLAB_CALLNEW(&spl); - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_CR0; - XMHF_SLAB_CALLNEW(&spl); - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_CONTROL_CR0_SHADOW; - XMHF_SLAB_CALLNEW(&spl); - - } - - - -} - - - -////// -// invoke hypapp initialization callbacks -////// -static uint32_t xc_hcbinvoke(uint32_t src_slabid, uint32_t cpuid, uint32_t cbtype, uint32_t cbqual, uint32_t guest_slab_index){ - uint32_t status = XC_HYPAPPCB_CHAIN; - uint32_t i; - slab_params_t spl; - xc_hypappcb_params_t *hcbp = (xc_hypappcb_params_t *)&spl.in_out_params[0]; - - spl.src_slabid = src_slabid; - spl.cpuid = cpuid; - spl.dst_uapifn = 0; - hcbp->cbtype=cbtype; - hcbp->cbqual=cbqual; - hcbp->guest_slab_index=guest_slab_index; - hcbp->cbresult = 0; - - for(i=0; i < HYPAPP_INFO_TABLE_NUMENTRIES; i++){ - if(_xcihub_hypapp_info_table[i].cbmask & XC_HYPAPPCB_MASK(cbtype)){ - spl.dst_slabid = _xcihub_hypapp_info_table[i].xmhfhic_slab_index; - XMHF_SLAB_CALLNEW(&spl); - if(hcbp->cbresult == XC_HYPAPPCB_NOCHAIN){ - status = XC_HYPAPPCB_NOCHAIN; - break; - } - } - } - - return status; -} - - -////// -// setup E820 hook for guest uobj -////// -static void xcinit_e820initializehooks(void){ - uint16_t orig_int15h_ip, orig_int15h_cs; - - //implant VMCALL followed by IRET at 0040:04AC - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu8, 0x4ac, 0x0f); //VMCALL - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu8, 0x4ad, 0x01); - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu8, 0x4ae, 0xc1); - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu8, 0x4af, 0xcf); //IRET - - //store original INT 15h handler CS:IP following VMCALL and IRET - orig_int15h_ip = CASM_FUNCCALL(xmhfhw_sysmemaccess_readu16, 0x54); - orig_int15h_cs = CASM_FUNCCALL(xmhfhw_sysmemaccess_readu16, 0x56); - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu16, 0x4b0, orig_int15h_ip); //original INT 15h IP - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu16, 0x4b2, orig_int15h_cs); //original INT 15h CS - - //point IVT INT15 handler to the VMCALL instruction - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu16, 0x54, 0x00ac); - CASM_FUNCCALL(xmhfhw_sysmemaccess_writeu16, 0x56, 0x0040); - -} - - -////// -// copy guest boot module into appropriate location -////// -static void xcinit_copyguestbootmodule(uint32_t g_bm_base, uint32_t g_bm_size){ - _XDPRINTF_("%s: boot-module at 0x%08x, size=0x%08x (%u) bytes\n", __func__, g_bm_base, g_bm_size, g_bm_size); - if( (g_bm_size == 512) ){ - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, 0x00007C00, g_bm_base, g_bm_size); - }else{ - _XDPRINTF_("%s: invalid boot-module at 0x%08x, size=0x%08x (%u) bytes, Halting!\n", __func__, g_bm_base, g_bm_size, g_bm_size); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } -} - - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -uint32_t check_esp, check_eip = CASM_RET_EIP; -slab_params_t test_sp; -uint32_t cpuid = 0; //cpu id - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - //inform hardware model to treat rich guest memory region as valid memory - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_start = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XG_RICHGUEST].slab_physmem_extents[0].addr_start; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_end = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XG_RICHGUEST].slab_physmem_extents[0].addr_end; - xmhfhwm_sysmemaccess_physmem_extents_total++; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_start = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XG_RICHGUEST].slab_physmem_extents[1].addr_start; - xmhfhwm_sysmemaccess_physmem_extents[xmhfhwm_sysmemaccess_physmem_extents_total].addr_end = - xmhfgeec_slab_info_table[XMHFGEEC_SLAB_XG_RICHGUEST].slab_physmem_extents[1].addr_end; - xmhfhwm_sysmemaccess_physmem_extents_total++; - - - test_sp.slab_ctype = framac_nondetu32(); - test_sp.src_slabid = framac_nondetu32(); - test_sp.dst_slabid = framac_nondetu32(); - test_sp.dst_uapifn = framac_nondetu32(); - test_sp.cpuid = framac_nondetu32(); - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - slab_main(&test_sp); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ -} -#endif - -void slab_main(slab_params_t *sp){ - bool isbsp = xmhfhw_lapic_isbsp(); - - #if defined (__DEBUG_SERIAL__) - static volatile uint32_t cpucount=0; - #endif //__DEBUG_SERIAL__ - - //grab lock - CASM_FUNCCALL(spin_lock,&__xcinit_smplock); - - _XDPRINTF_("XC_INIT[%u]: got control: ESP=%08x\n", (uint16_t)sp->cpuid, CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - _XDPRINTF_("XC_INIT[%u]: HYPAPP_INFO_TABLE_NUMENTRIES=%u\n", (uint16_t)sp->cpuid, HYPAPP_INFO_TABLE_NUMENTRIES); - - //plant int 15h redirection code for E820 reporting and copy boot-module - if(isbsp){ - _XDPRINTF_("XC_INIT[%u]: BSP: Proceeding to install E820 redirection...\n", (uint16_t)sp->cpuid); - xcinit_e820initializehooks(); - _XDPRINTF_("XC_INIT[%u]: BSP: E820 redirection enabled\n", (uint16_t)sp->cpuid); - _XDPRINTF_("XC_INIT[%u]: BSP: Proceeding to copy guest boot-module...\n", (uint16_t)sp->cpuid); - xcinit_copyguestbootmodule(sp->in_out_params[0], sp->in_out_params[1]); - _XDPRINTF_("XC_INIT[%u]: BSP: guest boot-module copied\n", - (uint16_t)sp->cpuid); - } - - //setup guest uobj state - xcinit_setup_guest(sp, isbsp); - - - //invoke hypapp initialization callbacks - xc_hcbinvoke(XMHFGEEC_SLAB_XC_INIT, sp->cpuid, XC_HYPAPPCB_INITIALIZE, - 0, XMHFGEEC_SLAB_XG_RICHGUEST); - - - _XDPRINTF_("XC_INIT[%u]: Proceeding to call guest: ESP=%08x, eflags=%08x\n", - (uint16_t)sp->cpuid, - CASM_FUNCCALL(read_esp,CASM_NOPARAM), - CASM_FUNCCALL(read_eflags, CASM_NOPARAM)); - - #if defined (__DEBUG_SERIAL__) - cpucount++; - #endif //__DEBUG_SERIAL__ - - //release lock - CASM_FUNCCALL(spin_unlock,&__xcinit_smplock); - - #if defined (__DEBUG_SERIAL__) - while(cpucount < __XMHF_CONFIG_DEBUG_SERIAL_MAXCPUS__); - #endif //__DEBUG_SERIAL__ - - //call guest - xcinit_do_callguest(sp); - - //_XDPRINTF_("%s[%u]: Should never get here.Halting!\n", __func__, (uint16_t)sp->cpuid); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - - return; -} - - diff --git a/uxmhf/xmhf-uobjs/xc_init/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xc_init/xmhfgeecslab.mk.in deleted file mode 100644 index b69f586b68..0000000000 --- a/uxmhf/xmhf-uobjs/xc_init/xmhfgeecslab.mk.in +++ /dev/null @@ -1,17 +0,0 @@ -######################################################################### -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xc_init -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -slevel 2048 $(VFLAGS) xmhfgeec_slabinfotable.c xmhfgeec_slabmapdef.c xc_init*.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xc_nwlog.gsm b/uxmhf/xmhf-uobjs/xc_nwlog/xc_nwlog.gsm deleted file mode 100644 index 1e80eb3b2e..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xc_nwlog.gsm +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include - -#include -#include - -#include - - -{ - "uobj-name": "xc_nwlog", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "XCORE", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - - "uobj-resource-devices":[ -/* { - "type": "include", - "opt1" : USMF_STR(PCI_VENDOR_ID_LOGNIC), - "opt2" : USMF_STR(PCI_DEVICE_ID_LOGNIC) - } -*/ - ], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_addtolog.c b/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_addtolog.c deleted file mode 100644 index bf30e5f7c2..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_addtolog.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -/* - * xcnwlog_addtolog: add data to network log - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - -/*@ - requires nwlogValid (nwlog_id); - - assigns xcnwlog_ls_index[nwlog_id]; - assigns xcnwlog_ls[nwlog_id][xcnwlog_ls_index[nwlog_id]]; - - behavior not_full: - assumes !nwlogFull(nwlog_id); - - assigns xcnwlog_ls_index[nwlog_id]; - assigns xcnwlog_ls[nwlog_id][xcnwlog_ls_index[nwlog_id]]; - - ensures H:nwlogValid (nwlog_id); - ensures I:nwlogSize (nwlog_id) == nwlogSize {Old}(nwlog_id) + 1; - ensures K:nwlogUnchanged {Pre ,Here }(nwlogStorage (nwlog_id), 0, nwlogSize{Pre}(nwlog_id)); - ensures J:nwlogTop( nwlogStorage (nwlog_id), nwlogSize{Pre}(nwlog_id), elem); - ensures !nwlogEmpty (nwlog_id); - ensures nwlogStorage (nwlog_id) == nwlogStorage {Old }( nwlog_id) ; - ensures nwlogCapacity ( nwlog_id) == nwlogCapacity { Old }(nwlog_id) ; - - behavior full : - assumes nwlogFull ( nwlog_id); - - assigns \nothing; - - ensures nwlogValid (nwlog_id); - ensures nwlogFull ( nwlog_id); - ensures nwlogUnchanged {Pre ,Here }(nwlogStorage (nwlog_id ), 0, nwlogSize(nwlog_id)); - ensures nwlogSize ( nwlog_id ) == nwlogSize { Old }(nwlog_id) ; - ensures nwlogStorage (nwlog_id ) == nwlogStorage {Old }( nwlog_id) ; - ensures nwlogCapacity ( nwlog_id ) == nwlogCapacity { Old }(nwlog_id) ; - - complete behaviors ; - disjoint behaviors ; -*/ -void xcnwlog_ls_push(uint32_t nwlog_id, xcnwlog_ls_element_t elem) -{ - uint32_t log_index = xcnwlog_ls_index[nwlog_id]; - if(log_index >=0 && log_index < XC_NWLOG_BUF_MAXELEM) { - xcnwlog_ls[nwlog_id][log_index].logbuf[0] = elem.logbuf[0]; - xcnwlog_ls[nwlog_id][log_index].logbuf[1] = elem.logbuf[1]; - xcnwlog_ls[nwlog_id][log_index].logbuf[2] = elem.logbuf[2]; - xcnwlog_ls[nwlog_id][log_index].logbuf[3] = elem.logbuf[3]; - xcnwlog_ls[nwlog_id][log_index].logbuf[4] = elem.logbuf[4]; - xcnwlog_ls[nwlog_id][log_index].logbuf[5] = elem.logbuf[5]; - xcnwlog_ls[nwlog_id][log_index].logbuf[6] = elem.logbuf[6]; - xcnwlog_ls[nwlog_id][log_index].logbuf[7] = elem.logbuf[7]; - xcnwlog_ls[nwlog_id][log_index].logbuf[8] = elem.logbuf[8]; - xcnwlog_ls[nwlog_id][log_index].logbuf[9] = elem.logbuf[9]; - xcnwlog_ls[nwlog_id][log_index].logbuf[10] = elem.logbuf[10]; - xcnwlog_ls[nwlog_id][log_index].logbuf[11] = elem.logbuf[11]; - xcnwlog_ls[nwlog_id][log_index].logbuf[12] = elem.logbuf[12]; - xcnwlog_ls[nwlog_id][log_index].logbuf[13] = elem.logbuf[13]; - xcnwlog_ls[nwlog_id][log_index].logbuf[14] = elem.logbuf[14]; - xcnwlog_ls[nwlog_id][log_index].logbuf[15] = elem.logbuf[15]; - - log_index++; - xcnwlog_ls_index[nwlog_id] = log_index; - } -} - diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_data.c b/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_data.c deleted file mode 100644 index e1e9ae99aa..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_data.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -//__attribute__((section(".slab_dmadata"))) xcnwlog_ls_element_t xcnwlog_lsdma[XC_NWLOG_BUF_MAXIDX][XC_NWLOG_BUF_MAXELEM]; - -__attribute__((section(".slab_dmadata"))) __attribute__((aligned(4096))) uint8_t xcnwlog_desc[PAGE_SIZE_4K]; - -__attribute__((section(".slab_dmadata"))) __attribute__((aligned(4096))) xcnwlog_packet_t xcnwlog_packet; - -__attribute__((section(".data"))) xcnwlog_ls_element_t xcnwlog_ls[XC_NWLOG_BUF_MAXIDX][XC_NWLOG_BUF_MAXELEM]; -__attribute__((section(".data"))) uint32_t xcnwlog_ls_index[XC_NWLOG_BUF_MAXIDX]= { 0 }; - - -__attribute__((section(".data"))) char e1000_driver_name[] = "e1000"; -__attribute__((section(".data"))) char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; -__attribute__((section(".data"))) char e1000_driver_version[] = "based on 7.3.20-k2"; - - -__attribute__((section(".data"))) pci_device_t e1000_dev; -__attribute__((section(".data"))) struct e1000_adapter e1000_adapt; -__attribute__((section(".data"))) unsigned int e1000_irq = 18; - -//------------------------------------------------------------------------------ -//[CONFIGURATION:START] -//this changes according to deployment platform -__attribute__((section(".data"))) unsigned char e1000_dst_macaddr[] = ""; -__attribute__((section(".data"))) unsigned char e1000_pkt_type[] = {0x80, 0x86}; -//[CONFIGURATION:END] -//------------------------------------------------------------------------------ - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_hw.c b/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_hw.c deleted file mode 100644 index 0e8223f048..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_hw.c +++ /dev/null @@ -1,2109 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include -#include - -#include -#include - -/* - * slab code - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - -////// -// e1000e hardware related support functions -////// - - -static void e1000_clear_vfta(struct e1000_hw *hw); -static int32_t e1000_get_auto_rd_done(struct e1000_hw *hw); -static int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw); -static int32_t e1000_get_phy_cfg_done(struct e1000_hw *hw); -static void e1000_init_rx_addrs(struct e1000_hw *hw); -static void e1000_initialize_hardware_bits(struct e1000_hw *hw); -static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw); -static int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); -static void e1000_set_pci_express_master_disable(struct e1000_hw *hw); -static int32_t e1000_setup_copper_link(struct e1000_hw *hw); -static int32_t e1000_spi_eeprom_ready(struct e1000_hw *hw); -static void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t *eecd); -static void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t *eecd); -static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, - uint16_t count); -static int32_t e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, - uint16_t phy_data); -static int32_t e1000_read_phy_reg_ex(struct e1000_hw *hw,uint32_t reg_addr, - uint16_t *phy_data); -static uint16_t e1000_shift_in_ee_bits(struct e1000_hw *hw, uint16_t count); -static int32_t e1000_acquire_eeprom(struct e1000_hw *hw); -static void e1000_release_eeprom(struct e1000_hw *hw); -static void e1000_standby_eeprom(struct e1000_hw *hw); - -void e1000_delay(uint64_t count) -{ - if (count) - while (count --); -} - -/****************************************************************************** - * Reset the transmit and receive units; mask and clear all interrupts. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -int32_t -e1000_reset_hw(struct e1000_hw *hw) -{ - uint32_t ctrl; - uint32_t icr; - int32_t ret_val; - - DEBUGFUNC("e1000_reset_hw"); - - { - /* Prevent the PCI-E bus from sticking if there is no TLP connection - * on the last TLP read/write transaction when MAC is reset. - */ - if (e1000_disable_pciex_master(hw) != E1000_SUCCESS) { - DEBUGOUT("PCI-E Master disable polling has failed.\n"); - } - } - - /* Clear interrupt mask to stop board from generating interrupts */ - DEBUGOUT("Masking off all interrupts\n"); - E1000_WRITE_REG(hw, IMC, 0xffffffff); - - /* Disable the Transmit and Receive units. Then delay to allow - * any pending transactions to complete before we hit the MAC with - * the global reset. - */ - E1000_WRITE_REG(hw, RCTL, 0); - E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP); - E1000_WRITE_FLUSH(hw); - - /* Delay to allow any outstanding PCI transactions to complete before - * resetting the device - */ - e1000_msleep(10); - - ctrl = E1000_READ_REG(hw, CTRL); - - /* Issue a global reset to the MAC. This will reset the chip's - * transmit, receive, DMA, and link units. It will not effect - * the current PCI configuration. The global reset bit is self- - * clearing, and should clear within a microsecond. - */ - DEBUGOUT("Issuing a global reset to MAC\n"); - E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); - - /* After MAC reset, force reload of EEPROM to restore power-on settings to - * device. Later controllers reload the EEPROM automatically, so just wait - * for reload to complete. - */ - { - /* Auto read done will delay 5ms or poll based on mac type */ - ret_val = e1000_get_auto_rd_done(hw); - if (ret_val) - return ret_val; - } - - /* Clear interrupt mask to stop board from generating interrupts */ - DEBUGOUT("Masking off all interrupts\n"); - E1000_WRITE_REG(hw, IMC, 0xffffffff); - - /* Clear any pending interrupt events. */ - icr = E1000_READ_REG(hw, ICR); - - return E1000_SUCCESS; -} - -/****************************************************************************** - * - * Initialize a number of hardware-dependent bits - * - * hw: Struct containing variables accessed by shared code - * - * This function contains hardware limitation workarounds for PCI-E adapters - * - *****************************************************************************/ -static void -e1000_initialize_hardware_bits(struct e1000_hw *hw) -{ - { - /* Settings common to all PCI-express silicon */ - uint32_t reg_tarc0, reg_tarc1; - uint32_t reg_tctl; - uint32_t reg_txdctl, reg_txdctl1; - - /* link autonegotiation/sync workarounds */ - reg_tarc0 = E1000_READ_REG(hw, TARC0); - reg_tarc0 &= ~((1 << 30)|(1 << 29)|(1 << 28)|(1 << 27)); - - /* Enable not-done TX descriptor counting */ - reg_txdctl = E1000_READ_REG(hw, TXDCTL); - reg_txdctl |= E1000_TXDCTL_COUNT_DESC; - E1000_WRITE_REG(hw, TXDCTL, reg_txdctl); - reg_txdctl1 = E1000_READ_REG(hw, TXDCTL1); - reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC; - E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1); - - { - /* Clear PHY TX compatible mode bits */ - reg_tarc1 = E1000_READ_REG(hw, TARC1); - reg_tarc1 &= ~((1 << 30)|(1 << 29)); - - /* link autonegotiation/sync workarounds */ - reg_tarc0 |= ((1 << 26)|(1 << 25)|(1 << 24)|(1 << 23)); - - /* TX ring control fixes */ - reg_tarc1 |= ((1 << 26)|(1 << 25)|(1 << 24)); - - /* Multiple read bit is reversed polarity */ - reg_tctl = E1000_READ_REG(hw, TCTL); - if (reg_tctl & E1000_TCTL_MULR) - reg_tarc1 &= ~(1 << 28); - else - reg_tarc1 |= (1 << 28); - - E1000_WRITE_REG(hw, TARC1, reg_tarc1); - } - - E1000_WRITE_REG(hw, TARC0, reg_tarc0); - } -} - -/****************************************************************************** - * Performs basic configuration of the adapter. - * - * hw - Struct containing variables accessed by shared code - * - * Assumes that the controller has previously been reset and is in a - * post-reset uninitialized state. Initializes the receive address registers, - * multicast table, and VLAN filter table. Calls routines to setup link - * configuration and flow control settings. Clears all on-chip counters. Leaves - * the transmit and receive units disabled and uninitialized. - *****************************************************************************/ -int32_t -e1000_init_hw(struct e1000_hw *hw) -{ - uint32_t ctrl; - uint32_t i; - int32_t ret_val; - uint32_t mta_size; - - DEBUGFUNC("e1000_init_hw"); - - /* Must be called after e1000_set_media_type because media_type is used */ - e1000_initialize_hardware_bits(hw); - - /* Disabling VLAN filtering. */ - DEBUGOUT("Initializing the IEEE VLAN\n"); - /* VET hardcoded to standard value and VFTA removed in ICH8 LAN */ - { - e1000_clear_vfta(hw); - } - - /* Setup the receive address. This involves initializing all of the Receive - * Address Registers (RARs 0 - 15). - */ - e1000_init_rx_addrs(hw); - - /* Zero out the Multicast HASH table */ - DEBUGOUT("Zeroing the MTA\n"); - mta_size = E1000_MC_TBL_SIZE; - for (i = 0; i < mta_size; i++) { - E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); - /* use write flush to prevent Memory Write Block (MWB) from - * occuring when accessing our register space */ - E1000_WRITE_FLUSH(hw); - } - - /* Call a subroutine to configure the link and setup flow control. */ - ret_val = e1000_setup_link(hw); - - /* Set the transmit descriptor write-back policy */ - { - ctrl = E1000_READ_REG(hw, TXDCTL); - ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; - E1000_WRITE_REG(hw, TXDCTL, ctrl); - } - - { - ctrl = E1000_READ_REG(hw, TXDCTL1); - ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; - E1000_WRITE_REG(hw, TXDCTL1, ctrl); - } - - return ret_val; -} - -/****************************************************************************** - * Configures flow control and link settings. - * - * hw - Struct containing variables accessed by shared code - * - * Determines which flow control settings to use. Calls the apropriate media- - * specific link configuration function. Configures the flow control settings. - * Assuming the adapter has a valid link partner, a valid link should be - * established. Assumes the hardware has previously been reset and the - * transmitter and receiver are not enabled. - *****************************************************************************/ -int32_t -e1000_setup_link(struct e1000_hw *hw) -{ - int32_t ret_val; - - DEBUGFUNC("e1000_setup_link"); - - /* In the case of the phy reset being blocked, we already have a link. - * We do not have to set it up again. */ - if (e1000_check_phy_reset_block(hw)) - return E1000_SUCCESS; - - /* Call the necessary subroutine to configure the link. */ - ret_val = e1000_setup_copper_link(hw); - - /* Initialize the flow control address, type, and PAUSE timer - * registers to their default values. This is done even if flow - * control is disabled, because it does not hurt anything to - * initialize these registers. - */ - DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); - - /* FCAL/H and FCT are hardcoded to standard values in e1000_ich8lan. */ - { - E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); - E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); - E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); - } - - E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); - - /* Set the flow control receive threshold registers. Normally, - * these registers will be set to a default threshold that may be - * adjusted later by the driver's runtime code. However, if the - * ability to transmit pause frames in not enabled, then these - * registers will be set to 0. - */ - { - E1000_WRITE_REG(hw, FCRTL, 0); - E1000_WRITE_REG(hw, FCRTH, 0); - } - return ret_val; -} - -/****************************************************************************** -* Make sure we have a valid PHY and change PHY mode before link setup. -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static int32_t -e1000_copper_link_preconfig(struct e1000_hw *hw) -{ - uint32_t ctrl; - - DEBUGFUNC("e1000_copper_link_preconfig"); - - ctrl = E1000_READ_REG(hw, CTRL); - /* With 82543, we need to force speed and duplex on the MAC equal to what - * the PHY speed and duplex configuration is. In addition, we need to - * perform a hardware reset on the PHY to take it out of reset. - */ - { - ctrl |= E1000_CTRL_SLU; - ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); - E1000_WRITE_REG(hw, CTRL, ctrl); - } - - return E1000_SUCCESS; -} - - -/******************************************************************** -* Copper link setup for e1000_phy_igp series. -* -* hw - Struct containing variables accessed by shared code -*********************************************************************/ -static int32_t -e1000_copper_link_igp_setup(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t phy_data; - - DEBUGFUNC("e1000_copper_link_igp_setup"); - - ret_val = e1000_phy_reset(hw); - if (ret_val) { - DEBUGOUT("Error Resetting the PHY\n"); - return ret_val; - } - - /* Wait 15ms for MAC to configure PHY from eeprom settings */ - e1000_msleep(15); - /* disable lplu d0 during driver init */ - ret_val = e1000_set_d0_lplu_state(hw, false); - if (ret_val) { - DEBUGOUT("Error Disabling LPLU D0\n"); - return ret_val; - } - /* Configure mdi-mdix settings */ - ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); - if (ret_val) - return ret_val; - - { - phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; - phy_data |= IGP01E1000_PSCR_AUTO_MDIX; - } - ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); - if (ret_val) - return ret_val; - - return E1000_SUCCESS; -} - -/******************************************************************** -* Setup auto-negotiation and flow control advertisements, -* and then perform auto-negotiation. -* -* hw - Struct containing variables accessed by shared code -*********************************************************************/ -static int32_t -e1000_copper_link_autoneg(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t phy_data; - - DEBUGFUNC("e1000_copper_link_autoneg"); - - /* If autoneg_advertised is zero, we assume it was not defaulted - * by the calling code so we set to advertise full capability. - */ - - hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; - - DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); - ret_val = e1000_phy_setup_autoneg(hw); - if (ret_val) { - DEBUGOUT("Error Setting up Auto-Negotiation\n"); - return ret_val; - } - DEBUGOUT("Restarting Auto-Neg\n"); - - /* Restart auto-negotiation by setting the Auto Neg Enable bit and - * the Auto Neg Restart bit in the PHY control register. - */ - ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); - if (ret_val) - return ret_val; - - phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); - ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); - if (ret_val) - return ret_val; - - return E1000_SUCCESS; -} - -/****************************************************************************** -* Detects which PHY is present and setup the speed and duplex -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -static int32_t -e1000_setup_copper_link(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t i; - uint16_t phy_data; - - DEBUGFUNC("e1000_setup_copper_link"); - - /* Check if it is a valid PHY and set PHY mode if necessary. */ - ret_val = e1000_copper_link_preconfig(hw); - if (ret_val) - return ret_val; - - { - ret_val = e1000_copper_link_igp_setup(hw); - if (ret_val) - return ret_val; - } - - { - /* Setup autoneg and flow control advertisement - * and perform autonegotiation */ - ret_val = e1000_copper_link_autoneg(hw); - if (ret_val) - return ret_val; - } - - /* Check link status. Wait up to 100 microseconds for link to become - * valid. - */ - for (i = 0; i < 10; i++) { - ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); - if (ret_val) - return ret_val; - ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); - if (ret_val) - return ret_val; - - e1000_udelay(10); - } - - DEBUGOUT("Unable to establish link!!!\n"); - return E1000_SUCCESS; -} - -/****************************************************************************** -* Configures PHY autoneg and flow control advertisement settings -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -int32_t -e1000_phy_setup_autoneg(struct e1000_hw *hw) -{ - int32_t ret_val; - uint16_t mii_autoneg_adv_reg; - uint16_t mii_1000t_ctrl_reg; - - DEBUGFUNC("e1000_phy_setup_autoneg"); - - /* Read the MII Auto-Neg Advertisement Register (Address 4). */ - ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); - if (ret_val) - return ret_val; - - { - /* Read the MII 1000Base-T Control Register (Address 9). */ - ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); - if (ret_val) - return ret_val; - } - - /* Need to parse both autoneg_advertised and fc and set up - * the appropriate PHY registers. First we will parse for - * autoneg_advertised software override. Since we can advertise - * a plethora of combinations, we need to check each bit - * individually. - */ - - /* First we clear all the 10/100 mb speed bits in the Auto-Neg - * Advertisement Register (Address 4) and the 1000 mb speed bits in - * the 1000Base-T Control Register (Address 9). - */ - mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; - mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; - - DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); - - /* Do we want to advertise 10 Mb Half Duplex? */ - { - DEBUGOUT("Advertise 10mb Half duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; - } - - /* Do we want to advertise 10 Mb Full Duplex? */ - { - DEBUGOUT("Advertise 10mb Full duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; - } - - /* Do we want to advertise 100 Mb Half Duplex? */ - { - DEBUGOUT("Advertise 100mb Half duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; - } - - /* Do we want to advertise 100 Mb Full Duplex? */ - { - DEBUGOUT("Advertise 100mb Full duplex\n"); - mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; - } - - /* Do we want to advertise 1000 Mb Full Duplex? */ - { - DEBUGOUT("Advertise 1000mb Full duplex\n"); - mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; - } - - /* Check for a software override of the flow control settings, and - * setup the PHY advertisement registers accordingly. If - * auto-negotiation is enabled, then software will have to set the - * "PAUSE" bits to the correct value in the Auto-Negotiation - * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation. - * - * The possible values of the "fc" parameter are: - * 0: Flow control is completely disabled - * 1: Rx flow control is enabled (we can receive pause frames - * but not send pause frames). - * 2: Tx flow control is enabled (we can send pause frames - * but we do not support receiving pause frames). - * 3: Both Rx and TX flow control (symmetric) are enabled. - * other: No software override. The flow control configuration - * in the EEPROM is used. - */ - { - /* Flow control (RX & TX) is completely disabled by a - * software over-ride. - */ - mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); - } - - ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); - if (ret_val) - return ret_val; - - DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); - - { - ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); - if (ret_val) - return ret_val; - } - - return E1000_SUCCESS; -} - -/***************************************************************************** -* Reads the value from a PHY register, if the value is on a specific non zero -* page, sets the page first. -* hw - Struct containing variables accessed by shared code -* reg_addr - address of the PHY register to read -******************************************************************************/ -int32_t -e1000_read_phy_reg(struct e1000_hw *hw, - uint32_t reg_addr, - uint16_t *phy_data) -{ - uint32_t ret_val; - uint16_t swfw; - - DEBUGFUNC("e1000_read_phy_reg"); - - swfw = E1000_SWFW_PHY0_SM; - if (e1000_get_hw_eeprom_semaphore(hw)) - return -E1000_ERR_SWFW_SYNC; - - if ((reg_addr > MAX_PHY_MULTI_PAGE_REG)) { - ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, - (uint16_t)reg_addr); - if (ret_val) { - e1000_put_hw_eeprom_semaphore(hw); - return ret_val; - } - } - ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, - phy_data); - - e1000_put_hw_eeprom_semaphore(hw); - return ret_val; -} - -static int32_t -e1000_read_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, - uint16_t *phy_data) -{ - uint32_t i; - uint32_t mdic = 0; - const uint32_t phy_addr = 1; - - DEBUGFUNC("e1000_read_phy_reg_ex"); - - if (reg_addr > MAX_PHY_REG_ADDRESS) { - DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); - return -E1000_ERR_PARAM; - } - - { - /* Set up Op-code, Phy Address, and register address in the MDI - * Control register. The MAC will take care of interfacing with the - * PHY to retrieve the desired data. - */ - mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | - (phy_addr << E1000_MDIC_PHY_SHIFT) | - (E1000_MDIC_OP_READ)); - - E1000_WRITE_REG(hw, MDIC, mdic); - - /* Poll the ready bit to see if the MDI read completed */ - for (i = 0; i < 64; i++) { - e1000_udelay(50); - mdic = E1000_READ_REG(hw, MDIC); - if (mdic & E1000_MDIC_READY) break; - } - if (!(mdic & E1000_MDIC_READY)) { - DEBUGOUT("MDI Read did not complete\n"); - return -E1000_ERR_PHY; - } - if (mdic & E1000_MDIC_ERROR) { - DEBUGOUT("MDI Error\n"); - return -E1000_ERR_PHY; - } - *phy_data = (uint16_t) mdic; - } - return E1000_SUCCESS; -} - -/****************************************************************************** -* Writes a value to a PHY register -* -* hw - Struct containing variables accessed by shared code -* reg_addr - address of the PHY register to write -* data - data to write to the PHY -******************************************************************************/ -int32_t -e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, - uint16_t phy_data) -{ - uint32_t ret_val; - uint16_t swfw; - - DEBUGFUNC("e1000_write_phy_reg"); - - { - swfw = E1000_SWFW_PHY0_SM; - } - if (e1000_get_hw_eeprom_semaphore(hw)) - return -E1000_ERR_SWFW_SYNC; - - if ((reg_addr > MAX_PHY_MULTI_PAGE_REG)) { - ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, - (uint16_t)reg_addr); - if (ret_val) { - e1000_put_hw_eeprom_semaphore(hw); - return ret_val; - } - } - - ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, - phy_data); - - e1000_put_hw_eeprom_semaphore(hw); - return ret_val; -} - -static int32_t -e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, - uint16_t phy_data) -{ - uint32_t i; - uint32_t mdic = 0; - const uint32_t phy_addr = 1; - - DEBUGFUNC("e1000_write_phy_reg_ex"); - - if (reg_addr > MAX_PHY_REG_ADDRESS) { - DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); - return -E1000_ERR_PARAM; - } - - { - /* Set up Op-code, Phy Address, register address, and data intended - * for the PHY register in the MDI Control register. The MAC will take - * care of interfacing with the PHY to send the desired data. - */ - mdic = (((uint32_t) phy_data) | - (reg_addr << E1000_MDIC_REG_SHIFT) | - (phy_addr << E1000_MDIC_PHY_SHIFT) | - (E1000_MDIC_OP_WRITE)); - - E1000_WRITE_REG(hw, MDIC, mdic); - - /* Poll the ready bit to see if the MDI read completed */ - for (i = 0; i < 641; i++) { - e1000_udelay(5); - mdic = E1000_READ_REG(hw, MDIC); - if (mdic & E1000_MDIC_READY) break; - } - if (!(mdic & E1000_MDIC_READY)) { - DEBUGOUT("MDI Write did not complete\n"); - return -E1000_ERR_PHY; - } - } - - return E1000_SUCCESS; -} - -/****************************************************************************** -* Returns the PHY to the power-on reset state -* -* hw - Struct containing variables accessed by shared code -******************************************************************************/ -int32_t -e1000_phy_hw_reset(struct e1000_hw *hw) -{ - uint32_t ctrl; - int32_t ret_val; - uint16_t swfw; - - DEBUGFUNC("e1000_phy_hw_reset"); - - /* In the case of the phy reset being blocked, it's not an error, we - * simply return success without performing the reset. */ - ret_val = e1000_check_phy_reset_block(hw); - if (ret_val) - return E1000_SUCCESS; - - DEBUGOUT("Resetting Phy...\n"); - - { - swfw = E1000_SWFW_PHY0_SM; - if (e1000_get_hw_eeprom_semaphore(hw)) { - DEBUGOUT("Unable to acquire swfw sync\n"); - return -E1000_ERR_SWFW_SYNC; - } - /* Read the device control register and assert the E1000_CTRL_PHY_RST - * bit. Then, take it out of reset. - * For pre-e1000_82571 hardware, we delay for 10ms between the assert - * and deassert. For e1000_82571 hardware and later, we instead delay - * for 50us between and 10ms after the deassertion. - */ - ctrl = E1000_READ_REG(hw, CTRL); - E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); - E1000_WRITE_FLUSH(hw); - - e1000_udelay(100); - - E1000_WRITE_REG(hw, CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - - e1000_mdelay(10); - - e1000_put_hw_eeprom_semaphore(hw); - } - e1000_udelay(150); - - /* Wait for FW to finish PHY configuration. */ - ret_val = e1000_get_phy_cfg_done(hw); - if (ret_val != E1000_SUCCESS) - return ret_val; - - return ret_val; -} - -/****************************************************************************** -* Resets the PHY -* -* hw - Struct containing variables accessed by shared code -* -* Sets bit 15 of the MII Control register -******************************************************************************/ -int32_t -e1000_phy_reset(struct e1000_hw *hw) -{ - int32_t ret_val; - - DEBUGFUNC("e1000_phy_reset"); - - /* In the case of the phy reset being blocked, it's not an error, we - * simply return success without performing the reset. */ - ret_val = e1000_check_phy_reset_block(hw); - if (ret_val) - return E1000_SUCCESS; - - { - ret_val = e1000_phy_hw_reset(hw); - if (ret_val) - return ret_val; - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Raises the EEPROM's clock input. - * - * hw - Struct containing variables accessed by shared code - * eecd - EECD's current value - *****************************************************************************/ -static void -e1000_raise_ee_clk(struct e1000_hw *hw, - uint32_t *eecd) -{ - /* Raise the clock input to the EEPROM (by setting the SK bit), and then - * wait microseconds. - */ - *eecd = *eecd | E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, *eecd); - E1000_WRITE_FLUSH(hw); - e1000_udelay(1); -} - -/****************************************************************************** - * Lowers the EEPROM's clock input. - * - * hw - Struct containing variables accessed by shared code - * eecd - EECD's current value - *****************************************************************************/ -static void -e1000_lower_ee_clk(struct e1000_hw *hw, - uint32_t *eecd) -{ - /* Lower the clock input to the EEPROM (by clearing the SK bit), and then - * wait 50 microseconds. - */ - *eecd = *eecd & ~E1000_EECD_SK; - E1000_WRITE_REG(hw, EECD, *eecd); - E1000_WRITE_FLUSH(hw); - e1000_udelay(1); -} - -/****************************************************************************** - * Shift data bits out to the EEPROM. - * - * hw - Struct containing variables accessed by shared code - * data - data to send to the EEPROM - * count - number of bits to shift out - *****************************************************************************/ -static void -e1000_shift_out_ee_bits(struct e1000_hw *hw, - uint16_t data, - uint16_t count) -{ - uint32_t eecd; - uint32_t mask; - - /* We need to shift "count" bits out to the EEPROM. So, value in the - * "data" parameter will be shifted out to the EEPROM one bit at a time. - * In order to do this, "data" must be broken down into bits. - */ - mask = 0x01 << (count - 1); - eecd = E1000_READ_REG(hw, EECD); - { - eecd |= E1000_EECD_DO; - } - do { - /* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1", - * and then raising and then lowering the clock (the SK bit controls - * the clock input to the EEPROM). A "0" is shifted out to the EEPROM - * by setting "DI" to "0" and then raising and then lowering the clock. - */ - eecd &= ~E1000_EECD_DI; - - if (data & mask) - eecd |= E1000_EECD_DI; - - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - - e1000_udelay(1); - - e1000_raise_ee_clk(hw, &eecd); - e1000_lower_ee_clk(hw, &eecd); - - mask = mask >> 1; - - } while (mask); - - /* We leave the "DI" bit set to "0" when we leave this routine. */ - eecd &= ~E1000_EECD_DI; - E1000_WRITE_REG(hw, EECD, eecd); -} - -/****************************************************************************** - * Shift data bits in from the EEPROM - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static uint16_t -e1000_shift_in_ee_bits(struct e1000_hw *hw, - uint16_t count) -{ - uint32_t eecd; - uint32_t i; - uint16_t data; - - /* In order to read a register from the EEPROM, we need to shift 'count' - * bits in from the EEPROM. Bits are "shifted in" by raising the clock - * input to the EEPROM (setting the SK bit), and then reading the value of - * the "DO" bit. During this "shifting in" process the "DI" bit should - * always be clear. - */ - - eecd = E1000_READ_REG(hw, EECD); - - eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); - data = 0; - - for (i = 0; i < count; i++) { - data = data << 1; - e1000_raise_ee_clk(hw, &eecd); - - eecd = E1000_READ_REG(hw, EECD); - - eecd &= ~(E1000_EECD_DI); - if (eecd & E1000_EECD_DO) - data |= 1; - - e1000_lower_ee_clk(hw, &eecd); - } - - return data; -} - -/****************************************************************************** - * Prepares EEPROM for access - * - * hw - Struct containing variables accessed by shared code - * - * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This - * function should be called before issuing a command to the EEPROM. - *****************************************************************************/ -static int32_t -e1000_acquire_eeprom(struct e1000_hw *hw) -{ - uint32_t eecd, i=0; - - DEBUGFUNC("e1000_acquire_eeprom"); - - - if (e1000_get_hw_eeprom_semaphore(hw)) - return -E1000_ERR_SWFW_SYNC; - eecd = E1000_READ_REG(hw, EECD); - - { - /* Request EEPROM Access */ - { - eecd |= E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - eecd = E1000_READ_REG(hw, EECD); - while ((!(eecd & E1000_EECD_GNT)) && - (i < E1000_EEPROM_GRANT_ATTEMPTS)) { - i++; - e1000_udelay(5); - eecd = E1000_READ_REG(hw, EECD); - } - if (!(eecd & E1000_EECD_GNT)) { - eecd &= ~E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - DEBUGOUT("Could not acquire EEPROM grant\n"); - e1000_put_hw_eeprom_semaphore(hw); - return -E1000_ERR_EEPROM; - } - } - } - - - /* Setup EEPROM for Read/Write */ - - { - /* Clear SK and CS */ - eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); - E1000_WRITE_REG(hw, EECD, eecd); - e1000_udelay(1); - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Returns EEPROM to a "standby" state - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_standby_eeprom(struct e1000_hw *hw) -{ - uint32_t eecd; - - eecd = E1000_READ_REG(hw, EECD); - - { - /* Toggle CS to flush commands */ - eecd |= E1000_EECD_CS; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - e1000_udelay(1); - eecd &= ~E1000_EECD_CS; - E1000_WRITE_REG(hw, EECD, eecd); - E1000_WRITE_FLUSH(hw); - e1000_udelay(1); - } -} - -/****************************************************************************** - * Terminates a command by inverting the EEPROM's chip select pin - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_release_eeprom(struct e1000_hw *hw) -{ - uint32_t eecd; - - DEBUGFUNC("e1000_release_eeprom"); - - eecd = E1000_READ_REG(hw, EECD); - - { - eecd |= E1000_EECD_CS; /* Pull CS high */ - eecd &= ~E1000_EECD_SK; /* Lower SCK */ - - E1000_WRITE_REG(hw, EECD, eecd); - - e1000_udelay(1); - } - - /* Stop requesting EEPROM access */ - { - eecd &= ~E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - } - - e1000_put_hw_eeprom_semaphore(hw); -} - -/****************************************************************************** - * Reads a 16 bit word from the EEPROM. - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static int32_t -e1000_spi_eeprom_ready(struct e1000_hw *hw) -{ - uint16_t retry_count = 0; - uint8_t spi_stat_reg; - - DEBUGFUNC("e1000_spi_eeprom_ready"); - - /* Read "Status Register" repeatedly until the LSB is cleared. The - * EEPROM will signal that the command has been completed by clearing - * bit 0 of the internal status register. If it's not cleared within - * 5 milliseconds, then error out. - */ - retry_count = 0; - do { - e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, - 8); - spi_stat_reg = (uint8_t)e1000_shift_in_ee_bits(hw, 8); - if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI)) - break; - - e1000_udelay(5); - retry_count += 5; - - e1000_standby_eeprom(hw); - } while (retry_count < EEPROM_MAX_RETRY_SPI); - - /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and - * only 0-5mSec on 5V devices) - */ - if (retry_count >= EEPROM_MAX_RETRY_SPI) { - DEBUGOUT("SPI EEPROM Status error\n"); - return -E1000_ERR_EEPROM; - } - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Reads a 16 bit word from the EEPROM. - * - * hw - Struct containing variables accessed by shared code - * offset - offset of word in the EEPROM to read - * data - word read from the EEPROM - * words - number of words to read - *****************************************************************************/ -int32_t -e1000_read_eeprom(struct e1000_hw *hw, - uint16_t offset, - uint16_t words, - uint16_t *data) -{ - uint32_t i = 0; - - DEBUGFUNC("e1000_read_eeprom"); - - /* A check for invalid values: offset too large, too many words, and not - * enough words. - */ - if ((offset >= 2048) || (words > 2048 - offset) || - (words == 0)) { - DEBUGOUT2("\"words\" parameter out of bounds. Words = %d, size = %d\n", offset, 2048); - return -E1000_ERR_EEPROM; - } - - /* EEPROM's that don't use EERD to read require us to bit-bang the SPI - * directly. In this case, we need to acquire the EEPROM so that - * FW or other port software does not interrupt. - */ - { - /* Prepare the EEPROM for bit-bang reading */ - if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) - return -E1000_ERR_EEPROM; - } - - - /* Set up the SPI or Microwire EEPROM for bit-bang reading. We have - * acquired the EEPROM at this point, so any returns should relase it */ - { - uint16_t word_in; - uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; - - if (e1000_spi_eeprom_ready(hw)) { - e1000_release_eeprom(hw); - return -E1000_ERR_EEPROM; - } - - - e1000_standby_eeprom(hw); - - /* Send the READ command (opcode + addr) */ - e1000_shift_out_ee_bits(hw, read_opcode, 8); - e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), 16); - - /* Read the data. The address of the eeprom internally increments with - * each byte (spi) being read, saving on the overhead of eeprom setup - * and tear-down. The address counter will roll over if reading beyond - * the size of the eeprom, thus allowing the entire memory to be read - * starting from any offset. */ - for (i = 0; i < words; i++) { - word_in = e1000_shift_in_ee_bits(hw, 16); - data[i] = (word_in >> 8) | (word_in << 8); - } - } - - /* End this read operation */ - e1000_release_eeprom(hw); - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the - * second function of dual function devices - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -int32_t -e1000_read_mac_addr(struct e1000_hw * hw) -{ - uint16_t offset; - uint16_t eeprom_data, i; - - DEBUGFUNC("e1000_read_mac_addr"); - - for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { - offset = i >> 1; - if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { - DEBUGOUT("EEPROM Read Error\n"); - return -E1000_ERR_EEPROM; - } - hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); - hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); - } - - for (i = 0; i < NODE_ADDRESS_SIZE; i++) - hw->mac_addr[i] = hw->perm_mac_addr[i]; - - return E1000_SUCCESS; -} - -/****************************************************************************** - * Initializes receive address filters. - * - * hw - Struct containing variables accessed by shared code - * - * Places the MAC address in receive address register 0 and clears the rest - * of the receive addresss registers. Clears the multicast table. Assumes - * the receiver is in reset when the routine is called. - *****************************************************************************/ -static void -e1000_init_rx_addrs(struct e1000_hw *hw) -{ - uint32_t i; - uint32_t rar_num; - - DEBUGFUNC("e1000_init_rx_addrs"); - - /* Setup the receive address. */ - DEBUGOUT("Programming MAC Address into RAR[0]\n"); - - e1000_rar_set(hw, hw->mac_addr, 0); - - rar_num = E1000_RAR_ENTRIES; - - /* Zero out the other 15 receive addresses. */ - DEBUGOUT("Clearing RAR[1-15]\n"); - for (i = 1; i < rar_num; i++) { - E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); - E1000_WRITE_FLUSH(hw); - E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); - E1000_WRITE_FLUSH(hw); - } -} - -/****************************************************************************** - * Puts an ethernet address into a receive address register. - * - * hw - Struct containing variables accessed by shared code - * addr - Address to put into receive address register - * index - Receive address register to write - *****************************************************************************/ -void -e1000_rar_set(struct e1000_hw *hw, - uint8_t *addr, - uint32_t index) -{ - uint32_t rar_low, rar_high; - - /* HW expects these in little endian so we reverse the byte order - * from network order (big endian) to little endian - */ - rar_low = ((uint32_t) addr[0] | - ((uint32_t) addr[1] << 8) | - ((uint32_t) addr[2] << 16) | ((uint32_t) addr[3] << 24)); - rar_high = ((uint32_t) addr[4] | ((uint32_t) addr[5] << 8)); - - /* Disable Rx and flush all Rx frames before enabling RSS to avoid Rx - * unit hang. - * - * Description: - * If there are any Rx frames queued up or otherwise present in the HW - * before RSS is enabled, and then we enable RSS, the HW Rx unit will - * hang. To work around this issue, we have to disable receives and - * flush out all Rx frames before we enable RSS. To do so, we modify we - * redirect all Rx traffic to manageability and then reset the HW. - * This flushes away Rx frames, and (since the redirections to - * manageability persists across resets) keeps new ones from coming in - * while we work. Then, we clear the Address Valid AV bit for all MAC - * addresses and undo the re-direction to manageability. - * Now, frames are coming in again, but the MAC won't accept them, so - * far so good. We now proceed to initialize RSS (if necessary) and - * configure the Rx unit. Last, we re-enable the AV bits and continue - * on our merry way. - */ - { - /* Indicate to hardware the Address is Valid. */ - rar_high |= E1000_RAH_AV; - } - - E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); - E1000_WRITE_FLUSH(hw); - E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); - E1000_WRITE_FLUSH(hw); -} - -/****************************************************************************** - * Clears the VLAN filer table - * - * hw - Struct containing variables accessed by shared code - *****************************************************************************/ -static void -e1000_clear_vfta(struct e1000_hw *hw) -{ - uint32_t offset; - uint32_t vfta_value = 0; - uint32_t vfta_offset = 0; - uint32_t vfta_bit_in_reg = 0; - - for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { - /* If the offset we want to clear is the same offset of the - * manageability VLAN ID, then clear all bits except that of the - * manageability unit */ - vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; - E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); - E1000_WRITE_FLUSH(hw); - } -} - -/***************************************************************************** - * - * This function sets the lplu d0 state according to the active flag. When - * activating lplu this function also disables smart speed and vise versa. - * lplu will not be activated unless the device autonegotiation advertisment - * meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. - * hw: Struct containing variables accessed by shared code - * active - true to enable lplu false to disable lplu. - * - * returns: - E1000_ERR_PHY if fail to read/write the PHY - * E1000_SUCCESS at any other case. - * - ****************************************************************************/ - -static int32_t -e1000_set_d0_lplu_state(struct e1000_hw *hw, - bool active) -{ - int32_t ret_val; - uint16_t phy_data; - DEBUGFUNC("e1000_set_d0_lplu_state"); - - { - ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); - if (ret_val) - return ret_val; - } - - { - { - phy_data &= ~IGP02E1000_PM_D0_LPLU; - ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); - if (ret_val) - return ret_val; - } - } - return E1000_SUCCESS; -} - -/*************************************************************************** - * - * Disables PCI-Express master access. - * - * hw: Struct containing variables accessed by shared code - * - * returns: - none. - * - ***************************************************************************/ -static void -e1000_set_pci_express_master_disable(struct e1000_hw *hw) -{ - uint32_t ctrl; - - DEBUGFUNC("e1000_set_pci_express_master_disable"); - - ctrl = E1000_READ_REG(hw, CTRL); - ctrl |= E1000_CTRL_GIO_MASTER_DISABLE; - E1000_WRITE_REG(hw, CTRL, ctrl); -} - -/******************************************************************************* - * - * Disables PCI-Express master access and verifies there are no pending requests - * - * hw: Struct containing variables accessed by shared code - * - * returns: - E1000_ERR_MASTER_REQUESTS_PENDING if master disable bit hasn't - * caused the master requests to be disabled. - * E1000_SUCCESS master requests disabled. - * - ******************************************************************************/ -int32_t -e1000_disable_pciex_master(struct e1000_hw *hw) -{ - int32_t timeout = MASTER_DISABLE_TIMEOUT; /* 80ms */ - - DEBUGFUNC("e1000_disable_pciex_master"); - - e1000_set_pci_express_master_disable(hw); - - while (timeout) { - if (!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE)) - break; - else - e1000_udelay(100); - timeout--; - } - - if (!timeout) { - DEBUGOUT("Master requests are pending.\n"); - return -E1000_ERR_MASTER_REQUESTS_PENDING; - } - - return E1000_SUCCESS; -} - -/******************************************************************************* - * - * Check for EEPROM Auto Read bit done. - * - * hw: Struct containing variables accessed by shared code - * - * returns: - E1000_ERR_RESET if fail to reset MAC - * E1000_SUCCESS at any other case. - * - ******************************************************************************/ -static int32_t -e1000_get_auto_rd_done(struct e1000_hw *hw) -{ - int32_t timeout = AUTO_READ_DONE_TIMEOUT; - - DEBUGFUNC("e1000_get_auto_rd_done"); - - { - while (timeout) { - if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) - break; - else e1000_msleep(1); - timeout--; - } - - if (!timeout) { - DEBUGOUT("Auto read by HW from EEPROM has not completed.\n"); - return -E1000_ERR_RESET; - } - } - - return E1000_SUCCESS; -} - -/*************************************************************************** - * Checks if the PHY configuration is done - * - * hw: Struct containing variables accessed by shared code - * - * returns: - E1000_ERR_RESET if fail to reset MAC - * E1000_SUCCESS at any other case. - * - ***************************************************************************/ -static int32_t -e1000_get_phy_cfg_done(struct e1000_hw *hw) -{ - int32_t timeout = PHY_CFG_TIMEOUT * 1000; - uint32_t cfg_mask = E1000_EEPROM_CFG_DONE; - - DEBUGFUNC("e1000_get_phy_cfg_done"); - - { - while (timeout) { - if (E1000_READ_REG(hw, EEMNGCTL) & cfg_mask) - break; - else - e1000_msleep(1); - timeout--; - } - if (!timeout) { - DEBUGOUT("MNG configuration cycle has not completed.\n"); - return -E1000_ERR_RESET; - } - } - - return E1000_SUCCESS; -} - -/*************************************************************************** - * - * Using the combination of SMBI and SWESMBI semaphore bits when resetting - * adapter or Eeprom access. - * - * hw: Struct containing variables accessed by shared code - * - * returns: - E1000_ERR_EEPROM if fail to access EEPROM. - * E1000_SUCCESS at any other case. - * - ***************************************************************************/ -static int32_t -e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) -{ - int32_t timeout; - uint32_t swsm; - - DEBUGFUNC("e1000_get_hw_eeprom_semaphore"); - - /* Get the FW semaphore. */ - timeout = 2048 + 1; - while (timeout) { - swsm = E1000_READ_REG(hw, SWSM); - swsm |= E1000_SWSM_SWESMBI; - E1000_WRITE_REG(hw, SWSM, swsm); - /* if we managed to set the bit we got the semaphore. */ - swsm = E1000_READ_REG(hw, SWSM); - if (swsm & E1000_SWSM_SWESMBI) - break; - - e1000_udelay(50); - timeout--; - } - - if (!timeout) { - /* Release semaphores */ - e1000_put_hw_eeprom_semaphore(hw); - DEBUGOUT("Driver can't access the Eeprom - SWESMBI bit is set.\n"); - return -E1000_ERR_EEPROM; - } - - return E1000_SUCCESS; -} - -/*************************************************************************** - * This function clears HW semaphore bits. - * - * hw: Struct containing variables accessed by shared code - * - * returns: - None. - * - ***************************************************************************/ -static void -e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) -{ - uint32_t swsm; - - DEBUGFUNC("e1000_put_hw_eeprom_semaphore"); - - swsm = E1000_READ_REG(hw, SWSM); - swsm &= ~(E1000_SWSM_SWESMBI); - E1000_WRITE_REG(hw, SWSM, swsm); -} - -/****************************************************************************** - * Checks if PHY reset is blocked due to SOL/IDER session, for example. - * Returning E1000_BLK_PHY_RESET isn't necessarily an error. But it's up to - * the caller to figure out how to deal with it. - * - * hw - Struct containing variables accessed by shared code - * - * returns: - E1000_BLK_PHY_RESET - * E1000_SUCCESS - * - *****************************************************************************/ -int32_t -e1000_check_phy_reset_block(struct e1000_hw *hw) -{ - uint32_t manc = 0; - - manc = E1000_READ_REG(hw, MANC); - return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? - E1000_BLK_PHY_RESET : E1000_SUCCESS; -} - - -static void e1000_pci_set_master(pci_device_t *nwdevice) -{ - uint32_t cmd; - - xmhf_baseplatform_arch_x86_pci_type1_read(nwdevice->bus, - nwdevice->dev, - nwdevice->func, - PCI_CONF_HDR_IDX_COMMAND, - sizeof(uint16_t), - &cmd); - cmd |= PCI_COMMAND_MASTER; - xmhf_baseplatform_arch_x86_pci_type1_write(nwdevice->bus, - nwdevice->dev, - nwdevice->func, - PCI_CONF_HDR_IDX_COMMAND, - sizeof(uint16_t), - cmd); -} - -static void e1000_pci_disable_master(pci_device_t *nwdevice) -{ - uint16_t cmd; - - xmhf_baseplatform_arch_x86_pci_type1_read(nwdevice->bus, - nwdevice->dev, - nwdevice->func, - PCI_CONF_HDR_IDX_COMMAND, - sizeof(uint16_t), - &cmd); - cmd &= ~PCI_COMMAND_MASTER; - xmhf_baseplatform_arch_x86_pci_type1_write(nwdevice->bus, - nwdevice->dev, - nwdevice->func, - PCI_CONF_HDR_IDX_COMMAND, - sizeof(uint16_t), - cmd); - -} - - - - - - - - - - - - - - -////// -// e1000e network card top-level support functions -////// - - - - -void e1000_reset(void); -static int e1000_setup_tx_resources(struct e1000_tx_ring *tx_ring); -static int e1000_probe(pci_device_t *nwdevice); -static int e1000_open(void); -static void e1000_configure_tx(void); -void e1000_xmit(unsigned short tail); -void e1000_wait4xmit(void); -static void e1000_irq_disable(void); - - -void e1000_mdelay1(unsigned int msec) -{ -/* first value is 1GHz, - * second is seconds to wait - * the third one depends how fast your CPU is - */ - uint64_t cycles = E1000_TIMEOUT_1MS * msec; - uint64_t diff; - uint64_t tscbefore, tscafter; - tscbefore = CASM_FUNCCALL(rdtsc64, CASM_NOPARAM); - do - { - tscafter = CASM_FUNCCALL(rdtsc64, CASM_NOPARAM); - diff = tscafter - tscbefore; - } while (diff < cycles); -} - - -void e1000_reset(void) -{ - uint32_t pba = 0; - uint16_t phy_data = 0; - - /* Repartition Pba for greater than 9k mtu - * To take effect CTRL.RST is required. - */ - - - pba = E1000_PBA_38K; - - E1000_WRITE_REG(&e1000_adapt.hw, PBA, pba); - - e1000_adapt.hw.fc_pause_time = E1000_FC_PAUSE_TIME; - - /* Allow time for pending master requests to run */ - e1000_reset_hw(&e1000_adapt.hw); - E1000_WRITE_REG(&e1000_adapt.hw, WUC, 0); - - if (e1000_init_hw(&e1000_adapt.hw)) - DPRINTK(PROBE, ERR, "Hardware Error\n"); - - /* speed up time to link by disabling smart power down, ignore - * the return value of this function because there is nothing - * different we would do if it failed */ - e1000_read_phy_reg(&e1000_adapt.hw, IGP02E1000_PHY_POWER_MGMT, - &phy_data); - phy_data &= ~IGP02E1000_PM_SPD; - e1000_write_phy_reg(&e1000_adapt.hw, IGP02E1000_PHY_POWER_MGMT, - phy_data); -} - -/** - * e1000_probe - Device Initialization Routine - * @pdev: PCI device information struct - * - * Returns 0 on success, negative on failure - * - * e1000_probe initializes an adapter identified by a pci_dev structure. - * The OS initialization, configuring of the adapter private structure, - * and a hardware reset occur. - **/ - -static int e1000_probe(pci_device_t *nwdevice) -{ - unsigned long mmio_start, mmio_len; - - int i, err; - uint16_t eeprom_data = 0; - uint32_t ctrl_ext; - - DEBUGQ(0); - e1000_pci_set_master(&e1000_dev); - - //err = -ENOMEM; - - memset(&e1000_adapt, 0, sizeof(struct e1000_adapter)); - e1000_adapt.msg_enable = 1; - - //TODO: probe base address of this adapter via config space - e1000_adapt.hw.hw_addr = E1000_HWADDR_BASE; - - - /* setup the private structure */ - e1000_irq_disable(); - - //err = -EIO; - - e1000_check_phy_reset_block(&e1000_adapt.hw); - - /* before reading the EEPROM, reset the controller to - * put the device in a known good starting state */ - - e1000_reset_hw(&e1000_adapt.hw); - - /* copy the MAC address out of the EEPROM */ - if (e1000_read_mac_addr(&e1000_adapt.hw)){ - //printf("\nNIC EEPROM Read Error"); - return -1; - } - - - DEBUGQ(0); - /* Transmit Descriptor Count */ - //e1000_adapt.tx_ring.count = ALIGN(E1000_DESC_COUNT, 2); - e1000_adapt.tx_ring.count = E1000_DESC_COUNT; - - e1000_read_eeprom(&e1000_adapt.hw, - EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); - - //printf("\nMAC address:"); - //e1000_adapt.hw.mac_addr[0]=e1000_adapt.hw.perm_mac_addr[0]=0x00; - //e1000_adapt.hw.mac_addr[1]=e1000_adapt.hw.perm_mac_addr[1]=0x1B; - //e1000_adapt.hw.mac_addr[2]=e1000_adapt.hw.perm_mac_addr[2]=0x21; - //e1000_adapt.hw.mac_addr[3]=e1000_adapt.hw.perm_mac_addr[3]=0x48; - //e1000_adapt.hw.mac_addr[4]=e1000_adapt.hw.perm_mac_addr[4]=0x09; - //e1000_adapt.hw.mac_addr[5]=e1000_adapt.hw.perm_mac_addr[5]=0x34; - - //for (i = 0; i < 6; i++) - // printf("%02x ", e1000_adapt.hw.mac_addr[i]); - - /* reset the hardware with the new settings */ - e1000_reset(); - - /* Let firmware know the driver has taken over */ - ctrl_ext = E1000_READ_REG(&e1000_adapt.hw, CTRL_EXT); - E1000_WRITE_REG(&e1000_adapt.hw, CTRL_EXT, - ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); - - DPRINTK(PROBE, INFO, "DEBUG : Intel(R) PRO/1000 Network Connection\n"); - - return 0; -} - -/** - * e1000_open - Called when a network interface is made active - * @netdev: network interface device structure - * - * Returns 0 on success, negative value on failure - * - * The open entry point is called when a network interface is made - * active by the system (IFF_UP). At this point all resources needed - * for transmit and receive operations are allocated, the interrupt - * handler is registered with the OS, the watchdog timer is started, - * and the stack is notified that the interface is ready. - **/ -static int e1000_open(void) -{ - int err = 0; - uint16_t mii_reg = 0; - - DEBUGQ(0); - - /* allocate transmit descriptors */ - err = e1000_setup_tx_resources(&e1000_adapt.tx_ring); - if (err) { - DPRINTK(PROBE, ERR, - "Allocation for Tx Queue %u failed\n", 0); - goto err_setup_tx; - } - - - /* Just clear the power down bit to wake the phy back up */ - /* according to the manual, the phy will retain its - * settings across a power-down/up cycle */ - e1000_read_phy_reg(&e1000_adapt.hw, PHY_CTRL, &mii_reg); - mii_reg &= ~MII_CR_POWER_DOWN; - e1000_write_phy_reg(&e1000_adapt.hw, PHY_CTRL, mii_reg); - - /* before we allocate an interrupt, we must be ready to handle it. - * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt - * as soon as we call pci_request_irq, so we have to setup our - * clean_rx handler before we do so. */ - e1000_configure_tx(); - - return E1000_SUCCESS; - -err_setup_tx: - return err; -} - -/** - * e1000_setup_tx_resources - allocate Tx resources (Descriptors) - * @adapter: board private structure - * @tx_ring: tx descriptor ring (for a specific queue) to setup - * - * Return 0 on success, negative on failure - **/ -static int e1000_setup_tx_resources(struct e1000_tx_ring *tx_ring) -{ - unsigned int i; - struct e1000_tx_desc *tx_desc = NULL; - unsigned char *buffer; - - memset(&xcnwlog_desc, 0, sizeof(xcnwlog_desc)); - - //setup descriptor table size - tx_ring->size_desc = tx_ring->count * sizeof(struct e1000_tx_desc); - tx_ring->size_desc = PAGE_ALIGN_UP4K(tx_ring->size_desc); - //setup descriptor table base - tx_ring->desc=&xcnwlog_desc; - tx_ring->dma_desc=&xcnwlog_desc; - - tx_desc = E1000_TX_DESC(*tx_ring, 0); - tx_desc->buffer_addr = e1000_cpu_to_le64((unsigned int)&xcnwlog_packet); - tx_desc->lower.data = e1000_cpu_to_le32(E1000_TXD_CMD_IFCS | E1000_TXD_CMD_EOP | (sizeof(xcnwlog_packet))); - tx_desc->upper.data = e1000_cpu_to_le32(0); - - - /*for (i = 0; i < tx_ring->count * sizeof(struct e1000_tx_desc); i ++) - { - printk("%02x ", *(unsigned char *)((unsigned int)tx_ring->desc + i)); - if ((i % 16) == 15) - printk("\n"); - }*/ - - return 0; -} - -/** - * e1000_configure_tx - Configure 8254x Transmit Unit after Reset - * @adapter: board private structure - * - * Configure the Tx unit of the MAC after a reset. - **/ - -static void -e1000_configure_tx(void) -{ - uint64_t tdba; - struct e1000_hw *hw = &e1000_adapt.hw; - uint32_t tdlen, tctl, tipg, tarc; - - /* Setup the HW Tx Head and Tail descriptor pointers */ - tdba = e1000_adapt.tx_ring.dma_desc; - //tdlen = e1000_adapt.tx_ring.count * sizeof(struct e1000_tx_desc); - tdlen = 4096; - E1000_WRITE_REG(hw, TDLEN, tdlen); - //E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); - //E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); - E1000_WRITE_REG(hw, TDBAH, 0); - E1000_WRITE_REG(hw, TDBAL, (uint32_t)e1000_adapt.tx_ring.dma_desc); - E1000_WRITE_REG(hw, TDT, 0); - E1000_WRITE_REG(hw, TDH, 0); - e1000_adapt.tx_ring.tdh = (E1000_TDH); - e1000_adapt.tx_ring.tdt = (E1000_TDT); - - tipg = DEFAULT_82543_TIPG_IPGT_COPPER; - tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; - tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; - - E1000_WRITE_REG(hw, TIPG, tipg); - - /* Set the Tx Interrupt Delay register */ - E1000_WRITE_REG(hw, TIDV, e1000_adapt.tx_int_delay); - E1000_WRITE_REG(hw, TADV, e1000_adapt.tx_abs_int_delay); - - /* Program the Transmit Control Register */ - tctl = E1000_READ_REG(hw, TCTL); - tctl &= ~E1000_TCTL_CT; - tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); - - tarc = E1000_READ_REG(hw, TARC0); - /* set the speed mode bit, we'll clear it if we're not at - * gigabit link later */ - tarc |= (1 << 21); - E1000_WRITE_REG(hw, TARC0, tarc); - - /* Setup Transmit Descriptor Settings for eop descriptor */ - e1000_adapt.txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS | E1000_TXD_CMD_RS; - E1000_WRITE_REG(hw, TCTL, tctl); -} - -void e1000_xmit(unsigned short tail) -{ - unsigned int tctl; - - DEBUGQ(tail); - -#ifdef E1000_DEBUG_PKTIDX - { - static unsigned int idx_init = 0; - if ((tail != 0) && (idx_init)) - { - unsigned int i; - unsigned int idx; - unsigned char *buffer; - struct e1000_tx_desc *tx_desc = NULL; - - for (i = 0; i < e1000_adapt.tx_ring.count; i ++) - { - tx_desc = E1000_TX_DESC(e1000_adapt.tx_ring, i); - if ((i % 2) == 0) - { - buffer = (unsigned char *)e1000_adapt.tx_ring.buf_header + E1000_HEADER_SIZE * (i / 2); - idx = *(unsigned int *)(buffer + 14); - idx += e1000_adapt.tx_ring.count; - *(unsigned int *)(buffer + 14) = idx; - } - } - } else - idx_init = 1; - } -#endif - /* enable transmits in the hardware, need to do this - * after setting TARC0 */ - tctl = E1000_READ_REG(&e1000_adapt.hw, TCTL); - tctl |= E1000_TCTL_EN; - E1000_WRITE_REG(&e1000_adapt.hw, TCTL, tctl); - - e1000_writel(tail, e1000_adapt.hw.hw_addr + e1000_adapt.tx_ring.tdt); -} - - -uint32_t e1000_check4xmit(void) -{ - unsigned short tail, head; - - tail = e1000_readl(e1000_adapt.hw.hw_addr + e1000_adapt.tx_ring.tdt); - head = e1000_readl(e1000_adapt.hw.hw_addr + e1000_adapt.tx_ring.tdh); - - if(tail != head) - return 0; - else - return 1; -} - - -void e1000_wait4xmit(void) -{ - unsigned short tail, head; - - tail = e1000_readl(e1000_adapt.hw.hw_addr + e1000_adapt.tx_ring.tdt); - DEBUGQ(tail); - - do { - head = e1000_readl(e1000_adapt.hw.hw_addr + e1000_adapt.tx_ring.tdh); - } while (head != tail); - -} - - - -/** - * e1000_irq_disable - Mask off interrupt generation on the NIC - * @adapter: board private structure - **/ - -static void e1000_irq_disable(void) -{ - E1000_WRITE_REG(&e1000_adapt.hw, IMC, ~0); - E1000_WRITE_FLUSH(&e1000_adapt.hw); -} - - -///// -void e1000_xmitack(void){ - _XDPRINTF_("%s: transmitting...\n", __func__); - e1000_xmit(1); - _XDPRINTF_("%s: transmit signal sent, waiting for finish...\n", __func__); - e1000_wait4xmit(); - _XDPRINTF_("%s: transmit successful\n", __func__); -} - -uint32_t e1000_init_module(void) -{ - int ret = 0; - uint32_t i; - - - //TODO: probe PCI bus to figure out b,d,f - e1000_dev.vendor_id = 0x8086; - e1000_dev.device_id = 0x10b9; - e1000_dev.bus = 4; - e1000_dev.dev = 0; - e1000_dev.func = 0; - - _XDPRINTF_("%s: probing for ethernet card...\n", __func__); - - DEBUGQ(0); - ret = e1000_probe(&e1000_dev); - - if (ret < 0) - return 0; - - _XDPRINTF_("%s: card found, MAC address=", __func__); - for (i = 0; i < 6; i++) - _XDPRINTF_("%02x ", e1000_adapt.hw.mac_addr[i]); - _XDPRINTF_("\n"); - - - _XDPRINTF_("%s: opening interface...\n", __func__); - ret = e1000_open(); - - if (ret < 0) - return 0; - - _XDPRINTF_("%s: interface opened successfully\n", __func__); - - - _XDPRINTF_("%s: waiting for switch...\n", __func__); - e1000_mdelay1(15 * 1000); - _XDPRINTF_("%s: ready to xmit...\n", __func__); - - //setup packet header - xcnwlog_packet.dst_mac[0] = 0xFF; - xcnwlog_packet.dst_mac[1] = 0xFF; - xcnwlog_packet.dst_mac[2] = 0xFF; - xcnwlog_packet.dst_mac[3] = 0xFF; - xcnwlog_packet.dst_mac[4] = 0xFF; - xcnwlog_packet.dst_mac[5] = 0xFF; - xcnwlog_packet.src_mac[0] = e1000_adapt.hw.mac_addr[0]; - xcnwlog_packet.src_mac[1] = e1000_adapt.hw.mac_addr[1]; - xcnwlog_packet.src_mac[2] = e1000_adapt.hw.mac_addr[2]; - xcnwlog_packet.src_mac[3] = e1000_adapt.hw.mac_addr[3]; - xcnwlog_packet.src_mac[4] = e1000_adapt.hw.mac_addr[4]; - xcnwlog_packet.src_mac[5] = e1000_adapt.hw.mac_addr[5]; - xcnwlog_packet.type[0] = 0x80; - xcnwlog_packet.type[1] = 0x86; - -/* _XDPRINTF_("%s: transmitting...\n", __func__); - e1000_xmit(1); - _XDPRINTF_("%s: transmit signal sent, waiting for finish...\n", __func__); - e1000_wait4xmit(); - _XDPRINTF_("%s: transmit successful\n", __func__); -*/ - - return ret; -} - - - diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_init.c b/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_init.c deleted file mode 100644 index 0db892b1a1..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_init.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -/* - * slab code - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - -void xcnwlog_init(void){ - memset(&xcnwlog_ls[0], 0, sizeof(xcnwlog_ls[0])); - xcnwlog_ls_index[0]=0; - e1000_init_module(); -} diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_logdata.c b/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_logdata.c deleted file mode 100644 index f8d20959c5..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_logdata.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -/* - * xcnwlog_logdata: log network log buffer to the network - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - -//@ghost bool xcnwlog_logdata_invokepush = false; -//@ghost bool xcnwlog_logdata_copytodmaregion = false; -//@ghost bool xcnwlog_logdata_xmit = false; -//@ghost bool xcnwlog_logdata_resetbuffer = false; -/*@ - behavior logdata_xmitandresetbuffer: - assumes (xcnwlog_ls_index[0] >= XC_NWLOG_BUF_MAXELEM); - ensures (xcnwlog_logdata_invokepush == \at(xcnwlog_logdata_invokepush, Pre)); - ensures (xcnwlog_logdata_copytodmaregion == true); - ensures (xcnwlog_logdata_xmit == true); - ensures (xcnwlog_logdata_resetbuffer == true); - ensures (xcnwlog_ls_index[0] == 0); - - behavior logdata_onlylog: - assumes (xcnwlog_ls_index[0] < XC_NWLOG_BUF_MAXELEM); - ensures (xcnwlog_logdata_invokepush == true); - ensures (xcnwlog_logdata_copytodmaregion == \at(xcnwlog_logdata_copytodmaregion, Pre)); - ensures (xcnwlog_logdata_xmit == \at(xcnwlog_logdata_xmit, Pre)); - ensures (xcnwlog_logdata_resetbuffer == \at(xcnwlog_logdata_resetbuffer, Pre)); - ensures (xcnwlog_ls_index[0] == \at(xcnwlog_ls_index[0], Pre)); - - complete behaviors; - disjoint behaviors; - -@*/ - -void xcnwlog_logdata(xcnwlog_ls_element_t elem){ - if(xcnwlog_ls_index[0] >= XC_NWLOG_BUF_MAXELEM){ - //memcpy(&xcnwlog_lsdma[0], &xcnwlog_ls[0], sizeof(xcnwlog_ls_element_t)*XC_NWLOG_BUF_MAXELEM); - memcpy(&xcnwlog_packet.logbuf, &xcnwlog_ls[0], sizeof(xcnwlog_ls_element_t)*XC_NWLOG_BUF_MAXELEM); - //@ghost xcnwlog_logdata_copytodmaregion = true; - e1000_xmitack(); - //@ghost xcnwlog_logdata_xmit = true; - memset(&xcnwlog_ls[0], 0, sizeof(xcnwlog_ls[0])); - //@ghost xcnwlog_logdata_resetbuffer = true; - xcnwlog_ls_index[0]=0; - }else{ - xcnwlog_ls_push(0, elem); - //@ghost xcnwlog_logdata_invokepush = true; - } -} - diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_main.c b/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_main.c deleted file mode 100644 index b019171645..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xcnwlog_main.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include -#include -#include - -#include -#include - -/* - * xcnwlog_main: main uobj code - * - * author: amit vasudevan (amitvasudevan@acm.org) - */ - - -////// -// entry function -////// - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -#include - -uint32_t cpuid = 0; //BSP cpu -uint32_t check_esp, check_eip = CASM_RET_EIP; -slab_params_t test_sp; -typedef enum { - XCNWLOG_VERIF_INIT, - XCNWLOG_VERIF_LOGDATA -} xcnwlog_verif_t; - -xcnwlog_verif_t xcnwlog_verif = XCNWLOG_VERIF_INIT; -bool xcnwlog_logdata_startedxmit = false; - -void cbhwm_e1000_write_tdt(uint32_t origval, uint32_t newval){ - switch(xcnwlog_verif){ - case XCNWLOG_VERIF_INIT: - //@assert 1; - break; - - case XCNWLOG_VERIF_LOGDATA:{ - if(xmhfhwm_e1000_tctl & E1000_TCTL_EN){ - //@assert newval == 1; - //@assert xmhfhwm_e1000_tdbah == 0; - //@assert xmhfhwm_e1000_tdbal == (uint32_t)&xcnwlog_desc; - //@assert xmhfhwm_e1000_status_transmitting == false; - xcnwlog_logdata_startedxmit = true; - } - break; - } - - default: - //@assert 0; - break; - } -} - -void cbhwm_e1000_write_tdbah(uint32_t origval, uint32_t newval){ - switch(xcnwlog_verif){ - case XCNWLOG_VERIF_INIT: - //@assert 1; - break; - - case XCNWLOG_VERIF_LOGDATA:{ - //@assert 0; - break; - } - - default: - //@assert 0; - break; - } -} - -void cbhwm_e1000_write_tdbal(uint32_t origval, uint32_t newval){ - switch(xcnwlog_verif){ - case XCNWLOG_VERIF_INIT: - //@assert 1; - break; - - case XCNWLOG_VERIF_LOGDATA:{ - //@assert 0; - break; - } - - default: - //@assert 0; - break; - } -} - -void cbhwm_e1000_write_tdlen(uint32_t origval, uint32_t newval){ - switch(xcnwlog_verif){ - case XCNWLOG_VERIF_INIT: - //@assert 1; - break; - - case XCNWLOG_VERIF_LOGDATA:{ - //@assert 0; - break; - } - - default: - //@assert 0; - break; - } -} - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.src_slabid = framac_nondetu32interval(0, XMHFGEEC_TOTAL_SLABS-1); - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - //execute harness - xcnwlog_verif = XCNWLOG_VERIF_INIT; - e1000_init_module(); - //@assert (e1000_adapt.hw.hw_addr == (uint8_t *)E1000_HWADDR_BASE); - //@assert (e1000_adapt.tx_ring.tdt == (uint16_t)(E1000_TDT)); - //@assert (e1000_adapt.tx_ring.tdh == (uint16_t)(E1000_TDH)); - //@assert xmhfhwm_e1000_tdbah == 0; - //@assert xmhfhwm_e1000_tdbal == (uint32_t)&xcnwlog_desc; - //@assert xmhfhwm_e1000_tdlen == 4096; - - //@assert xmhfhwm_e1000_status_transmitting == false; - xcnwlog_verif = XCNWLOG_VERIF_LOGDATA; - e1000_xmitack(); - //@assert xmhfhwm_e1000_status_transmitting == false; - - //@assert xmhfhwm_cpu_gprs_esp == check_esp; - //@assert xmhfhwm_cpu_gprs_eip == check_eip; -} -#endif - - - -//@ ghost bool xcnwlog_methodcall_init = false; -//@ ghost bool xcnwlog_methodcall_logdata = false; -//@ ghost bool xcnwlog_methodcall_invalid = false; -/*@ - requires \valid(sp); - ensures ( sp->dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_INITIALIZE) ==> (xcnwlog_methodcall_init == true); - ensures ( sp->dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_LOGDATA ) ==> (xcnwlog_methodcall_logdata == true); - ensures !( - ( sp->dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_INITIALIZE) || - ( sp->dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_LOGDATA ) - ) ==> (xcnwlog_methodcall_invalid == true); -@*/ -void slab_main(slab_params_t *sp){ - - _XDPRINTF_("XCNWLOG[%u]: Got control: src=%u, dst=%u, esp=%08x, eflags=%08x\n", - (uint16_t)sp->cpuid, sp->src_slabid, sp->dst_slabid, CASM_FUNCCALL(read_esp,CASM_NOPARAM), - CASM_FUNCCALL(read_eflags, CASM_NOPARAM)); - - if(sp->dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_INITIALIZE){ - xcnwlog_init(); - //@ghost xcnwlog_methodcall_init = true; - - }else if (sp->dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_LOGDATA){ - xcnwlog_ls_element_t elem; - elem.logbuf[0] = sp->in_out_params[0]; elem.logbuf[1] = sp->in_out_params[0]; - elem.logbuf[2] = sp->in_out_params[0]; elem.logbuf[3] = sp->in_out_params[0]; - elem.logbuf[4] = sp->in_out_params[0]; elem.logbuf[5] = sp->in_out_params[0]; - elem.logbuf[6] = sp->in_out_params[0]; elem.logbuf[7] = sp->in_out_params[0]; - elem.logbuf[8] = sp->in_out_params[0]; elem.logbuf[9] = sp->in_out_params[0]; - elem.logbuf[10] = sp->in_out_params[0]; elem.logbuf[11] = sp->in_out_params[0]; - elem.logbuf[12] = sp->in_out_params[0]; elem.logbuf[13] = sp->in_out_params[0]; - elem.logbuf[14] = sp->in_out_params[0]; elem.logbuf[15] = sp->in_out_params[0]; - xcnwlog_logdata(elem); - //@ghost xcnwlog_methodcall_logdata = true; - - }else { - _XDPRINTF_("XCNWLOG[%u]: Unknown sub-function %x. Halting!\n", - (uint16_t)sp->cpuid, sp->dst_uapifn); - //@ghost xcnwlog_methodcall_invalid = true; - - - } - -} - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xc_nwlog/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xc_nwlog/xmhfgeecslab.mk.in deleted file mode 100644 index c4a1f1b147..0000000000 --- a/uxmhf/xmhf-uobjs/xc_nwlog/xmhfgeecslab.mk.in +++ /dev/null @@ -1,20 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xc_nwlog -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main xcnwlog_ls_push -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xcnwlog_data.c.v.c xcnwlog_addtolog.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xcnwlog_data.c.v.c xcnwlog_main.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main xcnwlog_logdata -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xcnwlog_data.c.v.c xcnwlog_logdata.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -no-val-show-progress -slevel 512 -slevel-function e1000_delay:0 -slevel-function e1000_mdelay1:0 -slevel-function e1000_read_eeprom:0 -slevel-function e1000_read_mac_addr:0 $(VFLAGS) *.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) diff --git a/uxmhf/xmhf-uobjs/xg_richguest/xg_richguest.gsm b/uxmhf/xmhf-uobjs/xg_richguest/xg_richguest.gsm deleted file mode 100644 index a91283eeab..0000000000 --- a/uxmhf/xmhf-uobjs/xg_richguest/xg_richguest.gsm +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include - -#include -#include -#include - - -{ - "uobj-name": "xg_richguest", - "uobj-type": "uVU_SLAB", - "uobj-subtype": "XRICHGUEST", - - "uobj-uapifunctions":[], - - "uobj-callees": "", - - "uobj-uapicallees":[], - - "uobj-resource-devices":[ - { - "type": "include", - "opt1" : USMF_STR(0xffff), - "opt2" : USMF_STR(0xffff) - } -/* , - { - "type": "exclude", - "opt1" : USMF_STR(PCI_VENDOR_ID_LOGNIC), - "opt2" : USMF_STR(PCI_DEVICE_ID_LOGNIC) - } -*/ - ], - - "uobj-resource-memory":[ - { - "access-type" : "read", - "uobj-name" : "xc_init" - }, - { - "access-type" : "read", - "uobj-name" : "xc_ihub" - }, - { - "access-type" : "write", - "uobj-name" : "xc_init" - }, - { - "access-type" : "write", - "uobj-name" : "xc_ihub" - }, - { - "access-type" : "read", - "uobj-name" : "xh_syscalllog" - }, - { - "access-type" : "read", - "uobj-name" : "xh_ssteptrace" - } - - ], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x0" - }, - { - "section-name": "data", - "section-size": USMF_STR(__TARGET_BASE_XMHF) - }, - { - "section-name": "stack", - "section-size": USMF_STR(__TARGET_MAX_XMHF) - }, - { - "section-name": "dmadata", - "section-size": USMF_STR(__TARGET_MAX_SYS) - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xg_richguest/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xg_richguest/xmhfgeecslab.mk.in deleted file mode 100644 index 6c3c124611..0000000000 --- a/uxmhf/xmhf-uobjs/xg_richguest/xmhfgeecslab.mk.in +++ /dev/null @@ -1,16 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xg_richguest -export XMHF_SLAB_SOURCES := - -######################################################################## - -.PHONY: verify -verify: - @echo Nothing to verify for $(XMHF_SLAB_NAME) - diff --git a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec.gsm b/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec.gsm deleted file mode 100644 index 130ab3d090..0000000000 --- a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec.gsm +++ /dev/null @@ -1,23 +0,0 @@ -//slab manifest -#include -#include -#include - -//slab memory sections -MS:CODE:0x200000:void:void -MS:DATA:0x200000:void:void -MS:STACK:0x600000:void:void -MS:DMADATA:0x200000:void:void - - -S:uapi_gcpustate:void:void:void -S:uapi_slabmempgtbl:void:void:void - - -U:uapi_slabmempgtbl:XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB:(void)0;:(1) -U:uapi_slabmempgtbl:XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR:(void)0;:(1) -U:uapi_slabmempgtbl:XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR:{ setentryforpaddrp->entry=setentryforpaddrp->entry & 7; setentryforpaddrp->entry &= ~0x2; setentryforpaddrp->entry |= 0x1; setentryforpaddrp->entry |= 0x4;}:(!(setentryforpaddrp->entry & 0x2) && (setentryforpaddrp->entry & 0x1) && (setentryforpaddrp->entry & 0x4)) -U:uapi_gcpustate:XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD:(void)0;:(1) -U:uapi_gcpustate:XMHF_HIC_UAPI_CPUSTATE_VMREAD:(void)0;:(1) - - diff --git a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_code.c b/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_code.c deleted file mode 100644 index 3546a9f597..0000000000 --- a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_code.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// aprvexec hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -//#include -#include - -#include - - - -#define APRVEXEC_LOCK 0xD0 -#define APRVEXEC_UNLOCK 0xD1 - -static uint8_t _ae_page_buffer[PAGE_SIZE_4K]; - -static uint8_t _ae_database[][SHA_DIGEST_LENGTH] = { - {0xd1, 0x4e, 0x30, 0x25, 0x8e, 0x16, 0x85, 0x9b, 0x21, 0x81, 0x74, 0x78, 0xbb, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0xa1, 0x4e, 0x30, 0x25, 0x8e, 0x16, 0x85, 0x9b, 0x21, 0x71, 0x74, 0x78, 0xbb, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0xf1, 0x4e, 0x30, 0x25, 0x8e, 0x16, 0x85, 0x9b, 0x21, 0x81, 0x54, 0x78, 0xbb, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0xe1, 0x4e, 0x30, 0x25, 0x9e, 0x16, 0x85, 0x9b, 0x21, 0x81, 0x74, 0x78, 0x6b, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0x88, 0x3a, 0x97, 0x59, 0x09, 0x80, 0x12, 0xa9, 0x3b, 0xfb, 0x38, 0x09, 0xb2, 0xf2, 0xca, 0xb6, 0x12, 0x8c, 0x64, 0x52}, - {0x9d, 0xe8, 0x61, 0x2a, 0xea, 0x00, 0xc7, 0xe7, 0x8f, 0xd5, 0xf3, 0x6f, 0x7d, 0xec, 0xff, 0xda, 0xf9, 0xd9, 0xf9, 0x2f}, -}; - -#define NUMENTRIES_AE_DATABASE (sizeof(_ae_database)/sizeof(_ae_database[0])) - - -//approve and lock a page (at gpa) -static void ae_lock(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa){ - slab_params_t spl; - //xmhf_hic_uapi_physmem_desc_t *pdesc = (xmhf_hic_uapi_physmem_desc_t *)&spl.in_out_params[2]; - //xmhf_uapi_slabmemacc_params_t *smemaccp = (xmhf_uapi_slabmemacc_params_t *)spl.in_out_params; - uint8_t digest[SHA_DIGEST_LENGTH]; - bool found_in_database=false; - uint32_t i; - - _XDPRINTF_("%s[%u]: starting...\n", __func__, (uint16_t)cpuindex); - spl.src_slabid = XMHFGEEC_SLAB_XH_APRVEXEC; - //spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMACC; - spl.cpuid = cpuindex; - -if(!ae_activated){ - //grab page contents at gpa into local page buffer - //smemaccp->dst_slabid = guest_slab_index; - //smemaccp->addr_to = &_ae_page_buffer; - //smemaccp->addr_from = gpa; - //smemaccp->numbytes = PAGE_SIZE_4K; - ////spl.in_out_params[0] = XMHF_HIC_UAPI_PHYSMEM; - // spl.dst_uapifn = XMHF_HIC_UAPI_PHYSMEM_PEEK; - //XMHF_SLAB_CALLNEW(&spl); - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, &_ae_page_buffer, gpa, - PAGE_SIZE_4K); - - _XDPRINTF_("%s[%u]: grabbed page contents at gpa=%016x\n", - __func__, (uint16_t)cpuindex, gpa); - - _XDPRINTF_("%s[%u]: %02x, %02x, %02x, %02x, %02x ...\n", - __func__, (uint16_t)cpuindex, _ae_page_buffer[0], _ae_page_buffer[1], - _ae_page_buffer[2], _ae_page_buffer[3], _ae_page_buffer[4]); - - //compute SHA-1 of the local page buffer - sha1(&_ae_page_buffer, PAGE_SIZE_4K, digest); - - _XDPRINTF_("%s[%u]: computed SHA-1: %*D\n", - __func__, (uint16_t)cpuindex, SHA_DIGEST_LENGTH, digest, " "); - - //compare computed SHA-1 to the database - for(i=0; i < NUMENTRIES_AE_DATABASE; i++){ - if(!memcmp(&digest, &_ae_database[i], SHA_DIGEST_LENGTH)){ - found_in_database=true; - break; - } - } - - //if not approved then just return - if(!found_in_database){ - _XDPRINTF_("%s[%u]: could not find entry in database. returning\n", - __func__, (uint16_t)cpuindex); - return; - } - - _XDPRINTF_("%s[%u]: entry matched in database, proceeding to lock page...\n", - __func__, (uint16_t)cpuindex); - - { - //lock the code page so no one can write to it - //xmhf_hic_uapi_mempgtbl_desc_t *mdesc = (xmhf_hic_uapi_mempgtbl_desc_t *)&spl.in_out_params[2]; - //xmhf_uapi_slabmempgtbl_entry_params_t *smpgtblep = - // (xmhf_uapi_slabmempgtbl_entry_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *flushtlbp = - (xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *)spl.in_out_params; - - - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = gpa; - XMHF_SLAB_CALLNEW(&spl); - _XDPRINTF_("%s[%u]: original entry for gpa=%016llx is %016llx\n", - __func__, (uint16_t)cpuindex, gpa, getentryforpaddrp->result_entry); - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - setentryforpaddrp->dst_slabid = guest_slab_index; - setentryforpaddrp->gpa = gpa; - setentryforpaddrp->entry = (getentryforpaddrp->result_entry & ~(0x7)); - setentryforpaddrp->entry |= 0x5; // execute, read-only - XMHF_SLAB_CALLNEW(&spl); - - - //flush EPT TLB for permission changes to take effect - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB; - flushtlbp->dst_slabid = guest_slab_index; - XMHF_SLAB_CALLNEW(&spl); - - - /* - ////// - //debug - ////// - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = gpa; - XMHF_SLAB_CALLNEW(&spl); - _XDPRINTF_("%s[%u]: new entry for gpa=%016llx is %016llx\n", - __func__, (uint16_t)cpuindex, gpa, getentryforpaddrp->result_entry); - - ////// -*/ - - ae_activated = true; - ae_paddr = (uint32_t)gpa; - _XDPRINTF_("%s[%u]: approved and locked page at gpa %x\n", - __func__, (uint16_t)cpuindex, gpa); - } -} - -} - - -//unlock a page (at gpa) -static void ae_unlock(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa){ - slab_params_t spl; - //xmhf_hic_uapi_mempgtbl_desc_t *mdesc = (xmhf_hic_uapi_mempgtbl_desc_t *)&spl.in_out_params[2]; - //xmhf_uapi_slabmempgtbl_entry_params_t *smpgtblep = - // (xmhf_uapi_slabmempgtbl_entry_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)spl.in_out_params; - - - spl.src_slabid = XMHFGEEC_SLAB_XH_APRVEXEC; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = cpuindex; - //spl.in_out_params[0] = XMHF_HIC_UAPI_MEMPGTBL; - - _XDPRINTF_("%s[%u]: starting...\n", __func__, (uint16_t)cpuindex); - - if(ae_activated){ - //unlock the code page - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = gpa; - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: original entry for gpa=%016llx is %016llx\n", - __func__, (uint16_t)cpuindex, gpa, getentryforpaddrp->result_entry); - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - setentryforpaddrp->dst_slabid = guest_slab_index; - setentryforpaddrp->gpa = gpa; - setentryforpaddrp->entry = getentryforpaddrp->result_entry & ~(0x7); - setentryforpaddrp->entry |= 0x7; // execute, read-write - XMHF_SLAB_CALLNEW(&spl); - - ae_activated=false; - ae_paddr=0; - _XDPRINTF_("%s[%u]: restored permissions for page at %016llx\n", - __func__, (uint16_t)cpuindex, gpa); - } -} - - - -////// -// hypapp callbacks - - -//initialization -static void _hcb_initialize(uint32_t cpuindex){ - _XDPRINTF_("%s[%u]: aprvexec initializing...\n", __func__, (uint16_t)cpuindex); -} - -//hypercall -static void _hcb_hypercall(uint64_t cpuindex, uint64_t guest_slab_index){ - slab_params_t spl; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = - (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - x86regs_t *gprs = (x86regs_t *)&gcpustate_gprs->gprs; - uint32_t call_id; - uint64_t gpa; - - spl.src_slabid = XMHFGEEC_SLAB_XH_APRVEXEC; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - //spl.in_out_params[0] = XMHF_HIC_UAPI_CPUSTATE; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - - - call_id = gprs->eax; - gpa = ((uint64_t)gprs->ebx << 32) | gprs->edx; - - - - switch(call_id){ - - case APRVEXEC_LOCK:{ - _XDPRINTF_("%s[%u]: call_id=%x(LOCK), eax=%08x,ebx=%08x,edx=%08x\n", - __func__, (uint16_t)cpuindex, call_id, gprs->eax, gprs->ebx, gprs->edx); - _XDPRINTF_("%s[%u]: call_id=%x(LOCK), gpa=%016llx\n", __func__, (uint16_t)cpuindex, call_id, gpa); - ae_lock(cpuindex, guest_slab_index, gpa); - } - break; - - case APRVEXEC_UNLOCK:{ - _XDPRINTF_("%s[%u]: call_id=%x(UNLOCK), eax=%08x,ebx=%08x,edx=%08x\n", - __func__, (uint16_t)cpuindex, call_id, gprs->eax, gprs->ebx, gprs->edx); - _XDPRINTF_("%s[%u]: call_id=%x(UNLOCK), gpa=%016llx\n", __func__, (uint16_t)cpuindex, call_id, gpa); - ae_unlock(cpuindex, guest_slab_index, gpa); - } - break; - - default: - //_XDPRINTF_("%s[%u]: unsupported hypercall %x. Ignoring\n", __func__, (uint16_t)cpuindex, call_id); - break; - } - -} - - -//memory fault -static void _hcb_memoryfault(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa, uint64_t gva, uint64_t errorcode){ - - if(ae_activated && ae_paddr == (uint32_t)gpa){ - _XDPRINTF_("%s[%u]: memory fault in guest slab %u; gpa=%016llx, gva=%016llx, errorcode=%016llx, write error to approved code. Halting!\n", - __func__, (uint16_t)cpuindex, guest_slab_index, gpa, gva, errorcode); - HALT(); - } - -} - -// shutdown -static void _hcb_shutdown(uint32_t cpuindex, uint32_t guest_slab_index){ - _XDPRINTF_("%s[%u]: guest slab %u shutdown...\n", __func__, (uint16_t)cpuindex, guest_slab_index); -} - - - - - - - - - -////// -// slab interface - -//void slab_interface(slab_input_params_t *iparams, uint64_t iparams_size, slab_output_params_t *oparams, uint64_t oparams_size, uint64_t src_slabid, uint64_t cpuindex){ -void slab_main(slab_params_t *sp){ - //xc_hypappcb_inputparams_t *hcb_iparams = (xc_hypappcb_inputparams_t *)iparams; - //xc_hypappcb_outputparams_t *hcb_oparams = (xc_hypappcb_outputparams_t *)oparams; - xc_hypappcb_params_t *hcbp = (xc_hypappcb_params_t *)&sp->in_out_params[0]; - hcbp->cbresult=XC_HYPAPPCB_CHAIN; - - //_XDPRINTF_("XHAPRVEXEC[%u]: Got control, cbtype=%x: ESP=%08x\n", - // (uint16_t)sp->cpuid, hcbp->cbtype, CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - - switch(hcbp->cbtype){ - case XC_HYPAPPCB_INITIALIZE:{ - _hcb_initialize(sp->cpuid); - } - break; - - case XC_HYPAPPCB_HYPERCALL:{ - _hcb_hypercall(sp->cpuid, hcbp->guest_slab_index); - } - break; - - case XC_HYPAPPCB_MEMORYFAULT:{ - uint64_t errorcode; - uint64_t gpa; - uint64_t gva; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - - spl.src_slabid = XMHFGEEC_SLAB_XH_APRVEXEC; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = sp->cpuid; - //spl.in_out_params[0] = XMHF_HIC_UAPI_CPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - - gcpustate_vmrwp->encoding = VMCS_INFO_EXIT_QUALIFICATION; - XMHF_SLAB_CALLNEW(&spl); - errorcode = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_PADDR_FULL; - XMHF_SLAB_CALLNEW(&spl); - gpa = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_LINEAR_ADDRESS; - XMHF_SLAB_CALLNEW(&spl); - gva = gcpustate_vmrwp->value; - - _hcb_memoryfault(sp->cpuid, hcbp->guest_slab_index, gpa, gva, errorcode); - } - break; - - case XC_HYPAPPCB_SHUTDOWN:{ - _hcb_shutdown(sp->cpuid, hcbp->guest_slab_index); - } - break; - - //case XC_HYPAPPCB_TRAP_IO:{ - // - // - //} - //break; - - //case XC_HYPAPPCB_TRAP_INSTRUCTION:{ - // - // - //} - //break; - - //case XC_HYPAPPCB_TRAP_EXCEPTION:{ - // - // - //} - //break; - - - default:{ - //_XDPRINTF_("%s[%u]: Unknown cbtype. Ignoring!\n", - // __func__, (uint16_t)sp->cpuid); - } - } - -} diff --git a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_codesup.cS b/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_codesup.cS deleted file mode 100644 index a7dadbe484..0000000000 --- a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_codesup.cS +++ /dev/null @@ -1,45 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ diff --git a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_data.c b/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_data.c deleted file mode 100644 index 6744057df2..0000000000 --- a/uxmhf/xmhf-uobjs/xh_aprvexec/xh_aprvexec_data.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// approvexec hypapp -- verification manifest -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - - -#if defined (__XMHF_VERIFICATION__) -bool ae_activated=nondet_bool(); -uint32_t ae_paddr=nondet_u32(); -#else -bool ae_activated=false; -uint32_t ae_paddr=0; -#endif // defined - -/* -void xhapprovexec_inv_xmhf_hic_uapi_mempgtbl_setentry(xmhf_hic_uapi_mempgtbl_desc_t *imdesc){ - if(!ae_activated){ - assert( (imdesc->entry & 0x7) == 0x5 ); - } -} - -*/ diff --git a/uxmhf/xmhf-uobjs/xh_aprvexec/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xh_aprvexec/xmhfgeecslab.mk.in deleted file mode 100644 index a0c32fe3d1..0000000000 --- a/uxmhf/xmhf-uobjs/xh_aprvexec/xmhfgeecslab.mk.in +++ /dev/null @@ -1,18 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xh_aprvexec -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - - -.PHONY: verify -verify: - @echo Nothing to verify for $(XMHF_SLAB_NAME) - diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xh_hyperdep.gsm b/uxmhf/xmhf-uobjs/xh_hyperdep/xh_hyperdep.gsm deleted file mode 100644 index 55ba38638f..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xh_hyperdep.gsm +++ /dev/null @@ -1,88 +0,0 @@ -#include -#include - -#include -#include -#include - -{ - "uobj-name": "xh_hyperdep", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "XHYPAPP", - - "uobj-uapifunctions":[], - - "uobj-callees": " uapi_gcpustate - uapi_slabmempgtbl - ", - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR), - "opt1" : "{setentryforpaddrp->entry=setentryforpaddrp->entry&7; setentryforpaddrp->entry&=~0x4; setentryforpaddrp->entry|=0x1; setentryforpaddrp->entry|=0x2;}", - "opt2" : "(!(setentryforpaddrp->entry & 0x4) && (setentryforpaddrp->entry & 0x1) && (setentryforpaddrp->entry & 0x2))" - } - ], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_activate.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_activate.c deleted file mode 100644 index 24984ee710..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_activate.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - - -/*@ - ensures (!hd_activated && gpa != 0) ==> (hd_activated == true); -@*/ -void hyperdep_activatedep(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa){ - slab_params_t spl; - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_XH_HYPERDEP; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = cpuindex; - - if(!hd_activated && gpa != 0){ - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = gpa; - //@assert getentryforpaddrp->gpa == gpa; - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: original entry for gpa=%016llx is %016llx\n", __func__, (uint16_t)cpuindex, - gpa, getentryforpaddrp->result_entry); - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - setentryforpaddrp->dst_slabid = guest_slab_index; - setentryforpaddrp->gpa = gpa; - setentryforpaddrp->entry = getentryforpaddrp->result_entry & ~(0x4); //execute-disable - //@assert setentryforpaddrp->gpa == gpa; - //@assert !(setentryforpaddrp->entry & 0x4); - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: activated DEP for page at gpa %016llx\n", __func__, (uint16_t)cpuindex, gpa); - - hd_activated=true; - hd_pageaddr = (uint32_t)gpa; - }else{ - //do nothing - } -} diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_data.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_data.c deleted file mode 100644 index c17a981242..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_data.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp -- verification manifest -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - - -bool hd_activated=false; -uint32_t hd_pageaddr=0; diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_deactivate.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_deactivate.c deleted file mode 100644 index 751639d184..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_deactivate.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - - -//deactivate DEP for a given page (at gpa) -void hyperdep_deactivatedep(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa){ - slab_params_t spl; - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)spl.in_out_params; - - - spl.src_slabid = XMHFGEEC_SLAB_XH_HYPERDEP; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = cpuindex; - //spl.in_out_params[0] = XMHF_HIC_UAPI_MEMPGTBL; - - if(hd_activated){ - - if(gpa != 0){ - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = gpa; - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: original entry for gpa=%016llx is %016llx\n", __func__, - (uint16_t)cpuindex, gpa, getentryforpaddrp->result_entry); - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - setentryforpaddrp->dst_slabid = guest_slab_index; - setentryforpaddrp->gpa = gpa; - setentryforpaddrp->entry = getentryforpaddrp->result_entry & ~(0x7); - setentryforpaddrp->entry |= 0x7; //execute, read-write - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: deactivated DEP for page at gpa %016llx\n", __func__, (uint16_t)cpuindex, gpa); - - hd_activated=false; - } - } -} - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbhypercall.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbhypercall.c deleted file mode 100644 index f8fb358f05..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbhypercall.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp hypercall handler -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -//@ ghost bool hyperdep_methodcall_hcbhypercall_activatedep = false; -//@ ghost bool hyperdep_methodcall_hcbhypercall_deactivatedep = false; -//@ ghost bool hyperdep_methodcall_hcbhypercall_invalid = false; -/*@ - ensures (call_id == HYPERDEP_ACTIVATEDEP) ==> - (hyperdep_methodcall_hcbhypercall_activatedep == true); - ensures (call_id == HYPERDEP_DEACTIVATEDEP) ==> - (hyperdep_methodcall_hcbhypercall_deactivatedep == true); - ensures !( - (call_id == HYPERDEP_ACTIVATEDEP) || - (call_id == HYPERDEP_DEACTIVATEDEP) - ) ==> (hyperdep_methodcall_hcbhypercall_invalid == true); -@*/ - -static inline void hyperdep_hcbhypercall_helper(uint32_t cpuindex, uint32_t call_id, uint32_t guest_slab_index, uint64_t gpa){ - _XDPRINTF_("%s[%u]: call_id=%x, gpa=%016llx\n", __func__, (uint16_t)cpuindex, call_id, gpa); - - if(call_id == HYPERDEP_ACTIVATEDEP){ - hyperdep_activatedep(cpuindex, guest_slab_index, gpa); - //@ghost hyperdep_methodcall_hcbhypercall_activatedep = true; - - }else if (call_id == HYPERDEP_DEACTIVATEDEP){ - hyperdep_deactivatedep(cpuindex, guest_slab_index, gpa); - //@ghost hyperdep_methodcall_hcbhypercall_deactivatedep = true; - - }else{ - //_XDPRINTF_("%s[%u]: unsupported hypercall %x. Ignoring\n",__func__, (uint16_t)cpuindex, call_id); - //@ghost hyperdep_methodcall_hcbhypercall_invalid = true; - - } -} - -//@ghost bool hyperdep_hcbhypercall_invokehelper=false; -/*@ - ensures hyperdep_hcbhypercall_invokehelper == true; -@*/ -void hyperdep_hcbhypercall(uint32_t cpuindex, uint32_t guest_slab_index){ - slab_params_t spl; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = - (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - x86regs_t *gprs = (x86regs_t *)&gcpustate_gprs->gprs; - uint32_t call_id; - uint64_t gpa; - - spl.in_out_params[0] = spl.in_out_params[1] = spl.in_out_params[2] = spl.in_out_params[3] = 0; - spl.in_out_params[4] = spl.in_out_params[5] = spl.in_out_params[6] = spl.in_out_params[7] = 0; - spl.src_slabid = XMHFGEEC_SLAB_XH_HYPERDEP; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - - call_id = gprs->eax; - gpa = ((uint64_t)gprs->ebx << 32) | gprs->edx; - - hyperdep_hcbhypercall_helper(cpuindex, call_id, guest_slab_index, gpa); - //@ghost hyperdep_hcbhypercall_invokehelper = true; -} diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbinit.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbinit.c deleted file mode 100644 index a21f57473b..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbinit.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - -// initialization handler -void hyperdep_hcbinit(uint32_t cpuindex){ - _XDPRINTF_("%s[%u]: hyperDEP initializing...\n", __func__, (uint16_t)cpuindex); -} - - diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbmemfault.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbmemfault.c deleted file mode 100644 index 2ce1326507..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbmemfault.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - -#include - -//memory fault handler -void hyperdep_hcbmemfault(uint32_t cpuindex, uint32_t guest_slab_index){ - uint64_t errorcode; - uint64_t gpa; - uint64_t gva; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - - spl.src_slabid = XMHFGEEC_SLAB_XH_HYPERDEP; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - - gcpustate_vmrwp->encoding = VMCS_INFO_EXIT_QUALIFICATION; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - errorcode = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_PADDR_FULL; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - gpa = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_LINEAR_ADDRESS; - gcpustate_vmrwp->value=0; - XMHF_SLAB_CALLNEW(&spl); - gva = gcpustate_vmrwp->value; - - if(hd_activated && hd_pageaddr == (uint32_t)gpa){ - _XDPRINTF_("%s[%u]: memory fault in guest slab %u; gpa=%016llx, gva=%016llx, errorcode=%016llx, data page execution. Halting!\n", - __func__, (uint16_t)cpuindex, guest_slab_index, gpa, gva, errorcode); - CASM_FUNCCALL(xmhfhw_cpu_hlt, CASM_NOPARAM); - } -} - - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbshutdown.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbshutdown.c deleted file mode 100644 index 118775266b..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_hcbshutdown.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - -//shutdown handler -void hyperdep_hcbshutdown(uint32_t cpuindex, uint32_t guest_slab_index){ - _XDPRINTF_("%s[%u]: guest slab %u shutdown...\n", __func__, (uint16_t)cpuindex, guest_slab_index); -} - - diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_main.c b/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_main.c deleted file mode 100644 index dccad6f747..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xhhyperdep_main.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -slab_params_t test_sp; -uint32_t cpuid = 0; //BSP cpu -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.src_slabid = framac_nondetu32interval(0, XMHFGEEC_TOTAL_SLABS-1); - test_sp.dst_slabid = XMHFGEEC_SLAB_XH_HYPERDEP; - test_sp.dst_uapifn = framac_nondetu32(); - test_sp.cpuid = cpuid; - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - slab_main(&test_sp); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ - -} -#endif - -//@ ghost bool hyperdep_methodcall_hcbinit = false; -//@ ghost bool hyperdep_methodcall_hcbhypercall = false; -//@ ghost bool hyperdep_methodcall_hcbmemfault = false; -//@ ghost bool hyperdep_methodcall_hcbshutdown = false; -//@ ghost bool hyperdep_methodcall_invalid = false; -/*@ - requires \valid(sp); - ensures (sp->in_out_params[3] == XC_HYPAPPCB_CHAIN); - ensures (sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE) ==> - (hyperdep_methodcall_hcbinit == true); - ensures (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL) ==> - (hyperdep_methodcall_hcbhypercall == true); - ensures (sp->in_out_params[0] == XC_HYPAPPCB_MEMORYFAULT) ==> - (hyperdep_methodcall_hcbmemfault == true); - ensures (sp->in_out_params[0] == XC_HYPAPPCB_SHUTDOWN) ==> - (hyperdep_methodcall_hcbshutdown == true); - - ensures !( - (sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE) || - (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL) || - (sp->in_out_params[0] == XC_HYPAPPCB_MEMORYFAULT) || - (sp->in_out_params[0] == XC_HYPAPPCB_SHUTDOWN) - ) ==> (hyperdep_methodcall_invalid == true); -@*/ -void slab_main(slab_params_t *sp){ - - _XDPRINTF_("XHHYPERDEP[%u]: Got control, cbtype=%x: ESP=%08x\n", - (uint16_t)sp->cpuid, sp->in_out_params[0], CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - - if(sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE){ - hyperdep_hcbinit(sp->cpuid); - //@ghost hyperdep_methodcall_hcbinit = true; - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL){ - hyperdep_hcbhypercall(sp->cpuid, sp->in_out_params[2]); - //@ghost hyperdep_methodcall_hcbhypercall = true; - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_MEMORYFAULT){ - hyperdep_hcbmemfault(sp->cpuid, sp->in_out_params[2]); - //@ghost hyperdep_methodcall_hcbmemfault = true; - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_SHUTDOWN){ - hyperdep_hcbshutdown(sp->cpuid, sp->in_out_params[2]); - //@ghost hyperdep_methodcall_hcbshutdown = true; - - }else{ - //_XDPRINTF_("%s[%u]: Unknown cbtype. Ignoring!\n", __func__, (uint16_t)sp->cpuid); - //@ghost hyperdep_methodcall_invalid = true; - } - - sp->in_out_params[3]=XC_HYPAPPCB_CHAIN; -} diff --git a/uxmhf/xmhf-uobjs/xh_hyperdep/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xh_hyperdep/xmhfgeecslab.mk.in deleted file mode 100644 index 9073f8f486..0000000000 --- a/uxmhf/xmhf-uobjs/xh_hyperdep/xmhfgeecslab.mk.in +++ /dev/null @@ -1,24 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xh_hyperdep -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xhhyperdep_data.c.v.c xhhyperdep_main.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main hyperdep_hcbhypercall -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xhhyperdep_data.c.v.c xhhyperdep_hcbhypercall.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main hyperdep_activatedep -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xhhyperdep_data.c.v.c xhhyperdep_activate.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -slevel 2048 $(VFLAGS) *.c xmhfgeec_*.c *.ag.v.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - - - - diff --git a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace.gsm b/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace.gsm deleted file mode 100644 index fe4177cb99..0000000000 --- a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace.gsm +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include - -#include -#include - - -{ - "uobj-name": "xh_ssteptrace", - "uobj-type": "uVU_SLAB", - "uobj-subtype": "XHYPAPP", - - "uobj-uapifunctions":[], - - "uobj-callees": " uapi_gcpustate - ", - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - } - ], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_code.c b/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_code.c deleted file mode 100644 index d4f85d1cbc..0000000000 --- a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_code.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -//#include -#include - - -////// -//XMHF_SLABNEW(xhssteptrace) - - - -static uint8_t _st_tracebuffer[256]; - -// trace (single-step) on -static void st_on(uint32_t cpuindex, uint32_t guest_slab_index){ - uint32_t guest_rflags; - uint32_t exception_bitmap; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - //spl.in_out_params[0] = XMHF_HIC_UAPI_CPUSTATE; - -if(!ssteptrace_on){ - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_RFLAGS; - XMHF_SLAB_CALLNEW(&spl); - guest_rflags = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_CONTROL_EXCEPTION_BITMAP; - XMHF_SLAB_CALLNEW(&spl); - exception_bitmap = gcpustate_vmrwp->value; - - guest_rflags |= EFLAGS_TF; - exception_bitmap |= (1 << 1); - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_CONTROL_EXCEPTION_BITMAP; - gcpustate_vmrwp->value = exception_bitmap; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_RFLAGS; - gcpustate_vmrwp->value = guest_rflags; - XMHF_SLAB_CALLNEW(&spl); - - ssteptrace_on=true; -} -} - -// trace (single-step) off -static void st_off(uint32_t cpuindex, uint32_t guest_slab_index){ - uint32_t guest_rflags; - uint32_t exception_bitmap; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - //spl.in_out_params[0] = XMHF_HIC_UAPI_CPUSTATE; - - -if(ssteptrace_on){ - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_GUEST_RFLAGS; - XMHF_SLAB_CALLNEW(&spl); - guest_rflags = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_CONTROL_EXCEPTION_BITMAP; - XMHF_SLAB_CALLNEW(&spl); - exception_bitmap = gcpustate_vmrwp->value; - - - guest_rflags &= ~(EFLAGS_TF); - exception_bitmap &= ~(1 << 1); - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_CONTROL_EXCEPTION_BITMAP; - gcpustate_vmrwp->value = exception_bitmap; - XMHF_SLAB_CALLNEW(&spl); - - gcpustate_vmrwp->encoding = VMCS_GUEST_RFLAGS; - gcpustate_vmrwp->value = guest_rflags; - XMHF_SLAB_CALLNEW(&spl); - - ssteptrace_on=false; -} -} - - - - -static uint8_t _st_sigdatabase[][SHA_DIGEST_LENGTH] = { - {0xd1, 0x4e, 0x30, 0x25, 0x8e, 0x16, 0x85, 0x9b, 0x21, 0x81, 0x74, 0x78, 0xbb, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0xa1, 0x4e, 0x30, 0x25, 0x8e, 0x16, 0x85, 0x9b, 0x21, 0x71, 0x74, 0x78, 0xbb, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0xf1, 0x4e, 0x30, 0x25, 0x8e, 0x16, 0x85, 0x9b, 0x21, 0x81, 0x54, 0x78, 0xbb, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, - {0xe1, 0x4e, 0x30, 0x25, 0x9e, 0x16, 0x85, 0x9b, 0x21, 0x81, 0x74, 0x78, 0x6b, 0x1b, 0x5d, 0x99, 0xb5, 0x48, 0x60, 0xca}, -}; - -#define NUMENTRIES_ST_SIGDATABASE (sizeof(_st_sigdatabase)/sizeof(_st_sigdatabase[0])) - - -// scan for a trace match with incoming trace in buffer -static bool st_scanforsignature(uint8_t *buffer, uint32_t buffer_size){ - uint8_t digest[SHA_DIGEST_LENGTH]; - uint64_t i; - - //compute SHA-1 of the buffer - sha1(buffer, buffer_size, digest); - - //compare computed SHA-1 to the signature database - for(i=0; i < NUMENTRIES_ST_SIGDATABASE; i++){ - if(!memcmp(&digest, &_st_sigdatabase[i], SHA_DIGEST_LENGTH)){ - return true; - } - } - - //no match - return false; -} - - - -////// -// hypapp callbacks - - -// initialization -static void _hcb_initialize(uint32_t cpuindex){ - _XDPRINTF_("%s[%u]: xhssteptrace initializing...\n", __func__, - (uint16_t)cpuindex); -} - - -// hypercall -static void _hcb_hypercall(uint32_t cpuindex, uint32_t guest_slab_index){ - slab_params_t spl; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = - (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - x86regs_t *gprs = (x86regs_t *)&gcpustate_gprs->gprs; - uint32_t call_id; - //uint64_t gpa; - - spl.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - //spl.in_out_params[0] = XMHF_HIC_UAPI_CPUSTATE; - - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - - call_id = gprs->eax; - //gpa = ((uint64_t)gprs->edx << 32) | gprs->ebx; - - //_XDPRINTF_("%s[%u]: call_id=%x, gpa=%016llx\n", __func__, (uint16_t)cpuindex, call_id, gpa); - - switch(call_id){ - - case SSTEPTRACE_REGISTER:{ - ssteptrace_codepaddr = gprs->edx; - _XDPRINTF_("%s[%u]: call_id=%x(REGISTER) at paddr=0x%08x\n", __func__, (uint16_t)cpuindex, call_id, ssteptrace_codepaddr); - } - break; - - case SSTEPTRACE_ON:{ - _XDPRINTF_("%s[%u]: call_id=%x(TRACE_ON)\n", __func__, (uint16_t)cpuindex, call_id); - st_on(cpuindex, guest_slab_index); - } - break; - - case SSTEPTRACE_OFF:{ - _XDPRINTF_("%s[%u]: call_id=%x(TRACE_OFF)\n", __func__, (uint16_t)cpuindex, call_id); - st_off(cpuindex, guest_slab_index); - } - break; - - default: - //_XDPRINTF_("%s[%u]: unsupported hypercall %x. Ignoring\n", __func__, (uint16_t)cpuindex, call_id); - break; - } - -} - - -// trap exception -static void _hcb_trap_exception(uint32_t cpuindex, uint32_t guest_slab_index){ - uint32_t info_vmexit_interruption_information; - uint32_t guest_rip, guest_rip_paddr; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - //xmhf_hic_uapi_physmem_desc_t *pdesc = (xmhf_hic_uapi_physmem_desc_t *)&spl.in_out_params[2]; - //xmhf_uapi_slabmemacc_params_t *smemaccp = (xmhf_uapi_slabmemacc_params_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_XH_SSTEPTRACE; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - - if(ssteptrace_on){ - //spl.in_out_params[0] = XMHF_HIC_UAPI_CPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - gcpustate_vmrwp->encoding = VMCS_INFO_VMEXIT_INTERRUPT_INFORMATION; - XMHF_SLAB_CALLNEW(&spl); - info_vmexit_interruption_information = gcpustate_vmrwp->value; - - _XDPRINTF_("%s[%u]: guest slab %u exception %u...\n", - __func__, (uint16_t)cpuindex, guest_slab_index, - (uint8_t)info_vmexit_interruption_information); - - if((uint8_t)info_vmexit_interruption_information != 0x1) - return; - - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - XMHF_SLAB_CALLNEW(&spl); - guest_rip = gcpustate_vmrwp->value; - - //copy 256 bytes from the current guest RIP for trace inference - //spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMACC; - //smemaccp->dst_slabid = guest_slab_index; - //smemaccp->addr_to = &_st_tracebuffer; - //smemaccp->addr_from = guest_rip; - //smemaccp->numbytes = sizeof(_st_tracebuffer); - ////spl.in_out_params[0] = XMHF_HIC_UAPI_PHYSMEM; - // spl.dst_uapifn = XMHF_HIC_UAPI_PHYSMEM_PEEK; - //XMHF_SLAB_CALLNEW(&spl); - - guest_rip_paddr = ssteptrace_codepaddr | (guest_rip & 0x00000FFFUL); - _XDPRINTF_("%s[%u]: guest slab RIP=%x, RIP paddr=0x%08x\n", - __func__, (uint16_t)cpuindex, guest_rip, guest_rip_paddr); - - CASM_FUNCCALL(xmhfhw_sysmemaccess_copy, &_st_tracebuffer, guest_rip_paddr, sizeof(_st_tracebuffer)); - - //try to see if we found a match in our trace database - st_scanforsignature(&_st_tracebuffer, sizeof(_st_tracebuffer)); - _XDPRINTF_("%s[%u]: scan complete\n", - __func__, (uint16_t)cpuindex); - - } - -} - - -// shutdown -static void _hcb_shutdown(uint32_t cpuindex, uint32_t guest_slab_index){ - _XDPRINTF_("%s[%u]: guest slab %u shutdown...\n", - __func__, (uint16_t)cpuindex, guest_slab_index); -} - - - - - - - - - - - -/////// -// slab interface - -//void slab_interface(slab_input_params_t *iparams, uint64_t iparams_size, slab_output_params_t *oparams, uint64_t oparams_size, uint64_t src_slabid, uint64_t cpuindex){ -void slab_main(slab_params_t *sp){ - //xc_hypappcb_inputparams_t *hcb_iparams = (xc_hypappcb_inputparams_t *)iparams; - //xc_hypappcb_outputparams_t *hcb_oparams = (xc_hypappcb_outputparams_t *)oparams; - xc_hypappcb_params_t *hcbp = (xc_hypappcb_params_t *)&sp->in_out_params[0]; - hcbp->cbresult=XC_HYPAPPCB_CHAIN; - - - //_XDPRINTF_("XHSSTEPTRACE[%u]: Got control, cbtype=%x: ESP=%08x\n", - // (uint16_t)sp->cpuid, hcbp->cbtype, CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - - switch(hcbp->cbtype){ - case XC_HYPAPPCB_INITIALIZE:{ - _hcb_initialize(sp->cpuid); - } - break; - - case XC_HYPAPPCB_HYPERCALL:{ - _hcb_hypercall(sp->cpuid, hcbp->guest_slab_index); - } - break; - - //case XC_HYPAPPCB_MEMORYFAULT:{ - // - // - //} - //break; - - case XC_HYPAPPCB_SHUTDOWN:{ - _hcb_shutdown(sp->cpuid, hcbp->guest_slab_index); - } - break; - - //case XC_HYPAPPCB_TRAP_IO:{ - // - // - //} - //break; - - //case XC_HYPAPPCB_TRAP_INSTRUCTION:{ - // - // - //} - //break; - - case XC_HYPAPPCB_TRAP_EXCEPTION:{ - _hcb_trap_exception(sp->cpuid, hcbp->guest_slab_index); - } - break; - - - default:{ - _XDPRINTF_("%s[%u]: Unknown cbtype. Ignoring!\n", - __func__, (uint16_t)sp->cpuid); - } - } - -} diff --git a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_codesup.cS b/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_codesup.cS deleted file mode 100644 index a7dadbe484..0000000000 --- a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_codesup.cS +++ /dev/null @@ -1,45 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ diff --git a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_data.c b/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_data.c deleted file mode 100644 index 12c8eeb88f..0000000000 --- a/uxmhf/xmhf-uobjs/xh_ssteptrace/xh_ssteptrace_data.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// ssteptrace hypapp -- verification manifest -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - - -#if defined (__XMHF_VERIFICATION__) -bool ssteptrace_on= nondet_bool(); -uint32_t ssteptrace_codepaddr = nondet_u32(); - -#else -bool ssteptrace_on = false; -uint32_t ssteptrace_codepaddr = 0; -#endif - -/* -void xhssteptrace_inv_xmhf_hic_uapi_cpustate_vmwrite(uint64_t encoding, uint64_t value){ - if(!ssteptrace_on){ - if(encoding == VMCS_CONTROL_EXCEPTION_BITMAP) - assert( value & (1 << 1) ); - - if(encoding == VMCS_GUEST_RFLAGS) - assert (value & EFLAGS_TF); - } -}*/ diff --git a/uxmhf/xmhf-uobjs/xh_ssteptrace/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xh_ssteptrace/xmhfgeecslab.mk.in deleted file mode 100644 index 9fe61065e2..0000000000 --- a/uxmhf/xmhf-uobjs/xh_ssteptrace/xmhfgeecslab.mk.in +++ /dev/null @@ -1,17 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xh_ssteptrace -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: - @echo Nothing to verify for $(XMHF_SLAB_NAME) - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xh_syscalllog.gsm b/uxmhf/xmhf-uobjs/xh_syscalllog/xh_syscalllog.gsm deleted file mode 100644 index bb3ac2a8dc..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xh_syscalllog.gsm +++ /dev/null @@ -1,128 +0,0 @@ -#include -#include - -#include -#include -#include -#include - -{ - "uobj-name": "xh_syscalllog", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "XHYPAPP", - - "uobj-uapifunctions":[], - - - "uobj-callees": " uapi_gcpustate - uapi_slabmempgtbl - xc_nwlog - ", - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSWRITE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR), - "opt1" : "if (setentryforpaddrp->gpa == 0){setentryforpaddrp->entry = setentryforpaddrp->entry & 7; setentryforpaddrp->entry &= ~(0x4); setentryforpaddrp->entry |=0x1; setentryforpaddrp->entry |= 0x2;}", - "opt2" : "((setentryforpaddrp->gpa != 0) || (setentryforpaddrp->gpa==0 && !(setentryforpaddrp->entry & 0x4) && (setentryforpaddrp->entry & 0x1) && (setentryforpaddrp->entry & 0x2)))" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "xc_nwlog", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_SLAB_XC_NWLOG_INITIALIZE), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "xc_nwlog", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_SLAB_XC_NWLOG_LOGDATA), - "opt1" : "(void)0;", - "opt2" : "(1)" - } - - ], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_data.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_data.c deleted file mode 100644 index c0906f7169..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_data.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp -- verification manifest -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - - -__attribute__((section(".data"))) bool sl_activated=false; -__attribute__((section(".data"))) uint32_t sl_syscall_page_paddr=0; -__attribute__((section(".data"))) uint32_t sl_syscall_shadowpage_vaddr=0; - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbhypercall.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbhypercall.c deleted file mode 100644 index 8a55895beb..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbhypercall.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - - -// hypercall handler -void sysclog_hcbhypercall(uint32_t cpuindex, uint32_t guest_slab_index){ - slab_params_t spl; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = - (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - x86regs_t *gprs = (x86regs_t *)&gcpustate_gprs->gprs; - uint32_t call_id; - uint32_t syscall_page_paddr, syscall_shadowpage_vaddr, syscall_shadowpage_paddr; - - spl.in_out_params[0] = spl.in_out_params[1] = spl.in_out_params[2] = spl.in_out_params[3]=0; - spl.in_out_params[4] = spl.in_out_params[5] = spl.in_out_params[6] = spl.in_out_params[7]=0; - spl.src_slabid = XMHFGEEC_SLAB_XH_SYSCALLLOG; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - - call_id = gprs->eax; - syscall_page_paddr = gprs ->ebx; - syscall_shadowpage_vaddr = gprs->edx; - syscall_shadowpage_paddr = gprs->ecx; - - - switch(call_id){ - - case SYSCALLLOG_REGISTER:{ - //_XDPRINTF_("%s[%u]: call_id=%x, gpa=%016llx\n", __func__, (uint16_t)cpuindex, call_id, gpa); - sysclog_register(cpuindex, guest_slab_index, syscall_page_paddr, syscall_shadowpage_vaddr, syscall_shadowpage_paddr); - } - break; - - default: - //_XDPRINTF_("%s[%u]: unsupported hypercall %x. Ignoring\n", __func__, (uint16_t)cpuindex, call_id); - break; - } - -} - - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbinit.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbinit.c deleted file mode 100644 index c55e5cdd9e..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbinit.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - -// initialization handler -void sysclog_hcbinit(uint32_t cpuindex){ - _XDPRINTF_("%s[%u]: syscalllog initializing...\n", __func__, (uint16_t)cpuindex); - -} - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbmemfault.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbmemfault.c deleted file mode 100644 index f226096847..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_hcbmemfault.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - -//@ghost bool sysclog_hcbmemfault_invokelogger=false; -/*@ - ensures (sysclog_hcbmemfault_invokelogger == true); -@*/ -bool sysclog_hcbmemfault(uint32_t cpuindex, uint32_t guest_slab_index){ - bool result; - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - uint64_t errorcode; - uint64_t gpa; - uint64_t gva; - - spl.src_slabid = XMHFGEEC_SLAB_XH_SYSCALLLOG; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMREAD; - - gcpustate_vmrwp->encoding = VMCS_INFO_EXIT_QUALIFICATION; - //@assert spl.dst_slabid != XMHFGEEC_SLAB_XC_NWLOG; - XMHF_SLAB_CALLNEW(&spl); - errorcode = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_PADDR_FULL; - //@assert spl.dst_slabid != XMHFGEEC_SLAB_XC_NWLOG; - XMHF_SLAB_CALLNEW(&spl); - gpa = gcpustate_vmrwp->value; - - gcpustate_vmrwp->encoding = VMCS_INFO_GUEST_LINEAR_ADDRESS; - //@assert spl.dst_slabid != XMHFGEEC_SLAB_XC_NWLOG; - XMHF_SLAB_CALLNEW(&spl); - gva = gcpustate_vmrwp->value; - - result = sysclog_loginfo(cpuindex, guest_slab_index, gpa, gva, errorcode); - //@ghost sysclog_hcbmemfault_invokelogger = true; - - return result; -} - - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_loginfo.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_loginfo.c deleted file mode 100644 index 2809bea15b..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_loginfo.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include -#include - -//@ghost bool sysclog_loginfo_nwlogged=false; -/*@ - - behavior yes_log: - assumes (sl_activated && (((uint32_t)gpa & 0xFFFFF000UL) == sl_syscall_page_paddr)); - ensures sysclog_loginfo_nwlogged == true; - - behavior no_log: - assumes !(sl_activated && (((uint32_t)gpa & 0xFFFFF000UL) == sl_syscall_page_paddr)); - ensures sysclog_loginfo_nwlogged == false; - - complete behaviors; - disjoint behaviors; -@*/ -bool sysclog_loginfo(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa, uint64_t gva, uint64_t errorcode){ - slab_params_t spl; - xmhf_uapi_gcpustate_vmrw_params_t *gcpustate_vmrwp = - (xmhf_uapi_gcpustate_vmrw_params_t *)spl.in_out_params; - - if(sl_activated && (((uint32_t)gpa & 0xFFFFF000UL) == sl_syscall_page_paddr)){ - - _XDPRINTF_("%s[%u]: syscall trapping in guest slab %u; gpa=0x%08x, gva=0x%08x, errorcode=0x%08x\n", - __func__, (uint16_t)cpuindex, guest_slab_index, (uint32_t)gpa, (uint32_t)gva, (uint32_t)errorcode); - - - spl.src_slabid = XMHFGEEC_SLAB_XH_SYSCALLLOG; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - - //read GPR state - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - //@assert spl.dst_slabid == XMHFGEEC_SLAB_UAPI_GCPUSTATE && spl.dst_uapifn == XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - - //log GPR state for syscall - spl.dst_slabid = XMHFGEEC_SLAB_XC_NWLOG; - spl.dst_uapifn = XMHFGEEC_SLAB_XC_NWLOG_LOGDATA; - //@assert spl.dst_slabid == XMHFGEEC_SLAB_XC_NWLOG && spl.dst_uapifn == XMHFGEEC_SLAB_XC_NWLOG_LOGDATA; - XMHF_SLAB_CALLNEW(&spl); - //@ghost sysclog_loginfo_nwlogged = true; - - //set guest RIP to shadow syscall page to continue execution - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_VMWRITE; - gcpustate_vmrwp->encoding = VMCS_GUEST_RIP; - gcpustate_vmrwp->value = sl_syscall_shadowpage_vaddr | ((uint32_t)gpa & 0x00000FFFUL); - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: syscall trapping reset eip to 0x%08x\n", - __func__, (uint16_t)cpuindex, gcpustate_vmrwp->value); - - return true; - }else{ - //do nothing - //@ghost sysclog_loginfo_nwlogged = false; - return false; - } - -} - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_main.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_main.c deleted file mode 100644 index 6439474aca..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_main.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -slab_params_t test_sp; -uint32_t cpuid = 0; //BSP cpu -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.src_slabid = framac_nondetu32interval(0, XMHFGEEC_TOTAL_SLABS-1); - test_sp.dst_slabid = XMHFGEEC_SLAB_XH_SYSCALLLOG; - test_sp.dst_uapifn = framac_nondetu32(); - test_sp.cpuid = cpuid; - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - slab_main(&test_sp); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ - - sysclog_register(framac_nondetu32(), framac_nondetu32(), framac_nondetu32(), framac_nondetu32(), framac_nondetu32()); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ - -} -#endif - -//@ ghost bool sysclog_methodcall_hcbinit = false; -//@ ghost bool sysclog_methodcall_hcbhypercall = false; -//@ ghost bool sysclog_methodcall_hcbmemfault = false; -//@ ghost bool sysclog_methodcall_invalid = false; -/*@ - requires \valid(sp); - - ensures (sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE) ==> - (sysclog_methodcall_hcbinit == true && (sp->in_out_params[3] == XC_HYPAPPCB_CHAIN)); - ensures (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL) ==> - (sysclog_methodcall_hcbhypercall == true && (sp->in_out_params[3] == XC_HYPAPPCB_CHAIN)); - ensures (sp->in_out_params[0] == XC_HYPAPPCB_MEMORYFAULT) ==> - (sysclog_methodcall_hcbmemfault == true && (sp->in_out_params[3] == XC_HYPAPPCB_CHAIN || sp->in_out_params[3] == XC_HYPAPPCB_NOCHAIN)); - - ensures !( - (sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE) || - (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL) || - (sp->in_out_params[0] == XC_HYPAPPCB_MEMORYFAULT) - ) ==> (sysclog_methodcall_invalid == true); -@*/ - -void slab_main(slab_params_t *sp){ - - //_XDPRINTF_("XHSYSCALLLOG[%u]: Got control, cbtype=%x: ESP=%08x\n", - // (uint16_t)sp->cpuid, sp->in_out_params[0], CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - if( sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE){ - sysclog_hcbinit(sp->cpuid); - //@ghost sysclog_methodcall_hcbinit = true; - sp->in_out_params[3]= XC_HYPAPPCB_CHAIN; - - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL){ - sysclog_hcbhypercall(sp->cpuid, sp->in_out_params[2]); - //@ghost sysclog_methodcall_hcbhypercall = true; - sp->in_out_params[3]= XC_HYPAPPCB_CHAIN; - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_MEMORYFAULT){ - if(sysclog_hcbmemfault(sp->cpuid, sp->in_out_params[2])) - sp->in_out_params[3] = XC_HYPAPPCB_NOCHAIN; - else - sp->in_out_params[3] = XC_HYPAPPCB_CHAIN; - //@ghost sysclog_methodcall_hcbmemfault = true; - - }else{ - //_XDPRINTF_("%s[%u]: Unknown cbtype. Ignoring!\n",__func__, (uint16_t)sp->cpuid); - sp->in_out_params[3]= XC_HYPAPPCB_CHAIN; - //@ghost sysclog_methodcall_invalid = true; - } - -} diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_register.c b/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_register.c deleted file mode 100644 index 107b4cff32..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xhsysclog_register.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// syscalllog hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include -#include - -#include - -//register a syscall handler code page (at gpa) -void sysclog_register(uint32_t cpuindex, uint32_t guest_slab_index, uint32_t syscall_page_paddr, uint32_t syscall_shadowpage_vaddr, uint32_t syscall_shadowpage_paddr){ - - slab_params_t spl; - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *flushtlbp = - (xmhfgeec_uapi_slabmempgtbl_flushtlb_params_t *)spl.in_out_params; - - - _XDPRINTF_("%s[%u]: gid=%u, syscall_page_paddr=0x%08x\n", - __func__, (uint16_t)cpuindex, guest_slab_index, syscall_page_paddr); - _XDPRINTF_("%s[%u]: syscall_shadowpage_vaddr=0x%08x, syscall_shadowpage_paddr=0x%08x\n", - __func__, (uint16_t)cpuindex, syscall_shadowpage_vaddr, syscall_shadowpage_paddr); - - spl.src_slabid = XMHFGEEC_SLAB_XH_SYSCALLLOG; - spl.cpuid = cpuindex; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = syscall_page_paddr; - getentryforpaddrp->result_entry = 0; - XMHF_SLAB_CALLNEW(&spl); - _XDPRINTF_("%s[%u]: syscall_page existing entry = 0x%08x\n", - __func__, (uint16_t)cpuindex, (uint32_t)getentryforpaddrp->result_entry); - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - setentryforpaddrp->dst_slabid = guest_slab_index; - setentryforpaddrp->gpa = syscall_page_paddr; - setentryforpaddrp->entry = getentryforpaddrp->result_entry & ~(0x4); - XMHF_SLAB_CALLNEW(&spl); - _XDPRINTF_("%s[%u]: syscall_page new entry = 0x%08x\n", - __func__, (uint16_t)cpuindex, (uint32_t)setentryforpaddrp->entry); - - //flush EPT TLB for permission changes to take effect - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_FLUSHTLB; - flushtlbp->dst_slabid = guest_slab_index; - XMHF_SLAB_CALLNEW(&spl); - - //initialize network comms - spl.src_slabid = XMHFGEEC_SLAB_XH_SYSCALLLOG; - spl.dst_slabid = XMHFGEEC_SLAB_XC_NWLOG; - spl.cpuid = cpuindex; - spl.dst_uapifn = XMHFGEEC_SLAB_XC_NWLOG_INITIALIZE; - XMHF_SLAB_CALLNEW(&spl); - - sl_syscall_page_paddr = syscall_page_paddr; - sl_syscall_shadowpage_vaddr = syscall_shadowpage_vaddr; - sl_activated=true; -} - - diff --git a/uxmhf/xmhf-uobjs/xh_syscalllog/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xh_syscalllog/xmhfgeecslab.mk.in deleted file mode 100644 index 7b557e185e..0000000000 --- a/uxmhf/xmhf-uobjs/xh_syscalllog/xmhfgeecslab.mk.in +++ /dev/null @@ -1,22 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xh_syscalllog -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: verifybase - @echo Proceeding to verify $(XMHF_SLAB_NAME)... - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main slab_main -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xhsysclog_data.c.v.c xhsysclog_main.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main sysclog_hcbmemfault -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xhsysclog_data.c.v.c xhsysclog_hcbmemfault.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -main sysclog_loginfo -lib-entry -wp -wp-rte -wp-model +cint+cast -wp-prover alt-ergo,cvc3,z3 -cpp-extra-args=-nostdinc $(VFLAGS) xhsysclog_data.c.v.c xhsysclog_loginfo.c.v.c - cd $(XMHF_SLAB_VERIFICATION_DIR) && frama-c -no-frama-c-stdlib -val -cpp-extra-args=-nostdinc -cpp-extra-args=-D__USPARK_FRAMAC_VA__ -slevel 2048 $(VFLAGS) *.c xmhfgeec_*.c *.ag.v.c libxmhfhw/*.v.c $(V_XMHFHWM_MODULES) - - diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xh_uhcalltest.gsm b/uxmhf/xmhf-uobjs/xh_uhcalltest/xh_uhcalltest.gsm deleted file mode 100644 index bfdd75bbb9..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xh_uhcalltest.gsm +++ /dev/null @@ -1,88 +0,0 @@ -#include -#include - -#include -#include -#include - -{ - "uobj-name": "xh_uhcalltest", - "uobj-type": "VfT_SLAB", - "uobj-subtype": "XHYPAPP", - - "uobj-uapifunctions":[], - - "uobj-callees": " uapi_gcpustate - uapi_slabmempgtbl - ", - - "uobj-uapicallees":[ - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_VMREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_gcpustate", - "uobj-uapifunctionid": USMF_STR(XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR), - "opt1" : "(void)0;", - "opt2" : "(1)" - }, - { - "uobj-name": "uapi_slabmempgtbl", - "uobj-uapifunctionid": USMF_STR(XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR), - "opt1" : "{setentryforpaddrp->entry=setentryforpaddrp->entry&7; setentryforpaddrp->entry&=~0x4; setentryforpaddrp->entry|=0x1; setentryforpaddrp->entry|=0x2;}", - "opt2" : "(!(setentryforpaddrp->entry & 0x4) && (setentryforpaddrp->entry & 0x1) && (setentryforpaddrp->entry & 0x2))" - } - ], - - - "uobj-resource-devices":[], - - "uobj-resource-memory":[], - - "uobj-exportfunctions": "", - - - "uobj-binary-sections":[ - { - "section-name": "code", - "section-size": "0x200000" - }, - { - "section-name": "data", - "section-size": "0x200000" - }, - { - "section-name": "stack", - "section-size": "0x600000" - }, - { - "section-name": "dmadata", - "section-size": "0x200000" - } - ], - - - "c-files": "", - - "v-harness": [] - - -} - - - - - - - - - diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_copy.c b/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_copy.c deleted file mode 100644 index 06f58913fb..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_copy.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// uhcalltest hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - - -void uhcalltest_copy(uint32_t cpuindex, uint32_t guest_slab_index, uint64_t gpa){ - slab_params_t spl; - xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *getentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_getentryforpaddr_params_t *)spl.in_out_params; - xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *setentryforpaddrp = - (xmhfgeec_uapi_slabmempgtbl_setentryforpaddr_params_t *)spl.in_out_params; - - spl.src_slabid = XMHFGEEC_SLAB_XH_UHCALLTEST; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_SLABMEMPGTBL; - spl.cpuid = cpuindex; - - if( gpa != 0){ - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_GETENTRYFORPADDR; - getentryforpaddrp->dst_slabid = guest_slab_index; - getentryforpaddrp->gpa = gpa; - //@assert getentryforpaddrp->gpa == gpa; - XMHF_SLAB_CALLNEW(&spl); - - _XDPRINTF_("%s[%u]: original entry for gpa=%016llx is %016llx\n", - __func__, (uint16_t)cpuindex, - gpa, getentryforpaddrp->result_entry); - - spl.dst_uapifn = XMHFGEEC_UAPI_SLABMEMPGTBL_SETENTRYFORPADDR; - setentryforpaddrp->dst_slabid = guest_slab_index; - setentryforpaddrp->gpa = gpa; - setentryforpaddrp->entry = getentryforpaddrp->result_entry & ~(0x4); //execute-disable - //@assert setentryforpaddrp->gpa == gpa; - //@assert !(setentryforpaddrp->entry & 0x4); - XMHF_SLAB_CALLNEW(&spl); - - uhcalltest_param_t *uhctp; - uhctp = (uhcalltest_param_t *)gpa; - memcpy(uhctp->out, uhctp->in, 16); - - _XDPRINTF_("%s[%u]: finished uhcalltest \n", - __func__, (uint16_t)cpuindex); - }else{ - //do nothing - } -} diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_data.c b/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_data.c deleted file mode 100644 index a699b85c68..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_data.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// uhcalltest -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - - -#if defined (__XMHF_VERIFICATION__) - -#else - -#endif - diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcb_init.c b/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcb_init.c deleted file mode 100644 index f744a44417..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcb_init.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// uhcalltest hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - -// initialization handler -void uhcalltest_hcbinit(uint32_t cpuindex){ - _XDPRINTF_("%s[%u]: uhcalltest initializing...\n", __func__, (uint16_t)cpuindex); -} - - diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcbhypercall.c b/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcbhypercall.c deleted file mode 100644 index 6263c101a7..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcbhypercall.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp hypercall handler -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -static inline void uhcalltest_hcbhypercall_helper(uint32_t cpuindex, uint32_t call_id, uint32_t guest_slab_index, uint64_t gpa){ - _XDPRINTF_("%s[%u]: call_id=%x, gpa=%016llx\n", __func__, (uint16_t)cpuindex, call_id, gpa); - - if(call_id == UAPP_UHCALLTEST_FUNCTION_TEST){ - uhcalltest_copy(cpuindex, guest_slab_index, gpa); - }else{ - _XDPRINTF_("%s[%u]: unsupported hypercall %x. Ignoring\n",__func__, (uint16_t)cpuindex, call_id); - - } -} - -void uhcalltest_hcbhypercall(uint32_t cpuindex, uint32_t guest_slab_index){ - slab_params_t spl; - xmhf_uapi_gcpustate_gprs_params_t *gcpustate_gprs = - (xmhf_uapi_gcpustate_gprs_params_t *)spl.in_out_params; - x86regs_t *gprs = (x86regs_t *)&gcpustate_gprs->gprs; - uint32_t call_id; - uint64_t gpa; - - spl.in_out_params[0] = spl.in_out_params[1] = spl.in_out_params[2] = spl.in_out_params[3] = 0; - spl.in_out_params[4] = spl.in_out_params[5] = spl.in_out_params[6] = spl.in_out_params[7] = 0; - spl.src_slabid = XMHFGEEC_SLAB_XH_UHCALLTEST; - spl.dst_slabid = XMHFGEEC_SLAB_UAPI_GCPUSTATE; - spl.cpuid = cpuindex; - spl.dst_uapifn = XMHF_HIC_UAPI_CPUSTATE_GUESTGPRSREAD; - XMHF_SLAB_CALLNEW(&spl); - - call_id = gprs->eax; - gpa = ((uint64_t)gprs->ebx << 32) | gprs->edx; - - uhcalltest_hcbhypercall_helper(cpuindex, call_id, guest_slab_index, gpa); -} diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcbshutdown.c b/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcbshutdown.c deleted file mode 100644 index 515baa0e88..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_hcbshutdown.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include - -//shutdown handler -void uhcalltest_hcbshutdown(uint32_t cpuindex, uint32_t guest_slab_index){ - _XDPRINTF_("%s[%u]: guest slab %u shutdown...\n", __func__, (uint16_t)cpuindex, guest_slab_index); -} - - diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_main.c b/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_main.c deleted file mode 100644 index 1e870bf21a..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xhuhcalltest_main.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -// hyperdep hypapp main module -// author: amit vasudevan (amitvasudevan@acm.org) - -#include -#include -#include - -#include -#include -#include - -#include - - -#if defined (__XMHF_VERIFICATION__) && defined (__USPARK_FRAMAC_VA__) -slab_params_t test_sp; -uint32_t cpuid = 0; //BSP cpu -uint32_t check_esp, check_eip = CASM_RET_EIP; - -void main(void){ - //populate hardware model stack and program counter - xmhfhwm_cpu_gprs_esp = _slab_tos[cpuid]; - xmhfhwm_cpu_gprs_eip = check_eip; - check_esp = xmhfhwm_cpu_gprs_esp; // pointing to top-of-stack - - test_sp.src_slabid = framac_nondetu32interval(0, XMHFGEEC_TOTAL_SLABS-1); - test_sp.dst_slabid = XMHFGEEC_SLAB_XH_UHCALLTEST; - test_sp.dst_uapifn = framac_nondetu32(); - test_sp.cpuid = cpuid; - test_sp.in_out_params[0] = framac_nondetu32(); test_sp.in_out_params[1] = framac_nondetu32(); - test_sp.in_out_params[2] = framac_nondetu32(); test_sp.in_out_params[3] = framac_nondetu32(); - test_sp.in_out_params[4] = framac_nondetu32(); test_sp.in_out_params[5] = framac_nondetu32(); - test_sp.in_out_params[6] = framac_nondetu32(); test_sp.in_out_params[7] = framac_nondetu32(); - test_sp.in_out_params[8] = framac_nondetu32(); test_sp.in_out_params[9] = framac_nondetu32(); - test_sp.in_out_params[10] = framac_nondetu32(); test_sp.in_out_params[11] = framac_nondetu32(); - test_sp.in_out_params[12] = framac_nondetu32(); test_sp.in_out_params[13] = framac_nondetu32(); - test_sp.in_out_params[14] = framac_nondetu32(); test_sp.in_out_params[15] = framac_nondetu32(); - - slab_main(&test_sp); - - /*@assert ((xmhfhwm_cpu_state == CPU_STATE_RUNNING && xmhfhwm_cpu_gprs_esp == check_esp && xmhfhwm_cpu_gprs_eip == check_eip) || - (xmhfhwm_cpu_state == CPU_STATE_HALT)); - @*/ - -} -#endif - -void slab_main(slab_params_t *sp){ - - _XDPRINTF_("XHUHCALLTEST[%u]: Got control, cbtype=%x: ESP=%08x\n", - (uint16_t)sp->cpuid, sp->in_out_params[0], CASM_FUNCCALL(read_esp,CASM_NOPARAM)); - - - if(sp->in_out_params[0] == XC_HYPAPPCB_INITIALIZE){ - uhcalltest_hcbinit(sp->cpuid); - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_HYPERCALL){ - uhcalltest_hcbhypercall(sp->cpuid, sp->in_out_params[2]); - - }else if (sp->in_out_params[0] == XC_HYPAPPCB_SHUTDOWN){ - uhcalltest_hcbshutdown(sp->cpuid, sp->in_out_params[2]); - - }else{ - _XDPRINTF_("%s[%u]: Unknown cbtype. Ignoring!\n", __func__, (uint16_t)sp->cpuid); - //@ghost hyperdep_methodcall_invalid = true; - } - - sp->in_out_params[3]=XC_HYPAPPCB_CHAIN; -} diff --git a/uxmhf/xmhf-uobjs/xh_uhcalltest/xmhfgeecslab.mk.in b/uxmhf/xmhf-uobjs/xh_uhcalltest/xmhfgeecslab.mk.in deleted file mode 100644 index b8cf7810e9..0000000000 --- a/uxmhf/xmhf-uobjs/xh_uhcalltest/xmhfgeecslab.mk.in +++ /dev/null @@ -1,18 +0,0 @@ -######################################################################## -# -# options that each slab will customize -# author: amit vasudevan (amitvasudevan@acm.org) -# -######################################################################## - -export XMHF_SLAB_NAME := xh_uhcalltest -export XMHF_SLAB_SOURCES := $(wildcard $(srcdir)/*.c) - - -######################################################################## - -.PHONY: verify -verify: - @echo Nothing to verify for $(XMHF_SLAB_NAME) - - diff --git a/xmhf/CHANGELOG.md b/xmhf/CHANGELOG.md deleted file mode 100644 index bc1bf2f246..0000000000 --- a/xmhf/CHANGELOG.md +++ /dev/null @@ -1,73 +0,0 @@ -Introduction -============ - -XMHF is an eXtensible and Modular Hypervisor Framework -that strives to be a -comprehensible and flexible platform for performing -hypervisor research and development. The framework allows others to -build custom (security-sensitive) hypervisor-based solutions -(called "hypapps"). - -XMHF is designed to achieve three goals – modular extensibility, -automated verification, and high performance. XMHF includes a -core that provides functionality common to many hypervisor-based security -architectures and supports extensions that augment the core with -additional security or functional properties while preserving the -fundamental hypervisor security property of memory integrity -(i.e., ensuring that the hypervisor’s memory is not modified by -software running at a lower privilege level). - -XMHF advocates a "rich" single-guest execution model where the -hypervisor framework supports only a single-guest and allows the -guest direct access to all performance-critical system devices and -device interrupts. - -XMHF currently runs on recent multicore x86 hardware -virtualized platforms with support for dynamic root of trust -and nested (2-dimensional) paging. The framework is capable of -running unmodified legacy multiprocessor capable OSes such as -Windows and Linux. - -Documentation is automatically generated from markdown files in the -code repository, and is viewable at http://xmhf.sourceforge.net/doc/ - - -Changelog -========= - - * 0.1 Initial Release - * 0.1.1 - * Added TPM performance profiling. - * Stability improvements (ticket-28 fixed). - * Intercept handling now serialized in the core. - * XMHF now builds and runs on Ubuntu 12.04 (precise). - * Replaced LGPL tlsf implementation with public domain implementation. - * Added design-documents. - * 0.1.2 - * xmhf-core: stability improvements (ticket-73 fixed) - we can now handle guest NMIs gracefully - * xmhf-core: stability improvements (ticket-10 fixed) - we now support stock MTRR-enabled (linux) guest kernels on Intel platforms - * test-bed fixes, refactoring and improvements - now supporting 3.2.0-27-generic (and below) with ubuntu - * added documentation generator which takes in-tree markdown files and generates html output - * fixed build target install-bin to include correct destination path - * 0.2 - * xmhf-core: clarify documentation and add description for build configuration options and verification - * xmhf-core: add build configuration options --with-target-platform and --with-target-arch to choose target platform and CPU arch. - * xmhf-core: restructure core components and general cleanup - * xmhf-core: add XMHF/hypapp verification harness for verifying core memory integrity - * xmhf-core: fix build error with --enable-debug-vga configure option - * 0.2.1 - * tools: add scripts to deal with release tasks - * xmhf-core: refactor runtime build harness - * xmhf-core: add build debug information within generated binaries - * xmhf-core: segregate Dynamic Root-of-Trust and DMA protection logic and build configuration options - * xmhf-core: add support for upto 8 CPU cores (ticket-74) - * xmhf-core: add XSETBV intercept handling on Intel platforms for CPUs with XSAVE capabilities (ticket-74) - * xmhf-core: fix MTRR logic on Intel platforms to obtain required variable range MTRRs (ticket-74) - * xmhf-core: fix issue related to physical/virtual address overlap for runtime (ticket-31) - * 0.2.2 - * various general documentation fixes and cleanup - * tee-sdk: added patches for newlib and openssl libraries and removed deprecated/non-working examples - * re-organized framework components and revised configuration/build harness and related documentation - * fixed build errors with gcc 4.6.3 - * xmhf-core: re-factored verification harness and added support for 64-bit CBMC - diff --git a/xmhf/COPYING.md b/xmhf/COPYING.md deleted file mode 100644 index 0be5260ecf..0000000000 --- a/xmhf/COPYING.md +++ /dev/null @@ -1,1075 +0,0 @@ -This repository includes several sub-projects, many of which use code -from multiple sources, under different licenses. The AUTHORITATIVE -licenses and conditions are in file-headers and notices in the -individual sub-projects. - -For CONVENIENCE, we here attempt to summarize the state of -licensing for this repository. - -Our view on licensing -===================== - -Our preference is for permissive licenses allowing binary -distribution, though possibly requiring attribution. This is motivated -by several factors: - -1. This project is partially sponsored with government funding. For -this reason it makes sense to make it a "public good" with very few -restrictions. - -2. This project is partially sponsored by independent corporations. We -would like them to be able to view and use the code without fear of -legal entanglements. - -3. We believe that placing fewer restrictions on this code will help -it be used more widely and have greater impact. - -For these reasons, code generated specifically for this project is -placed under a BSD-style license, as in the accompanying [LICENSE](LICENSE) -file. - -We have attempted to minimize the incorporation of third party code -that would place additional restrictions on how our code is used. We -currently use some GPL code, though we continue to seek non-GPL -alternatives. See below for more details. - -Unmodified distribution -======================= - -All software in this repository is under some form of open source -license. You are free to use and distribute the unmodified source code. - -Derived works -============= - -Most of the source licenses have some form of attribution clause -requiring that any modifications leave the copyright and license -information place, and that distributed binaries be accompanied with -that copyright and license information. - -We attempt to avoid GPL-style licenses requiring that derived works -also be under GPL-style licenses. However, there is currently some GPL -code in this repository. See below. - -Binary distribution -=================== - -There is currently some GPL-licensed code in this repository. See below. - -GPL status of sub-projects -========================== - -* xmhf: - No GPL. - - * libbaremetal: - No GPL. - - * third-party: - No GPL. - -* trustvisor: - No GPL. - - * tee-sdk: - hypapps/trustvisor/tee-sdk/ports/newlib is GPLv2. Therefore, PALs - that link with newlib are necessarily GPLv2, including some of the - examples in hypapps/trustvisor/tee-sdk/examples. - -* lockdown: - The lockdown hypervisor itself is not GPL. Some third-party - tools may be, though. See lockdown/src/COPYING for a summary. - -* tools: - No GPL. - -Third party code in repository history -====================================== - -We attempt to summarize third-party code and their respective -licenses that appear somewhere in the history of this repository. -Note that these are no longer present in a checkout of the current -HEAD of the repository, but git always retrieves the exhaustive history. - -* OSLO (GPLv2), -* Putty (MIT license), -* OpenSSH (BSD), -* Linux kernel (GPLv2), -* Xen (GPLv2) -* Google Protocol Buffers (Apache 2.0) -* amtterm (GPLv2) (NOTE: A copy of amtterm's source code was accidentally - updated with our own headers in a now-defunct demo subdirectory of - TrustVisor. This was in error.) -* tlsf_malloc (special LGPL) - -Third party code in current HEAD as of 2013-10-21 -================================================= - -We attempt to summarize third-party code and their respective -license that appear in the current repository HEAD. - -* libtommath (WTFPL) -* libtomcrypto (WTFPL) -* Tboot (BSD-style) -* OpenSSL (BSD-style), -* newlib (GPL) -* tlsf.baisoku.org (public domain) - -Lockdown-specific: - -* RTFM Inc ssldump (http://www.rtfm.com/ssldump/) (BSD) -* LPCUSB, an USB device driver for LPC microcontrollers (BSD) -* LPC ARM processor runtime environment (no restrictions) -* Generic ARM CRC module by Gary S. Brown (no restrictions) - -Notices that must be reproduced -=============================== - -We attempt to catalogue license headers in source files that are -required to be included in any binary-only distribution (i.e., typical -BSD-style requirement): - -XMHF ----- - ----------------------------------------------------------------------- - - Copyright (c) 2003-2010, Intel Corporation - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------- - - Copyright (c) 2007 Henric Jungheim - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------------------------------------------------------------- - -Lockdown --------- - ----------------------------------------------------------------------- - /** - - Copyright (C) 1999-2000 RTFM, Inc. - All Rights Reserved - - This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla - and licensed by RTFM, Inc. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - - This product includes software developed by Eric Rescorla for - RTFM, Inc. - - 4. Neither the name of RTFM, Inc. nor the name of Eric Rescorla may be - used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY ERIC RESCORLA AND RTFM, INC. ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY SUCH DAMAGE. - - */ - ----------------------------------------------------------------------- - - /*- - ****************************************************************************** - * - * $RCSfile: $ - * $Revision: $ - * - * Header file for Philips LPC ARM Processors. - * Copyright 2004 R O SoftWare - * - * No guarantees, warrantees, or promises, implied or otherwise. - * May be used for hobby or commercial purposes provided copyright - * notice remains intact. - * - *****************************************************************************/ - ----------------------------------------------------------------------- - - /*- - LPCUSB, an USB device driver for LPC microcontrollers - Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -------------------------------------------------------------------- - -Automatically extracted ------------------------ - -The following are automatically extracted headers from files with -FreeBSD-style C-style license header comments starting with `/*-` (note -the dash). One way to identify such files: `egrep -rl '^\/\*-' > -filelist.txt` One way to do most of the heavy lifting (w/ a few false -positives): - - for i in `cat filelist.txt`; do \ - perl -n -e 'print "$_" if /\/\*-/ .. /\*\//;' $i; \ - done - --------------------------------------------------------------------- - - /*- - ** Two Level Segregated Fit memory allocator, version 1.9. - ** Written by Matthew Conte, and placed in the Public Domain. - ** http://tlsf.baisoku.org - ** - ** Based on the original documentation by Miguel Masmano: - ** http://rtportal.upv.es/rtmalloc/allocators/tlsf/index.shtml - ** - ** Please see the accompanying Readme.txt for implementation - ** notes and caveats. - ** - ** This implementation was written to the specification - ** of the document, therefore no GPL restrictions apply. - */ - /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz and Don Ahn. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - */ - /*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)ns16550.h 7.1 (Berkeley) 5/9/91 - * $FreeBSD: src/sys/dev/ic/ns16550.h,v 1.20 2010/01/11 04:13:06 imp Exp $ - */ - /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)strtoul.c 8.1 (Berkeley) 6/4/93 - */ - /*- - * Copyright (c) 2001 Mike Barcroft - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/stdint.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * $FreeBSD: stable/8/sys/i386/include/_limits.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1987, 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)endian.h 7.8 (Berkeley) 4/3/91 - * $FreeBSD: stable/8/sys/i386/include/endian.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 2001, 2002 Mike Barcroft - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/i386/include/_stdint.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/_null.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1982, 1986, 1991, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)types.h 8.6 (Berkeley) 2/19/95 - * $FreeBSD: stable/8/sys/sys/types.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 2002 Mike Barcroft - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD: stable/8/sys/i386/include/_types.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)libkern.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/sys/libkern.h,v 1.60.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $ - */ - /*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * $FreeBSD: stable/8/sys/i386/include/limits.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Berkeley Software Design, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/sys/cdefs.h,v 1.102.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $ - */ - /*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ - * $FreeBSD: stable/8/sys/i386/include/_inttypes.h 213956 2010-10-17 12:11:42Z marius $ - */ - /*- - * Copyright (c) 2002 Maxime Henrion - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/stddef.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/limits.h 219757 2011-03-18 22:35:48Z jilles $ - */ - /*- - * Copyright (c) 1982, 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/ctype.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 2002 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: stable/8/sys/sys/endian.h 199583 2009-11-20 15:27:52Z jhb $ - */ - /*- - * Copyright (c) 1986, 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 - */ - /*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - /*- - * Copyright (c) 2008 Damien Bergamini - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ ------------------------------------------------------------- diff --git a/xmhf/LICENSE b/xmhf/LICENSE deleted file mode 100644 index 43ad96f45c..0000000000 --- a/xmhf/LICENSE +++ /dev/null @@ -1,46 +0,0 @@ -The following license and copyright notice applies to all content in -this repository where some other license does not take precedence. In -particular, notices in sub-project directories and individual source -files take precedence over this file. - -See COPYING for more information. - -eXtensible, Modular Hypervisor Framework (XMHF) -Copyright (c) 2009-2012 Carnegie Mellon University -Copyright (c) 2010-2012 VDG Inc. -All Rights Reserved. - -Developed by: XMHF Team - Carnegie Mellon University / CyLab - VDG Inc - http://xmhf.org - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the -distribution. - -Neither the names of Carnegie Mellon or VDG Inc, nor the names of -its contributors may be used to endorse or promote products derived -from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/xmhf/xmhf/README.md b/xmhf/README.md similarity index 100% rename from xmhf/xmhf/README.md rename to xmhf/README.md diff --git a/xmhf/xmhf/src/libbaremetal/Makefile b/xmhf/src/libbaremetal/Makefile similarity index 100% rename from xmhf/xmhf/src/libbaremetal/Makefile rename to xmhf/src/libbaremetal/Makefile diff --git a/xmhf/xmhf/src/libbaremetal/README.md b/xmhf/src/libbaremetal/README.md similarity index 100% rename from xmhf/xmhf/src/libbaremetal/README.md rename to xmhf/src/libbaremetal/README.md diff --git a/xmhf/xmhf/src/libbaremetal/libtpm/Makefile b/xmhf/src/libbaremetal/libtpm/Makefile similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtpm/Makefile rename to xmhf/src/libbaremetal/libtpm/Makefile diff --git a/xmhf/xmhf/src/libbaremetal/libtpm/README.TXT b/xmhf/src/libbaremetal/libtpm/README.TXT similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtpm/README.TXT rename to xmhf/src/libbaremetal/libtpm/README.TXT diff --git a/xmhf/xmhf/src/libbaremetal/libtpm/include/tpm.h b/xmhf/src/libbaremetal/libtpm/include/tpm.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtpm/include/tpm.h rename to xmhf/src/libbaremetal/libtpm/include/tpm.h diff --git a/xmhf/xmhf/src/libbaremetal/libtpm/tpm.c b/xmhf/src/libbaremetal/libtpm/tpm.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtpm/tpm.c rename to xmhf/src/libbaremetal/libtpm/tpm.c diff --git a/xmhf/xmhf/src/libbaremetal/libtpm/tpm_extra.c b/xmhf/src/libbaremetal/libtpm/tpm_extra.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtpm/tpm_extra.c rename to xmhf/src/libbaremetal/libtpm/tpm_extra.c diff --git a/xmhf/xmhf/src/libbaremetal/libtv_utpm/Makefile b/xmhf/src/libbaremetal/libtv_utpm/Makefile similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtv_utpm/Makefile rename to xmhf/src/libbaremetal/libtv_utpm/Makefile diff --git a/xmhf/xmhf/src/libbaremetal/libtv_utpm/README b/xmhf/src/libbaremetal/libtv_utpm/README similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtv_utpm/README rename to xmhf/src/libbaremetal/libtv_utpm/README diff --git a/xmhf/xmhf/src/libbaremetal/libtv_utpm/include/tv_utpm.h b/xmhf/src/libbaremetal/libtv_utpm/include/tv_utpm.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtv_utpm/include/tv_utpm.h rename to xmhf/src/libbaremetal/libtv_utpm/include/tv_utpm.h diff --git a/xmhf/xmhf/src/libbaremetal/libtv_utpm/tv_utpm.pc b/xmhf/src/libbaremetal/libtv_utpm/tv_utpm.pc similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtv_utpm/tv_utpm.pc rename to xmhf/src/libbaremetal/libtv_utpm/tv_utpm.pc diff --git a/xmhf/xmhf/src/libbaremetal/libtv_utpm/utpm.c b/xmhf/src/libbaremetal/libtv_utpm/utpm.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libtv_utpm/utpm.c rename to xmhf/src/libbaremetal/libtv_utpm/utpm.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/Makefile b/xmhf/src/libbaremetal/libxmhfc/Makefile similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/Makefile rename to xmhf/src/libbaremetal/libxmhfc/Makefile diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/README b/xmhf/src/libbaremetal/libxmhfc/README similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/README rename to xmhf/src/libbaremetal/libxmhfc/README diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/abort.c b/xmhf/src/libbaremetal/libxmhfc/abort.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/abort.c rename to xmhf/src/libbaremetal/libxmhfc/abort.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/bcd.c b/xmhf/src/libbaremetal/libxmhfc/bcd.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/bcd.c rename to xmhf/src/libbaremetal/libxmhfc/bcd.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/emhfc_abort.c b/xmhf/src/libbaremetal/libxmhfc/emhfc_abort.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/emhfc_abort.c rename to xmhf/src/libbaremetal/libxmhfc/emhfc_abort.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/emhfc_log_error.c b/xmhf/src/libbaremetal/libxmhfc/emhfc_log_error.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/emhfc_log_error.c rename to xmhf/src/libbaremetal/libxmhfc/emhfc_log_error.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/assert.h b/xmhf/src/libbaremetal/libxmhfc/include/assert.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/assert.h rename to xmhf/src/libbaremetal/libxmhfc/include/assert.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/ctype.h b/xmhf/src/libbaremetal/libxmhfc/include/ctype.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/ctype.h rename to xmhf/src/libbaremetal/libxmhfc/include/ctype.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/emhfc_callbacks.h b/xmhf/src/libbaremetal/libxmhfc/include/emhfc_callbacks.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/emhfc_callbacks.h rename to xmhf/src/libbaremetal/libxmhfc/include/emhfc_callbacks.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/endian.h b/xmhf/src/libbaremetal/libxmhfc/include/endian.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/endian.h rename to xmhf/src/libbaremetal/libxmhfc/include/endian.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/limits.h b/xmhf/src/libbaremetal/libxmhfc/include/limits.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/limits.h rename to xmhf/src/libbaremetal/libxmhfc/include/limits.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdarg.h b/xmhf/src/libbaremetal/libxmhfc/include/stdarg.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdarg.h rename to xmhf/src/libbaremetal/libxmhfc/include/stdarg.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdbool.h b/xmhf/src/libbaremetal/libxmhfc/include/stdbool.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdbool.h rename to xmhf/src/libbaremetal/libxmhfc/include/stdbool.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/stddef.h b/xmhf/src/libbaremetal/libxmhfc/include/stddef.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/stddef.h rename to xmhf/src/libbaremetal/libxmhfc/include/stddef.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdint.h b/xmhf/src/libbaremetal/libxmhfc/include/stdint.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdint.h rename to xmhf/src/libbaremetal/libxmhfc/include/stdint.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdio.h b/xmhf/src/libbaremetal/libxmhfc/include/stdio.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdio.h rename to xmhf/src/libbaremetal/libxmhfc/include/stdio.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdlib.h b/xmhf/src/libbaremetal/libxmhfc/include/stdlib.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/stdlib.h rename to xmhf/src/libbaremetal/libxmhfc/include/stdlib.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/string.h b/xmhf/src/libbaremetal/libxmhfc/include/string.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/string.h rename to xmhf/src/libbaremetal/libxmhfc/include/string.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/_null.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/_null.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/_null.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/_null.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/cdefs.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/cdefs.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/cdefs.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/cdefs.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_endian.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_endian.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_endian.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/i386_endian.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_inttypes.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_inttypes.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_inttypes.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/i386_inttypes.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_limits.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_limits.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_limits.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/i386_limits.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_stdint.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_stdint.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_stdint.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/i386_stdint.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_types.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_types.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/i386_types.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/i386_types.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/libkern.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/libkern.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/libkern.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/libkern.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/limits.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/limits.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/limits.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/limits.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/types.h b/xmhf/src/libbaremetal/libxmhfc/include/sys/types.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/include/sys/types.h rename to xmhf/src/libbaremetal/libxmhfc/include/sys/types.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/libemhfc.pc b/xmhf/src/libbaremetal/libxmhfc/libemhfc.pc similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/libemhfc.pc rename to xmhf/src/libbaremetal/libxmhfc/libemhfc.pc diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/qsort.c b/xmhf/src/libbaremetal/libxmhfc/qsort.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/qsort.c rename to xmhf/src/libbaremetal/libxmhfc/qsort.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/strchr.c b/xmhf/src/libbaremetal/libxmhfc/strchr.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/strchr.c rename to xmhf/src/libbaremetal/libxmhfc/strchr.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/strcmp.c b/xmhf/src/libbaremetal/libxmhfc/strcmp.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/strcmp.c rename to xmhf/src/libbaremetal/libxmhfc/strcmp.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/string.c b/xmhf/src/libbaremetal/libxmhfc/string.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/string.c rename to xmhf/src/libbaremetal/libxmhfc/string.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/strlen.c b/xmhf/src/libbaremetal/libxmhfc/strlen.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/strlen.c rename to xmhf/src/libbaremetal/libxmhfc/strlen.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/strncmp.c b/xmhf/src/libbaremetal/libxmhfc/strncmp.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/strncmp.c rename to xmhf/src/libbaremetal/libxmhfc/strncmp.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/strncpy.c b/xmhf/src/libbaremetal/libxmhfc/strncpy.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/strncpy.c rename to xmhf/src/libbaremetal/libxmhfc/strncpy.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/strtoul.c b/xmhf/src/libbaremetal/libxmhfc/strtoul.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/strtoul.c rename to xmhf/src/libbaremetal/libxmhfc/strtoul.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfc/subr_prf.c b/xmhf/src/libbaremetal/libxmhfc/subr_prf.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfc/subr_prf.c rename to xmhf/src/libbaremetal/libxmhfc/subr_prf.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/Makefile b/xmhf/src/libbaremetal/libxmhfcrypto/Makefile similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/Makefile rename to xmhf/src/libbaremetal/libxmhfcrypto/Makefile diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/hashandprint.c b/xmhf/src/libbaremetal/libxmhfcrypto/hashandprint.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/hashandprint.c rename to xmhf/src/libbaremetal/libxmhfcrypto/hashandprint.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/aes.h b/xmhf/src/libbaremetal/libxmhfcrypto/include/aes.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/aes.h rename to xmhf/src/libbaremetal/libxmhfcrypto/include/aes.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/bignum.h b/xmhf/src/libbaremetal/libxmhfcrypto/include/bignum.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/bignum.h rename to xmhf/src/libbaremetal/libxmhfcrypto/include/bignum.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/bn_mul.h b/xmhf/src/libbaremetal/libxmhfcrypto/include/bn_mul.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/bn_mul.h rename to xmhf/src/libbaremetal/libxmhfcrypto/include/bn_mul.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/hmac.h b/xmhf/src/libbaremetal/libxmhfcrypto/include/hmac.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/hmac.h rename to xmhf/src/libbaremetal/libxmhfcrypto/include/hmac.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/rsa.h b/xmhf/src/libbaremetal/libxmhfcrypto/include/rsa.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/rsa.h rename to xmhf/src/libbaremetal/libxmhfcrypto/include/rsa.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/sha1.h b/xmhf/src/libbaremetal/libxmhfcrypto/include/sha1.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/include/sha1.h rename to xmhf/src/libbaremetal/libxmhfcrypto/include/sha1.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfcrypto/sha1_buffer.c b/xmhf/src/libbaremetal/libxmhfcrypto/sha1_buffer.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfcrypto/sha1_buffer.c rename to xmhf/src/libbaremetal/libxmhfcrypto/sha1_buffer.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/Makefile b/xmhf/src/libbaremetal/libxmhfutil/Makefile similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/Makefile rename to xmhf/src/libbaremetal/libxmhfutil/Makefile diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/cmdline.c b/xmhf/src/libbaremetal/libxmhfutil/cmdline.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/cmdline.c rename to xmhf/src/libbaremetal/libxmhfutil/cmdline.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt.c b/xmhf/src/libbaremetal/libxmhfutil/hpt.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt.c rename to xmhf/src/libbaremetal/libxmhfutil/hpt.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt_internal.c b/xmhf/src/libbaremetal/libxmhfutil/hpt_internal.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt_internal.c rename to xmhf/src/libbaremetal/libxmhfutil/hpt_internal.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt_internal.h b/xmhf/src/libbaremetal/libxmhfutil/hpt_internal.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt_internal.h rename to xmhf/src/libbaremetal/libxmhfutil/hpt_internal.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt_log.h b/xmhf/src/libbaremetal/libxmhfutil/hpt_log.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/hpt_log.h rename to xmhf/src/libbaremetal/libxmhfutil/hpt_log.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/hpto.c b/xmhf/src/libbaremetal/libxmhfutil/hpto.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/hpto.c rename to xmhf/src/libbaremetal/libxmhfutil/hpto.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/hptw.c b/xmhf/src/libbaremetal/libxmhfutil/hptw.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/hptw.c rename to xmhf/src/libbaremetal/libxmhfutil/hptw.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/bitfield.h b/xmhf/src/libbaremetal/libxmhfutil/include/bitfield.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/bitfield.h rename to xmhf/src/libbaremetal/libxmhfutil/include/bitfield.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/cmdline.h b/xmhf/src/libbaremetal/libxmhfutil/include/cmdline.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/cmdline.h rename to xmhf/src/libbaremetal/libxmhfutil/include/cmdline.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/euchk.h b/xmhf/src/libbaremetal/libxmhfutil/include/euchk.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/euchk.h rename to xmhf/src/libbaremetal/libxmhfutil/include/euchk.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/eulog.h b/xmhf/src/libbaremetal/libxmhfutil/include/eulog.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/eulog.h rename to xmhf/src/libbaremetal/libxmhfutil/include/eulog.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hpt.h b/xmhf/src/libbaremetal/libxmhfutil/include/hpt.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hpt.h rename to xmhf/src/libbaremetal/libxmhfutil/include/hpt.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hpt_consts.h b/xmhf/src/libbaremetal/libxmhfutil/include/hpt_consts.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hpt_consts.h rename to xmhf/src/libbaremetal/libxmhfutil/include/hpt_consts.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hpt_emhf.h b/xmhf/src/libbaremetal/libxmhfutil/include/hpt_emhf.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hpt_emhf.h rename to xmhf/src/libbaremetal/libxmhfutil/include/hpt_emhf.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hptw.h b/xmhf/src/libbaremetal/libxmhfutil/include/hptw.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/hptw.h rename to xmhf/src/libbaremetal/libxmhfutil/include/hptw.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_aes_rijndael.h b/xmhf/src/libbaremetal/libxmhfutil/include/nist_aes_rijndael.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_aes_rijndael.h rename to xmhf/src/libbaremetal/libxmhfutil/include/nist_aes_rijndael.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_config.h b/xmhf/src/libbaremetal/libxmhfutil/include/nist_config.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_config.h rename to xmhf/src/libbaremetal/libxmhfutil/include/nist_config.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg.h b/xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg.h rename to xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg_aes256.h b/xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg_aes256.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg_aes256.h rename to xmhf/src/libbaremetal/libxmhfutil/include/nist_ctr_drbg_aes256.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/perf.h b/xmhf/src/libbaremetal/libxmhfutil/include/perf.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/perf.h rename to xmhf/src/libbaremetal/libxmhfutil/include/perf.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/print_hex.h b/xmhf/src/libbaremetal/libxmhfutil/include/print_hex.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/print_hex.h rename to xmhf/src/libbaremetal/libxmhfutil/include/print_hex.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/rijndael.h b/xmhf/src/libbaremetal/libxmhfutil/include/rijndael.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/rijndael.h rename to xmhf/src/libbaremetal/libxmhfutil/include/rijndael.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/include/sha2.h b/xmhf/src/libbaremetal/libxmhfutil/include/sha2.h similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/include/sha2.h rename to xmhf/src/libbaremetal/libxmhfutil/include/sha2.h diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/nist_ctr_drbg.c b/xmhf/src/libbaremetal/libxmhfutil/nist_ctr_drbg.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/nist_ctr_drbg.c rename to xmhf/src/libbaremetal/libxmhfutil/nist_ctr_drbg.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/print_hex.c b/xmhf/src/libbaremetal/libxmhfutil/print_hex.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/print_hex.c rename to xmhf/src/libbaremetal/libxmhfutil/print_hex.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/rijndael.c b/xmhf/src/libbaremetal/libxmhfutil/rijndael.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/rijndael.c rename to xmhf/src/libbaremetal/libxmhfutil/rijndael.c diff --git a/xmhf/xmhf/src/libbaremetal/libxmhfutil/sha2.c b/xmhf/src/libbaremetal/libxmhfutil/sha2.c similarity index 100% rename from xmhf/xmhf/src/libbaremetal/libxmhfutil/sha2.c rename to xmhf/src/libbaremetal/libxmhfutil/sha2.c diff --git a/xmhf/xmhf/src/xmhf-core/Doxyfile b/xmhf/src/xmhf-core/Doxyfile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/Doxyfile rename to xmhf/src/xmhf-core/Doxyfile diff --git a/xmhf/xmhf/src/xmhf-core/Makefile b/xmhf/src/xmhf-core/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/Makefile rename to xmhf/src/xmhf-core/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_acpi.h b/xmhf/src/xmhf-core/include/arch/x86/_acpi.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_acpi.h rename to xmhf/src/xmhf-core/include/arch/x86/_acpi.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_apic.h b/xmhf/src/xmhf-core/include/arch/x86/_apic.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_apic.h rename to xmhf/src/xmhf-core/include/arch/x86/_apic.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_cmdline.h b/xmhf/src/xmhf-core/include/arch/x86/_cmdline.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_cmdline.h rename to xmhf/src/xmhf-core/include/arch/x86/_cmdline.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_com.h b/xmhf/src/xmhf-core/include/arch/x86/_com.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_com.h rename to xmhf/src/xmhf-core/include/arch/x86/_com.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_configx86.h b/xmhf/src/xmhf-core/include/arch/x86/_configx86.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_configx86.h rename to xmhf/src/xmhf-core/include/arch/x86/_configx86.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_div64.h b/xmhf/src/xmhf-core/include/arch/x86/_div64.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_div64.h rename to xmhf/src/xmhf-core/include/arch/x86/_div64.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_error.h b/xmhf/src/xmhf-core/include/arch/x86/_error.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_error.h rename to xmhf/src/xmhf-core/include/arch/x86/_error.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_io.h b/xmhf/src/xmhf-core/include/arch/x86/_io.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_io.h rename to xmhf/src/xmhf-core/include/arch/x86/_io.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_msr.h b/xmhf/src/xmhf-core/include/arch/x86/_msr.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_msr.h rename to xmhf/src/xmhf-core/include/arch/x86/_msr.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_multiboot.h b/xmhf/src/xmhf-core/include/arch/x86/_multiboot.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_multiboot.h rename to xmhf/src/xmhf-core/include/arch/x86/_multiboot.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_paging.h b/xmhf/src/xmhf-core/include/arch/x86/_paging.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_paging.h rename to xmhf/src/xmhf-core/include/arch/x86/_paging.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_pci.h b/xmhf/src/xmhf-core/include/arch/x86/_pci.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_pci.h rename to xmhf/src/xmhf-core/include/arch/x86/_pci.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_processor.h b/xmhf/src/xmhf-core/include/arch/x86/_processor.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_processor.h rename to xmhf/src/xmhf-core/include/arch/x86/_processor.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_svm.h b/xmhf/src/xmhf-core/include/arch/x86/_svm.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_svm.h rename to xmhf/src/xmhf-core/include/arch/x86/_svm.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_svm_eap.h b/xmhf/src/xmhf-core/include/arch/x86/_svm_eap.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_svm_eap.h rename to xmhf/src/xmhf-core/include/arch/x86/_svm_eap.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt.h b/xmhf/src/xmhf-core/include/arch/x86/_txt.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_acmod.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_acmod.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_acmod.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_acmod.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_config_regs.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_config_regs.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_config_regs.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_config_regs.h diff --git a/uxmhf/xmhf-bootloader/_txt_hash.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_hash.h similarity index 100% rename from uxmhf/xmhf-bootloader/_txt_hash.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_hash.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_heap.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_heap.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_heap.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_heap.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_mle.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_mle.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_mle.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_mle.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_mtrrs.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_mtrrs.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_mtrrs.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_mtrrs.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_smx.h b/xmhf/src/xmhf-core/include/arch/x86/_txt_smx.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_smx.h rename to xmhf/src/xmhf-core/include/arch/x86/_txt_smx.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_vmx.h b/xmhf/src/xmhf-core/include/arch/x86/_vmx.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_vmx.h rename to xmhf/src/xmhf-core/include/arch/x86/_vmx.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_vmx_eap.h b/xmhf/src/xmhf-core/include/arch/x86/_vmx_eap.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/_vmx_eap.h rename to xmhf/src/xmhf-core/include/arch/x86/_vmx_eap.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-baseplatform-arch-x86.h b/xmhf/src/xmhf-core/include/arch/x86/xmhf-baseplatform-arch-x86.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-baseplatform-arch-x86.h rename to xmhf/src/xmhf-core/include/arch/x86/xmhf-baseplatform-arch-x86.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-debug-arch-x86.h b/xmhf/src/xmhf-core/include/arch/x86/xmhf-debug-arch-x86.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-debug-arch-x86.h rename to xmhf/src/xmhf-core/include/arch/x86/xmhf-debug-arch-x86.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-smpguest-arch-x86.h b/xmhf/src/xmhf-core/include/arch/x86/xmhf-smpguest-arch-x86.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-smpguest-arch-x86.h rename to xmhf/src/xmhf-core/include/arch/x86/xmhf-smpguest-arch-x86.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-tpm-arch-x86.h b/xmhf/src/xmhf-core/include/arch/x86/xmhf-tpm-arch-x86.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/x86/xmhf-tpm-arch-x86.h rename to xmhf/src/xmhf-core/include/arch/x86/xmhf-tpm-arch-x86.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/xmhf-baseplatform-arch.h b/xmhf/src/xmhf-core/include/arch/xmhf-baseplatform-arch.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/xmhf-baseplatform-arch.h rename to xmhf/src/xmhf-core/include/arch/xmhf-baseplatform-arch.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/xmhf-debug-arch.h b/xmhf/src/xmhf-core/include/arch/xmhf-debug-arch.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/xmhf-debug-arch.h rename to xmhf/src/xmhf-core/include/arch/xmhf-debug-arch.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/xmhf-smpguest-arch.h b/xmhf/src/xmhf-core/include/arch/xmhf-smpguest-arch.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/xmhf-smpguest-arch.h rename to xmhf/src/xmhf-core/include/arch/xmhf-smpguest-arch.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/xmhf-tpm-arch.h b/xmhf/src/xmhf-core/include/arch/xmhf-tpm-arch.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/arch/xmhf-tpm-arch.h rename to xmhf/src/xmhf-core/include/arch/xmhf-tpm-arch.h diff --git a/xmhf/xmhf/src/xmhf-core/include/tomcrypt_custom.h b/xmhf/src/xmhf-core/include/tomcrypt_custom.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/tomcrypt_custom.h rename to xmhf/src/xmhf-core/include/tomcrypt_custom.h diff --git a/xmhf/xmhf/src/xmhf-core/include/tommath_superclass.h b/xmhf/src/xmhf-core/include/tommath_superclass.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/tommath_superclass.h rename to xmhf/src/xmhf-core/include/tommath_superclass.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-app.h b/xmhf/src/xmhf-core/include/xmhf-app.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-app.h rename to xmhf/src/xmhf-core/include/xmhf-app.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-baseplatform.h b/xmhf/src/xmhf-core/include/xmhf-baseplatform.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-baseplatform.h rename to xmhf/src/xmhf-core/include/xmhf-baseplatform.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-debug.h b/xmhf/src/xmhf-core/include/xmhf-debug.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-debug.h rename to xmhf/src/xmhf-core/include/xmhf-debug.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-dmaprot.h b/xmhf/src/xmhf-core/include/xmhf-dmaprot.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-dmaprot.h rename to xmhf/src/xmhf-core/include/xmhf-dmaprot.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-memprot.h b/xmhf/src/xmhf-core/include/xmhf-memprot.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-memprot.h rename to xmhf/src/xmhf-core/include/xmhf-memprot.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-parteventhub.h b/xmhf/src/xmhf-core/include/xmhf-parteventhub.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-parteventhub.h rename to xmhf/src/xmhf-core/include/xmhf-parteventhub.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-partition.h b/xmhf/src/xmhf-core/include/xmhf-partition.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-partition.h rename to xmhf/src/xmhf-core/include/xmhf-partition.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-runtime.h b/xmhf/src/xmhf-core/include/xmhf-runtime.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-runtime.h rename to xmhf/src/xmhf-core/include/xmhf-runtime.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-sl.h b/xmhf/src/xmhf-core/include/xmhf-sl.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-sl.h rename to xmhf/src/xmhf-core/include/xmhf-sl.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-smpguest.h b/xmhf/src/xmhf-core/include/xmhf-smpguest.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-smpguest.h rename to xmhf/src/xmhf-core/include/xmhf-smpguest.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-tpm.h b/xmhf/src/xmhf-core/include/xmhf-tpm.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-tpm.h rename to xmhf/src/xmhf-core/include/xmhf-tpm.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-types.h b/xmhf/src/xmhf-core/include/xmhf-types.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-types.h rename to xmhf/src/xmhf-core/include/xmhf-types.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-verification.h b/xmhf/src/xmhf-core/include/xmhf-verification.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-verification.h rename to xmhf/src/xmhf-core/include/xmhf-verification.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf-xcphandler.h b/xmhf/src/xmhf-core/include/xmhf-xcphandler.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf-xcphandler.h rename to xmhf/src/xmhf-core/include/xmhf-xcphandler.h diff --git a/xmhf/xmhf/src/xmhf-core/include/xmhf.h b/xmhf/src/xmhf-core/include/xmhf.h similarity index 100% rename from xmhf/xmhf/src/xmhf-core/include/xmhf.h rename to xmhf/src/xmhf-core/include/xmhf.h diff --git a/xmhf/xmhf/src/xmhf-core/verification/Makefile b/xmhf/src/xmhf-core/verification/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/verification/Makefile rename to xmhf/src/xmhf-core/verification/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/verification/check-mprot.sh b/xmhf/src/xmhf-core/verification/check-mprot.sh similarity index 100% rename from xmhf/xmhf/src/xmhf-core/verification/check-mprot.sh rename to xmhf/src/xmhf-core/verification/check-mprot.sh diff --git a/xmhf/xmhf/src/xmhf-core/verification/xmhf-core-verify-eventhub.c b/xmhf/src/xmhf-core/verification/xmhf-core-verify-eventhub.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/verification/xmhf-core-verify-eventhub.c rename to xmhf/src/xmhf-core/verification/xmhf-core-verify-eventhub.c diff --git a/xmhf/xmhf/src/xmhf-core/verification/xmhf-core-verify-sl.c b/xmhf/src/xmhf-core/verification/xmhf-core-verify-sl.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/verification/xmhf-core-verify-sl.c rename to xmhf/src/xmhf-core/verification/xmhf-core-verify-sl.c diff --git a/xmhf/xmhf/src/xmhf-core/verification/xmhf-core-verify-startup.c b/xmhf/src/xmhf-core/verification/xmhf-core-verify-startup.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/verification/xmhf-core-verify-startup.c rename to xmhf/src/xmhf-core/verification/xmhf-core-verify-startup.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/Makefile b/xmhf/src/xmhf-core/xmhf-bootloader/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/Makefile rename to xmhf/src/xmhf-core/xmhf-bootloader/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/cmdline.c b/xmhf/src/xmhf-core/xmhf-bootloader/cmdline.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/cmdline.c rename to xmhf/src/xmhf-core/xmhf-bootloader/cmdline.c diff --git a/uxmhf/xmhf-bootloader/header.S b/xmhf/src/xmhf-core/xmhf-bootloader/header.S similarity index 100% rename from uxmhf/xmhf-bootloader/header.S rename to xmhf/src/xmhf-core/xmhf-bootloader/header.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/init.c b/xmhf/src/xmhf-core/xmhf-bootloader/init.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/init.c rename to xmhf/src/xmhf-core/xmhf-bootloader/init.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/init.lds.S b/xmhf/src/xmhf-core/xmhf-bootloader/init.lds.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/init.lds.S rename to xmhf/src/xmhf-core/xmhf-bootloader/init.lds.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/initsup.S b/xmhf/src/xmhf-core/xmhf-bootloader/initsup.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/initsup.S rename to xmhf/src/xmhf-core/xmhf-bootloader/initsup.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/smp.c b/xmhf/src/xmhf-core/xmhf-bootloader/smp.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/smp.c rename to xmhf/src/xmhf-core/xmhf-bootloader/smp.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt.c b/xmhf/src/xmhf-core/xmhf-bootloader/txt.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt.c rename to xmhf/src/xmhf-core/xmhf-bootloader/txt.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt_acmod.c b/xmhf/src/xmhf-core/xmhf-bootloader/txt_acmod.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt_acmod.c rename to xmhf/src/xmhf-core/xmhf-bootloader/txt_acmod.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt_hash.c b/xmhf/src/xmhf-core/xmhf-bootloader/txt_hash.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt_hash.c rename to xmhf/src/xmhf-core/xmhf-bootloader/txt_hash.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt_heap.c b/xmhf/src/xmhf-core/xmhf-bootloader/txt_heap.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-bootloader/txt_heap.c rename to xmhf/src/xmhf-core/xmhf-bootloader/txt_heap.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/runtime.lds.S b/xmhf/src/xmhf-core/xmhf-runtime/runtime.lds.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/runtime.lds.S rename to xmhf/src/xmhf-core/xmhf-runtime/runtime.lds.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-acpi.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-acpi.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-acpi.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-acpi.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-addressing.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-addressing.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-addressing.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-addressing.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-cpu.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-cpu.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-cpu.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-cpu.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pci.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pci.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pci.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pci.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pit.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pit.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pit.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-pit.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-reboot.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-reboot.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-reboot.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-reboot.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smp.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smp.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smp.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smp.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smplock.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smplock.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smplock.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smplock.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smptrampoline.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smptrampoline.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smptrampoline.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86-smptrampoline.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/bplt-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-smp.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-smp.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-smp.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm-smp.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/svm/bplt-x86svm.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-mtrrs.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-mtrrs.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-mtrrs.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-mtrrs.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-reboot.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-reboot.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-reboot.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-reboot.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-smp.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-smp.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-smp.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-smp.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-vmcs.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-vmcs.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-vmcs.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx-vmcs.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/arch/x86/vmx/bplt-x86vmx.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface-smp.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface-smp.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface-smp.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface-smp.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-baseplatform/bplt-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-uart.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-uart.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-uart.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-uart.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-vgamem.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-vgamem.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-vgamem.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/dbg-x86-vgamem.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/emhf_debug_arch.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/emhf_debug_arch.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/emhf_debug_arch.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/arch/x86/emhf_debug_arch.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/dbg-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/dbg-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/dbg-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-debug/dbg-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/dmap-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/dmap-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/dmap-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/dmap-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/svm/dmap-x86svm.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/svm/dmap-x86svm.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/svm/dmap-x86svm.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/svm/dmap-x86svm.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/arch/x86/vmx/dmap-x86vmx.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/dmap-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/dmap-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/dmap-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-dmaprot/dmap-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-entry.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-entry.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-entry.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-entry.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-main.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-main.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-main.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/svm/peh-x86svm-main.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-entry.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-entry.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-entry.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-entry.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-main.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-main.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-main.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-eventhub/arch/x86/vmx/peh-x86vmx-main.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/memp-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/memp-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/memp-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/memp-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/svm/memp-x86svm.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/arch/x86/vmx/memp-x86vmx.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/memp-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/memp-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/memp-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-memprot/memp-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/part-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/part-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/part-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/part-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm-sup.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm-sup.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm-sup.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm-sup.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/svm/part-x86svm.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx-sup.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx-sup.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx-sup.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx-sup.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/arch/x86/vmx/part-x86vmx.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/part-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/part-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/part-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-partition/part-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/smpg-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/smpg-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/smpg-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/smpg-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/svm/smpg-x86svm.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/arch/x86/vmx/smpg-x86vmx.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/smpg-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/smpg-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/smpg-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-smpguest/smpg-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/arch/x86/rntm-x86-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/arch/x86/rntm-x86-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/arch/x86/rntm-x86-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/arch/x86/rntm-x86-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/rntm-data.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/rntm-data.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/rntm-data.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/rntm-data.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/runtime.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/runtime.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/runtime.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-startup/runtime.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/svm/tpm-x86svm.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/svm/tpm-x86svm.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/svm/tpm-x86svm.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/svm/tpm-x86svm.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/tpm-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/tpm-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/tpm-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/tpm-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/vmx/tpm-x86vmx.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/vmx/tpm-x86vmx.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/vmx/tpm-x86vmx.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/arch/x86/vmx/tpm-x86vmx.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/tpm-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/tpm-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/tpm-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-tpm/tpm-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-stubs.S b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-stubs.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-stubs.S rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-stubs.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-x86.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-x86.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/arch/x86/xcph-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/xcph-interface.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/xcph-interface.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/xcph-interface.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-xcphandler/xcph-interface.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/Makefile b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/Makefile rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/xmhfc-putchar.c b/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/xmhfc-putchar.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/xmhfc-putchar.c rename to xmhf/src/xmhf-core/xmhf-runtime/xmhf-xmhfcbackend/xmhfc-putchar.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/Makefile b/xmhf/src/xmhf-core/xmhf-secureloader/Makefile similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/Makefile rename to xmhf/src/xmhf-core/xmhf-secureloader/Makefile diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-entry.S b/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-entry.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-entry.S rename to xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-entry.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-sup.S b/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-sup.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-sup.S rename to xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86-sup.S diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86.c b/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86.c rename to xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/sl-x86.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/sl-x86-entry.S.debug b/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/sl-x86-entry.S.debug similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/sl-x86-entry.S.debug rename to xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/sl-x86-entry.S.debug diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/slheader.S.crazydebug b/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/slheader.S.crazydebug similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/slheader.S.crazydebug rename to xmhf/src/xmhf-core/xmhf-secureloader/arch/x86/tempdebug/slheader.S.crazydebug diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/sl.c b/xmhf/src/xmhf-core/xmhf-secureloader/sl.c similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/sl.c rename to xmhf/src/xmhf-core/xmhf-secureloader/sl.c diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-secureloader/sl.lds.S b/xmhf/src/xmhf-core/xmhf-secureloader/sl.lds.S similarity index 100% rename from xmhf/xmhf/src/xmhf-core/xmhf-secureloader/sl.lds.S rename to xmhf/src/xmhf-core/xmhf-secureloader/sl.lds.S diff --git a/xmhf/xmhf/third-party/libtomcrypt/Doxyfile b/xmhf/third-party/libtomcrypt/Doxyfile similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/Doxyfile rename to xmhf/third-party/libtomcrypt/Doxyfile diff --git a/xmhf/xmhf/third-party/libtomcrypt/LICENSE b/xmhf/third-party/libtomcrypt/LICENSE similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/LICENSE rename to xmhf/third-party/libtomcrypt/LICENSE diff --git a/xmhf/xmhf/third-party/libtomcrypt/README b/xmhf/third-party/libtomcrypt/README similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/README rename to xmhf/third-party/libtomcrypt/README diff --git a/xmhf/xmhf/third-party/libtomcrypt/TODO b/xmhf/third-party/libtomcrypt/TODO similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/TODO rename to xmhf/third-party/libtomcrypt/TODO diff --git a/xmhf/xmhf/third-party/libtomcrypt/build.sh b/xmhf/third-party/libtomcrypt/build.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/build.sh rename to xmhf/third-party/libtomcrypt/build.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/build_armcc.sh b/xmhf/third-party/libtomcrypt/build_armcc.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/build_armcc.sh rename to xmhf/third-party/libtomcrypt/build_armcc.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/changes b/xmhf/third-party/libtomcrypt/changes similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/changes rename to xmhf/third-party/libtomcrypt/changes diff --git a/xmhf/xmhf/third-party/libtomcrypt/crypt.lof b/xmhf/third-party/libtomcrypt/crypt.lof similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/crypt.lof rename to xmhf/third-party/libtomcrypt/crypt.lof diff --git a/xmhf/xmhf/third-party/libtomcrypt/crypt.tex b/xmhf/third-party/libtomcrypt/crypt.tex similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/crypt.tex rename to xmhf/third-party/libtomcrypt/crypt.tex diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/encrypt.c b/xmhf/third-party/libtomcrypt/demos/encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/encrypt.c rename to xmhf/third-party/libtomcrypt/demos/encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/hashsum.c b/xmhf/third-party/libtomcrypt/demos/hashsum.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/hashsum.c rename to xmhf/third-party/libtomcrypt/demos/hashsum.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/multi.c b/xmhf/third-party/libtomcrypt/demos/multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/multi.c rename to xmhf/third-party/libtomcrypt/demos/multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/small.c b/xmhf/third-party/libtomcrypt/demos/small.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/small.c rename to xmhf/third-party/libtomcrypt/demos/small.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/test.c b/xmhf/third-party/libtomcrypt/demos/test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/test.c rename to xmhf/third-party/libtomcrypt/demos/test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/timing.c b/xmhf/third-party/libtomcrypt/demos/timing.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/timing.c rename to xmhf/third-party/libtomcrypt/demos/timing.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/demos/tv_gen.c b/xmhf/third-party/libtomcrypt/demos/tv_gen.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/demos/tv_gen.c rename to xmhf/third-party/libtomcrypt/demos/tv_gen.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/doc/crypt.pdf b/xmhf/third-party/libtomcrypt/doc/crypt.pdf similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/doc/crypt.pdf rename to xmhf/third-party/libtomcrypt/doc/crypt.pdf diff --git a/xmhf/xmhf/third-party/libtomcrypt/doc/footer.html b/xmhf/third-party/libtomcrypt/doc/footer.html similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/doc/footer.html rename to xmhf/third-party/libtomcrypt/doc/footer.html diff --git a/xmhf/xmhf/third-party/libtomcrypt/doc/header.html b/xmhf/third-party/libtomcrypt/doc/header.html similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/doc/header.html rename to xmhf/third-party/libtomcrypt/doc/header.html diff --git a/xmhf/xmhf/third-party/libtomcrypt/filter.pl b/xmhf/third-party/libtomcrypt/filter.pl similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/filter.pl rename to xmhf/third-party/libtomcrypt/filter.pl diff --git a/xmhf/xmhf/third-party/libtomcrypt/fixupind.pl b/xmhf/third-party/libtomcrypt/fixupind.pl similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/fixupind.pl rename to xmhf/third-party/libtomcrypt/fixupind.pl diff --git a/xmhf/xmhf/third-party/libtomcrypt/genlist.sh b/xmhf/third-party/libtomcrypt/genlist.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/genlist.sh rename to xmhf/third-party/libtomcrypt/genlist.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/libtomcrypt.dsp b/xmhf/third-party/libtomcrypt/libtomcrypt.dsp similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/libtomcrypt.dsp rename to xmhf/third-party/libtomcrypt/libtomcrypt.dsp diff --git a/xmhf/xmhf/third-party/libtomcrypt/makefile b/xmhf/third-party/libtomcrypt/makefile similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/makefile rename to xmhf/third-party/libtomcrypt/makefile diff --git a/xmhf/xmhf/third-party/libtomcrypt/makefile.icc b/xmhf/third-party/libtomcrypt/makefile.icc similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/makefile.icc rename to xmhf/third-party/libtomcrypt/makefile.icc diff --git a/xmhf/xmhf/third-party/libtomcrypt/makefile.msvc b/xmhf/third-party/libtomcrypt/makefile.msvc similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/makefile.msvc rename to xmhf/third-party/libtomcrypt/makefile.msvc diff --git a/xmhf/xmhf/third-party/libtomcrypt/makefile.shared b/xmhf/third-party/libtomcrypt/makefile.shared similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/makefile.shared rename to xmhf/third-party/libtomcrypt/makefile.shared diff --git a/xmhf/xmhf/third-party/libtomcrypt/makefile.unix b/xmhf/third-party/libtomcrypt/makefile.unix similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/makefile.unix rename to xmhf/third-party/libtomcrypt/makefile.unix diff --git a/xmhf/xmhf/third-party/libtomcrypt/mess.sh b/xmhf/third-party/libtomcrypt/mess.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/mess.sh rename to xmhf/third-party/libtomcrypt/mess.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/base64_tv.txt b/xmhf/third-party/libtomcrypt/notes/base64_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/base64_tv.txt rename to xmhf/third-party/libtomcrypt/notes/base64_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/ccm_tv.txt b/xmhf/third-party/libtomcrypt/notes/ccm_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/ccm_tv.txt rename to xmhf/third-party/libtomcrypt/notes/ccm_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/cipher_tv.txt b/xmhf/third-party/libtomcrypt/notes/cipher_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/cipher_tv.txt rename to xmhf/third-party/libtomcrypt/notes/cipher_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/eax_tv.txt b/xmhf/third-party/libtomcrypt/notes/eax_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/eax_tv.txt rename to xmhf/third-party/libtomcrypt/notes/eax_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/ecc_tv.txt b/xmhf/third-party/libtomcrypt/notes/ecc_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/ecc_tv.txt rename to xmhf/third-party/libtomcrypt/notes/ecc_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/etc/saferp_optimizer.c b/xmhf/third-party/libtomcrypt/notes/etc/saferp_optimizer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/etc/saferp_optimizer.c rename to xmhf/third-party/libtomcrypt/notes/etc/saferp_optimizer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/etc/whirlgen.c b/xmhf/third-party/libtomcrypt/notes/etc/whirlgen.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/etc/whirlgen.c rename to xmhf/third-party/libtomcrypt/notes/etc/whirlgen.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/etc/whirltest.c b/xmhf/third-party/libtomcrypt/notes/etc/whirltest.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/etc/whirltest.c rename to xmhf/third-party/libtomcrypt/notes/etc/whirltest.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/gcm_tv.txt b/xmhf/third-party/libtomcrypt/notes/gcm_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/gcm_tv.txt rename to xmhf/third-party/libtomcrypt/notes/gcm_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/hash_tv.txt b/xmhf/third-party/libtomcrypt/notes/hash_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/hash_tv.txt rename to xmhf/third-party/libtomcrypt/notes/hash_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/hmac_tv.txt b/xmhf/third-party/libtomcrypt/notes/hmac_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/hmac_tv.txt rename to xmhf/third-party/libtomcrypt/notes/hmac_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/lrw_tv.txt b/xmhf/third-party/libtomcrypt/notes/lrw_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/lrw_tv.txt rename to xmhf/third-party/libtomcrypt/notes/lrw_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/ocb_tv.txt b/xmhf/third-party/libtomcrypt/notes/ocb_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/ocb_tv.txt rename to xmhf/third-party/libtomcrypt/notes/ocb_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/omac_tv.txt b/xmhf/third-party/libtomcrypt/notes/omac_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/omac_tv.txt rename to xmhf/third-party/libtomcrypt/notes/omac_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/pmac_tv.txt b/xmhf/third-party/libtomcrypt/notes/pmac_tv.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/pmac_tv.txt rename to xmhf/third-party/libtomcrypt/notes/pmac_tv.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0001.txt b/xmhf/third-party/libtomcrypt/notes/tech0001.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0001.txt rename to xmhf/third-party/libtomcrypt/notes/tech0001.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0002.txt b/xmhf/third-party/libtomcrypt/notes/tech0002.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0002.txt rename to xmhf/third-party/libtomcrypt/notes/tech0002.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0003.txt b/xmhf/third-party/libtomcrypt/notes/tech0003.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0003.txt rename to xmhf/third-party/libtomcrypt/notes/tech0003.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0004.txt b/xmhf/third-party/libtomcrypt/notes/tech0004.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0004.txt rename to xmhf/third-party/libtomcrypt/notes/tech0004.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0005.txt b/xmhf/third-party/libtomcrypt/notes/tech0005.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0005.txt rename to xmhf/third-party/libtomcrypt/notes/tech0005.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0006.txt b/xmhf/third-party/libtomcrypt/notes/tech0006.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0006.txt rename to xmhf/third-party/libtomcrypt/notes/tech0006.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/notes/tech0007.txt b/xmhf/third-party/libtomcrypt/notes/tech0007.txt similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/notes/tech0007.txt rename to xmhf/third-party/libtomcrypt/notes/tech0007.txt diff --git a/xmhf/xmhf/third-party/libtomcrypt/parsenames.pl b/xmhf/third-party/libtomcrypt/parsenames.pl similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/parsenames.pl rename to xmhf/third-party/libtomcrypt/parsenames.pl diff --git a/xmhf/xmhf/third-party/libtomcrypt/run.sh b/xmhf/third-party/libtomcrypt/run.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/run.sh rename to xmhf/third-party/libtomcrypt/run.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/aes/aes.c b/xmhf/third-party/libtomcrypt/src/ciphers/aes/aes.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/aes/aes.c rename to xmhf/third-party/libtomcrypt/src/ciphers/aes/aes.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/aes/aes_tab.c b/xmhf/third-party/libtomcrypt/src/ciphers/aes/aes_tab.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/aes/aes_tab.c rename to xmhf/third-party/libtomcrypt/src/ciphers/aes/aes_tab.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/anubis.c b/xmhf/third-party/libtomcrypt/src/ciphers/anubis.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/anubis.c rename to xmhf/third-party/libtomcrypt/src/ciphers/anubis.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/blowfish.c b/xmhf/third-party/libtomcrypt/src/ciphers/blowfish.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/blowfish.c rename to xmhf/third-party/libtomcrypt/src/ciphers/blowfish.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/cast5.c b/xmhf/third-party/libtomcrypt/src/ciphers/cast5.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/cast5.c rename to xmhf/third-party/libtomcrypt/src/ciphers/cast5.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/des.c b/xmhf/third-party/libtomcrypt/src/ciphers/des.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/des.c rename to xmhf/third-party/libtomcrypt/src/ciphers/des.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/kasumi.c b/xmhf/third-party/libtomcrypt/src/ciphers/kasumi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/kasumi.c rename to xmhf/third-party/libtomcrypt/src/ciphers/kasumi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/khazad.c b/xmhf/third-party/libtomcrypt/src/ciphers/khazad.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/khazad.c rename to xmhf/third-party/libtomcrypt/src/ciphers/khazad.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/kseed.c b/xmhf/third-party/libtomcrypt/src/ciphers/kseed.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/kseed.c rename to xmhf/third-party/libtomcrypt/src/ciphers/kseed.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/multi2.c b/xmhf/third-party/libtomcrypt/src/ciphers/multi2.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/multi2.c rename to xmhf/third-party/libtomcrypt/src/ciphers/multi2.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/noekeon.c b/xmhf/third-party/libtomcrypt/src/ciphers/noekeon.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/noekeon.c rename to xmhf/third-party/libtomcrypt/src/ciphers/noekeon.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/rc2.c b/xmhf/third-party/libtomcrypt/src/ciphers/rc2.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/rc2.c rename to xmhf/third-party/libtomcrypt/src/ciphers/rc2.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/rc5.c b/xmhf/third-party/libtomcrypt/src/ciphers/rc5.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/rc5.c rename to xmhf/third-party/libtomcrypt/src/ciphers/rc5.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/rc6.c b/xmhf/third-party/libtomcrypt/src/ciphers/rc6.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/rc6.c rename to xmhf/third-party/libtomcrypt/src/ciphers/rc6.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/safer/safer.c b/xmhf/third-party/libtomcrypt/src/ciphers/safer/safer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/safer/safer.c rename to xmhf/third-party/libtomcrypt/src/ciphers/safer/safer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/safer/safer_tab.c b/xmhf/third-party/libtomcrypt/src/ciphers/safer/safer_tab.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/safer/safer_tab.c rename to xmhf/third-party/libtomcrypt/src/ciphers/safer/safer_tab.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/safer/saferp.c b/xmhf/third-party/libtomcrypt/src/ciphers/safer/saferp.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/safer/saferp.c rename to xmhf/third-party/libtomcrypt/src/ciphers/safer/saferp.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/skipjack.c b/xmhf/third-party/libtomcrypt/src/ciphers/skipjack.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/skipjack.c rename to xmhf/third-party/libtomcrypt/src/ciphers/skipjack.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish.c b/xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish.c rename to xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish_tab.c b/xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish_tab.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish_tab.c rename to xmhf/third-party/libtomcrypt/src/ciphers/twofish/twofish_tab.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/ciphers/xtea.c b/xmhf/third-party/libtomcrypt/src/ciphers/xtea.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/ciphers/xtea.c rename to xmhf/third-party/libtomcrypt/src/ciphers/xtea.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_memory.c b/xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_memory.c rename to xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_test.c b/xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_test.c rename to xmhf/third-party/libtomcrypt/src/encauth/ccm/ccm_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_addheader.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_addheader.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_addheader.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_addheader.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_done.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_done.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_init.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_init.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_test.c b/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/eax/eax_test.c rename to xmhf/third-party/libtomcrypt/src/encauth/eax/eax_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_aad.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_aad.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_aad.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_aad.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_iv.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_iv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_iv.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_add_iv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_done.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_done.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_init.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_init.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_memory.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_memory.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_mult_h.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_mult_h.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_mult_h.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_mult_h.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_process.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_process.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_reset.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_reset.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_reset.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_reset.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_test.c b/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_test.c rename to xmhf/third-party/libtomcrypt/src/encauth/gcm/gcm_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_init.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_init.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_ntz.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_ntz.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_ntz.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_ntz.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_test.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_test.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/ocb_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/s_ocb_done.c b/xmhf/third-party/libtomcrypt/src/encauth/ocb/s_ocb_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/encauth/ocb/s_ocb_done.c rename to xmhf/third-party/libtomcrypt/src/encauth/ocb/s_ocb_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/chc/chc.c b/xmhf/third-party/libtomcrypt/src/hashes/chc/chc.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/chc/chc.c rename to xmhf/third-party/libtomcrypt/src/hashes/chc/chc.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_file.c b/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_file.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_file.c rename to xmhf/third-party/libtomcrypt/src/hashes/helper/hash_file.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_filehandle.c b/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_filehandle.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_filehandle.c rename to xmhf/third-party/libtomcrypt/src/hashes/helper/hash_filehandle.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory.c b/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory.c rename to xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory_multi.c b/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory_multi.c rename to xmhf/third-party/libtomcrypt/src/hashes/helper/hash_memory_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/md2.c b/xmhf/third-party/libtomcrypt/src/hashes/md2.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/md2.c rename to xmhf/third-party/libtomcrypt/src/hashes/md2.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/md4.c b/xmhf/third-party/libtomcrypt/src/hashes/md4.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/md4.c rename to xmhf/third-party/libtomcrypt/src/hashes/md4.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/md5.c b/xmhf/third-party/libtomcrypt/src/hashes/md5.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/md5.c rename to xmhf/third-party/libtomcrypt/src/hashes/md5.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd128.c b/xmhf/third-party/libtomcrypt/src/hashes/rmd128.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd128.c rename to xmhf/third-party/libtomcrypt/src/hashes/rmd128.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd160.c b/xmhf/third-party/libtomcrypt/src/hashes/rmd160.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd160.c rename to xmhf/third-party/libtomcrypt/src/hashes/rmd160.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd256.c b/xmhf/third-party/libtomcrypt/src/hashes/rmd256.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd256.c rename to xmhf/third-party/libtomcrypt/src/hashes/rmd256.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd320.c b/xmhf/third-party/libtomcrypt/src/hashes/rmd320.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/rmd320.c rename to xmhf/third-party/libtomcrypt/src/hashes/rmd320.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha1.c b/xmhf/third-party/libtomcrypt/src/hashes/sha1.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha1.c rename to xmhf/third-party/libtomcrypt/src/hashes/sha1.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha224.c b/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha224.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha224.c rename to xmhf/third-party/libtomcrypt/src/hashes/sha2/sha224.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha256.c b/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha256.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha256.c rename to xmhf/third-party/libtomcrypt/src/hashes/sha2/sha256.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha384.c b/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha384.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha384.c rename to xmhf/third-party/libtomcrypt/src/hashes/sha2/sha384.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha512.c b/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha512.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/sha2/sha512.c rename to xmhf/third-party/libtomcrypt/src/hashes/sha2/sha512.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/tiger.c b/xmhf/third-party/libtomcrypt/src/hashes/tiger.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/tiger.c rename to xmhf/third-party/libtomcrypt/src/hashes/tiger.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/whirl/whirl.c b/xmhf/third-party/libtomcrypt/src/hashes/whirl/whirl.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/whirl/whirl.c rename to xmhf/third-party/libtomcrypt/src/hashes/whirl/whirl.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/hashes/whirl/whirltab.c b/xmhf/third-party/libtomcrypt/src/hashes/whirl/whirltab.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/hashes/whirl/whirltab.c rename to xmhf/third-party/libtomcrypt/src/hashes/whirl/whirltab.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_argchk.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_argchk.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_argchk.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_argchk.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cfg.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cfg.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cfg.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cfg.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cipher.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cipher.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cipher.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_cipher.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_custom.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_custom.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_custom.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_custom.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_hash.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_hash.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_hash.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_hash.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_mac.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_mac.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_mac.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_mac.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_macros.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_macros.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_macros.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_macros.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_math.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_math.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_math.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_math.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_misc.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_misc.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_misc.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_misc.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pk.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pk.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pk.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pk.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pkcs.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pkcs.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pkcs.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_pkcs.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_prng.h b/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_prng.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/headers/tomcrypt_prng.h rename to xmhf/third-party/libtomcrypt/src/headers/tomcrypt_prng.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_done.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_done.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_file.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_file.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_file.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_file.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_init.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_init.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory_multi.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory_multi.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_memory_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_process.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_process.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_test.c b/xmhf/third-party/libtomcrypt/src/mac/f9/f9_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/f9/f9_test.c rename to xmhf/third-party/libtomcrypt/src/mac/f9/f9_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_done.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_done.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_file.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_file.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_file.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_file.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_init.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_init.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory_multi.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory_multi.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_memory_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_process.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_process.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_test.c b/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_test.c rename to xmhf/third-party/libtomcrypt/src/mac/hmac/hmac_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_done.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_done.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_file.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_file.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_file.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_file.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_init.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_init.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory_multi.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory_multi.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_memory_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_process.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_process.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_test.c b/xmhf/third-party/libtomcrypt/src/mac/omac/omac_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/omac/omac_test.c rename to xmhf/third-party/libtomcrypt/src/mac/omac/omac_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican.c b/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican.c rename to xmhf/third-party/libtomcrypt/src/mac/pelican/pelican.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_memory.c b/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_memory.c rename to xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_test.c b/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_test.c rename to xmhf/third-party/libtomcrypt/src/mac/pelican/pelican_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_done.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_done.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_file.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_file.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_file.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_file.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_init.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_init.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory_multi.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory_multi.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_memory_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_ntz.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_ntz.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_ntz.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_ntz.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_process.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_process.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_shift_xor.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_shift_xor.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_shift_xor.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_shift_xor.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_test.c b/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_test.c rename to xmhf/third-party/libtomcrypt/src/mac/pmac/pmac_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_done.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_done.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_file.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_file.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_file.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_file.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_init.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_init.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_process.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_process.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_test.c b/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_test.c rename to xmhf/third-party/libtomcrypt/src/mac/xcbc/xcbc_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c b/xmhf/third-party/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c rename to xmhf/third-party/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/math/gmp_desc.c b/xmhf/third-party/libtomcrypt/src/math/gmp_desc.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/math/gmp_desc.c rename to xmhf/third-party/libtomcrypt/src/math/gmp_desc.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/math/ltm_desc.c b/xmhf/third-party/libtomcrypt/src/math/ltm_desc.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/math/ltm_desc.c rename to xmhf/third-party/libtomcrypt/src/math/ltm_desc.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/math/multi.c b/xmhf/third-party/libtomcrypt/src/math/multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/math/multi.c rename to xmhf/third-party/libtomcrypt/src/math/multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/math/rand_prime.c b/xmhf/third-party/libtomcrypt/src/math/rand_prime.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/math/rand_prime.c rename to xmhf/third-party/libtomcrypt/src/math/rand_prime.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/math/tfm_desc.c b/xmhf/third-party/libtomcrypt/src/math/tfm_desc.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/math/tfm_desc.c rename to xmhf/third-party/libtomcrypt/src/math/tfm_desc.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/base64/base64_decode.c b/xmhf/third-party/libtomcrypt/src/misc/base64/base64_decode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/base64/base64_decode.c rename to xmhf/third-party/libtomcrypt/src/misc/base64/base64_decode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/base64/base64_encode.c b/xmhf/third-party/libtomcrypt/src/misc/base64/base64_encode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/base64/base64_encode.c rename to xmhf/third-party/libtomcrypt/src/misc/base64/base64_encode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/burn_stack.c b/xmhf/third-party/libtomcrypt/src/misc/burn_stack.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/burn_stack.c rename to xmhf/third-party/libtomcrypt/src/misc/burn_stack.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_argchk.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_argchk.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_argchk.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_argchk.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_prng.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_prng.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_prng.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_find_prng.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_fsa.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_fsa.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_fsa.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_fsa.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_cipher.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_cipher.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_cipher.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_cipher.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_hash.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_hash.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_prng.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_prng.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_prng.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_register_prng.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c b/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c rename to xmhf/third-party/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/error_to_string.c b/xmhf/third-party/libtomcrypt/src/misc/error_to_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/error_to_string.c rename to xmhf/third-party/libtomcrypt/src/misc/error_to_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c b/xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c rename to xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c b/xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c rename to xmhf/third-party/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/misc/zeromem.c b/xmhf/third-party/libtomcrypt/src/misc/zeromem.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/misc/zeromem.c rename to xmhf/third-party/libtomcrypt/src/misc/zeromem.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_done.c b/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_done.c rename to xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_getiv.c b/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_getiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_getiv.c rename to xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_getiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_setiv.c b/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_setiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_setiv.c rename to xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_setiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_start.c b/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_start.c rename to xmhf/third-party/libtomcrypt/src/modes/cbc/cbc_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_done.c b/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_done.c rename to xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_getiv.c b/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_getiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_getiv.c rename to xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_getiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_setiv.c b/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_setiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_setiv.c rename to xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_setiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_start.c b/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_start.c rename to xmhf/third-party/libtomcrypt/src/modes/cfb/cfb_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_done.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_done.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_getiv.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_getiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_getiv.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_getiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_setiv.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_setiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_setiv.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_setiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_start.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_start.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_test.c b/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_test.c rename to xmhf/third-party/libtomcrypt/src/modes/ctr/ctr_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_done.c b/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_done.c rename to xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_start.c b/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_start.c rename to xmhf/third-party/libtomcrypt/src/modes/ecb/ecb_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_done.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_done.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_getiv.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_getiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_getiv.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_getiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_setiv.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_setiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_setiv.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_setiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_start.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_start.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_test_mode.c b/xmhf/third-party/libtomcrypt/src/modes/f8/f8_test_mode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/f8/f8_test_mode.c rename to xmhf/third-party/libtomcrypt/src/modes/f8/f8_test_mode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_done.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_done.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_getiv.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_getiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_getiv.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_getiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_process.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_process.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_process.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_process.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_setiv.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_setiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_setiv.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_setiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_start.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_start.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_test.c b/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_test.c rename to xmhf/third-party/libtomcrypt/src/modes/lrw/lrw_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_done.c b/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_done.c rename to xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_getiv.c b/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_getiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_getiv.c rename to xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_getiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_setiv.c b/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_setiv.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_setiv.c rename to xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_setiv.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_start.c b/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_start.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_start.c rename to xmhf/third-party/libtomcrypt/src/modes/ofb/ofb_start.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_decrypt.c b/xmhf/third-party/libtomcrypt/src/modes/xts/xts_decrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_decrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/xts/xts_decrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_done.c b/xmhf/third-party/libtomcrypt/src/modes/xts/xts_done.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_done.c rename to xmhf/third-party/libtomcrypt/src/modes/xts/xts_done.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_encrypt.c b/xmhf/third-party/libtomcrypt/src/modes/xts/xts_encrypt.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_encrypt.c rename to xmhf/third-party/libtomcrypt/src/modes/xts/xts_encrypt.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_init.c b/xmhf/third-party/libtomcrypt/src/modes/xts/xts_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_init.c rename to xmhf/third-party/libtomcrypt/src/modes/xts/xts_init.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_mult_x.c b/xmhf/third-party/libtomcrypt/src/modes/xts/xts_mult_x.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_mult_x.c rename to xmhf/third-party/libtomcrypt/src/modes/xts/xts_mult_x.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_test.c b/xmhf/third-party/libtomcrypt/src/modes/xts/xts_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/modes/xts/xts_test.c rename to xmhf/third-party/libtomcrypt/src/modes/xts/xts_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c b/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c rename to xmhf/third-party/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_export.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_export.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_export.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_export.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_free.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_free.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_free.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_free.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_import.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_import.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_import.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_import.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_make_key.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_make_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_make_key.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_make_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_shared_secret.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_shared_secret.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_shared_secret.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_shared_secret.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_sign_hash.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_sign_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_sign_hash.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_sign_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_hash.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_hash.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_key.c b/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_key.c rename to xmhf/third-party/libtomcrypt/src/pk/dsa/dsa_verify_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_export.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_export.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_export.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_export.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_free.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_free.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_free.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_free.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_get_size.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_get_size.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_get_size.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_get_size.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_import.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_import.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_import.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_import.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_make_key.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_make_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_make_key.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_make_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_shared_secret.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_shared_secret.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_shared_secret.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_shared_secret.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sign_hash.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sign_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sign_hash.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sign_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sizes.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sizes.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sizes.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_sizes.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_test.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_test.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_verify_hash.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_verify_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_verify_hash.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ecc_verify_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_map.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_map.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_map.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_map.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_points.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_points.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_points.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_points.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c b/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c rename to xmhf/third-party/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_decrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_decrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_decrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_decrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_encrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_encrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_encrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_encrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_export.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_export.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_export.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_export.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_exptmod.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_exptmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_exptmod.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_exptmod.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_free.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_free.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_free.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_free.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_import.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_import.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_import.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_import.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_make_key.c b/xmhf/third-party/libtomcrypt/src/pk/katja/katja_make_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/katja/katja_make_key.c rename to xmhf/third-party/libtomcrypt/src/pk/katja/katja_make_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c b/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c rename to xmhf/third-party/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_export.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_export.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_export.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_export.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_exptmod.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_exptmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_exptmod.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_exptmod.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_free.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_free.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_free.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_free.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_import.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_import.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_import.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_import.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_make_key.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_make_key.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_make_key.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_make_key.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_sign_hash.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_sign_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_sign_hash.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_sign_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_verify_hash.c b/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_verify_hash.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_verify_hash.c rename to xmhf/third-party/libtomcrypt/src/pk/rsa/rsa_verify_hash.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/fortuna.c b/xmhf/third-party/libtomcrypt/src/prngs/fortuna.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/fortuna.c rename to xmhf/third-party/libtomcrypt/src/prngs/fortuna.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/rc4.c b/xmhf/third-party/libtomcrypt/src/prngs/rc4.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/rc4.c rename to xmhf/third-party/libtomcrypt/src/prngs/rc4.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/rng_get_bytes.c b/xmhf/third-party/libtomcrypt/src/prngs/rng_get_bytes.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/rng_get_bytes.c rename to xmhf/third-party/libtomcrypt/src/prngs/rng_get_bytes.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/rng_make_prng.c b/xmhf/third-party/libtomcrypt/src/prngs/rng_make_prng.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/rng_make_prng.c rename to xmhf/third-party/libtomcrypt/src/prngs/rng_make_prng.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/sober128.c b/xmhf/third-party/libtomcrypt/src/prngs/sober128.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/sober128.c rename to xmhf/third-party/libtomcrypt/src/prngs/sober128.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/sober128tab.c b/xmhf/third-party/libtomcrypt/src/prngs/sober128tab.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/sober128tab.c rename to xmhf/third-party/libtomcrypt/src/prngs/sober128tab.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/sprng.c b/xmhf/third-party/libtomcrypt/src/prngs/sprng.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/sprng.c rename to xmhf/third-party/libtomcrypt/src/prngs/sprng.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/src/prngs/yarrow.c b/xmhf/third-party/libtomcrypt/src/prngs/yarrow.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/src/prngs/yarrow.c rename to xmhf/third-party/libtomcrypt/src/prngs/yarrow.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testbuild.sh b/xmhf/third-party/libtomcrypt/testbuild.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testbuild.sh rename to xmhf/third-party/libtomcrypt/testbuild.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/testme.sh b/xmhf/third-party/libtomcrypt/testme.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testme.sh rename to xmhf/third-party/libtomcrypt/testme.sh diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/base64_test.c b/xmhf/third-party/libtomcrypt/testprof/base64_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/base64_test.c rename to xmhf/third-party/libtomcrypt/testprof/base64_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/cipher_hash_test.c b/xmhf/third-party/libtomcrypt/testprof/cipher_hash_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/cipher_hash_test.c rename to xmhf/third-party/libtomcrypt/testprof/cipher_hash_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/der_tests.c b/xmhf/third-party/libtomcrypt/testprof/der_tests.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/der_tests.c rename to xmhf/third-party/libtomcrypt/testprof/der_tests.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/dsa_test.c b/xmhf/third-party/libtomcrypt/testprof/dsa_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/dsa_test.c rename to xmhf/third-party/libtomcrypt/testprof/dsa_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/ecc_test.c b/xmhf/third-party/libtomcrypt/testprof/ecc_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/ecc_test.c rename to xmhf/third-party/libtomcrypt/testprof/ecc_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/katja_test.c b/xmhf/third-party/libtomcrypt/testprof/katja_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/katja_test.c rename to xmhf/third-party/libtomcrypt/testprof/katja_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/mac_test.c b/xmhf/third-party/libtomcrypt/testprof/mac_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/mac_test.c rename to xmhf/third-party/libtomcrypt/testprof/mac_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/makefile b/xmhf/third-party/libtomcrypt/testprof/makefile similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/makefile rename to xmhf/third-party/libtomcrypt/testprof/makefile diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/makefile.icc b/xmhf/third-party/libtomcrypt/testprof/makefile.icc similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/makefile.icc rename to xmhf/third-party/libtomcrypt/testprof/makefile.icc diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/makefile.msvc b/xmhf/third-party/libtomcrypt/testprof/makefile.msvc similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/makefile.msvc rename to xmhf/third-party/libtomcrypt/testprof/makefile.msvc diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/makefile.shared b/xmhf/third-party/libtomcrypt/testprof/makefile.shared similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/makefile.shared rename to xmhf/third-party/libtomcrypt/testprof/makefile.shared diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/modes_test.c b/xmhf/third-party/libtomcrypt/testprof/modes_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/modes_test.c rename to xmhf/third-party/libtomcrypt/testprof/modes_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/pkcs_1_test.c b/xmhf/third-party/libtomcrypt/testprof/pkcs_1_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/pkcs_1_test.c rename to xmhf/third-party/libtomcrypt/testprof/pkcs_1_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/rsa_test.c b/xmhf/third-party/libtomcrypt/testprof/rsa_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/rsa_test.c rename to xmhf/third-party/libtomcrypt/testprof/rsa_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/store_test.c b/xmhf/third-party/libtomcrypt/testprof/store_test.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/store_test.c rename to xmhf/third-party/libtomcrypt/testprof/store_test.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/test.der b/xmhf/third-party/libtomcrypt/testprof/test.der similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/test.der rename to xmhf/third-party/libtomcrypt/testprof/test.der diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/test.key b/xmhf/third-party/libtomcrypt/testprof/test.key similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/test.key rename to xmhf/third-party/libtomcrypt/testprof/test.key diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/test_driver.c b/xmhf/third-party/libtomcrypt/testprof/test_driver.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/test_driver.c rename to xmhf/third-party/libtomcrypt/testprof/test_driver.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/tomcrypt_test.h b/xmhf/third-party/libtomcrypt/testprof/tomcrypt_test.h similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/tomcrypt_test.h rename to xmhf/third-party/libtomcrypt/testprof/tomcrypt_test.h diff --git a/xmhf/xmhf/third-party/libtomcrypt/testprof/x86_prof.c b/xmhf/third-party/libtomcrypt/testprof/x86_prof.c similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/testprof/x86_prof.c rename to xmhf/third-party/libtomcrypt/testprof/x86_prof.c diff --git a/xmhf/xmhf/third-party/libtomcrypt/updatemakes.sh b/xmhf/third-party/libtomcrypt/updatemakes.sh similarity index 100% rename from xmhf/xmhf/third-party/libtomcrypt/updatemakes.sh rename to xmhf/third-party/libtomcrypt/updatemakes.sh diff --git a/xmhf/xmhf/third-party/libtommath/LICENSE b/xmhf/third-party/libtommath/LICENSE similarity index 100% rename from xmhf/xmhf/third-party/libtommath/LICENSE rename to xmhf/third-party/libtommath/LICENSE diff --git a/xmhf/xmhf/third-party/libtommath/bn.ilg b/xmhf/third-party/libtommath/bn.ilg similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn.ilg rename to xmhf/third-party/libtommath/bn.ilg diff --git a/xmhf/xmhf/third-party/libtommath/bn.ind b/xmhf/third-party/libtommath/bn.ind similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn.ind rename to xmhf/third-party/libtommath/bn.ind diff --git a/xmhf/xmhf/third-party/libtommath/bn.pdf b/xmhf/third-party/libtommath/bn.pdf similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn.pdf rename to xmhf/third-party/libtommath/bn.pdf diff --git a/xmhf/xmhf/third-party/libtommath/bn.tex b/xmhf/third-party/libtommath/bn.tex similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn.tex rename to xmhf/third-party/libtommath/bn.tex diff --git a/xmhf/xmhf/third-party/libtommath/bn_error.c b/xmhf/third-party/libtommath/bn_error.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_error.c rename to xmhf/third-party/libtommath/bn_error.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_fast_mp_invmod.c b/xmhf/third-party/libtommath/bn_fast_mp_invmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_fast_mp_invmod.c rename to xmhf/third-party/libtommath/bn_fast_mp_invmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_fast_mp_montgomery_reduce.c b/xmhf/third-party/libtommath/bn_fast_mp_montgomery_reduce.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_fast_mp_montgomery_reduce.c rename to xmhf/third-party/libtommath/bn_fast_mp_montgomery_reduce.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_fast_s_mp_mul_digs.c b/xmhf/third-party/libtommath/bn_fast_s_mp_mul_digs.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_fast_s_mp_mul_digs.c rename to xmhf/third-party/libtommath/bn_fast_s_mp_mul_digs.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_fast_s_mp_mul_high_digs.c b/xmhf/third-party/libtommath/bn_fast_s_mp_mul_high_digs.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_fast_s_mp_mul_high_digs.c rename to xmhf/third-party/libtommath/bn_fast_s_mp_mul_high_digs.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_fast_s_mp_sqr.c b/xmhf/third-party/libtommath/bn_fast_s_mp_sqr.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_fast_s_mp_sqr.c rename to xmhf/third-party/libtommath/bn_fast_s_mp_sqr.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_2expt.c b/xmhf/third-party/libtommath/bn_mp_2expt.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_2expt.c rename to xmhf/third-party/libtommath/bn_mp_2expt.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_abs.c b/xmhf/third-party/libtommath/bn_mp_abs.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_abs.c rename to xmhf/third-party/libtommath/bn_mp_abs.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_add.c b/xmhf/third-party/libtommath/bn_mp_add.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_add.c rename to xmhf/third-party/libtommath/bn_mp_add.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_add_d.c b/xmhf/third-party/libtommath/bn_mp_add_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_add_d.c rename to xmhf/third-party/libtommath/bn_mp_add_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_addmod.c b/xmhf/third-party/libtommath/bn_mp_addmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_addmod.c rename to xmhf/third-party/libtommath/bn_mp_addmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_and.c b/xmhf/third-party/libtommath/bn_mp_and.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_and.c rename to xmhf/third-party/libtommath/bn_mp_and.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_clamp.c b/xmhf/third-party/libtommath/bn_mp_clamp.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_clamp.c rename to xmhf/third-party/libtommath/bn_mp_clamp.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_clear.c b/xmhf/third-party/libtommath/bn_mp_clear.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_clear.c rename to xmhf/third-party/libtommath/bn_mp_clear.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_clear_multi.c b/xmhf/third-party/libtommath/bn_mp_clear_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_clear_multi.c rename to xmhf/third-party/libtommath/bn_mp_clear_multi.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_cmp.c b/xmhf/third-party/libtommath/bn_mp_cmp.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_cmp.c rename to xmhf/third-party/libtommath/bn_mp_cmp.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_cmp_d.c b/xmhf/third-party/libtommath/bn_mp_cmp_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_cmp_d.c rename to xmhf/third-party/libtommath/bn_mp_cmp_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_cmp_mag.c b/xmhf/third-party/libtommath/bn_mp_cmp_mag.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_cmp_mag.c rename to xmhf/third-party/libtommath/bn_mp_cmp_mag.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_cnt_lsb.c b/xmhf/third-party/libtommath/bn_mp_cnt_lsb.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_cnt_lsb.c rename to xmhf/third-party/libtommath/bn_mp_cnt_lsb.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_copy.c b/xmhf/third-party/libtommath/bn_mp_copy.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_copy.c rename to xmhf/third-party/libtommath/bn_mp_copy.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_count_bits.c b/xmhf/third-party/libtommath/bn_mp_count_bits.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_count_bits.c rename to xmhf/third-party/libtommath/bn_mp_count_bits.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_div.c b/xmhf/third-party/libtommath/bn_mp_div.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_div.c rename to xmhf/third-party/libtommath/bn_mp_div.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_div_2.c b/xmhf/third-party/libtommath/bn_mp_div_2.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_div_2.c rename to xmhf/third-party/libtommath/bn_mp_div_2.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_div_2d.c b/xmhf/third-party/libtommath/bn_mp_div_2d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_div_2d.c rename to xmhf/third-party/libtommath/bn_mp_div_2d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_div_3.c b/xmhf/third-party/libtommath/bn_mp_div_3.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_div_3.c rename to xmhf/third-party/libtommath/bn_mp_div_3.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_div_d.c b/xmhf/third-party/libtommath/bn_mp_div_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_div_d.c rename to xmhf/third-party/libtommath/bn_mp_div_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_dr_is_modulus.c b/xmhf/third-party/libtommath/bn_mp_dr_is_modulus.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_dr_is_modulus.c rename to xmhf/third-party/libtommath/bn_mp_dr_is_modulus.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_dr_reduce.c b/xmhf/third-party/libtommath/bn_mp_dr_reduce.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_dr_reduce.c rename to xmhf/third-party/libtommath/bn_mp_dr_reduce.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_dr_setup.c b/xmhf/third-party/libtommath/bn_mp_dr_setup.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_dr_setup.c rename to xmhf/third-party/libtommath/bn_mp_dr_setup.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_exch.c b/xmhf/third-party/libtommath/bn_mp_exch.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_exch.c rename to xmhf/third-party/libtommath/bn_mp_exch.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_expt_d.c b/xmhf/third-party/libtommath/bn_mp_expt_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_expt_d.c rename to xmhf/third-party/libtommath/bn_mp_expt_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_exptmod.c b/xmhf/third-party/libtommath/bn_mp_exptmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_exptmod.c rename to xmhf/third-party/libtommath/bn_mp_exptmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_exptmod_fast.c b/xmhf/third-party/libtommath/bn_mp_exptmod_fast.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_exptmod_fast.c rename to xmhf/third-party/libtommath/bn_mp_exptmod_fast.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_exteuclid.c b/xmhf/third-party/libtommath/bn_mp_exteuclid.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_exteuclid.c rename to xmhf/third-party/libtommath/bn_mp_exteuclid.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_fread.c b/xmhf/third-party/libtommath/bn_mp_fread.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_fread.c rename to xmhf/third-party/libtommath/bn_mp_fread.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_fwrite.c b/xmhf/third-party/libtommath/bn_mp_fwrite.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_fwrite.c rename to xmhf/third-party/libtommath/bn_mp_fwrite.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_gcd.c b/xmhf/third-party/libtommath/bn_mp_gcd.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_gcd.c rename to xmhf/third-party/libtommath/bn_mp_gcd.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_get_int.c b/xmhf/third-party/libtommath/bn_mp_get_int.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_get_int.c rename to xmhf/third-party/libtommath/bn_mp_get_int.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_grow.c b/xmhf/third-party/libtommath/bn_mp_grow.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_grow.c rename to xmhf/third-party/libtommath/bn_mp_grow.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_init.c b/xmhf/third-party/libtommath/bn_mp_init.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_init.c rename to xmhf/third-party/libtommath/bn_mp_init.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_init_copy.c b/xmhf/third-party/libtommath/bn_mp_init_copy.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_init_copy.c rename to xmhf/third-party/libtommath/bn_mp_init_copy.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_init_multi.c b/xmhf/third-party/libtommath/bn_mp_init_multi.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_init_multi.c rename to xmhf/third-party/libtommath/bn_mp_init_multi.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_init_set.c b/xmhf/third-party/libtommath/bn_mp_init_set.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_init_set.c rename to xmhf/third-party/libtommath/bn_mp_init_set.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_init_set_int.c b/xmhf/third-party/libtommath/bn_mp_init_set_int.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_init_set_int.c rename to xmhf/third-party/libtommath/bn_mp_init_set_int.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_init_size.c b/xmhf/third-party/libtommath/bn_mp_init_size.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_init_size.c rename to xmhf/third-party/libtommath/bn_mp_init_size.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_invmod.c b/xmhf/third-party/libtommath/bn_mp_invmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_invmod.c rename to xmhf/third-party/libtommath/bn_mp_invmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_invmod_slow.c b/xmhf/third-party/libtommath/bn_mp_invmod_slow.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_invmod_slow.c rename to xmhf/third-party/libtommath/bn_mp_invmod_slow.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_is_square.c b/xmhf/third-party/libtommath/bn_mp_is_square.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_is_square.c rename to xmhf/third-party/libtommath/bn_mp_is_square.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_jacobi.c b/xmhf/third-party/libtommath/bn_mp_jacobi.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_jacobi.c rename to xmhf/third-party/libtommath/bn_mp_jacobi.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_karatsuba_mul.c b/xmhf/third-party/libtommath/bn_mp_karatsuba_mul.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_karatsuba_mul.c rename to xmhf/third-party/libtommath/bn_mp_karatsuba_mul.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_karatsuba_sqr.c b/xmhf/third-party/libtommath/bn_mp_karatsuba_sqr.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_karatsuba_sqr.c rename to xmhf/third-party/libtommath/bn_mp_karatsuba_sqr.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_lcm.c b/xmhf/third-party/libtommath/bn_mp_lcm.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_lcm.c rename to xmhf/third-party/libtommath/bn_mp_lcm.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_lshd.c b/xmhf/third-party/libtommath/bn_mp_lshd.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_lshd.c rename to xmhf/third-party/libtommath/bn_mp_lshd.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mod.c b/xmhf/third-party/libtommath/bn_mp_mod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mod.c rename to xmhf/third-party/libtommath/bn_mp_mod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mod_2d.c b/xmhf/third-party/libtommath/bn_mp_mod_2d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mod_2d.c rename to xmhf/third-party/libtommath/bn_mp_mod_2d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mod_d.c b/xmhf/third-party/libtommath/bn_mp_mod_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mod_d.c rename to xmhf/third-party/libtommath/bn_mp_mod_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_montgomery_calc_normalization.c b/xmhf/third-party/libtommath/bn_mp_montgomery_calc_normalization.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_montgomery_calc_normalization.c rename to xmhf/third-party/libtommath/bn_mp_montgomery_calc_normalization.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_montgomery_reduce.c b/xmhf/third-party/libtommath/bn_mp_montgomery_reduce.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_montgomery_reduce.c rename to xmhf/third-party/libtommath/bn_mp_montgomery_reduce.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_montgomery_setup.c b/xmhf/third-party/libtommath/bn_mp_montgomery_setup.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_montgomery_setup.c rename to xmhf/third-party/libtommath/bn_mp_montgomery_setup.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mul.c b/xmhf/third-party/libtommath/bn_mp_mul.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mul.c rename to xmhf/third-party/libtommath/bn_mp_mul.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mul_2.c b/xmhf/third-party/libtommath/bn_mp_mul_2.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mul_2.c rename to xmhf/third-party/libtommath/bn_mp_mul_2.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mul_2d.c b/xmhf/third-party/libtommath/bn_mp_mul_2d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mul_2d.c rename to xmhf/third-party/libtommath/bn_mp_mul_2d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mul_d.c b/xmhf/third-party/libtommath/bn_mp_mul_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mul_d.c rename to xmhf/third-party/libtommath/bn_mp_mul_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_mulmod.c b/xmhf/third-party/libtommath/bn_mp_mulmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_mulmod.c rename to xmhf/third-party/libtommath/bn_mp_mulmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_n_root.c b/xmhf/third-party/libtommath/bn_mp_n_root.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_n_root.c rename to xmhf/third-party/libtommath/bn_mp_n_root.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_neg.c b/xmhf/third-party/libtommath/bn_mp_neg.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_neg.c rename to xmhf/third-party/libtommath/bn_mp_neg.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_or.c b/xmhf/third-party/libtommath/bn_mp_or.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_or.c rename to xmhf/third-party/libtommath/bn_mp_or.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_fermat.c b/xmhf/third-party/libtommath/bn_mp_prime_fermat.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_fermat.c rename to xmhf/third-party/libtommath/bn_mp_prime_fermat.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_is_divisible.c b/xmhf/third-party/libtommath/bn_mp_prime_is_divisible.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_is_divisible.c rename to xmhf/third-party/libtommath/bn_mp_prime_is_divisible.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_is_prime.c b/xmhf/third-party/libtommath/bn_mp_prime_is_prime.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_is_prime.c rename to xmhf/third-party/libtommath/bn_mp_prime_is_prime.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_miller_rabin.c b/xmhf/third-party/libtommath/bn_mp_prime_miller_rabin.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_miller_rabin.c rename to xmhf/third-party/libtommath/bn_mp_prime_miller_rabin.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_next_prime.c b/xmhf/third-party/libtommath/bn_mp_prime_next_prime.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_next_prime.c rename to xmhf/third-party/libtommath/bn_mp_prime_next_prime.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_rabin_miller_trials.c b/xmhf/third-party/libtommath/bn_mp_prime_rabin_miller_trials.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_rabin_miller_trials.c rename to xmhf/third-party/libtommath/bn_mp_prime_rabin_miller_trials.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_prime_random_ex.c b/xmhf/third-party/libtommath/bn_mp_prime_random_ex.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_prime_random_ex.c rename to xmhf/third-party/libtommath/bn_mp_prime_random_ex.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_radix_size.c b/xmhf/third-party/libtommath/bn_mp_radix_size.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_radix_size.c rename to xmhf/third-party/libtommath/bn_mp_radix_size.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_radix_smap.c b/xmhf/third-party/libtommath/bn_mp_radix_smap.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_radix_smap.c rename to xmhf/third-party/libtommath/bn_mp_radix_smap.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_rand.c b/xmhf/third-party/libtommath/bn_mp_rand.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_rand.c rename to xmhf/third-party/libtommath/bn_mp_rand.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_read_radix.c b/xmhf/third-party/libtommath/bn_mp_read_radix.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_read_radix.c rename to xmhf/third-party/libtommath/bn_mp_read_radix.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_read_signed_bin.c b/xmhf/third-party/libtommath/bn_mp_read_signed_bin.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_read_signed_bin.c rename to xmhf/third-party/libtommath/bn_mp_read_signed_bin.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_read_unsigned_bin.c b/xmhf/third-party/libtommath/bn_mp_read_unsigned_bin.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_read_unsigned_bin.c rename to xmhf/third-party/libtommath/bn_mp_read_unsigned_bin.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce.c b/xmhf/third-party/libtommath/bn_mp_reduce.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce.c rename to xmhf/third-party/libtommath/bn_mp_reduce.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k.c b/xmhf/third-party/libtommath/bn_mp_reduce_2k.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k.c rename to xmhf/third-party/libtommath/bn_mp_reduce_2k.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k_l.c b/xmhf/third-party/libtommath/bn_mp_reduce_2k_l.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k_l.c rename to xmhf/third-party/libtommath/bn_mp_reduce_2k_l.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k_setup.c b/xmhf/third-party/libtommath/bn_mp_reduce_2k_setup.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k_setup.c rename to xmhf/third-party/libtommath/bn_mp_reduce_2k_setup.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k_setup_l.c b/xmhf/third-party/libtommath/bn_mp_reduce_2k_setup_l.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_2k_setup_l.c rename to xmhf/third-party/libtommath/bn_mp_reduce_2k_setup_l.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_is_2k.c b/xmhf/third-party/libtommath/bn_mp_reduce_is_2k.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_is_2k.c rename to xmhf/third-party/libtommath/bn_mp_reduce_is_2k.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_is_2k_l.c b/xmhf/third-party/libtommath/bn_mp_reduce_is_2k_l.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_is_2k_l.c rename to xmhf/third-party/libtommath/bn_mp_reduce_is_2k_l.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_reduce_setup.c b/xmhf/third-party/libtommath/bn_mp_reduce_setup.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_reduce_setup.c rename to xmhf/third-party/libtommath/bn_mp_reduce_setup.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_rshd.c b/xmhf/third-party/libtommath/bn_mp_rshd.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_rshd.c rename to xmhf/third-party/libtommath/bn_mp_rshd.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_set.c b/xmhf/third-party/libtommath/bn_mp_set.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_set.c rename to xmhf/third-party/libtommath/bn_mp_set.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_set_int.c b/xmhf/third-party/libtommath/bn_mp_set_int.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_set_int.c rename to xmhf/third-party/libtommath/bn_mp_set_int.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_shrink.c b/xmhf/third-party/libtommath/bn_mp_shrink.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_shrink.c rename to xmhf/third-party/libtommath/bn_mp_shrink.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_signed_bin_size.c b/xmhf/third-party/libtommath/bn_mp_signed_bin_size.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_signed_bin_size.c rename to xmhf/third-party/libtommath/bn_mp_signed_bin_size.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_sqr.c b/xmhf/third-party/libtommath/bn_mp_sqr.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_sqr.c rename to xmhf/third-party/libtommath/bn_mp_sqr.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_sqrmod.c b/xmhf/third-party/libtommath/bn_mp_sqrmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_sqrmod.c rename to xmhf/third-party/libtommath/bn_mp_sqrmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_sqrt.c b/xmhf/third-party/libtommath/bn_mp_sqrt.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_sqrt.c rename to xmhf/third-party/libtommath/bn_mp_sqrt.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_sub.c b/xmhf/third-party/libtommath/bn_mp_sub.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_sub.c rename to xmhf/third-party/libtommath/bn_mp_sub.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_sub_d.c b/xmhf/third-party/libtommath/bn_mp_sub_d.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_sub_d.c rename to xmhf/third-party/libtommath/bn_mp_sub_d.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_submod.c b/xmhf/third-party/libtommath/bn_mp_submod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_submod.c rename to xmhf/third-party/libtommath/bn_mp_submod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_to_signed_bin.c b/xmhf/third-party/libtommath/bn_mp_to_signed_bin.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_to_signed_bin.c rename to xmhf/third-party/libtommath/bn_mp_to_signed_bin.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_to_signed_bin_n.c b/xmhf/third-party/libtommath/bn_mp_to_signed_bin_n.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_to_signed_bin_n.c rename to xmhf/third-party/libtommath/bn_mp_to_signed_bin_n.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_to_unsigned_bin.c b/xmhf/third-party/libtommath/bn_mp_to_unsigned_bin.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_to_unsigned_bin.c rename to xmhf/third-party/libtommath/bn_mp_to_unsigned_bin.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_to_unsigned_bin_n.c b/xmhf/third-party/libtommath/bn_mp_to_unsigned_bin_n.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_to_unsigned_bin_n.c rename to xmhf/third-party/libtommath/bn_mp_to_unsigned_bin_n.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_toom_mul.c b/xmhf/third-party/libtommath/bn_mp_toom_mul.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_toom_mul.c rename to xmhf/third-party/libtommath/bn_mp_toom_mul.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_toom_sqr.c b/xmhf/third-party/libtommath/bn_mp_toom_sqr.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_toom_sqr.c rename to xmhf/third-party/libtommath/bn_mp_toom_sqr.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_toradix.c b/xmhf/third-party/libtommath/bn_mp_toradix.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_toradix.c rename to xmhf/third-party/libtommath/bn_mp_toradix.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_toradix_n.c b/xmhf/third-party/libtommath/bn_mp_toradix_n.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_toradix_n.c rename to xmhf/third-party/libtommath/bn_mp_toradix_n.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_unsigned_bin_size.c b/xmhf/third-party/libtommath/bn_mp_unsigned_bin_size.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_unsigned_bin_size.c rename to xmhf/third-party/libtommath/bn_mp_unsigned_bin_size.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_xor.c b/xmhf/third-party/libtommath/bn_mp_xor.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_xor.c rename to xmhf/third-party/libtommath/bn_mp_xor.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_mp_zero.c b/xmhf/third-party/libtommath/bn_mp_zero.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_mp_zero.c rename to xmhf/third-party/libtommath/bn_mp_zero.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_prime_tab.c b/xmhf/third-party/libtommath/bn_prime_tab.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_prime_tab.c rename to xmhf/third-party/libtommath/bn_prime_tab.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_reverse.c b/xmhf/third-party/libtommath/bn_reverse.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_reverse.c rename to xmhf/third-party/libtommath/bn_reverse.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_s_mp_add.c b/xmhf/third-party/libtommath/bn_s_mp_add.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_s_mp_add.c rename to xmhf/third-party/libtommath/bn_s_mp_add.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_s_mp_exptmod.c b/xmhf/third-party/libtommath/bn_s_mp_exptmod.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_s_mp_exptmod.c rename to xmhf/third-party/libtommath/bn_s_mp_exptmod.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_s_mp_mul_digs.c b/xmhf/third-party/libtommath/bn_s_mp_mul_digs.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_s_mp_mul_digs.c rename to xmhf/third-party/libtommath/bn_s_mp_mul_digs.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_s_mp_mul_high_digs.c b/xmhf/third-party/libtommath/bn_s_mp_mul_high_digs.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_s_mp_mul_high_digs.c rename to xmhf/third-party/libtommath/bn_s_mp_mul_high_digs.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_s_mp_sqr.c b/xmhf/third-party/libtommath/bn_s_mp_sqr.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_s_mp_sqr.c rename to xmhf/third-party/libtommath/bn_s_mp_sqr.c diff --git a/xmhf/xmhf/third-party/libtommath/bn_s_mp_sub.c b/xmhf/third-party/libtommath/bn_s_mp_sub.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bn_s_mp_sub.c rename to xmhf/third-party/libtommath/bn_s_mp_sub.c diff --git a/xmhf/xmhf/third-party/libtommath/bncore.c b/xmhf/third-party/libtommath/bncore.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/bncore.c rename to xmhf/third-party/libtommath/bncore.c diff --git a/xmhf/xmhf/third-party/libtommath/booker.pl b/xmhf/third-party/libtommath/booker.pl similarity index 100% rename from xmhf/xmhf/third-party/libtommath/booker.pl rename to xmhf/third-party/libtommath/booker.pl diff --git a/xmhf/xmhf/third-party/libtommath/callgraph.txt b/xmhf/third-party/libtommath/callgraph.txt similarity index 100% rename from xmhf/xmhf/third-party/libtommath/callgraph.txt rename to xmhf/third-party/libtommath/callgraph.txt diff --git a/xmhf/xmhf/third-party/libtommath/changes.txt b/xmhf/third-party/libtommath/changes.txt similarity index 100% rename from xmhf/xmhf/third-party/libtommath/changes.txt rename to xmhf/third-party/libtommath/changes.txt diff --git a/xmhf/xmhf/third-party/libtommath/demo/demo.c b/xmhf/third-party/libtommath/demo/demo.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/demo/demo.c rename to xmhf/third-party/libtommath/demo/demo.c diff --git a/xmhf/xmhf/third-party/libtommath/demo/timing.c b/xmhf/third-party/libtommath/demo/timing.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/demo/timing.c rename to xmhf/third-party/libtommath/demo/timing.c diff --git a/xmhf/xmhf/third-party/libtommath/dep.pl b/xmhf/third-party/libtommath/dep.pl similarity index 100% rename from xmhf/xmhf/third-party/libtommath/dep.pl rename to xmhf/third-party/libtommath/dep.pl diff --git a/xmhf/xmhf/third-party/libtommath/etc/2kprime.1 b/xmhf/third-party/libtommath/etc/2kprime.1 similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/2kprime.1 rename to xmhf/third-party/libtommath/etc/2kprime.1 diff --git a/xmhf/xmhf/third-party/libtommath/etc/2kprime.c b/xmhf/third-party/libtommath/etc/2kprime.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/2kprime.c rename to xmhf/third-party/libtommath/etc/2kprime.c diff --git a/xmhf/xmhf/third-party/libtommath/etc/drprime.c b/xmhf/third-party/libtommath/etc/drprime.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/drprime.c rename to xmhf/third-party/libtommath/etc/drprime.c diff --git a/xmhf/xmhf/third-party/libtommath/etc/drprimes.28 b/xmhf/third-party/libtommath/etc/drprimes.28 similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/drprimes.28 rename to xmhf/third-party/libtommath/etc/drprimes.28 diff --git a/xmhf/xmhf/third-party/libtommath/etc/drprimes.txt b/xmhf/third-party/libtommath/etc/drprimes.txt similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/drprimes.txt rename to xmhf/third-party/libtommath/etc/drprimes.txt diff --git a/xmhf/xmhf/third-party/libtommath/etc/makefile b/xmhf/third-party/libtommath/etc/makefile similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/makefile rename to xmhf/third-party/libtommath/etc/makefile diff --git a/xmhf/xmhf/third-party/libtommath/etc/makefile.icc b/xmhf/third-party/libtommath/etc/makefile.icc similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/makefile.icc rename to xmhf/third-party/libtommath/etc/makefile.icc diff --git a/xmhf/xmhf/third-party/libtommath/etc/makefile.msvc b/xmhf/third-party/libtommath/etc/makefile.msvc similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/makefile.msvc rename to xmhf/third-party/libtommath/etc/makefile.msvc diff --git a/xmhf/xmhf/third-party/libtommath/etc/mersenne.c b/xmhf/third-party/libtommath/etc/mersenne.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/mersenne.c rename to xmhf/third-party/libtommath/etc/mersenne.c diff --git a/xmhf/xmhf/third-party/libtommath/etc/mont.c b/xmhf/third-party/libtommath/etc/mont.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/mont.c rename to xmhf/third-party/libtommath/etc/mont.c diff --git a/xmhf/xmhf/third-party/libtommath/etc/pprime.c b/xmhf/third-party/libtommath/etc/pprime.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/pprime.c rename to xmhf/third-party/libtommath/etc/pprime.c diff --git a/xmhf/xmhf/third-party/libtommath/etc/prime.1024 b/xmhf/third-party/libtommath/etc/prime.1024 similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/prime.1024 rename to xmhf/third-party/libtommath/etc/prime.1024 diff --git a/xmhf/xmhf/third-party/libtommath/etc/prime.512 b/xmhf/third-party/libtommath/etc/prime.512 similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/prime.512 rename to xmhf/third-party/libtommath/etc/prime.512 diff --git a/xmhf/xmhf/third-party/libtommath/etc/timer.asm b/xmhf/third-party/libtommath/etc/timer.asm similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/timer.asm rename to xmhf/third-party/libtommath/etc/timer.asm diff --git a/xmhf/xmhf/third-party/libtommath/etc/tune.c b/xmhf/third-party/libtommath/etc/tune.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/etc/tune.c rename to xmhf/third-party/libtommath/etc/tune.c diff --git a/xmhf/xmhf/third-party/libtommath/gen.pl b/xmhf/third-party/libtommath/gen.pl similarity index 100% rename from xmhf/xmhf/third-party/libtommath/gen.pl rename to xmhf/third-party/libtommath/gen.pl diff --git a/xmhf/xmhf/third-party/libtommath/libtommath.dsp b/xmhf/third-party/libtommath/libtommath.dsp similarity index 100% rename from xmhf/xmhf/third-party/libtommath/libtommath.dsp rename to xmhf/third-party/libtommath/libtommath.dsp diff --git a/xmhf/xmhf/third-party/libtommath/libtommath_VS2005.sln b/xmhf/third-party/libtommath/libtommath_VS2005.sln similarity index 100% rename from xmhf/xmhf/third-party/libtommath/libtommath_VS2005.sln rename to xmhf/third-party/libtommath/libtommath_VS2005.sln diff --git a/xmhf/xmhf/third-party/libtommath/libtommath_VS2005.vcproj b/xmhf/third-party/libtommath/libtommath_VS2005.vcproj similarity index 100% rename from xmhf/xmhf/third-party/libtommath/libtommath_VS2005.vcproj rename to xmhf/third-party/libtommath/libtommath_VS2005.vcproj diff --git a/xmhf/xmhf/third-party/libtommath/libtommath_VS2008.sln b/xmhf/third-party/libtommath/libtommath_VS2008.sln similarity index 100% rename from xmhf/xmhf/third-party/libtommath/libtommath_VS2008.sln rename to xmhf/third-party/libtommath/libtommath_VS2008.sln diff --git a/xmhf/xmhf/third-party/libtommath/libtommath_VS2008.vcproj b/xmhf/third-party/libtommath/libtommath_VS2008.vcproj similarity index 100% rename from xmhf/xmhf/third-party/libtommath/libtommath_VS2008.vcproj rename to xmhf/third-party/libtommath/libtommath_VS2008.vcproj diff --git a/xmhf/xmhf/third-party/libtommath/logs/README b/xmhf/third-party/libtommath/logs/README similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/README rename to xmhf/third-party/libtommath/logs/README diff --git a/xmhf/xmhf/third-party/libtommath/logs/addsub.png b/xmhf/third-party/libtommath/logs/addsub.png similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/addsub.png rename to xmhf/third-party/libtommath/logs/addsub.png diff --git a/xmhf/xmhf/third-party/libtommath/logs/expt.png b/xmhf/third-party/libtommath/logs/expt.png similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/expt.png rename to xmhf/third-party/libtommath/logs/expt.png diff --git a/xmhf/xmhf/third-party/libtommath/logs/graphs.dem b/xmhf/third-party/libtommath/logs/graphs.dem similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/graphs.dem rename to xmhf/third-party/libtommath/logs/graphs.dem diff --git a/xmhf/xmhf/third-party/libtommath/logs/index.html b/xmhf/third-party/libtommath/logs/index.html similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/index.html rename to xmhf/third-party/libtommath/logs/index.html diff --git a/xmhf/xmhf/third-party/libtommath/logs/invmod.png b/xmhf/third-party/libtommath/logs/invmod.png similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/invmod.png rename to xmhf/third-party/libtommath/logs/invmod.png diff --git a/xmhf/xmhf/third-party/libtommath/logs/mult.png b/xmhf/third-party/libtommath/logs/mult.png similarity index 100% rename from xmhf/xmhf/third-party/libtommath/logs/mult.png rename to xmhf/third-party/libtommath/logs/mult.png diff --git a/xmhf/xmhf/third-party/libtommath/makefile b/xmhf/third-party/libtommath/makefile similarity index 100% rename from xmhf/xmhf/third-party/libtommath/makefile rename to xmhf/third-party/libtommath/makefile diff --git a/xmhf/xmhf/third-party/libtommath/makefile.bcc b/xmhf/third-party/libtommath/makefile.bcc similarity index 100% rename from xmhf/xmhf/third-party/libtommath/makefile.bcc rename to xmhf/third-party/libtommath/makefile.bcc diff --git a/xmhf/xmhf/third-party/libtommath/makefile.cygwin_dll b/xmhf/third-party/libtommath/makefile.cygwin_dll similarity index 100% rename from xmhf/xmhf/third-party/libtommath/makefile.cygwin_dll rename to xmhf/third-party/libtommath/makefile.cygwin_dll diff --git a/xmhf/xmhf/third-party/libtommath/makefile.icc b/xmhf/third-party/libtommath/makefile.icc similarity index 100% rename from xmhf/xmhf/third-party/libtommath/makefile.icc rename to xmhf/third-party/libtommath/makefile.icc diff --git a/xmhf/xmhf/third-party/libtommath/makefile.msvc b/xmhf/third-party/libtommath/makefile.msvc similarity index 100% rename from xmhf/xmhf/third-party/libtommath/makefile.msvc rename to xmhf/third-party/libtommath/makefile.msvc diff --git a/xmhf/xmhf/third-party/libtommath/makefile.shared b/xmhf/third-party/libtommath/makefile.shared similarity index 100% rename from xmhf/xmhf/third-party/libtommath/makefile.shared rename to xmhf/third-party/libtommath/makefile.shared diff --git a/xmhf/xmhf/third-party/libtommath/mess.sh b/xmhf/third-party/libtommath/mess.sh similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mess.sh rename to xmhf/third-party/libtommath/mess.sh diff --git a/xmhf/xmhf/third-party/libtommath/mtest/logtab.h b/xmhf/third-party/libtommath/mtest/logtab.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mtest/logtab.h rename to xmhf/third-party/libtommath/mtest/logtab.h diff --git a/xmhf/xmhf/third-party/libtommath/mtest/mpi-config.h b/xmhf/third-party/libtommath/mtest/mpi-config.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mtest/mpi-config.h rename to xmhf/third-party/libtommath/mtest/mpi-config.h diff --git a/xmhf/xmhf/third-party/libtommath/mtest/mpi-types.h b/xmhf/third-party/libtommath/mtest/mpi-types.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mtest/mpi-types.h rename to xmhf/third-party/libtommath/mtest/mpi-types.h diff --git a/xmhf/xmhf/third-party/libtommath/mtest/mpi.c b/xmhf/third-party/libtommath/mtest/mpi.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mtest/mpi.c rename to xmhf/third-party/libtommath/mtest/mpi.c diff --git a/xmhf/xmhf/third-party/libtommath/mtest/mpi.h b/xmhf/third-party/libtommath/mtest/mpi.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mtest/mpi.h rename to xmhf/third-party/libtommath/mtest/mpi.h diff --git a/xmhf/xmhf/third-party/libtommath/mtest/mtest.c b/xmhf/third-party/libtommath/mtest/mtest.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/mtest/mtest.c rename to xmhf/third-party/libtommath/mtest/mtest.c diff --git a/xmhf/xmhf/third-party/libtommath/pics/design_process.sxd b/xmhf/third-party/libtommath/pics/design_process.sxd similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/design_process.sxd rename to xmhf/third-party/libtommath/pics/design_process.sxd diff --git a/xmhf/xmhf/third-party/libtommath/pics/design_process.tif b/xmhf/third-party/libtommath/pics/design_process.tif similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/design_process.tif rename to xmhf/third-party/libtommath/pics/design_process.tif diff --git a/xmhf/xmhf/third-party/libtommath/pics/expt_state.sxd b/xmhf/third-party/libtommath/pics/expt_state.sxd similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/expt_state.sxd rename to xmhf/third-party/libtommath/pics/expt_state.sxd diff --git a/xmhf/xmhf/third-party/libtommath/pics/expt_state.tif b/xmhf/third-party/libtommath/pics/expt_state.tif similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/expt_state.tif rename to xmhf/third-party/libtommath/pics/expt_state.tif diff --git a/xmhf/xmhf/third-party/libtommath/pics/makefile b/xmhf/third-party/libtommath/pics/makefile similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/makefile rename to xmhf/third-party/libtommath/pics/makefile diff --git a/xmhf/xmhf/third-party/libtommath/pics/primality.tif b/xmhf/third-party/libtommath/pics/primality.tif similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/primality.tif rename to xmhf/third-party/libtommath/pics/primality.tif diff --git a/xmhf/xmhf/third-party/libtommath/pics/radix.sxd b/xmhf/third-party/libtommath/pics/radix.sxd similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/radix.sxd rename to xmhf/third-party/libtommath/pics/radix.sxd diff --git a/xmhf/xmhf/third-party/libtommath/pics/sliding_window.sxd b/xmhf/third-party/libtommath/pics/sliding_window.sxd similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/sliding_window.sxd rename to xmhf/third-party/libtommath/pics/sliding_window.sxd diff --git a/xmhf/xmhf/third-party/libtommath/pics/sliding_window.tif b/xmhf/third-party/libtommath/pics/sliding_window.tif similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pics/sliding_window.tif rename to xmhf/third-party/libtommath/pics/sliding_window.tif diff --git a/xmhf/xmhf/third-party/libtommath/poster.out b/xmhf/third-party/libtommath/poster.out similarity index 100% rename from xmhf/xmhf/third-party/libtommath/poster.out rename to xmhf/third-party/libtommath/poster.out diff --git a/xmhf/xmhf/third-party/libtommath/poster.pdf b/xmhf/third-party/libtommath/poster.pdf similarity index 100% rename from xmhf/xmhf/third-party/libtommath/poster.pdf rename to xmhf/third-party/libtommath/poster.pdf diff --git a/xmhf/xmhf/third-party/libtommath/poster.tex b/xmhf/third-party/libtommath/poster.tex similarity index 100% rename from xmhf/xmhf/third-party/libtommath/poster.tex rename to xmhf/third-party/libtommath/poster.tex diff --git a/xmhf/xmhf/third-party/libtommath/pre_gen/mpi.c b/xmhf/third-party/libtommath/pre_gen/mpi.c similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pre_gen/mpi.c rename to xmhf/third-party/libtommath/pre_gen/mpi.c diff --git a/xmhf/xmhf/third-party/libtommath/pretty.build b/xmhf/third-party/libtommath/pretty.build similarity index 100% rename from xmhf/xmhf/third-party/libtommath/pretty.build rename to xmhf/third-party/libtommath/pretty.build diff --git a/xmhf/xmhf/third-party/libtommath/tombc/grammar.txt b/xmhf/third-party/libtommath/tombc/grammar.txt similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tombc/grammar.txt rename to xmhf/third-party/libtommath/tombc/grammar.txt diff --git a/xmhf/xmhf/third-party/libtommath/tommath.h b/xmhf/third-party/libtommath/tommath.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath.h rename to xmhf/third-party/libtommath/tommath.h diff --git a/xmhf/xmhf/third-party/libtommath/tommath.out b/xmhf/third-party/libtommath/tommath.out similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath.out rename to xmhf/third-party/libtommath/tommath.out diff --git a/xmhf/xmhf/third-party/libtommath/tommath.pdf b/xmhf/third-party/libtommath/tommath.pdf similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath.pdf rename to xmhf/third-party/libtommath/tommath.pdf diff --git a/xmhf/xmhf/third-party/libtommath/tommath.src b/xmhf/third-party/libtommath/tommath.src similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath.src rename to xmhf/third-party/libtommath/tommath.src diff --git a/xmhf/xmhf/third-party/libtommath/tommath.tex b/xmhf/third-party/libtommath/tommath.tex similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath.tex rename to xmhf/third-party/libtommath/tommath.tex diff --git a/xmhf/xmhf/third-party/libtommath/tommath_class.h b/xmhf/third-party/libtommath/tommath_class.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath_class.h rename to xmhf/third-party/libtommath/tommath_class.h diff --git a/xmhf/xmhf/third-party/libtommath/tommath_superclass.h b/xmhf/third-party/libtommath/tommath_superclass.h similarity index 100% rename from xmhf/xmhf/third-party/libtommath/tommath_superclass.h rename to xmhf/third-party/libtommath/tommath_superclass.h diff --git a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_hash.h b/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_hash.h deleted file mode 100644 index 25b9f1b7c5..0000000000 --- a/xmhf/xmhf/src/xmhf-core/include/arch/x86/_txt_hash.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -/* - * hash.h: definition of and support fns for tb_hash_t type - * - * Copyright (c) 2006-2007, Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * Modified for XMHF by jonmccune@cmu.edu, 2011.01.04 - */ - -#ifndef __HASH_H__ -#define __HASH_H__ - -#define TB_HALG_SHA1 0 - -#ifndef SHA1_LENGTH -#define SHA1_LENGTH 20 -#endif -#ifndef SHA256_LENGTH -#define SHA256_LENGTH 32 -#endif - -typedef union { - uint8_t sha1[SHA1_LENGTH]; - uint8_t sha256[SHA256_LENGTH]; -} tb_hash_t; - - -/* static inline const char *hash_alg_to_string(uint8_t hash_alg) */ -/* { */ -/* if ( hash_alg == TB_HALG_SHA1 ) */ -/* return "TB_HALG_SHA1"; */ -/* else { */ -/* static char buf[32]; */ -/* snprintf(buf, sizeof(buf), "unsupported (%u)", hash_alg); */ -/* return buf; */ -/* } */ -/* } */ - - -static inline unsigned int get_hash_size(uint8_t hash_alg) -{ - return (hash_alg == TB_HALG_SHA1) ? SHA1_LENGTH : 0; -} - -extern bool are_hashes_equal(const tb_hash_t *hash1, const tb_hash_t *hash2, - uint8_t hash_alg); -extern bool hash_buffer(const unsigned char* buf, size_t size, tb_hash_t *hash, - uint8_t hash_alg); -extern bool extend_hash(tb_hash_t *hash1, const tb_hash_t *hash2, - uint8_t hash_alg); -extern void print_hash(const tb_hash_t *hash, uint8_t hash_alg); -extern void copy_hash(tb_hash_t *dest_hash, const tb_hash_t *src_hash, - uint8_t hash_alg); - - -#endif /* __HASH_H__ */ - - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/header.S b/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/header.S deleted file mode 100644 index 2a6c7dadbb..0000000000 --- a/xmhf/xmhf/src/xmhf-core/xmhf-bootloader/header.S +++ /dev/null @@ -1,88 +0,0 @@ -/* - * @XMHF_LICENSE_HEADER_START@ - * - * eXtensible, Modular Hypervisor Framework (XMHF) - * Copyright (c) 2009-2012 Carnegie Mellon University - * Copyright (c) 2010-2012 VDG Inc. - * All Rights Reserved. - * - * Developed by: XMHF Team - * Carnegie Mellon University / CyLab - * VDG Inc. - * http://xmhf.org - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of Carnegie Mellon or VDG Inc, nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @XMHF_LICENSE_HEADER_END@ - */ - -#include - - .section .multiboot_header - - .align 4 - .global multiboot_header -multiboot_header: - .long 0x1BADB002 - .long 0x10003 - .long -(0x1BAEB005) - .long multiboot_header - .long multiboot_header - .long 0 - .long 0 - .long init_start - .long 0 - .long 0 - .long 0 - .long 0 - - .extern cstartup - .section .text - .global init_start -init_start: - - movl $(init_stack + INIT_STACK_SIZE), %esp - - pushl $0 - popf - - pushl %ebx - //pushl %eax - call cstartup - -halt: - hlt - jmp halt - - .section .stack -init_stack: - .fill INIT_STACK_SIZE, 1, 0 -