x86, galileo: Add sample non-driver protection domain
This patch adds a simple non-driver protection domain sample to serve as an example for defining other non-driver protection domains. It simply performs a ping-pong test of protection domain switching latency during boot, including optional accesses to a private metadata region, and prints out the results.
This commit is contained in:
parent
e0aefd11d9
commit
73774def6b
8 changed files with 243 additions and 1 deletions
|
@ -63,6 +63,10 @@ SECTIONS {
|
|||
{
|
||||
*(.rodata*)
|
||||
|
||||
_sdata_kern_startup_func = .;
|
||||
KEEP(*(.kern_startup_func))
|
||||
_edata_kern_startup_func = .;
|
||||
|
||||
_sdata_shared_isr = .;
|
||||
KEEP(*(.shared_isr_data*))
|
||||
_edata_shared_isr = .;
|
||||
|
|
|
@ -119,6 +119,10 @@ SECTIONS {
|
|||
*(.rodata*)
|
||||
*(.data*)
|
||||
|
||||
_sdata_kern_startup_func = .;
|
||||
KEEP(*(.kern_startup_func))
|
||||
_edata_kern_startup_func = .;
|
||||
|
||||
/*
|
||||
These could alternatively be treated as read-only data to prevent tampering
|
||||
from the user privilege level.
|
||||
|
|
|
@ -128,6 +128,10 @@ SECTIONS {
|
|||
*(.rodata*)
|
||||
*(.data*)
|
||||
|
||||
_sdata_kern_startup_func = .;
|
||||
KEEP(*(.kern_startup_func))
|
||||
_edata_kern_startup_func = .;
|
||||
|
||||
/*
|
||||
These could alternatively be treated as read-only data to prevent tampering
|
||||
from the user privilege level.
|
||||
|
|
46
cpu/x86/startup.h
Normal file
46
cpu/x86/startup.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2016, 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:
|
||||
* 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 copyright holder nor the names of its
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CPU_X86_STARTUP_H_
|
||||
#define CPU_X86_STARTUP_H_
|
||||
|
||||
/**
|
||||
* \brief Declare a function that will be automatically invoked from the kernel
|
||||
* protection domain during boot, after all of the default device
|
||||
* initialization has been completed.
|
||||
*/
|
||||
#define KERN_STARTUP_FUNC(f) \
|
||||
static void f(void); \
|
||||
static uintptr_t \
|
||||
__attribute__((used, section(".kern_startup_func"))) \
|
||||
__kern_startup_f = (uintptr_t)f; \
|
||||
static void f(void)
|
||||
|
||||
#endif /* CPU_X86_STARTUP_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue