process.cc (2665:a124942bacb8) process.cc (2680:246e7104f744)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30 * Ali Saidi
31 */
32
33#include "arch/sparc/isa_traits.hh"
34#include "arch/sparc/linux/process.hh"
35#include "arch/sparc/regfile.hh"
36
37#include "base/trace.hh"
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30 * Ali Saidi
31 */
32
33#include "arch/sparc/isa_traits.hh"
34#include "arch/sparc/linux/process.hh"
35#include "arch/sparc/regfile.hh"
36
37#include "base/trace.hh"
38#include "cpu/exec_context.hh"
38#include "cpu/thread_context.hh"
39#include "kern/linux/linux.hh"
40
41#include "sim/process.hh"
42#include "sim/syscall_emul.hh"
43
44using namespace std;
45using namespace SparcISA;
46
47
48/// Target uname() handler.
49static SyscallReturn
50unameFunc(SyscallDesc *desc, int callnum, Process *process,
39#include "kern/linux/linux.hh"
40
41#include "sim/process.hh"
42#include "sim/syscall_emul.hh"
43
44using namespace std;
45using namespace SparcISA;
46
47
48/// Target uname() handler.
49static SyscallReturn
50unameFunc(SyscallDesc *desc, int callnum, Process *process,
51 ExecContext *xc)
51 ThreadContext *tc)
52{
52{
53 TypedBufferArg<Linux::utsname> name(xc->getSyscallArg(0));
53 TypedBufferArg<Linux::utsname> name(tc->getSyscallArg(0));
54
55 strcpy(name->sysname, "Linux");
56 strcpy(name->nodename, "m5.eecs.umich.edu");
57 strcpy(name->release, "2.4.20");
58 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
59 strcpy(name->machine, "sparc");
60
54
55 strcpy(name->sysname, "Linux");
56 strcpy(name->nodename, "m5.eecs.umich.edu");
57 strcpy(name->release, "2.4.20");
58 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
59 strcpy(name->machine, "sparc");
60
61 name.copyOut(xc->getMemPort());
61 name.copyOut(tc->getMemPort());
62
63 return 0;
64}
65
66
67SyscallReturn SparcISA::getresuidFunc(SyscallDesc *desc, int num,
62
63 return 0;
64}
65
66
67SyscallReturn SparcISA::getresuidFunc(SyscallDesc *desc, int num,
68 Process *p, ExecContext *xc)
68 Process *p, ThreadContext *tc)
69{
70 const IntReg id = htog(100);
69{
70 const IntReg id = htog(100);
71 Addr ruid = xc->getSyscallArg(0);
72 Addr euid = xc->getSyscallArg(1);
73 Addr suid = xc->getSyscallArg(2);
71 Addr ruid = tc->getSyscallArg(0);
72 Addr euid = tc->getSyscallArg(1);
73 Addr suid = tc->getSyscallArg(2);
74 //Handle the EFAULT case
75 //Set the ruid
76 if(ruid)
77 {
78 BufferArg ruidBuff(ruid, sizeof(IntReg));
79 memcpy(ruidBuff.bufferPtr(), &id, sizeof(IntReg));
74 //Handle the EFAULT case
75 //Set the ruid
76 if(ruid)
77 {
78 BufferArg ruidBuff(ruid, sizeof(IntReg));
79 memcpy(ruidBuff.bufferPtr(), &id, sizeof(IntReg));
80 ruidBuff.copyOut(xc->getMemPort());
80 ruidBuff.copyOut(tc->getMemPort());
81 }
82 //Set the euid
83 if(euid)
84 {
85 BufferArg euidBuff(euid, sizeof(IntReg));
86 memcpy(euidBuff.bufferPtr(), &id, sizeof(IntReg));
81 }
82 //Set the euid
83 if(euid)
84 {
85 BufferArg euidBuff(euid, sizeof(IntReg));
86 memcpy(euidBuff.bufferPtr(), &id, sizeof(IntReg));
87 euidBuff.copyOut(xc->getMemPort());
87 euidBuff.copyOut(tc->getMemPort());
88 }
89 //Set the suid
90 if(suid)
91 {
92 BufferArg suidBuff(suid, sizeof(IntReg));
93 memcpy(suidBuff.bufferPtr(), &id, sizeof(IntReg));
88 }
89 //Set the suid
90 if(suid)
91 {
92 BufferArg suidBuff(suid, sizeof(IntReg));
93 memcpy(suidBuff.bufferPtr(), &id, sizeof(IntReg));
94 suidBuff.copyOut(xc->getMemPort());
94 suidBuff.copyOut(tc->getMemPort());
95 }
96 return 0;
97}
98
99SyscallDesc SparcLinuxProcess::syscallDescs[] = {
100 /* 0 */ SyscallDesc("restart_syscall", unimplementedFunc),
101 /* 1 */ SyscallDesc("exit", exitFunc),
102 /* 2 */ SyscallDesc("fork", unimplementedFunc),

--- 309 unchanged lines hidden ---
95 }
96 return 0;
97}
98
99SyscallDesc SparcLinuxProcess::syscallDescs[] = {
100 /* 0 */ SyscallDesc("restart_syscall", unimplementedFunc),
101 /* 1 */ SyscallDesc("exit", exitFunc),
102 /* 2 */ SyscallDesc("fork", unimplementedFunc),

--- 309 unchanged lines hidden ---