all clean:
@$(MAKE) -C acesskernel_src $@
@$(MAKE) -C ld-acess_src $@
+ @$(MAKE) -C libacess-native.so_src $@
--- /dev/null
+#!/bin/sh
+#
+# Execute the specified root application using the ARCH=native build
+#
+_=$PWD; cd $(dirname $0); DIR=$PWD; cd $_
+DISTROOT=$(dirname $DIR)/Usermode/Output/native/
+VTERM=/Devices/pts/vt0
+
+# 1. Start up AcessKernel
+# - Set DISTROOT to the output directory of ARCH=native
+# - Don't start a root application
+${DIR}/AcessKernel --distroot $DISTROOT > ${DIR}/log/native_AcessKernel.log &
+sleep 1
+LD_LIBRARY_PATH=${DIR}:${DISTROOT}Libs AN_PREOPEN=$VTERM:$VTERM:$VTERM ${DBG} ${DISTROOT}Apps/AxWin/4.0/AxWinServer
#!/bin/sh
+#
+# Spin up an application bound to VTerm 0 using ./ld-acess
+#
+
$DBG ./ld-acess --open /Devices/VTerm/0 --open /Devices/VTerm/0 --open /Devices/VTerm/0 $*
#!/bin/sh
+#
+# Runs the AcessNative kernel and spawns a native executable using ./ld-acess
+#
trap '' 2
#$1 ./AcessKernel --rootapp /Acess/SBin/login
$1 ./AcessKernel --rootapp /Acess/Apps/AxWin/3.0/AxWinWM
CFLAGS += -Wall -g -std=gnu99\r
CPPFLAGS += $(shell sdl-config --cflags) -I /usr/include/\r
LDFLAGS += $(shell sdl-config --libs) -g -Wl,--defsym,__buildnum=$(BUILD_NUM)\r
+LDFLAGS += -Wl,-Map,obj-$(PLATFORM)/Map.txt\r
\r
ifeq ($(PLATFORM),win)\r
BIN := ../AcessKernel.exe\r
// Send it off
SendData(Request, RequestSize);
- if( Request->CallID == SYS_EXIT ) return 0;
-
// Wait for a response (no timeout)
ReadData(Request, sizeof(*Request), 0);
+
+ size_t recvbytes = sizeof(*Request);
// TODO: Sanity
- size_t recvbytes = sizeof(*Request), expbytes = Request->MessageLength;
+ size_t expbytes = Request->MessageLength;
char *ptr = (void*)Request->Params;
while( recvbytes < expbytes )
{
tRequestHeader *req;
void *dataPtr;
uint64_t retValue;
- int i;
// DEBUG!
// printf("&tRequestHeader->Params = %i\n", offsetof(tRequestHeader, Params));
exit(127);
}
+ if( !(req->NParams >= 2) ) {
+ fprintf(stderr, "syscalls.c: Too few return params (%i)", req->NParams);
+ exit(127);
+ }
dataPtr = (void*)&req->Params[req->NParams];
- assert(req->NParams >= 2);
// return
assert(req->Params[0].Type == ARG_TYPE_INT64);
assert(req->Params[0].Length == sizeof(uint64_t));
exit(127);
}
retCount = 0;
- for( i = 2; i < req->NParams; i ++ )
+ for( unsigned int i = 2; i < req->NParams; i ++ )
{
#if 0
int j;
CFLAGS += -Wall
CFLAGS += -Werror
-CFLAGS += -g -shared -fPIC
+CFLAGS += -g -shared -fPIC -std=c99
CPPFLAGS += -DARCHDIR_is_x86_64=1
LDFLAGS += -g -shared -Wl,--no-undefined -lc
path[len] = 0;
int fd = acess__SysOpen(path, 6); // WRITE,READ,no EXEC
if( fd == -1 ) {
- fprintf(stderr, "Unable to preopen '%s'\n", path);
+ fprintf(stderr, "Unable to preopen '%s' errno=%i\n", path, acess__errno);
}
if( !splitter )
int acessnative_spawn(const char *Binary, int SyscallID, const char * const * argv, const char * const * envp)
{
int envc = 0;
- while( envp[envc++] )
+ while( envp && envp[envc++] )
envc ++;
// Set environment variables for libacess-native
const char *newenv[envc+2+1];
int i = 0;
- for( ; envp[i]; i ++ )
+ for( ; envp && envp[i]; i ++ )
{
const char *ev = envp[i];
if( strncmp(ev, ENV_VAR_KEY"=", sizeof(ENV_VAR_KEY"=")) == 0 ) {
}
if( !bKeyHit )
newenv[i++] = keystr;
- newenv[i++] = "LD_LIBRARY_PATH=Libs/"; // HACK
+ newenv[i++] = getenv("LD_LIBRARY_PATH") - (sizeof("LD_LIBRARY_PATH=")-1); // VERY hacky
newenv[i] = NULL;
// TODO: Detect native_spawn failing