diff options
Diffstat (limited to 'big-little/secure_world/secure_world.h')
-rw-r--r-- | big-little/secure_world/secure_world.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/big-little/secure_world/secure_world.h b/big-little/secure_world/secure_world.h new file mode 100644 index 0000000..9d6db42 --- /dev/null +++ b/big-little/secure_world/secure_world.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2011, ARM Limited. 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 ARM nor the names of its + * contributors may be used to endorse or promote products + * derived from this software without specific prior written + * permission. + */ + +#ifndef __SECURE_WORLD_H__ +#define __SECURE_WORLD_H__ + +#include "hyp_types.h" +#include "virt_helpers.h" +#include "events.h" +#include "misc.h" +#include "gic_registers.h" +#include "hyp_vmmap.h" + +/* Definitions for creating a 4K page table entry */ +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) +#define PAGE_ALIGN(x) (x & PAGE_MASK) + +#define MB_SHIFT 20 +#define MB_SIZE (1UL << MB_SHIFT) +#define MB_MASK (~(MB_SIZE-1)) +#define MB_ALIGN(x) (x & MB_MASK) + +#define SP_L1_BASE_SHIFT 10 +#define SP_L1_BASE_MASK (~((1UL << SP_L1_BASE_SHIFT) - 1)) + +/* Definitions for first level small page descriptors */ +#define SMALL_PAGE (1 << 0) +#define SMALL_PAGE_NS (1 << 3) + +/* Definitions for second level small page descriptors */ +#define SP_XN (1 << 0) +#define SP_SBO (1 << 1) +#define SP_BUFFERABLE (1 << 2) +#define SP_CACHEABLE (1 << 3) +#define SP_AP0 (1 << 4) +#define SP_AP1 (1 << 5) +#define SP_AP2 (1 << 9) +#define SP_TEX0 (1 << 6) +#define SP_TEX1 (1 << 7) +#define SP_TEX2 (1 << 8) +#define SP_SHARED (1 << 10) +#define SP_GLOBAL (1 << 11) + +typedef struct sec_stack { + unsigned stack[STACK_SIZE]; +} sec_stack; + +typedef struct sec_context { + unsigned sctlr; + unsigned actlr; + unsigned cpacr; + unsigned nsacr; + unsigned scr; + unsigned vbar; + unsigned mvbar; + unsigned cntfrq; + unsigned cci_sar; + unsigned vgic_icdisr0; + unsigned vgic_iccpmr; +} sec_context; + +extern void enable_caches(void); +extern void secure_context_restore(void); +extern void secure_context_save(unsigned); + +#endif /* __SECURE_WORLD_H__ */ |