process.cc (2686:f0d591379ac3) process.cc (3114:7a4771b9b720)
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;

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

39#include "sim/process.hh"
40#include "sim/syscall_emul.hh"
41
42using namespace std;
43using namespace MipsISA;
44
45/// Target uname() handler.
46static SyscallReturn
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;

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

39#include "sim/process.hh"
40#include "sim/syscall_emul.hh"
41
42using namespace std;
43using namespace MipsISA;
44
45/// Target uname() handler.
46static SyscallReturn
47unameFunc(SyscallDesc *desc, int callnum, Process *process,
47unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
48 ThreadContext *tc)
49{
50 TypedBufferArg<Linux::utsname> name(tc->getSyscallArg(0));
51
52 strcpy(name->sysname, "Linux");
53 strcpy(name->nodename, "m5.eecs.umich.edu");
54 strcpy(name->release, "2.4.20");
55 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
56 strcpy(name->machine, "mips");
57
58 name.copyOut(tc->getMemPort());
59 return 0;
60}
61
62/// Target sys_getsysyinfo() handler. Even though this call is
63/// borrowed from Tru64, the subcases that get used appear to be
64/// different in practice from those used by Tru64 processes.
65static SyscallReturn
48 ThreadContext *tc)
49{
50 TypedBufferArg<Linux::utsname> name(tc->getSyscallArg(0));
51
52 strcpy(name->sysname, "Linux");
53 strcpy(name->nodename, "m5.eecs.umich.edu");
54 strcpy(name->release, "2.4.20");
55 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
56 strcpy(name->machine, "mips");
57
58 name.copyOut(tc->getMemPort());
59 return 0;
60}
61
62/// Target sys_getsysyinfo() handler. Even though this call is
63/// borrowed from Tru64, the subcases that get used appear to be
64/// different in practice from those used by Tru64 processes.
65static SyscallReturn
66sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
66sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
67 ThreadContext *tc)
68{
69 unsigned op = tc->getSyscallArg(0);
70 // unsigned nbytes = tc->getSyscallArg(2);
71
72 switch (op) {
73
74 case 45: { // GSI_IEEE_FP_CONTROL

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

85 break;
86 }
87
88 return 1;
89}
90
91/// Target sys_setsysinfo() handler.
92static SyscallReturn
67 ThreadContext *tc)
68{
69 unsigned op = tc->getSyscallArg(0);
70 // unsigned nbytes = tc->getSyscallArg(2);
71
72 switch (op) {
73
74 case 45: { // GSI_IEEE_FP_CONTROL

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

85 break;
86 }
87
88 return 1;
89}
90
91/// Target sys_setsysinfo() handler.
92static SyscallReturn
93sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
93sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
94 ThreadContext *tc)
95{
96 unsigned op = tc->getSyscallArg(0);
97 // unsigned nbytes = tc->getSyscallArg(2);
98
99 switch (op) {
100
101 case 14: { // SSI_IEEE_FP_CONTROL

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

405
406MipsLinuxProcess::MipsLinuxProcess(const std::string &name,
407 ObjectFile *objFile,
408 System *system,
409 int stdin_fd,
410 int stdout_fd,
411 int stderr_fd,
412 std::vector<std::string> &argv,
94 ThreadContext *tc)
95{
96 unsigned op = tc->getSyscallArg(0);
97 // unsigned nbytes = tc->getSyscallArg(2);
98
99 switch (op) {
100
101 case 14: { // SSI_IEEE_FP_CONTROL

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

405
406MipsLinuxProcess::MipsLinuxProcess(const std::string &name,
407 ObjectFile *objFile,
408 System *system,
409 int stdin_fd,
410 int stdout_fd,
411 int stderr_fd,
412 std::vector<std::string> &argv,
413 std::vector<std::string> &envp)
413 std::vector<std::string> &envp,
414 uint64_t _uid,
415 uint64_t _euid,
416 uint64_t _gid,
417 uint64_t _egid,
418 uint64_t _pid,
419 uint64_t _ppid)
414 : MipsLiveProcess(name, objFile, system, stdin_fd, stdout_fd, stderr_fd,
420 : MipsLiveProcess(name, objFile, system, stdin_fd, stdout_fd, stderr_fd,
415 argv, envp),
421 argv, envp, _uid, _euid, _gid, _egid, _pid, _ppid),
416 Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
417{ }
418
419SyscallDesc*
420MipsLinuxProcess::getDesc(int callnum)
421{
422 //MIPS32 syscalls are in the range of 4000 - 4999
423 int m5_sys_idx = callnum - 4000;
424
425 if (m5_sys_idx < 0 || m5_sys_idx > Num_Syscall_Descs)
426 return NULL;
427
428 return &syscallDescs[m5_sys_idx];
429}
422 Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
423{ }
424
425SyscallDesc*
426MipsLinuxProcess::getDesc(int callnum)
427{
428 //MIPS32 syscalls are in the range of 4000 - 4999
429 int m5_sys_idx = callnum - 4000;
430
431 if (m5_sys_idx < 0 || m5_sys_idx > Num_Syscall_Descs)
432 return NULL;
433
434 return &syscallDescs[m5_sys_idx];
435}