Proc_Execve(Binary, ArgV, EnvP, size);
for(;;);
}
- if( ret < 0 )
+ if( ret == -1 )
{
VFS_FreeSavedHandles(nFD, handles);
free(cachebuf);
return stamp * 1000;
}
+static Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R);
+
+static Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R)
+{
+ int sign = (N < 0) != (D < 0);
+ if(N < 0) N = -N;
+ if(D < 0) D = -D;
+ if(sign)
+ return -DivMod64U(N, D, (Uint64*)R);
+ else
+ return DivMod64U(N, D, (Uint64*)R);
+}
+
void format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms)
{
int is_leap = 0, i;
- auto Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R);
-
- Sint64 DivMod64(Sint64 N, Sint64 D, Sint64 *R)
- {
- int sign = (N < 0) != (D < 0);
- if(N < 0) N = -N;
- if(D < 0) D = -D;
- if(sign)
- return -DivMod64U(N, D, (Uint64*)R);
- else
- return DivMod64U(N, D, (Uint64*)R);
- }
-
// Get time
// TODO: Leap-seconds?
{
/**
* \brief Append a character the the vsnprintf output
*/
-#define PUTCH(c) _putch(c)
+#define PUTCH(ch) do { \
+ if(pos < __maxlen) { \
+ if(__s) __s[pos] = ch; \
+ } \
+ pos ++; \
+ } while(0)
#define GETVAL() do {\
if(isLongLong) val = va_arg(args, Uint64);\
else val = va_arg(args, unsigned int);\
size_t pos = 0;
// Flags
int bPadLeft = 0;
-
- auto void _putch(char ch);
-
- void _putch(char ch)
- {
- if(pos < __maxlen)
- {
- if(__s) __s[pos] = ch;
- }
- pos ++;
- }
while((c = *__format++) != 0)
{
{
tUSBHost *host;
- host = malloc(sizeof(tUSBHost) + nPorts*sizeof(tUSBHubPort));
+ host = malloc(sizeof(tUSBHost) + sizeof(tUSBDevice) + sizeof(tUSBInterface) + nPorts*sizeof(tUSBHubPort));
if(!host) {
// Oh, bugger.
return NULL;
host->Ptr = ControllerPtr;
memset(host->AddressBitmap, 0, sizeof(host->AddressBitmap));
- host->RootHubDev.ParentHub = NULL;
- host->RootHubDev.Host = host;
- host->RootHubDev.Address = 0;
+ host->RootHubDev = (void*)(host + 1);
+ host->RootHubDev->ParentHub = NULL;
+ host->RootHubDev->Host = host;
+ host->RootHubDev->Address = 0;
ASSERT(HostDef->InitControl);
- host->RootHubDev.EndpointHandles[0] = HostDef->InitControl(ControllerPtr, 0, 64);
+ host->RootHubDev->EndpointHandles[0] = HostDef->InitControl(ControllerPtr, 0, 64);
-// host->RootHubIf.Next = NULL;
- host->RootHubIf.Dev = &host->RootHubDev;
- host->RootHubIf.Driver = NULL;
- host->RootHubIf.Data = NULL;
- host->RootHubIf.nEndpoints = 0;
+ host->RootHubIf = (void*)(host->RootHubDev + 1);
+// host->RootHubIf->Next = NULL;
+ host->RootHubIf->Dev = host->RootHubDev;
+ host->RootHubIf->Driver = NULL;
+ host->RootHubIf->Data = NULL;
+ host->RootHubIf->nEndpoints = 0;
- host->RootHub.Interface = &host->RootHubIf;
+ host->RootHub.Interface = host->RootHubIf;
host->RootHub.nPorts = nPorts;
memset(host->RootHub.Ports, 0, sizeof(tUSBHubPort)*nPorts);
Uint8 AddressBitmap[128/8];
- tUSBDevice RootHubDev;
- tUSBInterface RootHubIf;
+ tUSBDevice *RootHubDev;
+ tUSBInterface *RootHubIf;
tUSBHub RootHub;
};
int USB_int_SendSetupSetAddress(tUSBHost *Host, int Address)
{
- USB_int_Request(&Host->RootHubDev, 0, 0x00, 5, Address & 0x7F, 0, 0, NULL);
+ USB_int_Request(Host->RootHubDev, 0, 0x00, 5, Address & 0x7F, 0, 0, NULL);
return 0;
}
char *dynstrtab = NULL; // .dynamic String Table
Elf32_Sym *dynsymtab;
int (*do_relocate)(uint32_t t_info, uint32_t *ptr, Elf32_Addr addend, int Type, int bRela, const char *Sym, intptr_t iBaseDiff);
- auto int _doRelocate(uint32_t r_info, uint32_t *ptr, int bRela, Elf32_Addr addend);
DEBUGS("ElfRelocate: (Base=0x%x)", Base);
DEBUGS(" elf_relocate: Beginning Relocation");
- int _doRelocate(uint32_t r_info, uint32_t *ptr, int bRela, Elf32_Addr addend)
- {
- int type = ELF32_R_TYPE(r_info);
- int sym = ELF32_R_SYM(r_info);
- const char *symname = dynstrtab + dynsymtab[sym].nameOfs;
- return do_relocate(r_info, ptr, addend, type, bRela, symname, iBaseDiff);
- }
-
switch(hdr->machine)
{
case EM_386:
int fail = 0;
+ #define _doRelocate(r_info, ptr, bRela, addend) \
+ do_relocate(r_info, ptr, addend, ELF32_R_TYPE(r_info), bRela, \
+ dynstrtab + dynsymtab[ELF32_R_SYM(r_info)].nameOfs, iBaseDiff);
+
// Parse Relocation Entries
if(rel && relSz)
{
return NULL;
}
+ #undef _doRelocate
+
DEBUGS("ElfRelocate: RETURN 0x%x to %p", hdr->entrypoint + iBaseDiff, __builtin_return_address(0));
return (void*)(intptr_t)( hdr->entrypoint + iBaseDiff );
}