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
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2004, Axel Dörfler, [email protected].
|
* Copyright 2002-2005, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* 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
|
// 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)
|
if (err < B_OK)
|
||||||
goto err3;
|
goto err3;
|
||||||
|
|
||||||
@@ -1022,7 +1022,8 @@ load_image_etc(int32 argCount, char **args, int32 envCount, char **env, int32 pr
|
|||||||
threadName = args[0];
|
threadName = args[0];
|
||||||
|
|
||||||
// create a kernel thread, but under the context of the new team
|
// 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) {
|
if (thread < 0) {
|
||||||
err = thread;
|
err = thread;
|
||||||
goto err4;
|
goto err4;
|
||||||
@@ -1204,7 +1205,7 @@ fork_team(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create an address space for this team
|
// 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)
|
if (status < B_OK)
|
||||||
goto err3;
|
goto err3;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,6 @@
|
|||||||
vm_address_space *kernel_aspace;
|
vm_address_space *kernel_aspace;
|
||||||
|
|
||||||
#define ASPACE_HASH_TABLE_SIZE 1024
|
#define ASPACE_HASH_TABLE_SIZE 1024
|
||||||
static aspace_id next_aspace_id;
|
|
||||||
static void *aspace_table;
|
static void *aspace_table;
|
||||||
static sem_id aspace_hash_sem;
|
static sem_id aspace_hash_sem;
|
||||||
|
|
||||||
@@ -283,10 +282,10 @@ vm_delete_aspace(vm_address_space *aspace)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
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;
|
vm_address_space *aspace;
|
||||||
status_t err;
|
status_t status;
|
||||||
|
|
||||||
aspace = (vm_address_space *)malloc(sizeof(vm_address_space));
|
aspace = (vm_address_space *)malloc(sizeof(vm_address_space));
|
||||||
if (aspace == NULL)
|
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);
|
strcpy(aspace->name, name);
|
||||||
|
|
||||||
aspace->id = next_aspace_id++;
|
aspace->id = id;
|
||||||
aspace->ref_count = 1;
|
aspace->ref_count = 1;
|
||||||
aspace->state = VM_ASPACE_STATE_NORMAL;
|
aspace->state = VM_ASPACE_STATE_NORMAL;
|
||||||
aspace->fault_count = 0;
|
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();
|
aspace->last_working_set_adjust = system_time();
|
||||||
|
|
||||||
// initialize the corresponding translation map
|
// initialize the corresponding translation map
|
||||||
err = arch_vm_translation_map_init_map(&aspace->translation_map, kernel);
|
status = arch_vm_translation_map_init_map(&aspace->translation_map, kernel);
|
||||||
if (err < B_OK) {
|
if (status < B_OK) {
|
||||||
free(aspace->name);
|
free(aspace->name);
|
||||||
free(aspace);
|
free(aspace);
|
||||||
return err;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the virtual map
|
// initialize the virtual map
|
||||||
@@ -363,7 +362,6 @@ vm_aspace_walk_next(struct hash_iterator *i)
|
|||||||
status_t
|
status_t
|
||||||
vm_aspace_init(void)
|
vm_aspace_init(void)
|
||||||
{
|
{
|
||||||
next_aspace_id = 0;
|
|
||||||
aspace_hash_sem = -1;
|
aspace_hash_sem = -1;
|
||||||
|
|
||||||
// create the area and address space hash tables
|
// create the area and address space hash tables
|
||||||
@@ -378,7 +376,7 @@ vm_aspace_init(void)
|
|||||||
kernel_aspace = NULL;
|
kernel_aspace = NULL;
|
||||||
|
|
||||||
// create the initial kernel address space
|
// 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");
|
panic("vm_init: error creating kernel address space!\n");
|
||||||
|
|
||||||
add_debugger_command("aspaces", &dump_aspace_list, "Dump a list of all address spaces");
|
add_debugger_command("aspaces", &dump_aspace_list, "Dump a list of all address spaces");
|
||||||
|
|||||||
Reference in New Issue
Block a user