x86: Add support for (paging-based) protection domains
This patch implements a simple, lightweight form of protection domains using a pluggable framework. Currently, the following plugin is available: - Flat memory model with paging. The overall goal of a protection domain implementation within this framework is to define a set of resources that should be accessible to each protection domain and to prevent that protection domain from accessing other resources. The details of each implementation of protection domains may differ substantially, but they should all be guided by the principle of least privilege. However, that idealized principle is balanced against the practical objectives of limiting the number of relatively time-consuming context switches and minimizing changes to existing code. For additional information, please refer to cpu/x86/mm/README.md. This patch also causes the C compiler to be used as the default linker and assembler.
This commit is contained in:
parent
b0de416682
commit
3908253038
48 changed files with 3558 additions and 295 deletions
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "helpers.h"
|
||||
#include <stdlib.h>
|
||||
#include "prot-domains.h"
|
||||
|
||||
/** PCI configuration register identifier for Base Address Registers */
|
||||
#define PCI_CONFIG_REG_BAR0 0x10
|
||||
|
@ -98,22 +100,23 @@ uint32_t pci_config_read(pci_config_addr_t addr);
|
|||
void pci_config_write(pci_config_addr_t addr, uint32_t data);
|
||||
void pci_command_enable(pci_config_addr_t addr, uint32_t flags);
|
||||
|
||||
/**
|
||||
* PCI device driver instance with an optional single MMIO range and optional
|
||||
* metadata.
|
||||
*/
|
||||
typedef struct pci_driver {
|
||||
uintptr_t mmio; /**< MMIO range base address */
|
||||
uintptr_t meta; /**< Driver-defined metadata base address */
|
||||
} pci_driver_t;
|
||||
typedef dom_client_data_t pci_driver_t;
|
||||
|
||||
void pci_init(pci_driver_t *c_this, pci_config_addr_t pci_addr, uintptr_t meta);
|
||||
int pci_irq_agent_set_pirq(IRQAGENT agent, INTR_PIN pin, PIRQ pirq);
|
||||
void pci_init(pci_driver_t *c_this,
|
||||
pci_config_addr_t pci_addr,
|
||||
size_t mmio_sz,
|
||||
uintptr_t meta,
|
||||
size_t meta_sz);
|
||||
void pci_irq_agent_set_pirq(IRQAGENT agent, INTR_PIN pin, PIRQ pirq);
|
||||
void pci_pirq_set_irq(PIRQ pirq, uint8_t irq, uint8_t route_to_legacy);
|
||||
void pci_root_complex_init(void);
|
||||
void pci_root_complex_lock(void);
|
||||
|
||||
#define PCI_MMIO_READL(c_this, dest, reg_addr) \
|
||||
dest = *((volatile uint32_t *)((c_this).mmio + (reg_addr)))
|
||||
dest = *((volatile uint32_t *) \
|
||||
(((uintptr_t)PROT_DOMAINS_MMIO(c_this)) + (reg_addr)))
|
||||
#define PCI_MMIO_WRITEL(c_this, reg_addr, src) \
|
||||
*((volatile uint32_t *)((c_this).mmio + (reg_addr))) = (src)
|
||||
*((volatile uint32_t *) \
|
||||
(((uintptr_t)PROT_DOMAINS_MMIO(c_this)) + (reg_addr))) = (src)
|
||||
|
||||
#endif /* CPU_X86_DRIVERS_LEGACY_PC_PCI_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue