From cc0c987a286a74ede9cfea3bc351705ae80e5308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 18 Oct 2004 15:36:31 +0000 Subject: [PATCH] No longer relies on certain allocation aligments of malloc(), and instead uses the new memalign() call. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9397 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../core/arch/x86/arch_vm_translation_map.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/kernel/core/arch/x86/arch_vm_translation_map.c b/src/kernel/core/arch/x86/arch_vm_translation_map.c index 19674d890f..1084843e1b 100755 --- a/src/kernel/core/arch/x86/arch_vm_translation_map.c +++ b/src/kernel/core/arch/x86/arch_vm_translation_map.c @@ -1,24 +1,25 @@ /* -** Copyright 2002-2004, The OpenBeOS Team. All rights reserved. -** Distributed under the terms of the OpenBeOS License. +** Copyright 2002-2004, The Haiku Team. All rights reserved. +** Distributed under the terms of the Haiku License. ** ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include #include #include #include +#include #include -#include #include +#include #include +#include #include -#define TRACE_VM_TMAP 0 -#if TRACE_VM_TMAP +//#define TRACE_VM_TMAP +#ifdef TRACE_VM_TMAP # define TRACE(x) dprintf x #else # define TRACE(x) ; @@ -651,7 +652,7 @@ vm_translation_map_create(vm_translation_map *new_map, bool kernel) new_map->arch_data = (vm_translation_map_arch_info *)malloc(sizeof(vm_translation_map_arch_info)); if (new_map == NULL) { recursive_lock_destroy(&new_map->lock); - return ENOMEM; + return B_NO_MEMORY; } new_map->arch_data->num_invalidate_pages = 0; @@ -659,14 +660,12 @@ vm_translation_map_create(vm_translation_map *new_map, bool kernel) if (!kernel) { // user // allocate a pgdir - new_map->arch_data->pgdir_virt = malloc(PAGE_SIZE); + new_map->arch_data->pgdir_virt = memalign(B_PAGE_SIZE, B_PAGE_SIZE); if (new_map->arch_data->pgdir_virt == NULL) { free(new_map->arch_data); recursive_lock_destroy(&new_map->lock); - return ENOMEM; + return B_NO_MEMORY; } - if (((addr_t)new_map->arch_data->pgdir_virt % PAGE_SIZE) != 0) - panic("vm_translation_map_create: malloced pgdir and found it wasn't aligned!\n"); vm_get_page_mapping(vm_get_kernel_aspace_id(), (addr_t)new_map->arch_data->pgdir_virt, (addr_t *)&new_map->arch_data->pgdir_phys); } else { // kernel