From bde6836aff2838a67369896f44245a61f29b6af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 27 Jan 2005 07:11:45 +0000 Subject: [PATCH] vm_create_aspace() now also get the team_id of the owner of the address space to be created - this replaces the internal ID they had before. Now, team_id == aspace_id. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11085 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/team.c | 9 +++++---- src/kernel/core/vm/vm_address_space.c | 16 +++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/kernel/core/team.c b/src/kernel/core/team.c index 7b77c001ec..bbaccc81b9 100644 --- a/src/kernel/core/team.c +++ b/src/kernel/core/team.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -1010,7 +1010,7 @@ load_image_etc(int32 argCount, char **args, int32 envCount, char **env, int32 pr } // create an address space for this team - err = vm_create_aspace(team->name, USER_BASE, USER_SIZE, false, &team->aspace); + err = vm_create_aspace(team->name, team->id, USER_BASE, USER_SIZE, false, &team->aspace); if (err < B_OK) goto err3; @@ -1022,7 +1022,8 @@ load_image_etc(int32 argCount, char **args, int32 envCount, char **env, int32 pr threadName = args[0]; // create a kernel thread, but under the context of the new team - thread = spawn_kernel_thread_etc(team_create_thread_start, threadName, B_NORMAL_PRIORITY, teamArgs, team->id); + thread = spawn_kernel_thread_etc(team_create_thread_start, threadName, B_NORMAL_PRIORITY, + teamArgs, team->id); if (thread < 0) { err = thread; goto err4; @@ -1204,7 +1205,7 @@ fork_team(void) } // create an address space for this team - status = vm_create_aspace(team->name, USER_BASE, USER_SIZE, false, &team->aspace); + status = vm_create_aspace(team->name, team->id, USER_BASE, USER_SIZE, false, &team->aspace); if (status < B_OK) goto err3; diff --git a/src/kernel/core/vm/vm_address_space.c b/src/kernel/core/vm/vm_address_space.c index 2d26644940..87a52b0dc7 100644 --- a/src/kernel/core/vm/vm_address_space.c +++ b/src/kernel/core/vm/vm_address_space.c @@ -50,7 +50,6 @@ vm_address_space *kernel_aspace; #define ASPACE_HASH_TABLE_SIZE 1024 -static aspace_id next_aspace_id; static void *aspace_table; static sem_id aspace_hash_sem; @@ -283,10 +282,10 @@ vm_delete_aspace(vm_address_space *aspace) status_t -vm_create_aspace(const char *name, addr_t base, addr_t size, bool kernel, vm_address_space **_aspace) +vm_create_aspace(const char *name, team_id id, addr_t base, addr_t size, bool kernel, vm_address_space **_aspace) { vm_address_space *aspace; - status_t err; + status_t status; aspace = (vm_address_space *)malloc(sizeof(vm_address_space)); if (aspace == NULL) @@ -301,7 +300,7 @@ vm_create_aspace(const char *name, addr_t base, addr_t size, bool kernel, vm_add } strcpy(aspace->name, name); - aspace->id = next_aspace_id++; + aspace->id = id; aspace->ref_count = 1; aspace->state = VM_ASPACE_STATE_NORMAL; aspace->fault_count = 0; @@ -312,11 +311,11 @@ vm_create_aspace(const char *name, addr_t base, addr_t size, bool kernel, vm_add aspace->last_working_set_adjust = system_time(); // initialize the corresponding translation map - err = arch_vm_translation_map_init_map(&aspace->translation_map, kernel); - if (err < B_OK) { + status = arch_vm_translation_map_init_map(&aspace->translation_map, kernel); + if (status < B_OK) { free(aspace->name); free(aspace); - return err; + return status; } // initialize the virtual map @@ -363,7 +362,6 @@ vm_aspace_walk_next(struct hash_iterator *i) status_t vm_aspace_init(void) { - next_aspace_id = 0; aspace_hash_sem = -1; // create the area and address space hash tables @@ -378,7 +376,7 @@ vm_aspace_init(void) kernel_aspace = NULL; // create the initial kernel address space - if (vm_create_aspace("kernel_land", KERNEL_BASE, KERNEL_SIZE, true, &kernel_aspace) != B_OK) + if (vm_create_aspace("kernel_land", 1, KERNEL_BASE, KERNEL_SIZE, true, &kernel_aspace) != B_OK) panic("vm_init: error creating kernel address space!\n"); add_debugger_command("aspaces", &dump_aspace_list, "Dump a list of all address spaces");