Removed REGION_WIRING_* and REGION_ADDR_* and replaced them by their

BeOS counterparts.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7849 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-06-08 09:33:51 +00:00
parent 3b183ea392
commit ee7e4109ad
10 changed files with 38 additions and 43 deletions

View File

@ -145,9 +145,6 @@ typedef struct vm_store_ops {
// args for the create_area funcs
enum {
REGION_ADDR_ANY_ADDRESS = 0,
REGION_ADDR_EXACT_ADDRESS,
// ToDo: these are here only temporarily - it's a private
// addition to the BeOS create_area() flags
B_EXACT_KERNEL_ADDRESS = 6
@ -159,11 +156,6 @@ enum {
};
enum {
REGION_WIRING_LAZY = 0,
REGION_WIRING_WIRED,
REGION_WIRING_WIRED_ALREADY,
REGION_WIRING_WIRED_CONTIG,
// ToDo: these are here only temporarily - it's a private
// addition to the BeOS create_area() flags
B_ALREADY_WIRED = 6

View File

@ -51,7 +51,7 @@ arch_cpu_init2(kernel_args *ka)
gGDT = (segment_descriptor *)ka->arch_args.vir_gdt;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "gdt", (void **)&gGDT,
REGION_ADDR_EXACT_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED_ALREADY,
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
// currently taken out of the build, because it's not yet used (and assumes
@ -79,7 +79,7 @@ arch_cpu_init2(kernel_args *ka)
sprintf(tss_name, "tss%d", i);
rid = vm_create_anonymous_region(vm_get_kernel_aspace_id(), tss_name, (void **)&tss[i],
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED,
B_ANY_KERNEL_ADDRESS, PAGE_SIZE, B_FULL_LOCK,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if (rid < 0) {
panic("arch_cpu_init2: unable to create region for tss\n");

View File

@ -361,7 +361,7 @@ arch_int_init2(kernel_args *ka)
{
idt = (desc_table *)ka->arch_args.vir_idt;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "idt", (void *)&idt,
REGION_ADDR_EXACT_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED_ALREADY,
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
return 0;
}

View File

@ -111,10 +111,10 @@ arch_smp_init(kernel_args *ka)
// setup regions that represent the apic & ioapic
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "local_apic", (void *)&apic,
REGION_ADDR_EXACT_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED_ALREADY,
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "ioapic", (void *)&ioapic,
REGION_ADDR_EXACT_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED_ALREADY,
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
// set up the local apic on the boot cpu

View File

@ -790,27 +790,27 @@ vm_translation_map_module_init2(kernel_args *ka)
temp = (void *)kernel_pgdir_virt;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "kernel_pgdir", &temp,
REGION_ADDR_EXACT_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED_ALREADY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
temp = (void *)paddr_desc;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "physical_page_mapping_descriptors", &temp,
REGION_ADDR_EXACT_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc) * 1024, PAGE_SIZE),
REGION_WIRING_WIRED_ALREADY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
B_EXACT_KERNEL_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc) * 1024, PAGE_SIZE),
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
temp = (void *)virtual_pmappings;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "iospace_virtual_chunk_descriptors", &temp,
REGION_ADDR_EXACT_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc *) * num_virtual_chunks, PAGE_SIZE),
REGION_WIRING_WIRED_ALREADY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
B_EXACT_KERNEL_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc *) * num_virtual_chunks, PAGE_SIZE),
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
temp = (void *)iospace_pgtables;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "iospace_pgtables", &temp,
REGION_ADDR_EXACT_ADDRESS, PAGE_SIZE * (IOSPACE_SIZE / (PAGE_SIZE * 1024)),
REGION_WIRING_WIRED_ALREADY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE * (IOSPACE_SIZE / (PAGE_SIZE * 1024)),
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
TRACE(("vm_translation_map_module_init2: creating iospace\n"));
temp = (void *)IOSPACE_BASE;
vm_create_null_region(vm_get_kernel_aspace_id(), "iospace", &temp,
REGION_ADDR_EXACT_ADDRESS, IOSPACE_SIZE);
B_EXACT_KERNEL_ADDRESS, IOSPACE_SIZE);
TRACE(("vm_translation_map_module_init2: done\n"));

View File

@ -1085,7 +1085,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry)
id = vm_map_file(p->_aspace_id, regionName,
(void **)&regionAddress,
REGION_ADDR_EXACT_ADDRESS,
B_EXACT_ADDRESS,
fileUpperBound,
B_READ_AREA | B_WRITE_AREA, REGION_PRIVATE_MAP,
path, ROUNDOWN(pheaders[i].p_offset, PAGE_SIZE));
@ -1130,7 +1130,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry)
*/
id = vm_map_file(p->_aspace_id, regionName,
(void **)&regionAddress,
REGION_ADDR_EXACT_ADDRESS,
B_EXACT_ADDRESS,
ROUNDUP(pheaders[i].p_memsz + (pheaders[i].p_vaddr % PAGE_SIZE), PAGE_SIZE),
B_READ_AREA | B_EXECUTE_AREA, REGION_PRIVATE_MAP,
path, ROUNDOWN(pheaders[i].p_offset, PAGE_SIZE));

View File

@ -260,8 +260,8 @@ vm_page_init2(kernel_args *ka)
void *null;
null = all_pages;
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "page_structures", &null, REGION_ADDR_EXACT_ADDRESS,
PAGE_ALIGN(num_pages * sizeof(vm_page)), REGION_WIRING_WIRED_ALREADY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "page_structures", &null, B_EXACT_KERNEL_ADDRESS,
PAGE_ALIGN(num_pages * sizeof(vm_page)), B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
add_debugger_command("page_stats", &dump_page_stats, "Dump statistics about page usage");
add_debugger_command("free_pages", &dump_free_page_table, "Dump list of free pages");

View File

@ -2,6 +2,7 @@
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#include <kernel.h>
#include <vm.h>
#include <debug.h>
@ -13,7 +14,9 @@
#include <ctype.h>
#include <stdio.h>
void vm_test()
void
vm_test()
{
// region_id region, region2, region3;
// addr region_addr;
@ -27,15 +30,15 @@ void vm_test()
addr region_addr;
region = vm_create_anonymous_region(vm_get_kernel_aspace_id(), "test_region", (void **)&region_addr,
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if(region < 0)
B_ANY_KERNEL_ADDRESS, PAGE_SIZE * 16, B_NO_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if (region < 0)
panic("vm_test 1: failed to create test region\n");
dprintf("region = 0x%lx, addr = 0x%lx\n", region, region_addr);
memset((void *)region_addr, 0, PAGE_SIZE * 16);
dprintf("memsetted the region\n");
if(vm_delete_region(vm_get_kernel_aspace_id(), region) < 0)
if (vm_delete_region(vm_get_kernel_aspace_id(), region) < 0)
panic("vm_test 1: error deleting test region\n");
dprintf("deleted the region\n");
}
@ -49,7 +52,7 @@ void vm_test()
int i;
region = vm_map_physical_memory(vm_get_kernel_aspace_id(), "test_physical_region", (void **)&ptr,
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, 0xb8000);
B_ANY_KERNEL_ADDRESS, PAGE_SIZE * 16, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, 0xb8000);
if(region < 0)
panic("vm_test 2: failed to create test region\n");
@ -107,7 +110,7 @@ void vm_test()
dprintf("vid_mem region = 0x%lx\n", region);
region2 = vm_clone_region(vm_get_kernel_aspace_id(), "vid_mem2",
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
&ptr, B_ANY_KERNEL_ADDRESS, region, REGION_NO_PRIVATE_MAP, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if(region2 < 0)
panic("vm_test 4: error cloning region 'vid_mem'\n");
dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
@ -136,7 +139,7 @@ void vm_test()
dprintf("vid_mem region = 0x%lx\n", region);
region2 = vm_clone_region(vm_get_kernel_aspace_id(), "vid_mem3",
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, B_KERNEL_READ_AREA);
&ptr, B_ANY_KERNEL_ADDRESS, region, REGION_NO_PRIVATE_MAP, B_KERNEL_READ_AREA);
if(region2 < 0)
panic("vm_test 5: error cloning region 'vid_mem'\n");
dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
@ -161,8 +164,8 @@ void vm_test()
int rc;
region = vm_create_anonymous_region(vm_get_kernel_aspace_id(), "test_region", &region_addr,
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if(region < 0)
B_ANY_KERNEL_ADDRESS, PAGE_SIZE * 16, B_NO_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if (region < 0)
panic("vm_test 6: error creating test region\n");
dprintf("region = 0x%lx, addr = %p\n", region, region_addr);
@ -171,7 +174,7 @@ void vm_test()
dprintf("memsetted the region\n");
region2 = vm_clone_region(vm_get_kernel_aspace_id(), "test_region2",
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
&ptr, B_ANY_KERNEL_ADDRESS, region, REGION_NO_PRIVATE_MAP, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if(region2 < 0)
panic("vm_test 6: error cloning test region\n");
dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
@ -199,10 +202,10 @@ void vm_test()
fd = sys_open("/boot/kernel", 0);
rid = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test", &ptr, REGION_ADDR_ANY_ADDRESS,
rid = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test", &ptr, B_ANY_KERNEL_ADDRESS,
PAGE_SIZE, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, REGION_NO_PRIVATE_MAP, "/boot/kernel", 0);
rid2 = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test2", &ptr2, REGION_ADDR_ANY_ADDRESS,
rid2 = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test2", &ptr2, B_ANY_KERNEL_ADDRESS,
PAGE_SIZE, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, REGION_NO_PRIVATE_MAP, "/boot/kernel", 0);
dprintf("diff %d\n", memcmp(ptr, ptr2, PAGE_SIZE));
@ -230,7 +233,7 @@ void vm_test()
dprintf("vm_test 8: creating test region...\n");
region = vm_create_anonymous_region(vm_get_kernel_aspace_id(), "test_region", &region_addr,
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
B_ANY_KERNEL_ADDRESS, PAGE_SIZE * 16, B_NO_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if(region < 0)
panic("vm_test 8: error creating test region\n");
dprintf("region = 0x%lx, addr = %p\n", region, region_addr);
@ -242,7 +245,7 @@ void vm_test()
dprintf("vm_test 8: cloning test region with PRIVATE_MAP\n");
region2 = vm_clone_region(vm_get_kernel_aspace_id(), "test_region2",
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_PRIVATE_MAP, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
&ptr, B_ANY_KERNEL_ADDRESS, region, REGION_PRIVATE_MAP, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
if(region2 < 0)
panic("vm_test 8: error cloning test region\n");
dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
@ -310,10 +313,10 @@ void vm_test()
dprintf("vm_test 9: mapping /boot/kernel twice\n");
rid = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test", &ptr, REGION_ADDR_ANY_ADDRESS,
rid = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test", &ptr, B_ANY_KERNEL_ADDRESS,
PAGE_SIZE*4, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, REGION_NO_PRIVATE_MAP, "/boot/kernel", 0);
rid2 = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test2", &ptr2, REGION_ADDR_ANY_ADDRESS,
rid2 = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test2", &ptr2, B_ANY_KERNEL_ADDRESS,
PAGE_SIZE*4, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, REGION_PRIVATE_MAP, "/boot/kernel", 0);
err = memcmp(ptr, ptr2, PAGE_SIZE);

View File

@ -311,7 +311,7 @@ console_dev_init(kernel_args *ka)
{
if (!ka->fb.enabled) {
dprintf("con_init: mapping vid mem\n");
vm_map_physical_memory(vm_get_kernel_aspace_id(), "vid_mem", (void *)&origin, REGION_ADDR_ANY_ADDRESS,
vm_map_physical_memory(vm_get_kernel_aspace_id(), "vid_mem", (void *)&origin, B_ANY_KERNEL_ADDRESS,
SCREEN_END - SCREEN_START, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, SCREEN_START);
dprintf("con_init: mapped vid mem to virtual address 0x%x\n", origin);

View File

@ -411,7 +411,7 @@ fb_console_dev_init(kernel_args *ka)
if(ka->fb.already_mapped) {
console.fb = ka->fb.mapping.start;
} else {
vm_map_physical_memory(vm_get_kernel_aspace_id(), "vesa_fb", (void *)&console.fb, REGION_ADDR_ANY_ADDRESS,
vm_map_physical_memory(vm_get_kernel_aspace_id(), "vesa_fb", (void *)&console.fb, B_ANY_KERNEL_ADDRESS,
ka->fb.mapping.size, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, ka->fb.mapping.start);
}