Added elf_get_image_info_for_address() to get an image info for a kernel
image. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27300 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5379de87bf
commit
dd1c278d4b
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
@ -31,6 +31,7 @@ status_t elf_debug_lookup_symbol_address(addr_t address, addr_t *_baseAddress,
|
||||
status_t elf_debug_lookup_user_symbol_address(struct team* team, addr_t address,
|
||||
addr_t *_baseAddress, const char **_symbolName,
|
||||
const char **_imageName, bool *_exactMatch);
|
||||
status_t elf_get_image_info_for_address(addr_t address, image_info* info);
|
||||
status_t elf_init(struct kernel_args *args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <team.h>
|
||||
#include <thread.h>
|
||||
#include <runtime_loader.h>
|
||||
#include <util/AutoLock.h>
|
||||
#include <util/khash.h>
|
||||
#include <vfs.h>
|
||||
#include <vm.h>
|
||||
@ -1819,6 +1820,33 @@ unload_kernel_add_on(image_id id)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
elf_get_image_info_for_address(addr_t address, image_info* info)
|
||||
{
|
||||
MutexLocker _(sImageMutex);
|
||||
struct elf_image_info* elfInfo = find_image_at_address(address);
|
||||
if (elfInfo == NULL)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
info->id = elfInfo->id;
|
||||
info->type = B_SYSTEM_IMAGE;
|
||||
info->sequence = 0;
|
||||
info->init_order = 0;
|
||||
info->init_routine = NULL;
|
||||
info->term_routine = NULL;
|
||||
info->device = -1;
|
||||
info->node = -1;
|
||||
// TODO: We could actually fill device/node in.
|
||||
strlcpy(info->name, elfInfo->name, sizeof(info->name));
|
||||
info->text = (void*)elfInfo->text_region.start;
|
||||
info->data = (void*)elfInfo->data_region.start;
|
||||
info->text_size = elfInfo->text_region.size;
|
||||
info->data_size = elfInfo->data_region.size;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
elf_init(kernel_args *args)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user