Rewrote image.h.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22582 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+50
-70
@@ -1,37 +1,19 @@
|
|||||||
/******************************************************************************
|
/*
|
||||||
/
|
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||||
/ File: image.h
|
* Distributed under the terms of the MIT license.
|
||||||
/
|
*/
|
||||||
/ Description: Kernel interface for managing executable images.
|
|
||||||
/
|
|
||||||
/ Copyright 1993-98, Be Incorporated
|
|
||||||
/
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef _IMAGE_H
|
#ifndef _IMAGE_H
|
||||||
#define _IMAGE_H
|
#define _IMAGE_H
|
||||||
|
|
||||||
#include <BeBuild.h>
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*/
|
|
||||||
/*----- Image types, info, and functions ------------------*/
|
|
||||||
|
|
||||||
#define B_INIT_BEFORE_FUNCTION_NAME "initialize_before"
|
|
||||||
#define B_INIT_AFTER_FUNCTION_NAME "initialize_after"
|
|
||||||
#define B_TERM_BEFORE_FUNCTION_NAME "terminate_before"
|
|
||||||
#define B_TERM_AFTER_FUNCTION_NAME "terminate_after"
|
|
||||||
|
|
||||||
typedef int32 image_id;
|
typedef int32 image_id;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
B_APP_IMAGE = 1,
|
B_APP_IMAGE = 1,
|
||||||
B_LIBRARY_IMAGE,
|
B_LIBRARY_IMAGE,
|
||||||
B_ADD_ON_IMAGE,
|
B_ADD_ON_IMAGE,
|
||||||
B_SYSTEM_IMAGE
|
B_SYSTEM_IMAGE
|
||||||
@@ -53,59 +35,57 @@ typedef struct {
|
|||||||
int32 data_size;
|
int32 data_size;
|
||||||
} image_info;
|
} image_info;
|
||||||
|
|
||||||
// flags for _kern_load_image()
|
// flags for clear_caches()
|
||||||
|
#define B_FLUSH_DCACHE 0x0001 /* data cache */
|
||||||
|
#define B_FLUSH_ICACHE 0x0004 /* instruction cache */
|
||||||
|
#define B_INVALIDATE_DCACHE 0x0002
|
||||||
|
#define B_INVALIDATE_ICACHE 0x0008
|
||||||
|
|
||||||
|
// symbol types
|
||||||
|
#define B_SYMBOL_TYPE_DATA 0x1
|
||||||
|
#define B_SYMBOL_TYPE_TEXT 0x2
|
||||||
|
#define B_SYMBOL_TYPE_ANY 0x5
|
||||||
|
|
||||||
|
// initialization/termination functions of shared objects
|
||||||
|
#define B_INIT_BEFORE_FUNCTION_NAME "initialize_before"
|
||||||
|
#define B_INIT_AFTER_FUNCTION_NAME "initialize_after"
|
||||||
|
#define B_TERM_BEFORE_FUNCTION_NAME "terminate_before"
|
||||||
|
#define B_TERM_AFTER_FUNCTION_NAME "terminate_after"
|
||||||
|
|
||||||
|
// flags for _kern_load_image() (private API)
|
||||||
enum {
|
enum {
|
||||||
B_WAIT_TILL_LOADED = 0x01, // Wait till the loader has loaded and relocated
|
B_WAIT_TILL_LOADED = 0x01,
|
||||||
// (but not yet initialized) the application
|
// Wait till the loader has loaded and relocated
|
||||||
// image and all dependencies. If not supplied,
|
// (but not yet initialized) the application
|
||||||
// the function returns before the loader
|
// image and all dependencies. If not supplied,
|
||||||
// started to do anything at all, i.e. it
|
// the function returns before the loader
|
||||||
// returns success, even if the executable
|
// started to do anything at all, i.e. it
|
||||||
// doesn't exist.
|
// returns success, even if the executable
|
||||||
|
// doesn't exist.
|
||||||
};
|
};
|
||||||
|
|
||||||
extern thread_id load_image(int32 argc, const char **argv,
|
#ifdef __cplusplus
|
||||||
const char **envp);
|
extern "C" {
|
||||||
extern image_id load_add_on(const char *path);
|
#endif
|
||||||
extern status_t unload_add_on(image_id imageID);
|
|
||||||
|
thread_id load_image(int32 argc, const char **argv, const char **environ);
|
||||||
|
image_id load_add_on(const char *path);
|
||||||
|
status_t unload_add_on(image_id image);
|
||||||
|
status_t get_image_symbol(image_id image, const char *name, int32 symbolType,
|
||||||
|
void **_symbolLocation);
|
||||||
|
status_t get_nth_image_symbol(image_id image, int32 n, char *nameBuffer,
|
||||||
|
int32 *_nameLength, int32 *_symbolType, void **_symbolLocation);
|
||||||
|
void clear_caches(void *address, size_t length, uint32 flags);
|
||||||
|
|
||||||
/* private; use the macros, below */
|
|
||||||
extern status_t _get_image_info (image_id imageID,
|
|
||||||
image_info *info, size_t size);
|
|
||||||
extern status_t _get_next_image_info (team_id team, int32 *cookie,
|
|
||||||
image_info *info, size_t size);
|
|
||||||
/* use these */
|
|
||||||
#define get_image_info(image, info) \
|
#define get_image_info(image, info) \
|
||||||
_get_image_info((image), (info), sizeof(*(info)))
|
_get_image_info((image), (info), sizeof(*(info)))
|
||||||
#define get_next_image_info(team, cookie, info) \
|
#define get_next_image_info(team, cookie, info) \
|
||||||
_get_next_image_info((team), (cookie), (info), sizeof(*(info)))
|
_get_next_image_info((team), (cookie), (info), sizeof(*(info)))
|
||||||
|
|
||||||
|
/* private, use the macros above */
|
||||||
/*---------------------------------------------------------*/
|
status_t _get_image_info (image_id image, image_info *info, size_t size);
|
||||||
/*----- symbol types and functions ------------------------*/
|
status_t _get_next_image_info (team_id team, int32 *cookie, image_info *info,
|
||||||
|
size_t size);
|
||||||
#define B_SYMBOL_TYPE_DATA 0x1
|
|
||||||
#define B_SYMBOL_TYPE_TEXT 0x2
|
|
||||||
#define B_SYMBOL_TYPE_ANY 0x5
|
|
||||||
|
|
||||||
extern status_t get_image_symbol(image_id imid,
|
|
||||||
const char *name, int32 sclass, void **ptr);
|
|
||||||
extern status_t get_nth_image_symbol(image_id imid, int32 index,
|
|
||||||
char *buf, int32 *bufsize, int32 *sclass,
|
|
||||||
void **ptr);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*/
|
|
||||||
/*----- cache manipulation --------------------------------*/
|
|
||||||
|
|
||||||
#define B_FLUSH_DCACHE 0x0001 /* dcache = data cache */
|
|
||||||
#define B_FLUSH_ICACHE 0x0004 /* icache = instruction cache */
|
|
||||||
#define B_INVALIDATE_DCACHE 0x0002
|
|
||||||
#define B_INVALIDATE_ICACHE 0x0008
|
|
||||||
|
|
||||||
extern void clear_caches(void *addr, size_t len, uint32 flags);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user