Did anyone ever import this code?  If not, anyone see any reason not to?

On Wed, Jul 29, 2009 at 2:50 PM, Vince Weaver <vi...@csl.cornell.edu> wrote:
> Hello
>
> I'm trying to run gcc from spec2k under SPARC_SE and ran into a few
> unimplemented syscalls.  Attached is a patch that enables getrlimit and
> getrusage and sets setrlimit to be ignored.
>
> The code is modeled on the Alpha code and seems to work.  gcc.spec2k still
> doesn't work though.  On expr it makes it about 1/3 the way through and
> then fails out due to an illegal memory access.
>
> Vince
>
>
> diff -r b35ef789e6f6 src/arch/sparc/linux/linux.hh
> --- a/src/arch/sparc/linux/linux.hh     Wed Jul 29 00:35:49 2009 -0700
> +++ b/src/arch/sparc/linux/linux.hh     Wed Jul 29 17:42:04 2009 -0400
> @@ -77,6 +77,31 @@
>     static const int NUM_OPEN_FLAGS;
>
>     static const unsigned TGT_MAP_ANONYMOUS = 0x20;
> +
> +    //@{
> +       /// For getrusage().
> +       static const int TGT_RUSAGE_SELF     = 0;
> +       static const int TGT_RUSAGE_CHILDREN = -1;
> +       static const int TGT_RUSAGE_BOTH     = -2;
> +    //@}
> +
> +    /// Resource enumeration for getrlimit().
> +    enum rlimit_resources {
> +       TGT_RLIMIT_CPU = 0,
> +       TGT_RLIMIT_FSIZE = 1,
> +       TGT_RLIMIT_DATA = 2,
> +       TGT_RLIMIT_STACK = 3,
> +       TGT_RLIMIT_CORE = 4,
> +       TGT_RLIMIT_RSS = 5,
> +       TGT_RLIMIT_NOFILE = 6,
> +       TGT_RLIMIT_AS = 7,
> +       TGT_RLIMIT_VMEM = 7,
> +       TGT_RLIMIT_NPROC = 8,
> +       TGT_RLIMIT_MEMLOCK = 9,
> +       TGT_RLIMIT_LOCKS = 10
> +    };
> +
> +
>  };
>
>  class Sparc32Linux : public SparcLinux
> diff -r b35ef789e6f6 src/arch/sparc/linux/syscalls.cc
> --- a/src/arch/sparc/linux/syscalls.cc  Wed Jul 29 00:35:49 2009 -0700
> +++ b/src/arch/sparc/linux/syscalls.cc  Wed Jul 29 17:42:04 2009 -0400
> @@ -31,6 +31,9 @@
>  #include "arch/sparc/linux/process.hh"
>  #include "sim/syscall_emul.hh"
>
> +using namespace std;
> +using namespace SparcISA;
> +
>  class LiveProcess;
>  class ThreadContext;
>
> @@ -205,7 +208,7 @@
>     /* 114 */ SyscallDesc("sendmsg", unimplementedFunc),
>     /* 115 */ SyscallDesc("getgroups32", unimplementedFunc), //32 bit
>     /* 116 */ SyscallDesc("gettimeofday", gettimeofdayFunc<Sparc32Linux>), 
> //32 bit
> -    /* 117 */ SyscallDesc("getrusage", unimplementedFunc), //32 bit
> +    /* 117 */ SyscallDesc("getrusage", getrusageFunc<Sparc32Linux>), //32 bit
>     /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
>     /* 119 */ SyscallDesc("getcwd", getcwdFunc),
>     /* 120 */ SyscallDesc("readv", unimplementedFunc),
> @@ -232,8 +235,8 @@
>     /* 141 */ SyscallDesc("getpeername", unimplementedFunc),
>     /* 142 */ SyscallDesc("futex", unimplementedFunc), //32 bit
>     /* 143 */ SyscallDesc("gettid", unimplementedFunc),
> -    /* 144 */ SyscallDesc("getrlimit", unimplementedFunc),
> -    /* 145 */ SyscallDesc("setrlimit", unimplementedFunc),
> +    /* 144 */ SyscallDesc("getrlimit", getrlimitFunc<Sparc32Linux>),
> +    /* 145 */ SyscallDesc("setrlimit", ignoreFunc),
>     /* 146 */ SyscallDesc("pivot_root", unimplementedFunc),
>     /* 147 */ SyscallDesc("prctl", unimplementedFunc), //32 bit
>     /* 148 */ SyscallDesc("pciconfig_read", unimplementedFunc),
> @@ -511,7 +514,7 @@
>     /* 114 */ SyscallDesc("sendmsg", unimplementedFunc),
>     /* 115 */ SyscallDesc("getgroups32", unimplementedFunc),
>     /* 116 */ SyscallDesc("gettimeofday", gettimeofdayFunc<SparcLinux>),
> -    /* 117 */ SyscallDesc("getrusage", unimplementedFunc),
> +    /* 117 */ SyscallDesc("getrusage", getrusageFunc<SparcLinux>),
>     /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
>     /* 119 */ SyscallDesc("getcwd", unimplementedFunc),
>     /* 120 */ SyscallDesc("readv", unimplementedFunc),
> @@ -538,7 +541,7 @@
>     /* 141 */ SyscallDesc("getpeername", unimplementedFunc),
>     /* 142 */ SyscallDesc("futex", unimplementedFunc),
>     /* 143 */ SyscallDesc("gettid", unimplementedFunc),
> -    /* 144 */ SyscallDesc("getrlimit", unimplementedFunc),
> +    /* 144 */ SyscallDesc("getrlimit", getrlimitFunc<SparcLinux>),
>     /* 145 */ SyscallDesc("setrlimit", unimplementedFunc),
>     /* 146 */ SyscallDesc("pivot_root", unimplementedFunc),
>     /* 147 */ SyscallDesc("prctl", unimplementedFunc),
> _______________________________________________
> m5-dev mailing list
> m5-dev@m5sim.org
> http://m5sim.org/mailman/listinfo/m5-dev
>
>
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to