Kernel - Commenting changes only
[tpg/acess2.git] / AcessNative / ld-acess_src / common.h
1 /*
2  */
3 #ifndef _COMMON_H_
4 #define _COMMON_H_
5
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <stdint.h>
9 #include <string.h>
10
11 extern int      Binary_GetSymbol(const char *SymbolName, uintptr_t *Value, size_t *Size);
12 extern void     *Binary_LoadLibrary(const char *Path);
13 extern void     *Binary_Load(const char *Path, uintptr_t *EntryPoint);
14 extern void     Binary_SetReadyToUse(void *Base);
15
16 // HACKS - So this can share the usermode elf.c
17 static inline int GetSymbol(const char *sym, void **val, size_t *sz)
18 {
19         uintptr_t rv;
20         if( !Binary_GetSymbol(sym, &rv, sz) )
21                 return 0;
22         *val = (void*)rv;
23         return 1;
24 }
25 static inline void *LoadLibrary(const char *Name, const char *SearchPath, char **envp)
26 {
27         return Binary_LoadLibrary(Name);
28 }
29 static inline void AddLoaded(const char *Path, void *Base)
30 {
31         Binary_SetReadyToUse(Base);
32 }
33
34 static inline int _SysSetMemFlags(uintptr_t Addr, unsigned int flags, unsigned int mask)
35 {
36         return 0;
37 }
38
39 extern int      AllocateMemory(uintptr_t VirtAddr, size_t ByteCount);
40 extern uintptr_t        FindFreeRange(size_t ByteCount, int MaxBits);
41
42 extern void     Warning(const char *Format, ...);
43 extern void     Notice(const char *Format, ...);
44 extern void     Debug(const char *Format, ...);
45 #define SysDebug        Debug
46
47 #define ACESS_SEEK_CUR  0
48 #define ACESS_SEEK_SET  1
49 #define ACESS_SEEK_END  -1
50
51 #include "exports.h"
52
53 typedef struct sBinFmt {
54         struct sBinFmt  *Next;
55         char    *Name;
56         void    *(*Load)(int fd);
57         uintptr_t       (*Relocate)(void *base);
58          int    (*GetSymbol)(void*,char*,uintptr_t*,size_t*);
59 }       tBinFmt;
60
61 #endif
62

UCC git Repository :: git.ucc.asn.au