X86: Install some 32 bit system calls.
authorGabe Black <gblack@eecs.umich.edu>
Fri, 27 Feb 2009 17:22:50 +0000 (09:22 -0800)
committerGabe Black <gblack@eecs.umich.edu>
Fri, 27 Feb 2009 17:22:50 +0000 (09:22 -0800)
src/arch/x86/linux/linux.cc
src/arch/x86/linux/linux.hh
src/arch/x86/linux/syscalls.cc

index 5e8d2de1640034dfff44470672c476f16f2e5440..41855da59b108d4a13774f8b480e6d70aa22f231 100644 (file)
@@ -97,3 +97,42 @@ const int X86Linux64::NUM_OPEN_FLAGS =
         sizeof(X86Linux64::openFlagTable) /
         sizeof(X86Linux64::openFlagTable[0]);
 
+// open(2) flags translation table
+OpenFlagTransTable X86Linux32::openFlagTable[] = {
+#ifdef _MSC_VER
+  { TGT_O_RDONLY, _O_RDONLY },
+  { TGT_O_WRONLY, _O_WRONLY },
+  { TGT_O_RDWR, _O_RDWR },
+  { TGT_O_APPEND, _O_APPEND },
+  { TGT_O_CREAT, _O_CREAT },
+  { TGT_O_TRUNC, _O_TRUNC },
+  { TGT_O_EXCL, _O_EXCL },
+#ifdef _O_NONBLOCK
+  { TGT_O_NONBLOCK, _O_NONBLOCK },
+#endif
+#ifdef _O_NOCTTY
+  { TGT_O_NOCTTY, _O_NOCTTY },
+#endif
+#ifdef _O_SYNC
+  { TGT_O_SYNC, _O_SYNC },
+#endif
+#else /* !_MSC_VER */
+  { TGT_O_RDONLY, O_RDONLY },
+  { TGT_O_WRONLY, O_WRONLY },
+  { TGT_O_RDWR, O_RDWR },
+  { TGT_O_APPEND, O_APPEND },
+  { TGT_O_CREAT, O_CREAT },
+  { TGT_O_TRUNC, O_TRUNC },
+  { TGT_O_EXCL, O_EXCL },
+  { TGT_O_NONBLOCK, O_NONBLOCK },
+  { TGT_O_NOCTTY, O_NOCTTY },
+#ifdef O_SYNC
+  { TGT_O_SYNC, O_SYNC },
+#endif
+#endif /* _MSC_VER */
+};
+
+const int X86Linux32::NUM_OPEN_FLAGS =
+        sizeof(X86Linux32::openFlagTable) /
+        sizeof(X86Linux32::openFlagTable[0]);
+
index dbc336da195cdc8d30587b4e7126ff503f039b9c..c45caa19f65a56f5acab6de46b75577858f9a11b 100644 (file)
@@ -113,4 +113,29 @@ class X86Linux64 : public Linux
     } tgt_iovec;
 };
 
+class X86Linux32 : public Linux
+{
+  public:
+
+    static OpenFlagTransTable openFlagTable[];
+
+    static const int TGT_O_RDONLY       = 00000000;     //!< O_RDONLY
+    static const int TGT_O_WRONLY       = 00000001;     //!< O_WRONLY
+    static const int TGT_O_RDWR         = 00000002;     //!< O_RDWR
+    static const int TGT_O_NONBLOCK     = 00004000;     //!< O_NONBLOCK
+    static const int TGT_O_APPEND       = 00002000;     //!< O_APPEND
+    static const int TGT_O_CREAT        = 00000100;     //!< O_CREAT
+    static const int TGT_O_TRUNC        = 00001000;     //!< O_TRUNC
+    static const int TGT_O_EXCL         = 00000200;     //!< O_EXCL
+    static const int TGT_O_NOCTTY       = 00000400;     //!< O_NOCTTY
+    static const int TGT_O_SYNC         = 00010000;     //!< O_SYNC
+//    static const int TGT_O_DRD        = 0x00010000;   //!< O_DRD
+//    static const int TGT_O_DIRECTIO   = 0x00020000; //!< O_DIRECTIO
+//    static const int TGT_O_CACHE      = 0x00002000;   //!< O_CACHE
+//    static const int TGT_O_DSYNC      = 0x00008000;   //!< O_DSYNC
+//    static const int TGT_O_RSYNC      = 0x00040000;   //!< O_RSYNC
+
+    static const int NUM_OPEN_FLAGS;
+};
+
 #endif
index e4e0fa23489fd4f042086eb4ac6411b7880becc2..6c44785d274e6455049bae6a3d002d84b940cee2 100644 (file)
@@ -404,7 +404,7 @@ SyscallDesc I386LinuxProcess::syscallDescs[] = {
     /*   2 */ SyscallDesc("fork", unimplementedFunc),
     /*   3 */ SyscallDesc("read", unimplementedFunc),
     /*   4 */ SyscallDesc("write", unimplementedFunc),
-    /*   5 */ SyscallDesc("open", unimplementedFunc),
+    /*   5 */ SyscallDesc("open", openFunc<X86Linux64>),
     /*   6 */ SyscallDesc("close", unimplementedFunc),
     /*   7 */ SyscallDesc("waitpid", unimplementedFunc),
     /*   8 */ SyscallDesc("creat", unimplementedFunc),
@@ -444,7 +444,7 @@ SyscallDesc I386LinuxProcess::syscallDescs[] = {
     /*  42 */ SyscallDesc("pipe", unimplementedFunc),
     /*  43 */ SyscallDesc("times", unimplementedFunc),
     /*  44 */ SyscallDesc("prof", unimplementedFunc),
-    /*  45 */ SyscallDesc("brk", unimplementedFunc),
+    /*  45 */ SyscallDesc("brk", brkFunc),
     /*  46 */ SyscallDesc("setgid", unimplementedFunc),
     /*  47 */ SyscallDesc("getgid", unimplementedFunc),
     /*  48 */ SyscallDesc("signal", unimplementedFunc),
@@ -521,7 +521,7 @@ SyscallDesc I386LinuxProcess::syscallDescs[] = {
     /* 119 */ SyscallDesc("sigreturn", unimplementedFunc),
     /* 120 */ SyscallDesc("clone", unimplementedFunc),
     /* 121 */ SyscallDesc("setdomainname", unimplementedFunc),
-    /* 122 */ SyscallDesc("uname", unimplementedFunc),
+    /* 122 */ SyscallDesc("uname", unameFunc),
     /* 123 */ SyscallDesc("modify_ldt", unimplementedFunc),
     /* 124 */ SyscallDesc("adjtimex", unimplementedFunc),
     /* 125 */ SyscallDesc("mprotect", unimplementedFunc),
@@ -545,7 +545,7 @@ SyscallDesc I386LinuxProcess::syscallDescs[] = {
     /* 143 */ SyscallDesc("flock", unimplementedFunc),
     /* 144 */ SyscallDesc("msync", unimplementedFunc),
     /* 145 */ SyscallDesc("readv", unimplementedFunc),
-    /* 146 */ SyscallDesc("writev", unimplementedFunc),
+    /* 146 */ SyscallDesc("writev", writevFunc<X86Linux32>),
     /* 147 */ SyscallDesc("getsid", unimplementedFunc),
     /* 148 */ SyscallDesc("fdatasync", unimplementedFunc),
     /* 149 */ SyscallDesc("_sysctl", unimplementedFunc),