mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
- Compiles and Codezero runs as normal without touching mutex implementation - Mutex implementation needs testing. The mutex control syscall allows userspace programs to declare any virtual address as a mutex lock and ask for help from the kernel syscall for resolving locking contentions.
78 lines
2.8 KiB
C
78 lines
2.8 KiB
C
/*
|
|
* 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_SIZE (sizeof(int) * 64)
|
|
|
|
#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 0x50
|
|
|
|
#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 PAGER_ADDR(x) ((x >= INITTASK_AREA_START) && (x < INITTASK_AREA_END))
|
|
#define KERN_ADDR(x) ((x >= KERNEL_AREA_START) && (x < KERNEL_AREA_END))
|
|
#define UTCB_ADDR(x) ((x >= UTCB_AREA_START) && (x < UTCB_AREA_END))
|
|
#define SHM_ADDR(x) ((x >= SHM_AREA_START) && (x < SHM_AREA_END))
|
|
#define USER_ADDR(x) (((x >= USER_AREA_START) && (x < USER_AREA_END)) || \
|
|
UTCB_ADDR(x) || SHM_ADDR(x) || PAGER_ADDR(x))
|
|
#define PRIVILEGED_ADDR(x) (KERN_ADDR(x) || (x >= ARM_HIGH_VECTOR) || \
|
|
(x >= IO_AREA_START && x < IO_AREA_END))
|
|
|
|
#endif /* __MEMLAYOUT_H__ */
|