LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
Macros | Functions | Variables
elf.c File Reference
#include <fcntl.h>
#include <libfdt/libfdt.h>
#include <nocfe/cfe.h>
#include <ppc/cache.h>
#include <ppc/register.h>
#include <ppc/timebase.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time/time.h>
#include <unistd.h>
#include <xenon_soc/xenon_power.h>
#include "elf.h"
#include "elf_abi.h"
#include "xetypes.h"
Include dependency graph for elf.c:

Go to the source code of this file.

Macros

#define ELF_DEVTREE_START   ((void *)0x85FE0000)
 
#define ELF_DEVTREE_MAX_SIZE   0x00010000
 
#define MAX_CMDLINE_SIZE   255
 
#define INITRD_RELOC_START   ((void *)0x86000000)
 
#define INITRD_MAX_SIZE   (32 * 1024 * 1024)
 
#define ELF_CODE_STACK_END   ((void *)0x87F80000)
 
#define ELF_CODE_RELOC_START   ((void *)0x87F80000)
 
#define ELF_CODE_MAX_SIZE   0x00080000
 
#define ELF_TEMP_BEGIN   ((void *)0x88000000)
 
#define ELF_MAX_SIZE   0x03000000
 
#define ELF_DATA_RELOC_START   ((void *)0x8B000000)
 
#define ELF_ARGV_BEGIN   ((void *)0x8E000000)
 
#define ELF_GET_RELOCATED(x)    (ELF_CODE_RELOC_START + ((unsigned long)(x) - (unsigned long)elfldr_start))
 
#define ELF_GET_RELOCATED_REAL(x)   (void*)((uint64_t)ELF_GET_RELOCATED(x) & 0x1FFFFFFF)
 
#define ELF_DEBUG   1
 
#define LINESIZE   128
 

Functions

void shutdown_drivers ()
 
void elf_call_real (uint64_t function,...)
 
void elf_run (unsigned long entry, unsigned long devtree)
 
void elf_hold_thread ()
 
char * argv_GetFilename (const char *argv)
 
char * argv_GetFilepath (const char *argv)
 
char * argv_GetDevice (const char *argv)
 
void elf_setArgcArgv (int argc, char *argv[])
 
int elf_runFromMemory (void *addr, int size)
 
int elf_runFromDisk (char *filename)
 
int elf_runWithDeviceTree (void *elf_addr, int elf_size, void *dt_addr, int dt_size)
 
int kernel_prepare_initrd (void *start, size_t size)
 
void kernel_relocate_initrd (void *start, size_t size)
 
void kernel_reset_initrd (void)
 
void kernel_build_cmdline (const char *parameters, const char *root)
 

Variables

unsigned char elfldr_start []
 
unsigned char elfldr_end []
 
unsigned char pagetable_end []
 
volatile unsigned long elf_secondary_hold_addr
 
volatile unsigned long elf_secondary_count
 

Macro Definition Documentation

◆ ELF_ARGV_BEGIN

#define ELF_ARGV_BEGIN   ((void *)0x8E000000)

Definition at line 46 of file elf.c.

◆ ELF_CODE_MAX_SIZE

#define ELF_CODE_MAX_SIZE   0x00080000

Definition at line 38 of file elf.c.

◆ ELF_CODE_RELOC_START

#define ELF_CODE_RELOC_START   ((void *)0x87F80000)

Definition at line 37 of file elf.c.

◆ ELF_CODE_STACK_END

#define ELF_CODE_STACK_END   ((void *)0x87F80000)

Definition at line 36 of file elf.c.

◆ ELF_DATA_RELOC_START

#define ELF_DATA_RELOC_START   ((void *)0x8B000000)

Definition at line 45 of file elf.c.

◆ ELF_DEBUG

#define ELF_DEBUG   1

Definition at line 51 of file elf.c.

◆ ELF_DEVTREE_MAX_SIZE

#define ELF_DEVTREE_MAX_SIZE   0x00010000

Definition at line 27 of file elf.c.

◆ ELF_DEVTREE_START

#define ELF_DEVTREE_START   ((void *)0x85FE0000)

Definition at line 26 of file elf.c.

◆ ELF_GET_RELOCATED

#define ELF_GET_RELOCATED (   x)     (ELF_CODE_RELOC_START + ((unsigned long)(x) - (unsigned long)elfldr_start))

Definition at line 47 of file elf.c.

◆ ELF_GET_RELOCATED_REAL

#define ELF_GET_RELOCATED_REAL (   x)    (void*)((uint64_t)ELF_GET_RELOCATED(x) & 0x1FFFFFFF)

Definition at line 49 of file elf.c.

◆ ELF_MAX_SIZE

#define ELF_MAX_SIZE   0x03000000

Definition at line 42 of file elf.c.

◆ ELF_TEMP_BEGIN

#define ELF_TEMP_BEGIN   ((void *)0x88000000)

Definition at line 41 of file elf.c.

◆ INITRD_MAX_SIZE

#define INITRD_MAX_SIZE   (32 * 1024 * 1024)

Definition at line 31 of file elf.c.

◆ INITRD_RELOC_START

#define INITRD_RELOC_START   ((void *)0x86000000)

Definition at line 30 of file elf.c.

◆ LINESIZE

#define LINESIZE   128

Definition at line 109 of file elf.c.

◆ MAX_CMDLINE_SIZE

#define MAX_CMDLINE_SIZE   255

Definition at line 28 of file elf.c.

Function Documentation

◆ argv_GetDevice()

char * argv_GetDevice ( const char *  argv)

Definition at line 285 of file elf.c.

◆ argv_GetFilename()

char * argv_GetFilename ( const char *  argv)

Definition at line 253 of file elf.c.

◆ argv_GetFilepath()

char * argv_GetFilepath ( const char *  argv)

Definition at line 269 of file elf.c.

◆ elf_call_real()

void elf_call_real ( uint64_t  function,
  ... 
)

◆ elf_hold_thread()

void elf_hold_thread ( )

◆ elf_run()

void elf_run ( unsigned long  entry,
unsigned long  devtree 
)

◆ elf_runFromDisk()

int elf_runFromDisk ( char *  filename)

Definition at line 434 of file elf.c.

◆ elf_runFromMemory()

int elf_runFromMemory ( void *  addr,
int  size 
)

Definition at line 367 of file elf.c.

◆ elf_runWithDeviceTree()

int elf_runWithDeviceTree ( void *  elf_addr,
int  elf_size,
void *  dt_addr,
int  dt_size 
)

Definition at line 457 of file elf.c.

◆ elf_setArgcArgv()

void elf_setArgcArgv ( int  argc,
char *  argv[] 
)

Definition at line 301 of file elf.c.

◆ kernel_build_cmdline()

void kernel_build_cmdline ( const char *  parameters,
const char *  root 
)

Definition at line 579 of file elf.c.

◆ kernel_prepare_initrd()

int kernel_prepare_initrd ( void *  start,
size_t  size 
)

Definition at line 541 of file elf.c.

◆ kernel_relocate_initrd()

void kernel_relocate_initrd ( void *  start,
size_t  size 
)

Definition at line 557 of file elf.c.

◆ kernel_reset_initrd()

void kernel_reset_initrd ( void  )

Definition at line 571 of file elf.c.

◆ shutdown_drivers()

void shutdown_drivers ( )

Definition at line 92 of file xenon_syscalls.c.

Variable Documentation

◆ elf_secondary_count

volatile unsigned long elf_secondary_count
extern

◆ elf_secondary_hold_addr

volatile unsigned long elf_secondary_hold_addr
extern

◆ elfldr_end

unsigned char elfldr_end[]

Definition at line 56 of file elf.c.

◆ elfldr_start

unsigned char elfldr_start[]
extern

◆ pagetable_end

unsigned char pagetable_end[]

Definition at line 56 of file elf.c.