[Softpear-cvs] softpear/src/loader nativelib.cc,1.57,1.58
Status: Pre-Alpha
Brought to you by:
mist
|
From: <mas...@us...> - 2005-03-14 00:43:20
|
Update of /cvsroot/softpear/softpear/src/loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17038/src/loader Modified Files: nativelib.cc Log Message: added James' floating point patch some more nativelib calls (some are still no-op's) Index: nativelib.cc =================================================================== RCS file: /cvsroot/softpear/softpear/src/loader/nativelib.cc,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- nativelib.cc 26 Jan 2005 10:25:47 -0000 1.57 +++ nativelib.cc 14 Mar 2005 00:43:09 -0000 1.58 @@ -19,6 +19,7 @@ #include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> +#include <inttypes.h> #ifdef OS_DARWIN #include <vis.h> @@ -153,6 +154,19 @@ return (FILE*)reg; } +void convert_passwd(struct passwd *pwd) { + pwd->pw_name = (char*)Host_to_BE32((sp_uint32_t)pwd->pw_name); + pwd->pw_passwd = (char*)Host_to_BE32((sp_uint32_t)pwd->pw_passwd); + pwd->pw_uid = (uid_t)Host_to_BE32((sp_uint32_t)pwd->pw_uid); + pwd->pw_gid = (gid_t)Host_to_BE32((sp_uint32_t)pwd->pw_gid); + /* TODO: + pwd->pw_change */ + pwd->pw_class = (char*)Host_to_BE32((sp_uint32_t)pwd->pw_class); + pwd->pw_gecos = (char*)Host_to_BE32((sp_uint32_t)pwd->pw_gecos); + pwd->pw_dir = (char*)Host_to_BE32((sp_uint32_t)pwd->pw_dir); + pwd->pw_shell = (char*)Host_to_BE32((sp_uint32_t)pwd->pw_shell); +} + /**********************************************************************************/ /* @@ -975,6 +989,111 @@ gCPU.gpr[10]); } +/* +int sigsetjmp (sigjmp_buf env, int savemask) +*/ +void my_sigsetjmp() { + /* TODO */ + gCPU.gpr[3] = 0; +} + +/* +int sigaction(int sig, const struct sigaction * restrict act, struct sigaction * restrict oact); +*/ +void my_sigaction() { + /* TODO */ + gCPU.gpr[3] = 0; +} + +/* +int sigprocmask (int how, const sigset_t *set, sigset_t *oset); +*/ +void my_sigprocmask() { + /* TODO */ + gCPU.gpr[3] = 0; +} + +/* +struct passwd * getpwuid(uid_t uid); +*/ +void my_getpwuid() { + struct passwd *pwd = getpwuid((uid_t)gCPU.gpr[3]); + convert_passwd(pwd); + gCPU.gpr[3] = (unsigned int)pwd; +} + +/* +void endpwent(void); +*/ +void my_endpwent() { + endpwent(); +} + +/* +pid_t getpid(void); +*/ +void my_getpid() { + gCPU.gpr[3] = getpid(); +} + +/* +pid_t getppid(void); +*/ +void my_getppid() { + gCPU.gpr[3] = getppid(); +} + +/* +intmax_t strtoimax(const char * restrict nptr, char **restrict endptr, int base); +*/ +void my_strtoimax() { + char **endptr = (char**)gCPU.gpr[4]; + set_gpr64(3,4,strtoimax((char*)gCPU.gpr[3], endptr, gCPU.gpr[5])); + *endptr = (char*) Host_to_BE32((sp_uint32_t) *endptr); +} + +/* +pid_t getpgrp(void); +*/ +void my_getpgrp() { + gCPU.gpr[3] = (unsigned int)getpgrp(); +} + +/* +pid_t tcgetpgrp(int fd); +*/ +void my_tcgetpgrp() { + gCPU.gpr[3] = tcgetpgrp(gCPU.gpr[3]); +} + +/* +int dup(int oldd); +*/ +void my_dup() { + gCPU.gpr[3] = dup(gCPU.gpr[3]); +} + +/* +int dup2(int oldd, int newd); +*/ +void my_dup2() { + gCPU.gpr[3] = dup2(gCPU.gpr[3], gCPU.gpr[4]); +} + +/* +int getdtablsize(void); +*/ +void my_getdtablesize() { + gCPU.gpr[3] = getdtablesize(); +} + +/* +int fcntl (int fd, int cmd, int arg); +*/ +void my_fcntl() { + gCPU.gpr[3] = fcntl(gCPU.gpr[3], gCPU.gpr[4], gCPU.gpr[5]); +} + /* This is a list with pointers to functions provided by the local environment */ /* Please do not forget to justify the #define NATIVELIBCOUNT in nativelib.h */ NativeLibEntry NativeLibs[] = { @@ -1098,6 +1217,20 @@ {"_geteuid", (NativeLibFuncPtr) my_geteuid }, {"_strmode", (NativeLibFuncPtr) my_strmode }, {"_warnx", (NativeLibFuncPtr) my_warnx }, + {"_sigsetjmp", (NativeLibFuncPtr) my_sigsetjmp }, + {"_sigaction", (NativeLibFuncPtr) my_sigaction }, + {"_sigprocmask", (NativeLibFuncPtr) my_sigprocmask }, + {"_getpwuid", (NativeLibFuncPtr) my_getpwuid }, + {"_endpwent", (NativeLibFuncPtr) my_endpwent }, + {"_getpid", (NativeLibFuncPtr) my_getpid }, + {"_getppid", (NativeLibFuncPtr) my_getppid }, + {"_strtoimax", (NativeLibFuncPtr) my_strtoimax }, + {"_getpgrp", (NativeLibFuncPtr) my_getpgrp }, + {"_tcgetpgrp", (NativeLibFuncPtr) my_tcgetpgrp }, + {"_dup", (NativeLibFuncPtr) my_dup }, + {"_dup2", (NativeLibFuncPtr) my_dup2 }, + {"_getdtablesize", (NativeLibFuncPtr) my_getdtablesize }, + {"_fcntl", (NativeLibFuncPtr) my_fcntl }, }; const unsigned int kNativeLibCount = sizeof (NativeLibs) / sizeof (NativeLibEntry); |