git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/debug - Panic to VT for the first nested panic
[tpg/acess2.git]
/
AcessNative
/
ld-acess_src
/
syscalls.c
diff --git
a/AcessNative/ld-acess_src/syscalls.c
b/AcessNative/ld-acess_src/syscalls.c
index
3c691aa
..
26f6c44
100644
(file)
--- a/
AcessNative/ld-acess_src/syscalls.c
+++ b/
AcessNative/ld-acess_src/syscalls.c
@@
-9,9
+9,14
@@
#include <string.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>
#include <stddef.h>
#include <unistd.h>
+#include <spawn.h> // posix_spawn
#include "request.h"
#include "request.h"
+#if SYSCALL_TRACE
#define DEBUG(str, x...) Debug(str, x)
#define DEBUG(str, x...) Debug(str, x)
+#else
+#define DEBUG(...) do{}while(0)
+#endif
#define MAX_FPS 16
#define MAX_FPS 16
@@
-108,7
+113,7
@@
const char *ReadEntry(tRequestValue *Dest, void *DataDest, void **PtrDest, const
break;
// Data (special handling)
case 'd':
break;
// Data (special handling)
case 'd':
- len = va_arg(*Args,
in
t);
+ len = va_arg(*Args,
size_
t);
str = va_arg(*Args, char*);
// Save the pointer for later
str = va_arg(*Args, char*);
// Save the pointer for later
@@
-116,7
+121,7
@@
const char *ReadEntry(tRequestValue *Dest, void *DataDest, void **PtrDest, const
// Create parameter block
Dest->Type = ARG_TYPE_DATA;
// Create parameter block
Dest->Type = ARG_TYPE_DATA;
- Dest->Length =
len
;
+ Dest->Length =
str ? len : 0
;
Dest->Flags = 0;
if( direction & 2 )
Dest->Flags |= ARG_FLAG_RETURN;
Dest->Flags = 0;
if( direction & 2 )
Dest->Flags |= ARG_FLAG_RETURN;
@@
-124,7
+129,7
@@
const char *ReadEntry(tRequestValue *Dest, void *DataDest, void **PtrDest, const
// Has data?
if( direction & 1 )
{
// Has data?
if( direction & 1 )
{
- if( DataDest )
+ if( DataDest
&& str
)
memcpy(DataDest, str, len);
}
else
memcpy(DataDest, str, len);
}
else
@@
-206,6
+211,7
@@
uint64_t _Syscall(int SyscallID, const char *ArgTypes, ...)
req->ClientID = 0; //< Filled later
req->CallID = SyscallID;
req->NParams = paramCount;
req->ClientID = 0; //< Filled later
req->CallID = SyscallID;
req->NParams = paramCount;
+ req->MessageLength = dataLength;
dataPtr = &req->Params[paramCount];
// Fill `output` and `input`
dataPtr = &req->Params[paramCount];
// Fill `output` and `input`
@@
-253,6
+259,11
@@
uint64_t _Syscall(int SyscallID, const char *ArgTypes, ...)
}
// Write changes to buffers
}
// Write changes to buffers
+ if( req->NParams - 1 != retCount ) {
+ fprintf(stderr, "syscalls.c: Return count inbalance (%i - 1 != exp %i) [Call %i]\n",
+ req->NParams, retCount, SyscallID);
+ exit(127);
+ }
retCount = 0;
for( i = 1; i < req->NParams; i ++ )
{
retCount = 0;
for( i = 1; i < req->NParams; i ++ )
{
@@
-270,7
+281,7
@@
uint64_t _Syscall(int SyscallID, const char *ArgTypes, ...)
free( req );
free( retPtrs );
free( req );
free( retPtrs );
- DEBUG(": %
llx"
, retValue);
+ DEBUG(": %
i 0x%llx", SyscallID
, retValue);
return retValue;
}
return retValue;
}
@@
-318,10
+329,19
@@
uint64_t native_tell(int FD)
return ftell( gaSyscall_LocalFPs[FD] );
}
return ftell( gaSyscall_LocalFPs[FD] );
}
-int native_execve(const char *filename, c
har *const argv[],
char *const envp[])
+int native_execve(const char *filename, c
onst char *const argv[], const
char *const envp[])
{
int ret;
{
int ret;
- ret = execve(filename,
argv,
envp);
+ ret = execve(filename,
(void*)argv, (void*)
envp);
perror("native_execve");
return ret;
}
perror("native_execve");
return ret;
}
+
+int native_spawn(const char *filename, const char *const argv[], const char *const envp[])
+{
+ int rv;
+
+ rv = posix_spawn(NULL, filename, NULL, NULL, (void*)argv, (void*)envp);
+
+ return rv;
+}
UCC
git Repository :: git.ucc.asn.au