# define MAX_CPUS 1
#endif
+#if USE_PAE
+# define PHYS_BITS 48
+#else
+# define PHYS_BITS 32
+#endif
+
// === MACROS ===
#define LOCK(lockptr) do {int v=1;\
while(v)__asm__ __volatile__("lock xchgl %%eax, (%%edi)":"=a"(v):"a"(1),"D"(lockptr));}while(0)
// === FUNCTIONS ===
extern void MM_SetCR3(Uint32 CR3);
-extern tPAddr MM_Allocate(Uint VAddr);
-extern void MM_Deallocate(Uint VAddr);
-extern int MM_Map(Uint VAddr, tPAddr PAddr);
-extern Uint MM_Clone();
-extern Uint MM_NewKStack();
-extern Uint MM_NewWorkerStack();
+extern tPAddr MM_Allocate(tVAddr VAddr);
+extern void MM_Deallocate(tVAddr VAddr);
+extern int MM_Map(tVAddr VAddr, tPAddr PAddr);
+extern tVAddr MM_Clone();
+extern tVAddr MM_NewKStack();
+extern tVAddr MM_NewWorkerStack();
#endif
}
for(b=0;gaSuperBitmap[a]&(1<<b);b++);
for(c=0;gaPageBitmap[a*32+b]&(1<<c);c++);
- //for(c=0;gaPageReferences[a*32*32+b*32+c]>0;c++);
// Mark page used
if(gaPageReferences)
// Release Spinlock
RELEASE( &giPhysAlloc );
- //LOG("Allocated 0x%x\n", ret);
- //LOG("ret = %x", ret);
+
+ return ret;
+}
+
+/**
+ * \fn tPAddr MM_AllocPhysRange(int Pages)
+ * \brief Allocate a range of physical pages
+ * \param Pages Number of pages to allocate
+ */
+tPAddr MM_AllocPhysRange(int Pages)
+{
+ int num = giPageCount / 32 / 32;
+ int a, b, c;
+ Uint32 ret;
+
+ LOCK( &giPhysAlloc );
+
+ // Find free page
+ for(a=0;gaSuperBitmap[a]==-1&&a<num;a++);
+ if(a == num) {
+ RELEASE( &giPhysAlloc );
+ Warning("MM_AllocPhys - OUT OF MEMORY (Called by %p)", __builtin_return_address(0));
+ return 0;
+ }
+ for(b=0;gaSuperBitmap[a]&(1<<b);b++);
+ for(c=0;gaPageBitmap[a*32+b]&(1<<c);c++);
+
+ // Mark page used
+ if(gaPageReferences)
+ gaPageReferences[a*32*32+b*32+c] = 1;
+ gaPageBitmap[ a*32+b ] |= 1 << c;
+
+ // Get address
+ ret = (a << 22) + (b << 17) + (c << 12);
+
+ // Mark used block
+ if(gaPageBitmap[ a*32+b ] == -1) gaSuperBitmap[a] |= 1 << b;
+
+ // Release Spinlock
+ RELEASE( &giPhysAlloc );
+
return ret;
}
// === IMPORTS ===
extern Uint32 gaInitPageDir[1024];
extern Uint32 gaInitPageTable[1024];
-extern void Threads_SegFault(Uint Addr);
+extern void Threads_SegFault(tVAddr Addr);
extern void Error_Backtrace(Uint eip, Uint ebp);
// === PROTOTYPES ===
void MM_PreinitVirtual();
void MM_InstallVirtual();
-void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs);
+void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs);
void MM_DumpTables(tVAddr Start, tVAddr End);
-tPAddr MM_DuplicatePage(Uint VAddr);
+tPAddr MM_DuplicatePage(tVAddr VAddr);
// === GLOBALS ===
tPAddr *gaPageTable = (void*)PAGE_TABLE_ADDR;
}
/**
- * \fn void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs)
+ * \fn void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
* \brief Called on a page fault
*/
-void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs)
+void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
{
//ENTER("xAddr bErrorCode", Addr, ErrorCode);
}
/**
- * \fn tPAddr MM_Allocate(Uint VAddr)
+ * \fn tPAddr MM_Allocate(tVAddr VAddr)
*/
-tPAddr MM_Allocate(Uint VAddr)
+tPAddr MM_Allocate(tVAddr VAddr)
{
tPAddr paddr;
// Check if the directory is mapped
}
/**
- * \fn void MM_Deallocate(Uint VAddr)
+ * \fn void MM_Deallocate(tVAddr VAddr)
*/
-void MM_Deallocate(Uint VAddr)
+void MM_Deallocate(tVAddr VAddr)
{
if( gaPageDir[ VAddr >> 22 ] == 0 ) {
Warning("MM_Deallocate - Directory not mapped");
}
/**
- * \fn tPAddr MM_GetPhysAddr(Uint Addr)
+ * \fn tPAddr MM_GetPhysAddr(tVAddr Addr)
* \brief Checks if the passed address is accesable
*/
-tPAddr MM_GetPhysAddr(Uint Addr)
+tPAddr MM_GetPhysAddr(tVAddr Addr)
{
if( !(gaPageDir[Addr >> 22] & 1) )
return 0;
}
/**
- * \fn void MM_SetCR3(Uint CR3)
+ * \fn void MM_SetCR3(tPAddr CR3)
* \brief Sets the current process space
*/
-void MM_SetCR3(Uint CR3)
+void MM_SetCR3(tPAddr CR3)
{
__asm__ __volatile__ ("mov %0, %%cr3"::"r"(CR3));
}
/**
- * \fn int MM_Map(Uint VAddr, tPAddr PAddr)
+ * \fn int MM_Map(tVAddr VAddr, tPAddr PAddr)
* \brief Map a physical page to a virtual one
*/
-int MM_Map(Uint VAddr, tPAddr PAddr)
+int MM_Map(tVAddr VAddr, tPAddr PAddr)
{
//ENTER("xVAddr xPAddr", VAddr, PAddr);
// Sanity check
}
/**
- * \fn Uint MM_ClearUser()
+ * \fn tVAddr MM_ClearUser()
* \brief Clear user's address space
*/
-Uint MM_ClearUser()
+tVAddr MM_ClearUser()
{
Uint i, j;
}
/**
- * \fn Uint MM_Clone()
+ * \fn tPAddr MM_Clone()
* \brief Clone the current address space
*/
-Uint MM_Clone()
+tPAddr MM_Clone()
{
Uint i, j;
- Uint ret;
+ tVAddr ret;
Uint page = 0;
- Uint kStackBase = Proc_GetCurThread()->KernelStack - KERNEL_STACK_SIZE;
+ tVAddr kStackBase = Proc_GetCurThread()->KernelStack - KERNEL_STACK_SIZE;
void *tmp;
LOCK( &gilTempFractal );
}
/**
- * \fn Uint MM_NewKStack()
+ * \fn tVAddr MM_NewKStack()
* \brief Create a new kernel stack
*/
-Uint MM_NewKStack()
+tVAddr MM_NewKStack()
{
- Uint base = KERNEL_STACKS;
+ tVAddr base = KERNEL_STACKS;
Uint i;
for(;base<KERNEL_STACKS_END;base+=KERNEL_STACK_SIZE)
{
}
/**
- * \fn Uint MM_NewWorkerStack()
+ * \fn tVAddr MM_NewWorkerStack()
* \brief Creates a new worker stack
*/
-Uint MM_NewWorkerStack()
+tVAddr MM_NewWorkerStack()
{
Uint esp, ebp;
Uint oldstack;
}
/**
- * \fn void MM_SetFlags(Uint VAddr, Uint Flags, Uint Mask)
+ * \fn void MM_SetFlags(tVAddr VAddr, Uint Flags, Uint Mask)
* \brief Sets the flags on a page
*/
-void MM_SetFlags(Uint VAddr, Uint Flags, Uint Mask)
+void MM_SetFlags(tVAddr VAddr, Uint Flags, Uint Mask)
{
tPAddr *ent;
if( !(gaPageDir[VAddr >> 22] & 1) ) return ;
}
/**
- * \fn tPAddr MM_DuplicatePage(Uint VAddr)
+ * \fn tPAddr MM_DuplicatePage(tVAddr VAddr)
* \brief Duplicates a virtual page to a physical one
*/
-tPAddr MM_DuplicatePage(Uint VAddr)
+tPAddr MM_DuplicatePage(tVAddr VAddr)
{
tPAddr ret;
Uint temp;
* \brief Create a temporary memory mapping
* \todo Show Luigi Barone (C Lecturer) and see what he thinks
*/
-Uint MM_MapTemp(tPAddr PAddr)
+tVAddr MM_MapTemp(tPAddr PAddr)
{
int i;
}
/**
- * \fn void MM_FreeTemp(Uint PAddr)
+ * \fn void MM_FreeTemp(tVAddr PAddr)
* \brief Free's a temp mapping
*/
-void MM_FreeTemp(Uint VAddr)
+void MM_FreeTemp(tVAddr VAddr)
{
int i = VAddr >> 12;
//ENTER("xVAddr", VAddr);
}
/**
- * \fn Uint MM_MapHWPage(tPAddr PAddr, Uint Number)
+ * \fn tVAddr MM_MapHWPage(tPAddr PAddr, Uint Number)
* \brief Allocates a contigous number of pages
*/
-Uint MM_MapHWPage(tPAddr PAddr, Uint Number)
+tVAddr MM_MapHWPage(tPAddr PAddr, Uint Number)
{
int i, j;
}
/**
- * \fn void MM_UnmapHWPage(Uint VAddr, Uint Number)
+ * \fn tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
+ * \brief Allocates DMA physical memory
+ * \param Pages Number of pages required
+ * \param MaxBits Maximum number of bits the physical address can have
+ * \param PhysAddr Pointer to the location to place the physical address allocated
+ * \return Virtual address allocate
+ */
+tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
+{
+ tPAddr maxCheck = (1 << MaxBits);
+ tPAddr phys;
+ tVAddr ret;
+
+ ENTER("iPages iMaxBits pPhysAddr", Pages, MaxBits, PhysAddr);
+
+ // Sanity Check
+ if(MaxBits < 12 || !PhysAddr) {
+ LEAVE('i', 0);
+ return 0;
+ }
+
+ // Bound
+ if(MaxBits >= PHYS_BITS) maxCheck = -1;
+
+ // Fast Allocate
+ if(Pages == 1 && MaxBits >= PHYS_BITS)
+ {
+ phys = MM_AllocPhys();
+ *PhysAddr = phys;
+ ret = MM_MapHWPage(phys, 1);
+ if(ret == 0) {
+ MM_DerefPhys(phys);
+ LEAVE('i', 0);
+ return 0;
+ }
+ LEAVE('x', ret);
+ return ret;
+ }
+
+ // Slow Allocate
+ phys = MM_AllocPhysRange(Pages);
+ // - Was it allocated?
+ if(phys == 0) {
+ LEAVE('i', 0);
+ return 0;
+ }
+ // - Check if the memory is OK
+ if(phys + (Pages-1)*0x1000 > maxCheck)
+ {
+ // Deallocate and return 0
+ for(;Pages--;phys+=0x1000)
+ MM_DerefPhys(phys);
+ LEAVE('i', 0);
+ return 0;
+ }
+
+ // Allocated successfully, now map
+ ret = MM_MapHWPage(phys, Pages);
+ if( ret == 0 ) {
+ // If it didn't map, free then return 0
+ for(;Pages--;phys+=0x1000)
+ MM_DerefPhys(phys);
+ LEAVE('i', 0);
+ return 0;
+ }
+
+ *PhysAddr = phys;
+ LEAVE('x', ret);
+ return ret;
+}
+
+/**
+ * \fn void MM_UnmapHWPage(tVAddr VAddr, Uint Number)
* \brief Unmap a hardware page
*/
-void MM_UnmapHWPage(Uint VAddr, Uint Number)
+void MM_UnmapHWPage(tVAddr VAddr, Uint Number)
{
int i, j;
// Sanity Check
EXPORT(MM_Map);
//EXPORT(MM_Unmap);
EXPORT(MM_MapHWPage);
+EXPORT(MM_AllocDMA);
EXPORT(MM_UnmapHWPage);
}\r
\r
Warning("[BIN ] 0x%x is an unknown file type. (0x%x 0x%x 0x%x 0x%x)",\r
- Base, ident&0xFF, ident>>8, ident>>16, ident>>24);\r
+ Base, ident&0xFF, (ident>>8)&0xFF, (ident>>16)&0xFF, (ident>>24)&0xFF);\r
return 0;\r
}\r
\r
\r
\r
// === EXPORTS ===\r
-/*\r
+//*\r
EXPORT(PCI_CountDevices);\r
EXPORT(PCI_GetDevice);\r
+EXPORT(PCI_GetDeviceByClass);\r
EXPORT(PCI_AssignPort);\r
EXPORT(PCI_GetIRQ);\r
-*/\r
+//*/\r
case KEY_F10: VT_SetTerminal(9); return;
case KEY_F11: VT_SetTerminal(10); return;
case KEY_F12: VT_SetTerminal(11); return;
+ case KEY_PGUP:
+ break;
+ case KEY_PGDOWN:
+ break;
}
}
#include <arch.h>
#include <stdarg.h>
+// --- Helper Macros ---
+/**
+ * \name Helper Macros
+ * \{
+ */
+#define CONCAT(x,y) x ## y
+#define EXPAND_CONCAT(x,y) CONCAT(x,y)
+#define STR(x) #x
+#define EXPAND_STR(x) STR(x)
+/**
+ * \}
+ */
+
+/**
+ * \name Per-Process Configuration Settings
+ * \{
+ */
enum eConfigTypes {
CFGT_NULL,
CFGT_INT,
};
#define CFGINT(id) (*Threads_GetCfgPtr(id))
#define CFGPTR(id) (*(void**)Threads_GetCfgPtr(id))
+/**
+ * \}
+ */
// === CONSTANTS ===
// --- Memory Flags --
+/**
+ * \name Memory Flags
+ * \{
+ * \todo Move to mm_virt.h
+ */
#define MM_PFLAG_RO 0x01 // Writes disallowed
#define MM_PFLAG_EXEC 0x02 // Allow execution
#define MM_PFLAG_NOPAGE 0x04 // Prevent from being paged out
#define MM_PFLAG_COW 0x08 // Copy-On-Write
#define MM_PFLAG_KERNEL 0x10 // Kernel-Only (Ring0)
+/**
+ * \}
+ */
// === Kernel Export Macros ===
+/**
+ * \name Kernel Function
+ * \{
+ */
typedef struct sKernelSymbol {
char *Name;
unsigned int Value;
} tKernelSymbol;
#define EXPORT(_name) tKernelSymbol _kexp_##_name __attribute__((section ("KEXPORT"),unused))={#_name, (Uint)_name}
+#define EXPORTV(_name) tKernelSymbol _kexp_##_name __attribute__((section ("KEXPORT"),unused))={#_name, (Uint)&_name}
#define EXPORTAS(_sym,_name) tKernelSymbol _kexp_##_name __attribute__((section ("KEXPORT"),unused))={#_name, (Uint)_sym}
+/**
+ * \}
+ */
// === FUNCTIONS ===
// --- Core ---
extern void System_Init(char *ArgString);
+
+// --- IRQs ---
extern int IRQ_AddHandler(int Num, void (*Callback)(int));
+
// --- Debug ---
+/**
+ * \name Debugging and Errors
+ * \{
+ */
extern void Panic(char *Msg, ...);
extern void Warning(char *Msg, ...);
extern void Log(char *Fmt, ...);
# define LOG(...)
# define LEAVE(...)
#endif
+/**
+ * \}
+ */
+
// --- IO ---
+/**
+ * \name I/O Memory Access
+ * \{
+ */
extern void outb(Uint16 Port, Uint8 Data);
extern void outw(Uint16 Port, Uint16 Data);
extern void outd(Uint16 Port, Uint32 Data);
extern Uint16 inw(Uint16 Port);
extern Uint32 ind(Uint16 Port);
extern Uint64 inq(Uint16 Port);
-// --- Memory ---
-extern tPAddr MM_Allocate(Uint VAddr);
-extern void MM_Deallocate(Uint VAddr); //!< Deallocate a page
-extern int MM_Map(Uint VAddr, tPAddr PAddr); //!< Map a page
-extern tPAddr MM_GetPhysAddr(Uint VAddr); //!< Get the physical address of a page
-extern int MM_IsUser(Uint VAddr, int Length); //!< Checks if a memory address is valid user memory
-extern void MM_SetFlags(Uint VAddr, Uint Flags, Uint Mask);
-extern Uint MM_MapTemp(tPAddr PAddr);
-extern void MM_FreeTemp(Uint PAddr);
-extern Uint MM_MapHWPage(tPAddr PAddr, Uint Number);
-extern void MM_UnmapHWPage(Uint VAddr, Uint Number);
+/**
+ * \}
+ */
+
+// --- Memory Management ---
+/**
+ * \name Memory Management
+ * \{
+ * \todo Move to mm_virt.h
+ */
+/**
+ * \brief Allocate a physical page at \a VAddr
+ * \param VAddr Virtual Address to allocate at
+ * \return Physical address allocated
+ */
+extern tPAddr MM_Allocate(tVAddr VAddr);
+/**
+ * \brief Deallocate a page
+ * \param VAddr Virtual address to unmap
+ */
+extern void MM_Deallocate(tVAddr VAddr);
+/**
+ * \brief Map a physical page at \a PAddr to \a VAddr
+ * \param VAddr Target virtual address
+ * \param PAddr Physical address to map
+ * \return Boolean Success
+ */
+extern int MM_Map(tVAddr VAddr, tPAddr PAddr);
+/**
+ * \brief Get the physical address of \a VAddr
+ * \param VAddr Address of the page to get the physical address of
+ * \return Physical page mapped at \A VAddr
+ */
+extern tPAddr MM_GetPhysAddr(tVAddr VAddr);
+/**
+ * \brief Checks is a memory range is user accessable
+ * \param VAddr Base address to check
+ * \param Length Number of bytes to check
+ * \return 1 if the memory is all user-accessable, 0 otherwise
+ */
+extern int MM_IsUser(tVAddr VAddr, int Length);
+/**
+ * \brief Set the access flags on a page
+ * \param VAddr Virtual address of the page
+ * \param Flags New flags value
+ * \param Mask Flags to set
+ */
+extern void MM_SetFlags(tVAddr VAddr, Uint Flags, Uint Mask);
+/**
+ * \brief Temporarily map a page into the address space
+ * \param PAddr Physical addres to map
+ * \return Virtual address of page in memory
+ * \note There is only a limited ammount of slots avaliable
+ */
+extern tVAddr MM_MapTemp(tPAddr PAddr);
+/**
+ * \brief Free a temporarily mapped page
+ * \param VAddr Allocate virtual addres of page
+ */
+extern void MM_FreeTemp(tVAddr VAddr);
+/**
+ * \brief Map a physcal address range into the virtual address space
+ * \param PAddr Physical address to map in
+ * \param Number Number of pages to map
+ */
+extern tVAddr MM_MapHWPage(tPAddr PAddr, Uint Number);
+/**
+ * \brief Allocates DMA physical memory
+ * \param Pages Number of pages required
+ * \param MaxBits Maximum number of bits the physical address can have
+ * \param PhysAddr Pointer to the location to place the physical address allocated
+ * \return Virtual address allocate
+ */
+extern tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr);
+/**
+ * \brief Unmaps an allocated hardware range
+ * \param VAddr Virtual address allocate by ::MM_MapHWPage or ::MM_AllocDMA
+ * \param Number Number of pages to free
+ */
+extern void MM_UnmapHWPage(tVAddr VAddr, Uint Number);
+/**
+ * \brief Allocate a single physical page
+ * \return Physical address allocated
+ */
extern tPAddr MM_AllocPhys();
-extern void MM_RefPhys(tPAddr Addr);
-extern void MM_DerefPhys(tPAddr Addr);
+/**
+ * \brief Allocate a contiguous range of physical pages
+ * \param Pages Number of pages to allocate
+ * \return First physical address allocated
+ */
+extern tPAddr MM_AllocPhysRange(int Pages);
+/**
+ * \brief Reference a physical page
+ * \param PAddr Page to mark as referenced
+ */
+extern void MM_RefPhys(tPAddr PAddr);
+/**
+ * \brief Dereference a physical page
+ * \param PAddr Page to dereference
+ */
+extern void MM_DerefPhys(tPAddr PAddr);
+/**
+ * \}
+ */
+
+// --- Memory Manipulation ---
+/**
+ * \name Memory Manipulation
+ * \{
+ */
extern int memcmp(const void *m1, const void *m2, Uint count);
extern void *memcpy(void *dest, const void *src, Uint count);
extern void *memcpyd(void *dest, const void *src, Uint count);
extern void *memset(void *dest, int val, Uint count);
extern void *memsetd(void *dest, Uint val, Uint count);
+/**
+ * \}
+ */
+
+// --- Endianness ---
+/**
+ * \name Endianness Swapping
+ * \{
+ */
extern Uint16 LittleEndian16(Uint16 Val);
extern Uint16 BigEndian16(Uint16 Val);
extern Uint32 LittleEndian32(Uint32 Val);
extern Uint32 BigEndian32(Uint32 Val);
+/**
+ * \}
+ */
+
// --- Strings ---
+/**
+ * \name Strings
+ * \{
+ */
extern Uint strlen(const char *Str);
extern char *strcpy(char *__dest, const char *__src);
extern int strcmp(const char *__str1, const char *__str2);
extern int strncmp(const char *Str1, const char *Str2, size_t num);
extern int strucmp(const char *Str1, const char *Str2);
-extern char *strdup(const char *__str);
+extern char *strdup(const char *Str);
extern int strpos(const char *Str, char Ch);
extern int strpos8(const char *str, Uint32 search);
extern void itoa(char *buf, Uint num, int base, int minLength, char pad);
extern int ReadUTF8(Uint8 *str, Uint32 *Val);
extern int WriteUTF8(Uint8 *str, Uint32 Val);
+/**
+ * \}
+ */
+
extern Uint rand();
+
// --- Heap ---
+/**
+ * \name Heap
+ * \{
+ */
extern void *malloc(size_t size);
extern void *calloc(size_t num, size_t size);
extern void *realloc(void *ptr, size_t size);
extern void free(void *Ptr);
extern int IsHeap(void *Ptr);
+/**
+ * \}
+ */
+
// --- Modules ---
+/**
+ * \name Modules
+ * \{
+ */
extern int Module_LoadMem(void *Buffer, Uint Length, char *ArgStr);
extern int Module_LoadFile(char *Path, char *ArgStr);
+/**
+ * \}
+ */
+
// --- Timing ---
+/**
+ * \name Time and Timing
+ * \{
+ */
extern Sint64 timestamp(int sec, int mins, int hrs, int day, int month, int year);
extern Sint64 now();
extern int Time_CreateTimer(int Delta, void *Callback, void *Argument);
extern void Time_RemoveTimer(int ID);
extern void Time_Delay(int Delay);
+/**
+ * \}
+ */
+
// --- Threads ---
+/**
+ * \name Threads and Processes
+ * \{
+ */
extern int Proc_SpawnWorker();
extern int Proc_Spawn(char *Path);
extern void Threads_Exit();
extern int Threads_GetGID();
extern int SpawnTask(tThreadFunction Function, void *Arg);
extern Uint *Threads_GetCfgPtr(int Id);
+/**
+ * \}
+ */
+
// --- Simple Math ---
extern int DivUp(int num, int dem);
}
/**
- * \fn int tolower(int __c)
+ * \fn int tolower(int c)
* \brief Converts a character to lower case
*/
int tolower(int c)
}
/**
- * \fn int strpos(char *Str, char Ch)
+ * \fn int strpos(const char *Str, char Ch)
* \brief Search a string for an ascii character
*/
int strpos(const char *Str, char Ch)
}
/**
+ * \fn int ByteSum(void *Ptr, int Size)
+ * \brief Adds the bytes in a memory region and returns the sum
*/
int ByteSum(void *Ptr, int Size)
{
}
/**
- * \fn Uint strlen(char *__str)
+ * \fn Uint strlen(const char *__str)
* \brief Get the length of string
*/
Uint strlen(const char *__str)
}
/**
- * \fn char *strcpy(char *__str1, char *__str2)
+ * \fn char *strcpy(const char *__str1, const char *__str2)
* \brief Copy a string to a new location
*/
char *strcpy(char *__str1, const char *__str2)
}
/**
- * \fn int strcmp(char *str1, char *str2)
+ * \fn int strcmp(const char *str1, const char *str2)
* \brief Compare two strings return the difference between
* the first non-matching characters.
*/
}
/**
- * \fn int strncmp(char *Str1, char *Str2, size_t num)
+ * \fn int strncmp(const char *Str1, const char *Str2, size_t num)
* \brief Compare strings \a Str1 and \a Str2 to a maximum of \a num characters
*/
int strncmp(const char *Str1, const char *Str2, size_t num)
}
/**
- * \fn char *strdup(char *str)
+ * \fn char *strdup(const char *Str)
* \brief Duplicates a string
*/
-char *strdup(const char *str)
+char *strdup(const char *Str)
{
char *ret;
- ret = malloc(strlen(str)+1);
- strcpy(ret, str);
+ ret = malloc(strlen(Str)+1);
+ strcpy(ret, Str);
return ret;
}
return 0;
}
+ Log("Initialising %p '%s' v%i.%i...",
+ info,
+ info->Name,
+ info->Version>>8, info->Version & 0xFF
+ );
+
// Call Initialiser
//if( info->Init( ArgString ) != 0 )
if( info->Init( NULL ) == 0 )
// Return buffer
return ret;
}
+
+// === EXPORTS ===
+// --- Variables ---
+EXPORTV(gVFS_ACL_EveryoneRWX);
+EXPORTV(gVFS_ACL_EveryoneRW);
+EXPORTV(gVFS_ACL_EveryoneRX);
+// --- Functions ---
+EXPORT(VFS_UnixToAcessACL);
* Acess2 VFS
* - Directory Management Functions
*/
-#define DEBUG 1
+#define DEBUG 0
#include <common.h>
#include <vfs.h>
#include <vfs_int.h>
$(BIN): $(OBJ)
@echo --- $(LD) -o $@
- @$(LD) -T ../link.ld -shared -o $@ $(OBJ)
+ @$(LD) -T ../link.ld -shared -nostdlib -o $@ $(OBJ)
+# @$(LD) -shared -nostdlib -o $@ $(OBJ)
@echo --- $(LD) -o $(KOBJ)
@$(CC) -Wl,-r -nostdlib -o $(KOBJ) $(OBJ)