mirror of
https://github.com/drasko/codezero.git
synced 2026-07-09 17:04:15 +02:00
Removed hard-coded area definitions from kernel
This commit is contained in:
@@ -52,7 +52,7 @@ int user_mutex_test(void)
|
|||||||
__FUNCTION__, (int)base);
|
__FUNCTION__, (int)base);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
} else
|
} else
|
||||||
printf("mmap: Anonymous shared buffer at %p\n", base);
|
test_printf("mmap: Anonymous shared buffer at %p\n", base);
|
||||||
|
|
||||||
shared_page = base;
|
shared_page = base;
|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include INC_PLAT(offsets.h)
|
#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_START 0xF0000000
|
||||||
#define KERNEL_AREA_END 0xF8000000 /* 128 MB */
|
#define KERNEL_AREA_END 0xF8000000 /* 128 MB */
|
||||||
#define KERNEL_AREA_SIZE (KERNEL_AREA_END - KERNEL_AREA_START)
|
#define KERNEL_AREA_SIZE (KERNEL_AREA_END - KERNEL_AREA_START)
|
||||||
@@ -65,12 +50,8 @@
|
|||||||
#define virt_to_phys(addr) ((unsigned int)(addr) - KERNEL_OFFSET)
|
#define virt_to_phys(addr) ((unsigned int)(addr) - KERNEL_OFFSET)
|
||||||
#endif
|
#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 KERN_ADDR(x) ((x >= KERNEL_AREA_START) && (x < KERNEL_AREA_END))
|
||||||
#define UTCB_ADDR(x) ((x >= UTCB_AREA_START) && (x < UTCB_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) || \
|
#define PRIVILEGED_ADDR(x) (KERN_ADDR(x) || (x >= ARM_HIGH_VECTOR) || \
|
||||||
(x >= IO_AREA_START && x < IO_AREA_END))
|
(x >= IO_AREA_START && x < IO_AREA_END))
|
||||||
|
|
||||||
|
|||||||
@@ -75,26 +75,6 @@ static inline void be32_to_cpu(unsigned int x)
|
|||||||
p[2] = tmp;
|
p[2] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Some anticipated values in terms of memory consumption */
|
|
||||||
#define TASK_AVERAGE_SIZE SZ_16MB
|
|
||||||
#define TASKS_PER_1MB_GRANT 28
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 grant_kmem_usage {
|
|
||||||
unsigned long total_size;
|
|
||||||
unsigned long total_tasks;
|
|
||||||
unsigned long total_pgds;
|
|
||||||
unsigned long total_pmds;
|
|
||||||
unsigned long total_tcbs;
|
|
||||||
unsigned long extra;
|
|
||||||
} grant_kmem_usage_t;
|
|
||||||
|
|
||||||
void paging_init(void);
|
void paging_init(void);
|
||||||
|
|
||||||
unsigned int space_flags_to_ptflags(unsigned int flags);
|
unsigned int space_flags_to_ptflags(unsigned int flags);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ int sys_mutex_control(unsigned long mutex_address, int mutex_op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check valid user virtual address */
|
/* Check valid user virtual address */
|
||||||
if (!USER_ADDR(mutex_address)) {
|
if (KERN_ADDR(mutex_address)) {
|
||||||
printk("Invalid args to %s.\n", __FUNCTION__);
|
printk("Invalid args to %s.\n", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,10 +147,6 @@ int check_access_task(unsigned long vaddr, unsigned long size,
|
|||||||
int err;
|
int err;
|
||||||
unsigned long start, end, mapsize;
|
unsigned long start, end, mapsize;
|
||||||
|
|
||||||
/* Do not allow ridiculously big sizes */
|
|
||||||
if (size >= USER_AREA_SIZE)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* Get lower and upper page boundaries */
|
/* Get lower and upper page boundaries */
|
||||||
start = page_align(vaddr);
|
start = page_align(vaddr);
|
||||||
end = page_align_up(vaddr + size);
|
end = page_align_up(vaddr + size);
|
||||||
|
|||||||
Reference in New Issue
Block a user