Some cleanups on last commit

This commit is contained in:
Bahadir Balban
2009-10-15 20:24:01 +03:00
parent e762f4162c
commit 6982e96d1f
2 changed files with 30 additions and 20 deletions

View File

@@ -10,6 +10,16 @@
#include <init.h> #include <init.h>
#include <physmem.h> #include <physmem.h>
#include <linker.h> #include <linker.h>
#include <capability.h>
struct container_memory_regions {
struct capability *shmem;
struct capability *utcb;
struct capability *task;
struct capability *pager;
struct capability *physmem;
};
extern struct container_memory_regions cont_mem_regions;
#define PAGER_MMAP_SEGMENT SZ_4MB #define PAGER_MMAP_SEGMENT SZ_4MB
#define PAGER_MMAP_START (page_align_up(__stack)) #define PAGER_MMAP_START (page_align_up(__stack))

View File

@@ -43,17 +43,13 @@ struct memdesc physmem; /* Initial, primitive memory descriptor */
struct membank membank[1]; /* The memory bank */ struct membank membank[1]; /* The memory bank */
struct page *page_array; /* The physical page array based on mem bank */ struct page *page_array; /* The physical page array based on mem bank */
struct container_memory_regions {
struct capability *shmem;
struct capability *utcb;
struct capability *task;
struct capability *pager;
struct capability *physmem;
} cont_mem_regions;
/* Capability descriptor list */ /* Capability descriptor list */
struct cap_list capability_list; struct cap_list capability_list;
/* Memory region capabilities */
struct container_memory_regions cont_mem_regions;
__initdata static struct capability *caparray; __initdata static struct capability *caparray;
__initdata static int total_caps = 0; __initdata static int total_caps = 0;
@@ -192,8 +188,6 @@ int read_pager_capabilities()
" capabilities failed.\n Could not " " capabilities failed.\n Could not "
"complete CAP_CONTROL_NCAPS request.\n"); "complete CAP_CONTROL_NCAPS request.\n");
BUG(); BUG();
} else {
printf("There are %d capabilities defined.\n", ncaps);
} }
total_caps = ncaps; total_caps = ncaps;
@@ -225,16 +219,16 @@ int read_pager_capabilities()
if ((cap->type & CAP_RTYPE_MASK) if ((cap->type & CAP_RTYPE_MASK)
== CAP_RTYPE_VIRTMEM) { == CAP_RTYPE_VIRTMEM) {
printf("Capability range 0x%lx - 0x%lx\n",
__pfn_to_addr(cap->start), __pfn_to_addr(cap->end));
/* Pager address region (get from linker-defined) */ /* Pager address region (get from linker-defined) */
if (__pfn_to_addr(cap->start) if (__pfn_to_addr(cap->start)
== (unsigned long)virtual_base) == (unsigned long)virtual_base)
cont_mem_regions.pager = cap; cont_mem_regions.pager = cap;
/* UTCB address region */ /* UTCB address region */
else if (UTCB_REGION_START == __pfn_to_addr(cap->start)) { else if (UTCB_REGION_START ==
if (UTCB_REGION_END != __pfn_to_addr(cap->end)) { __pfn_to_addr(cap->start)) {
if (UTCB_REGION_END !=
__pfn_to_addr(cap->end)) {
printf("FATAL: Region designated " printf("FATAL: Region designated "
"for UTCB allocation does not " "for UTCB allocation does not "
"match on start/end marks"); "match on start/end marks");
@@ -251,8 +245,10 @@ int read_pager_capabilities()
} }
/* Shared memory disjoint region */ /* Shared memory disjoint region */
else if (SHMEM_REGION_START == __pfn_to_addr(cap->start)) { else if (SHMEM_REGION_START ==
if (SHMEM_REGION_END != __pfn_to_addr(cap->end)) { __pfn_to_addr(cap->start)) {
if (SHMEM_REGION_END !=
__pfn_to_addr(cap->end)) {
printf("FATAL: Region designated " printf("FATAL: Region designated "
"for SHM allocation does not " "for SHM allocation does not "
"match on start/end marks"); "match on start/end marks");
@@ -263,11 +259,13 @@ int read_pager_capabilities()
} }
/* Task memory region */ /* Task memory region */
else if (TASK_REGION_START == __pfn_to_addr(cap->start)) { else if (TASK_REGION_START ==
if (TASK_REGION_END != __pfn_to_addr(cap->end)) { __pfn_to_addr(cap->start)) {
if (TASK_REGION_END !=
__pfn_to_addr(cap->end)) {
printf("FATAL: Region designated " printf("FATAL: Region designated "
"for Task address space does not " "for Task address space does"
"match on start/end marks"); "not match on start/end mark.");
BUG(); BUG();
} }
cont_mem_regions.task = cap; cont_mem_regions.task = cap;
@@ -283,7 +281,9 @@ int read_pager_capabilities()
printf("%s: Error, pager does not have one of the required" printf("%s: Error, pager does not have one of the required"
"mem capabilities defined. (TASK, SHM, PHYSMEM, UTCB)\n", "mem capabilities defined. (TASK, SHM, PHYSMEM, UTCB)\n",
__TASKNAME__); __TASKNAME__);
printf("%p, %p, %p, %p, %p\n", cont_mem_regions.task, cont_mem_regions.shmem, cont_mem_regions.utcb, cont_mem_regions.physmem, cont_mem_regions.pager); printf("%p, %p, %p, %p, %p\n", cont_mem_regions.task,
cont_mem_regions.shmem, cont_mem_regions.utcb,
cont_mem_regions.physmem, cont_mem_regions.pager);
BUG(); BUG();
} }