83 lines
1.9 KiB
C
83 lines
1.9 KiB
C
#ifndef __HYPERVISOR_INTERNAL_H__
|
|
# define __HYPERVISOR_INTERNAL_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "fxBoot/hypervisor.h"
|
|
#include "fxBoot/fs/smemfs.h"
|
|
#include "fxBoot/elf.h"
|
|
|
|
/* internal gint symbols information structure */
|
|
struct dyngint {
|
|
const char *name;
|
|
const void *addr;
|
|
};
|
|
extern const struct dyngint gint_reloc[];
|
|
|
|
//---
|
|
// Main API
|
|
//---
|
|
extern int hypervisor_elf_loader(struct hworld *, struct smemfs_inode *);
|
|
|
|
//---
|
|
// Error helpers
|
|
//---
|
|
struct hel_error_db {
|
|
const int id;
|
|
const char *strerror;
|
|
};
|
|
extern int hypervisor_elf_loader_error(const struct hel_error_db *db,
|
|
const char *prefix, int errnum);
|
|
|
|
//---
|
|
// ELF Header helpers
|
|
//---
|
|
enum {
|
|
hel_header_valid = 0,
|
|
hel_header_size_error = -1,
|
|
hel_header_magic_error = -2,
|
|
hel_header_class_error = -3,
|
|
hel_header_indent_error = -4,
|
|
hel_header_type_error = -5,
|
|
hel_header_machine_error = -6,
|
|
hel_header_version_error = -7,
|
|
};
|
|
extern int hypervisor_elf_loader_header_get(struct smemfs_inode*,Elf32_Ehdr*);
|
|
extern int hypervisor_elf_loader_header_check(struct smemfs_inode *inode);
|
|
extern int hypervisor_elf_loader_header_error(int errnum);
|
|
|
|
|
|
|
|
|
|
//---
|
|
// ELF image helpers
|
|
//---
|
|
enum {
|
|
hel_image_success = 0,
|
|
hel_image_size_error = -1,
|
|
hel_image_type_error = -2,
|
|
hel_image_mem_error = -3,
|
|
};
|
|
extern int hypervisor_elf_loader_image_load(struct hworld *world,
|
|
struct smemfs_inode *inode, Elf32_Ehdr *header);
|
|
extern int hypervisor_elf_loader_image_error(int errnum);
|
|
|
|
|
|
|
|
|
|
//---
|
|
// ELF symbols relocatlisation helpers
|
|
//---
|
|
enum {
|
|
hel_reloc_success = 0,
|
|
hel_reloc_size_error = -1,
|
|
hel_reloc_error = -2,
|
|
};
|
|
extern int hypervisor_elf_loader_reloc_sym(struct hworld *world,
|
|
struct smemfs_inode *inode, Elf32_Ehdr *header);
|
|
extern int hypervisor_elf_loader_reloc_error(int errnum);
|
|
|
|
extern int hypervisor_elf_loader_dynamic_check(struct smemfs_inode *inode);
|
|
#endif /*__HYPERVISOR_INTERNAL_H__*/
|