FreeNOS
|
ARM architecture specific code such as caching, virtual memory and exception/interrupt handling. More...
Namespaces | |
Arch | |
Data Structures | |
class | ARMCacheV6 |
ARMv6 cache management implementation. More... | |
class | ARMCacheV7 |
ARMv7 cache management implementation. More... | |
class | ARMControl |
ARM System Control Coprocessor (CP15). More... | |
struct | CPUState |
Contains all the CPU registers. More... | |
class | ARMCore |
Class representing an ARM processor core. More... | |
class | ARMException |
ARM exception handling functionality. More... | |
class | ARMFirstTable |
ARM first level page table. More... | |
class | ARMGenericInterrupt |
ARM Generic Interrupt Controller (GIC) version 2. More... | |
class | ARMIO |
Input/Output operations specific to the ARM architecture. More... | |
class | ARMMap |
Memory mapping for the kernel and user processes on the ARM architecture. More... | |
class | ARMPaging |
ARM virtual memory implementation. More... | |
class | ARMSecondTable |
ARM second level page table implementation. More... | |
class | ARMTimer |
ARM Generic Timer. More... | |
class | SunxiClockControl |
Allwinner Clock Control Unit (CCU) More... | |
class | SunxiCpuConfig |
Allwinner sunxi CPU configuration module support. More... | |
class | SunxiPowerManagement |
Allwinner Power, Reset and Clock Management (PRCM) module. More... | |
class | SunxiSystemControl |
Allwinner System Control (SYSCON) module. More... | |
Macros | |
#define | IRQ(vector) (vector) |
Remap interrupt vector (unused for ARM) More... | |
#define | mrc(coproc, opcode1, opcode2, reg, subReg) |
Move to ARM from CoProcessor (MRC). More... | |
#define | mcr(coproc, opcode1, opcode2, reg, subReg, value) |
Move to CoProcessor from ARM (MCR). More... | |
#define | mrrc(coproc, opcode1, CRm) |
64-bit move to ARM from CoProcessor (MRC). More... | |
#define | mcrr(coproc, opcode1, CRm, value) |
64-bit move to CoProcessor from ARM (MCR). More... | |
#define | timestamp() 0 |
Reads the CPU's timestamp counter. More... | |
#define | cpu_reboot() |
Reboot the system. More... | |
#define | cpu_shutdown() |
Shutdown the machine via ACPI. More... | |
#define | idle() asm volatile ("wfi") |
Puts the CPU in a lower power consuming state. More... | |
#define | vbar_set(addr) mcr(p15, 0, 0, c12, c0, (addr)) |
Change Vector Base Address (VBAR) More... | |
#define | sysctrl_read() (mrc(p15, 0, 0, c1, c0)) |
Read System Control register. More... | |
#define | sysctrl_write(val) mcr(p15, 0, 0, c1, c0, (val)) |
Write System Control register. More... | |
#define | read_core_id() (mrc(p15, 0, 5, c0, c0) & 0xff) |
Read unique core identifier. More... | |
#define | tlb_invalidate(page) |
#define | ARM_EX_VECTAB_SIZE (64) |
Size of the ARM exception vector table in bytes. More... | |
Functions | |
void | tlb_flush_all () |
Flush the entire Translation Lookaside Buffer. More... | |
void | dmb () |
Data Memory Barrier. More... | |
void | dsb () |
Data Synchronisation Barrier. More... | |
void | flushBranchPrediction () |
Flush branch prediction. More... | |
void | isb () |
Instruction Synchronisation Barrier (ARMv7 and above) More... | |
void | flushPrefetchBuffer () |
Flush Prefetch Buffer. More... | |
struct CPUState | ALIGN (4) CPUState |
Contains all the CPU registers. More... | |
Variables | |
class ARMCore | ALIGN |
#define | USR_MODE 16 |
ARM Program Status Register (CPSR) More... | |
#define | IRQ_MODE 18 |
#define | FIQ_MODE 17 |
#define | SVC_MODE 19 |
#define | ABT_MODE 23 |
#define | UND_MODE 27 |
#define | SYS_MODE 31 |
#define | HYP_MODE 0x1a |
#define | MODE_MASK 0x1f |
#define | IRQ_BIT (1 << 7) |
#define | FIQ_BIT (1 << 6) |
#define | ASYNC_ABORT_BIT (1 << 8) |
#define | ELR .long 0xe12ef30e |
ARM Model-Specific Instructions. More... | |
#define | ERET .long 0xe160006e |
eret More... | |
#define | PAGESHIFT 12 |
ARM Memory Constants. More... | |
#define | DIRSHIFT 20 |
Page table bit shift. More... | |
#define | PAGESIZE 4096 |
ARM uses 4K pages. More... | |
#define | PAGEDIR_MAX 4096 |
Number of entries in the first-level page table. More... | |
#define | PAGEDIR_SIZE (PAGEDIR_MAX * sizeof(u32)) |
#define | PAGETAB_MAX 256 |
Number of entries in a second-level page table. More... | |
#define | PAGETAB_SIZE (PAGETAB_MAX * sizeof(u32)) |
#define | PAGETAB_SPAN (PAGETAB_MAX*PAGESIZE) |
#define | PAGEMASK 0xfffff000 |
Mask to find the page. More... | |
#define | SECTIONMASK 0xfff00000 |
Mask for large 1MiB section mappings. More... | |
#define | MEMALIGN 4 |
Memory address alignment. More... | |
ARM Kernel Traps | |
ARM specific software interrupts. These functions are called by the user program to invoke the kernel APIs, also known as system calls. On ARM, there are no machine-specific input operand constraints to specify registers for inline assembly. Therefore, we need to use Local Register Variables syntax to guarantee that specific registers are used. | |
ulong | trapKernel1 (ulong api, ulong arg1) |
Perform a kernel trap with 1 argument. More... | |
ulong | trapKernel2 (ulong api, ulong arg1, ulong arg2) |
Perform a kernel trap with 2 arguments. More... | |
ulong | trapKernel3 (ulong api, ulong arg1, ulong arg2, ulong arg3) |
Perform a kernel trap with 3 arguments. More... | |
ulong | trapKernel4 (ulong api, ulong arg1, ulong arg2, ulong arg3, ulong arg4) |
Perform a kernel trap with 4 arguments. More... | |
ulong | trapKernel5 (ulong api, ulong arg1, ulong arg2, ulong arg3, ulong arg4, ulong arg5) |
Perform a kernel trap with 5 arguments. More... | |
ARM architecture specific code such as caching, virtual memory and exception/interrupt handling.
#define ABT_MODE 23 |
Definition at line 50 of file ARMConstant.h.
#define ARM_EX_VECTAB_SIZE (64) |
Size of the ARM exception vector table in bytes.
Definition at line 39 of file ARMException.h.
#define ASYNC_ABORT_BIT (1 << 8) |
Definition at line 57 of file ARMConstant.h.
#define cpu_shutdown | ( | ) |
#define DIRSHIFT 20 |
Page table bit shift.
In ARM, the first-level page directory entry is selected by bits [31:20] from the virtual address, plus two 0 bytes.
Definition at line 94 of file ARMConstant.h.
#define ELR .long 0xe12ef30e |
#define ERET .long 0xe160006e |
eret
Definition at line 72 of file ARMConstant.h.
#define FIQ_BIT (1 << 6) |
Definition at line 56 of file ARMConstant.h.
#define FIQ_MODE 17 |
Definition at line 48 of file ARMConstant.h.
#define HYP_MODE 0x1a |
Definition at line 53 of file ARMConstant.h.
#define idle | ( | ) | asm volatile ("wfi") |
#define IRQ | ( | vector | ) | (vector) |
#define IRQ_BIT (1 << 7) |
Definition at line 55 of file ARMConstant.h.
#define IRQ_MODE 18 |
Definition at line 47 of file ARMConstant.h.
#define mcr | ( | coproc, | |
opcode1, | |||
opcode2, | |||
reg, | |||
subReg, | |||
value | |||
) |
#define mcrr | ( | coproc, | |
opcode1, | |||
CRm, | |||
value | |||
) |
#define MEMALIGN 4 |
Memory address alignment.
Definition at line 127 of file ARMConstant.h.
#define MODE_MASK 0x1f |
Definition at line 54 of file ARMConstant.h.
#define mrc | ( | coproc, | |
opcode1, | |||
opcode2, | |||
reg, | |||
subReg | |||
) |
#define mrrc | ( | coproc, | |
opcode1, | |||
CRm | |||
) |
#define PAGEDIR_MAX 4096 |
Number of entries in the first-level page table.
TTBR0 is the first-level page table for the application. TTBR1 is always 16KB, the first-level page table of the kernel/OS.
Definition at line 105 of file ARMConstant.h.
#define PAGEDIR_SIZE (PAGEDIR_MAX * sizeof(u32)) |
Definition at line 106 of file ARMConstant.h.
#define PAGEMASK 0xfffff000 |
Mask to find the page.
Definition at line 121 of file ARMConstant.h.
#define PAGESHIFT 12 |
#define PAGESIZE 4096 |
ARM uses 4K pages.
Definition at line 97 of file ARMConstant.h.
#define PAGETAB_MAX 256 |
Number of entries in a second-level page table.
Second-level page tables are 1KB in size and map 1MB of virtual memory. Second-level page tables must be aligned on 1KB boundaries.
Definition at line 116 of file ARMConstant.h.
#define PAGETAB_SIZE (PAGETAB_MAX * sizeof(u32)) |
Definition at line 117 of file ARMConstant.h.
#define PAGETAB_SPAN (PAGETAB_MAX*PAGESIZE) |
Definition at line 118 of file ARMConstant.h.
#define read_core_id | ( | ) | (mrc(p15, 0, 5, c0, c0) & 0xff) |
Read unique core identifier.
This function reads the Multi-Processor Affinity Register (MPIDR) to determine the unique identifier of the processor. Note that only the most significant affinity level 0 is used and others are ignored.
#define SECTIONMASK 0xfff00000 |
Mask for large 1MiB section mappings.
Definition at line 124 of file ARMConstant.h.
#define SVC_MODE 19 |
Definition at line 49 of file ARMConstant.h.
#define SYS_MODE 31 |
Definition at line 52 of file ARMConstant.h.
#define sysctrl_read | ( | ) | (mrc(p15, 0, 0, c1, c0)) |
#define sysctrl_write | ( | val | ) | mcr(p15, 0, 0, c1, c0, (val)) |
#define timestamp | ( | ) | 0 |
#define tlb_invalidate | ( | page | ) |
#define UND_MODE 27 |
Definition at line 51 of file ARMConstant.h.
#define USR_MODE 16 |
ARM Program Status Register (CPSR)
Definition at line 46 of file ARMConstant.h.
#define vbar_set | ( | addr | ) | mcr(p15, 0, 0, c12, c0, (addr)) |
struct CPUState ALIGN | ( | 4 | ) |
Contains all the CPU registers.
|
inline |
Data Memory Barrier.
Ensures that all memory transactions are complete when the next instruction runs. If the next instruction is not a memory instruction, it is allowed to run out of order. The DMB provides slightly looser memory barrier than DSB on ARM.
Definition at line 180 of file ARMCore.h.
Referenced by ARMIO::read(), and ARMIO::write().
|
inline |
Data Synchronisation Barrier.
Enforces a strict memory barrier which ensures all memory transactions are completed when the next instruction begins. The DSB is the most strict memory barrier available on ARM.
Definition at line 198 of file ARMCore.h.
Referenced by ARMCacheV7::cleanAddress(), ARMCacheV6::cleanInvalidate(), ARMCacheV7::cleanInvalidate(), ARMCacheV7::cleanInvalidateAddress(), ARMCacheV7::flushLevel(), ARMCacheV6::invalidate(), ARMCacheV7::invalidateAddress(), Sun8iEmac::receive(), Sun8iEmac::resetReceive(), and Sun8iEmac::startDMA().
|
inline |
Flush branch prediction.
Definition at line 210 of file ARMCore.h.
Referenced by ARMCacheV6::cleanInvalidate(), and ARMCacheV7::cleanInvalidate().
|
inline |
Flush Prefetch Buffer.
Definition at line 230 of file ARMCore.h.
Referenced by ARMCacheV6::cleanInvalidate(), and ARMControl::write().
|
inline |
Instruction Synchronisation Barrier (ARMv7 and above)
Definition at line 218 of file ARMCore.h.
Referenced by ARMPaging::activate(), ARMCacheV7::cleanAddress(), ARMCacheV7::cleanInvalidate(), ARMCacheV7::cleanInvalidateAddress(), ARMPaging::map(), and ARMPaging::unmap().
|
inline |
Flush the entire Translation Lookaside Buffer.
Definition at line 161 of file ARMCore.h.
Referenced by ARMPaging::activate().
Perform a kernel trap with 1 argument.
api | Unique number of the handler to execute. |
arg1 | First argument |
Definition at line 59 of file ARMTraps.h.
Referenced by SystemInfo().
Perform a kernel trap with 2 arguments.
api | Unique number of the handler to execute. |
arg1 | First argument |
arg2 | Second argument |
Definition at line 80 of file ARMTraps.h.
Referenced by PrivExec().
Perform a kernel trap with 3 arguments.
api | Unique number of the handler to execute. |
arg1 | First argument |
arg2 | Second argument |
arg3 | Third argument |
Definition at line 103 of file ARMTraps.h.
Perform a kernel trap with 4 arguments.
api | Unique number of the handler to execute. |
arg1 | First argument |
arg2 | Second argument |
arg3 | Third argument |
arg4 | Fourth argument |
Definition at line 128 of file ARMTraps.h.
Referenced by ProcessCtl().
Perform a kernel trap with 5 arguments.
api | Unique number of the handler to execute. |
arg1 | First argument |
arg2 | Second argument |
arg3 | Third argument |
arg4 | Fourth argument |
arg5 | Fifth argument |
Definition at line 156 of file ARMTraps.h.
Referenced by VMCopy().
class ARMCore ALIGN |