mirror of
https://github.com/drasko/codezero.git
synced 2026-01-19 22:33:15 +01:00
Initial commit
This commit is contained in:
9
include/l4/glue/arm/init.h
Normal file
9
include/l4/glue/arm/init.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __ARM_GLUE_INIT_H__
|
||||
#define __ARM_GLUE_INIT_H__
|
||||
|
||||
#include <l4/generic/tcb.h>
|
||||
|
||||
void switch_to_user(struct ktcb *inittask);
|
||||
void timer_start(void);
|
||||
|
||||
#endif /* __ARM_GLUE_INIT_H__ */
|
||||
71
include/l4/glue/arm/memlayout.h
Normal file
71
include/l4/glue/arm/memlayout.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Virtual memory layout of ARM systems.
|
||||
*/
|
||||
|
||||
#ifndef __MEMLAYOUT_H__
|
||||
#define __MEMLAYOUT_H__
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include INC_GLUE(memory.h)
|
||||
#endif
|
||||
#include INC_PLAT(offsets.h)
|
||||
|
||||
#define USER_AREA_START 0x10000000
|
||||
#define USER_AREA_END 0x20000000
|
||||
#define USER_AREA_SIZE (USER_AREA_END - USER_AREA_START)
|
||||
#define USER_AREA_SECTIONS (USER_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
#define PMDS_PER_TASK (USER_AREA_SIZE / PMD_MAP_SIZE)
|
||||
|
||||
#define SHM_AREA_START 0x20000000
|
||||
#define SHM_AREA_END 0x30000000
|
||||
#define SHM_AREA_SIZE (SHM_AREA_END - SHM_AREA_START)
|
||||
#define SHM_AREA_SECTIONS (SHM_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
#define INITTASK_AREA_START 0xE0000000
|
||||
#define INITTASK_AREA_END 0xF0000000 /* 256 MB, too much. */
|
||||
#define INITTASK_AREA_SIZE (INITTASK_AREA_END - INITTASK_AREA_START)
|
||||
|
||||
#define KERNEL_AREA_START 0xF0000000
|
||||
#define KERNEL_AREA_END 0xF8000000 /* 128 MB */
|
||||
#define KERNEL_AREA_SIZE (KERNEL_AREA_END - KERNEL_AREA_START)
|
||||
#define KERNEL_AREA_SECTIONS (KERNEL_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
#define UTCB_AREA_START 0xF8000000
|
||||
#define UTCB_AREA_END 0xF9000000
|
||||
#define UTCB_AREA_SIZE (UTCB_AREA_END - UTCB_AREA_START)
|
||||
#define UTCB_AREA_SECTIONS (UTCB_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
#define IO_AREA_START 0xF9000000
|
||||
#define IO_AREA_END 0xFF000000
|
||||
#define IO_AREA_SIZE (IO_AREA_END - IO_AREA_START)
|
||||
#define IO_AREA_SECTIONS (IO_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
#define USER_KIP_PAGE 0xFF000000
|
||||
|
||||
/* ARM-specific offset in KIP that tells the address of UTCB page */
|
||||
#define UTCB_KIP_OFFSET 0xFF0
|
||||
|
||||
#define IO_AREA0_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*0))
|
||||
#define IO_AREA1_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*1))
|
||||
#define IO_AREA2_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*2))
|
||||
#define IO_AREA3_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*3))
|
||||
#define IO_AREA4_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*4))
|
||||
#define IO_AREA5_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*5))
|
||||
#define IO_AREA6_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*6))
|
||||
#define IO_AREA7_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*7))
|
||||
|
||||
#define ARM_HIGH_VECTOR 0xFFFF0000
|
||||
#define ARM_SYSCALL_VECTOR 0xFFFFFF00
|
||||
|
||||
#define KERNEL_OFFSET (KERNEL_AREA_START - PHYS_MEM_START)
|
||||
|
||||
/* User tasks define them differently */
|
||||
#if defined (__KERNEL__)
|
||||
#define phys_to_virt(addr) ((unsigned int)(addr) + KERNEL_OFFSET)
|
||||
#define virt_to_phys(addr) ((unsigned int)(addr) - KERNEL_OFFSET)
|
||||
#endif
|
||||
|
||||
#define KERN_ADDR(x) ((x >= KERNEL_AREA_START) && (x < KERNEL_AREA_END))
|
||||
#define USER_ADDR(x) ((x >= USER_AREA_START) && (x < USER_AREA_END))
|
||||
|
||||
#endif /* __MEMLAYOUT_H__ */
|
||||
124
include/l4/glue/arm/memory.h
Normal file
124
include/l4/glue/arm/memory.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Includes memory-related architecture specific definitions and their
|
||||
* corresponding generic wrappers.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
#ifndef __GLUE_ARM_MEMORY_H__
|
||||
#define __GLUE_ARM_MEMORY_H__
|
||||
|
||||
#include INC_ARCH(bootdesc.h) /* Definition of last loaded svc image address */
|
||||
#include INC_GLUE(memlayout.h) /* Important generic definitions */
|
||||
#include INC_SUBARCH(mm.h)
|
||||
|
||||
/* Generic definitions */
|
||||
#define PAGE_SIZE ARM_PAGE_SIZE
|
||||
#define PAGE_MASK ARM_PAGE_MASK
|
||||
#define PAGE_BITS ARM_PAGE_BITS
|
||||
|
||||
/*
|
||||
* This defines the largest size defined by this architecture that is
|
||||
* easily mappable. ARM supports 1MB mappings so it fits well. If it's
|
||||
* unsupported by the arch then a reasonable size could be 1MB.
|
||||
*/
|
||||
#define SECTION_SIZE ARM_SECTION_SIZE
|
||||
#define SECTION_MASK ARM_SECTION_MASK
|
||||
#define SECTION_BITS ARM_SECTION_BITS
|
||||
|
||||
/* Aligns to the upper page (ceiling) */
|
||||
#define page_align_up(addr) ((((unsigned int)(addr)) + \
|
||||
(PAGE_SIZE - 1)) & \
|
||||
(~PAGE_MASK))
|
||||
/* Aligns to the lower page (floor) */
|
||||
#define page_align(addr) (((unsigned int)(addr)) & \
|
||||
(~PAGE_MASK))
|
||||
|
||||
#define is_aligned(val, mask) (!(((unsigned long)val) & mask))
|
||||
#define is_page_aligned(val) (!(((unsigned long)val) & PAGE_MASK))
|
||||
|
||||
/* Align to given size */
|
||||
#define align(addr, size) (((unsigned int)(addr)) & (~(size-1)))
|
||||
|
||||
/* Extract page frame number from address and vice versa. */
|
||||
#define __pfn(x) (((unsigned long)(x)) >> PAGE_BITS)
|
||||
#define __pfn_to_addr(x) (((unsigned long)(x)) << PAGE_BITS)
|
||||
|
||||
/* Extract physical address from page table entry (pte) */
|
||||
#define __pte_to_addr(x) (((unsigned long)(x)) & ~PAGE_MASK)
|
||||
|
||||
/* Minimum excess needed for word alignment */
|
||||
#define SZ_WORD sizeof(unsigned int)
|
||||
#define WORD_BITS 32
|
||||
#define WORD_BITS_LOG2 5
|
||||
#define BITWISE_GETWORD(x) ((x) >> WORD_BITS_LOG2) /* Divide by 32 */
|
||||
#define BITWISE_GETBIT(x) (1 << ((x) % WORD_BITS))
|
||||
|
||||
#define align_up(addr, size) ((((unsigned long)(addr)) + ((size) - 1)) & (~((size) - 1)))
|
||||
|
||||
/* Endianness conversion */
|
||||
static inline void be32_to_cpu(unsigned int x)
|
||||
{
|
||||
char *p = (char *)&x;
|
||||
char tmp;
|
||||
|
||||
/* Swap bytes */
|
||||
tmp = p[0];
|
||||
p[0] = p[3];
|
||||
p[3] = tmp;
|
||||
|
||||
tmp = p[1];
|
||||
p[1] = p[2];
|
||||
p[2] = tmp;
|
||||
}
|
||||
|
||||
/* Some anticipated values in terms of memory consumption */
|
||||
#define TASK_AVERAGE_SIZE SZ_16MB
|
||||
#define TASKS_PER_1MB_GRANT 28
|
||||
|
||||
extern pgd_table_t kspace;
|
||||
extern pmd_table_t pmd_tables[];
|
||||
extern unsigned long pmdtab_i;
|
||||
|
||||
void init_pmd_tables(void);
|
||||
pmd_table_t *alloc_boot_pmd(void);
|
||||
|
||||
/*
|
||||
* Each time a pager grants memory to the kernel, these parameters are called
|
||||
* for in order to distribute the granted memory for different purposes.
|
||||
*
|
||||
* The granted memory is used in an architecture-specific way, e.g. for pgds,
|
||||
* pmds, and kernel stack. Therefore this should be defined per-arch.
|
||||
*/
|
||||
typedef struct kmem_usage_per_grant {
|
||||
int grant_size; /* The size of the grant given by pager */
|
||||
int task_size_avg; /* Average memory a task occupies */
|
||||
int tasks_per_kmem_grant; /* Num of tasks to allocate for, per grant */
|
||||
int pg_total; /* Total size of page allocs needed per grant */
|
||||
int pmd_total; /* Total size of pmd allocs needed per grant */
|
||||
int pgd_total; /* Total size of pgd allocs needed per grant */
|
||||
int extra; /* Extra unused space, left per grant */
|
||||
} kmem_usage_per_grant_t;
|
||||
|
||||
void paging_init(void);
|
||||
void init_pmd_tables(void);
|
||||
void init_clear_ptab(void);
|
||||
|
||||
unsigned int space_flags_to_ptflags(unsigned int flags);
|
||||
|
||||
void add_boot_mapping(unsigned int paddr, unsigned int vaddr,
|
||||
unsigned int size, unsigned int flags);
|
||||
void add_mapping_pgd(unsigned int paddr, unsigned int vaddr,
|
||||
unsigned int size, unsigned int flags,
|
||||
pgd_table_t *pgd);
|
||||
void add_mapping(unsigned int paddr, unsigned int vaddr,
|
||||
unsigned int size, unsigned int flags);
|
||||
void remove_mapping(unsigned long vaddr);
|
||||
void remove_mapping_pgd(unsigned long vaddr, pgd_table_t *pgd);
|
||||
void prealloc_phys_pagedesc(void);
|
||||
|
||||
void copy_pgd_kern_all(pgd_table_t *);
|
||||
pte_t virt_to_pte(unsigned long virtual);
|
||||
pte_t virt_to_pte_from_pgd(unsigned long virtual, pgd_table_t *pgd);
|
||||
|
||||
#endif /* __GLUE_ARM_MEMORY_H__ */
|
||||
|
||||
60
include/l4/glue/arm/syscall.h
Normal file
60
include/l4/glue/arm/syscall.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* ARM-specific system call details.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ARM_GLUE_SYSCALL_H__
|
||||
#define __ARM_GLUE_SYSCALL_H__
|
||||
|
||||
/* Only specific call is the trap that gives back the kip address
|
||||
* from which other system calls can be discovered. */
|
||||
#define L4_TRAP_KIP 0xB4
|
||||
|
||||
/* Used in the kernel to refer to virtual address of this page.
|
||||
* User space discovers it from the KIP */
|
||||
#define ARM_SYSCALL_PAGE 0xFFFFF000
|
||||
|
||||
extern unsigned int __syscall_page_start;
|
||||
|
||||
typedef struct syscall_args {
|
||||
u32 r0;
|
||||
u32 r1;
|
||||
u32 r2;
|
||||
u32 r3; /* MR0 */
|
||||
u32 r4; /* MR1 */
|
||||
u32 r5; /* MR2 */
|
||||
u32 r6; /* MR3 */
|
||||
u32 r7; /* MR4 */
|
||||
u32 r8; /* MR5 */
|
||||
} syscall_args_t;
|
||||
|
||||
typedef struct msg_regs {
|
||||
u32 mr0;
|
||||
u32 mr1;
|
||||
u32 mr2;
|
||||
u32 mr3;
|
||||
u32 mr4;
|
||||
u32 mr5;
|
||||
} msg_regs_t;
|
||||
|
||||
/* NOTE:
|
||||
* These references are valid only when they have been explicitly set
|
||||
* by a kernel entry point, e.g. a system call, a data abort handler.
|
||||
*/
|
||||
#define KTCB_REF_ARG0(ktcb) (&(ktcb)->syscall_regs->r0)
|
||||
#define KTCB_REF_MR0(ktcb) (&(ktcb)->syscall_regs->r3)
|
||||
|
||||
/* Represents each syscall. We get argument registers
|
||||
* from stack for now. This is slower but the simplest. */
|
||||
typedef int (*syscall_fn_t)(struct syscall_args *regs);
|
||||
|
||||
/* Entry point for syscall dispatching. Called from asm */
|
||||
int syscall(struct syscall_args *regs, unsigned long);
|
||||
|
||||
/* Syscall-related initialiser called during system init. */
|
||||
void syscall_init(void);
|
||||
void kip_init_syscalls(void);
|
||||
|
||||
#endif /* __ARM_GLUE_SYSCALL_H__ */
|
||||
18
include/l4/glue/arm/utcb.h
Normal file
18
include/l4/glue/arm/utcb.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Userspace thread control block
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
#ifndef __GLUE_ARM_UTCB_H__
|
||||
#define __GLUE_ARM_UTCB_H__
|
||||
|
||||
#define MR_TOTAL 6
|
||||
|
||||
/* Compact utcb for now! 8-) */
|
||||
struct utcb {
|
||||
u32 mr[MR_TOTAL];
|
||||
u32 global_id; /* Thread id */
|
||||
u32 usr_handle; /* Use as TLS */
|
||||
};
|
||||
|
||||
#endif /* __GLUE_ARM_UTCB_H__ */
|
||||
107
include/l4/glue/tests/memlayout.h
Normal file
107
include/l4/glue/tests/memlayout.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Mock-up memory layout definitions for test purposes.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BASICLAYOUT_H__
|
||||
#define __BASICLAYOUT_H__
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include INC_GLUE(memory.h)
|
||||
#endif
|
||||
#include INC_PLAT(offsets.h)
|
||||
|
||||
#define RESERVED_AREA_START 0x0
|
||||
#define RESERVED_AREA_END 0x00400000
|
||||
#define RESERVED_AREA_SIZE (RESERVED_AREA_END - RESERVED_AREA_START)
|
||||
#define RESERVED_AREA_SECTIONS (RESERVED_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* 0x00400000 */
|
||||
#define USER_AREA_START 0x00400000
|
||||
#define USER_AREA_END 0xF0000000
|
||||
#define USER_AREA_SIZE (USER_AREA_END - USER_AREA_START)
|
||||
#define USER_AREA_SECTIONS (USER_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* 0xf0000000 */
|
||||
#define KERNEL_AREA_START 0xF0000000
|
||||
#define KERNEL_AREA_END 0xF4000000
|
||||
#define KERNEL_AREA_SIZE (KERNEL_AREA_END - KERNEL_AREA_START)
|
||||
#define KERNEL_AREA_SECTIONS (KERNEL_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* Kernel offset is taken as virtual memory base */
|
||||
#define VIRT_ADDR_BASE KERNEL_AREA_START
|
||||
|
||||
/* 0xf4000000 */
|
||||
#define UNCACHE_AREA_START 0xF4000000
|
||||
#define UNCACHE_AREA_END 0xF8000000
|
||||
#define UNCACHE_AREA_SIZE (UNCACHE_AREA_END - UNCACHE_AREA_START)
|
||||
#define UNCACHE_AREA_SECTIONS (UNCACHE_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* The page tables are the main clients of uncached virtual memory */
|
||||
#define PGTABLE_ADDR_BASE UNCACHE_AREA_START
|
||||
|
||||
/* 0xf8000000 */
|
||||
#define VAR_AREA_START 0xF8000000
|
||||
#define VAR_AREA_END 0xF9000000
|
||||
#define VAR_AREA_SIZE (VAR_AREA_END - VAR_AREA_START)
|
||||
#define VAR_AREA_SECTIONS (VAR_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* 0xf9000000 */
|
||||
#define IO_AREA_START 0xF9000000
|
||||
#define IO_AREA_END 0xFF000000
|
||||
#define IO_AREA_SIZE (IO_AREA_END - IO_AREA_START)
|
||||
#define IO_AREA_SECTIONS (IO_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* 0xff000000 */
|
||||
#define MISC_AREA_START 0xFF000000
|
||||
#define MISC_AREA_END 0xFFF00000
|
||||
#define MISC_AREA_SIZE (MISC_AREA_END - MISC_AREA_START)
|
||||
#define MISC_AREA_SECTIONS (MISC_AREA_SIZE / ARM_SECTION_SIZE)
|
||||
|
||||
/* First page in MISC area is used for KIP/UTCB reference page */
|
||||
#define USER_KIP_PAGE MISC_AREA_START
|
||||
|
||||
/* 0xfff00000 */
|
||||
#define EXCPT_AREA_START 0xFFF00000
|
||||
#define EXCPT_AREA_END (EXCPT_AREA_START + ARM_SECTION_SIZE)
|
||||
#define EXCPT_AREA_SIZE (EXCPT_AREA_END - EXCPT_AREA_START)
|
||||
|
||||
/* 1MB IO Areas in the Virtual Address space. Define more if needed */
|
||||
#define IO_AREA0_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*0))
|
||||
#define IO_AREA1_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*1))
|
||||
#define IO_AREA2_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*2))
|
||||
#define IO_AREA3_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*3))
|
||||
#define IO_AREA4_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*4))
|
||||
#define IO_AREA5_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*5))
|
||||
#define IO_AREA6_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*6))
|
||||
#define IO_AREA7_VADDR (IO_AREA_START + (ARM_SECTION_SIZE*7))
|
||||
|
||||
/*
|
||||
* Address of start of arm_high_vector - exception handling code
|
||||
*/
|
||||
#define ARM_HIGH_VECTOR_VADDR (EXCPT_AREA_START | 0x000f0000 )
|
||||
#define ARM_SYSCALL_VECTOR (0xffffff00)
|
||||
|
||||
/*
|
||||
* These offsets depend on where the platform defines its physical memory
|
||||
* and how the system defines the virtual memory regions in arm/basiclayout.h
|
||||
*/
|
||||
//#define KERNEL_OFFSET (VIRT_ADDR_BASE - PHYS_ADDR_BASE)
|
||||
//#define PGTABLE_OFFSET (PGTABLE_ADDR_BASE - PGTABLE_PHYS_ADDR_BASE)
|
||||
/* Use a more predictible offset by just changing the top nibble */
|
||||
#define KERNEL_OFFSET VIRT_ADDR_BASE
|
||||
#define PGTABLE_OFFSET PGTABLE_ADDR_BASE
|
||||
|
||||
/*
|
||||
* Convenience macros for converting between address types.
|
||||
*/
|
||||
#if defined(__KERNEL__)
|
||||
#define phys_to_virt(addr) ((unsigned int)addr)
|
||||
#define phys_to_ptab(addr) ((unsigned int)addr)
|
||||
#define virt_to_phys(addr) ((unsigned int)addr)
|
||||
#define virt_to_ptab(addr) (phys_to_ptab(virt_to_phys(addr)))
|
||||
#endif
|
||||
#endif /* __BASICLAYOUT_H__ */
|
||||
84
include/l4/glue/tests/memory.h
Normal file
84
include/l4/glue/tests/memory.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Memory related definitions for test purposes.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*
|
||||
*/
|
||||
#ifndef __GLUE_TEST_MEMORY_H__
|
||||
#define __GLUE_TEST_MEMORY_H__
|
||||
|
||||
|
||||
/* ARM specific definitions */
|
||||
#define TEST_SECTION_SIZE SZ_1MB
|
||||
//#define TEST_PAGE_SIZE SZ_4K
|
||||
//#define TEST_PAGE_MASK 0xFFF
|
||||
//#define TEST_PAGE_BITS 12
|
||||
#define TEST_PAGE_SIZE 128
|
||||
#define TEST_PAGE_MASK (TEST_PAGE_SIZE-1)
|
||||
#define TEST_PAGE_BITS 7
|
||||
#define TEST_SECTION_MASK 0xFFFFF
|
||||
|
||||
/* Aligns to the upper page (ceiling) */
|
||||
#define page_align_up(addr) ((((unsigned int)(addr)) + \
|
||||
(PAGE_SIZE - 1)) & \
|
||||
(~PAGE_MASK))
|
||||
/* Aligns to the lower page (floor) */
|
||||
#define page_align(addr) (((unsigned int)(addr)) & \
|
||||
(~PAGE_MASK))
|
||||
|
||||
/* Align to given size */
|
||||
#define align(addr, size) (((unsigned int)(addr)) & (~(size-1)))
|
||||
|
||||
/* Extract page frame number from address */
|
||||
#define __pfn(x) (((unsigned long)(x)) >> PAGE_BITS)
|
||||
#define __pfn_to_addr(x) (((unsigned long)(x)) << PAGE_BITS)
|
||||
|
||||
/* Extract physical address from page table entry (pte) */
|
||||
#define __pte_to_addr(x) (((unsigned long)(x)) & ~PAGE_MASK)
|
||||
|
||||
/* Minimum excess needed for word alignment */
|
||||
#define SZ_WORD sizeof(unsigned long)
|
||||
#define WORD_BITS 32
|
||||
|
||||
#define BITWISE_GETWORD(x) ((x) >> 5) /* Divide by 32 */
|
||||
#define BITWISE_GETBIT(x) (1 << ((x) % WORD_BITS))
|
||||
|
||||
#define align_up(addr, size) ((((unsigned long)(addr)) + ((size) - 1)) & (~((size) - 1)))
|
||||
|
||||
/* Generic definitions */
|
||||
extern unsigned int PAGE_SIZE;
|
||||
extern unsigned int PAGE_MASK;
|
||||
extern unsigned int PAGE_BITS;
|
||||
|
||||
|
||||
/* Type-checkable page table elements */
|
||||
typedef u32 pgd_t;
|
||||
typedef u32 pmd_t;
|
||||
typedef u32 pte_t;
|
||||
|
||||
/* Page global directory made up of pgd_t entries */
|
||||
typedef struct pgd_table {
|
||||
pgd_t entry[SZ_4K];
|
||||
} pgd_table_t;
|
||||
|
||||
/* Page middle directory made up of pmd_t entries */
|
||||
typedef struct pmd_table {
|
||||
pmd_t entry[256];
|
||||
} pmd_table_t;
|
||||
|
||||
|
||||
/* Number of pmd tables to describe all physical memory.
|
||||
* TODO: Need more for IO etc. */
|
||||
#define NUM_PMD_TABLES ((PHYS_MEM_END - PHYS_MEM_START) / PAGE_SIZE) \
|
||||
/ PMD_NUM_PAGES
|
||||
|
||||
/* Page table related */
|
||||
extern pgd_table_t kspace;
|
||||
extern pmd_table_t pmd_tables[];
|
||||
extern unsigned long pmdtab_i;
|
||||
|
||||
void paging_init(void);
|
||||
void init_clear_ptab(void);
|
||||
|
||||
#endif /* __GLUE_TEST_MEMORY_H__ */
|
||||
|
||||
19
include/l4/glue/tests/utcb.h
Normal file
19
include/l4/glue/tests/utcb.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef __GLUE__V4_ARM__UTCB_H__
|
||||
#define __GLUE__V4_ARM__UTCB_H__
|
||||
|
||||
/*
|
||||
* Userspace thread control block
|
||||
*
|
||||
* Copyright (C) 2005 Bahadir Balban
|
||||
*
|
||||
*/
|
||||
#include <macros.h>
|
||||
#include <config.h>
|
||||
#include <types.h>
|
||||
|
||||
struct utcb {
|
||||
u32 global_id;
|
||||
u32 error_code;
|
||||
};
|
||||
|
||||
#endif /* !__GLUE__V4_ARM__UTCB_H__ */
|
||||
Reference in New Issue
Block a user