process.cc (13985:38d2d93a93c3) process.cc (13995:5d459168a680)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

75};
76
77MipsLinuxObjectFileLoader loader;
78
79} // anonymous namespace
80
81/// Target uname() handler.
82static SyscallReturn
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

75};
76
77MipsLinuxObjectFileLoader loader;
78
79} // anonymous namespace
80
81/// Target uname() handler.
82static SyscallReturn
83unameFunc(SyscallDesc *desc, int callnum, Process *process,
84 ThreadContext *tc)
83unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
85{
86 int index = 0;
84{
85 int index = 0;
86 auto process = tc->getProcessPtr();
87 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
88
89 strcpy(name->sysname, "Linux");
90 strcpy(name->nodename,"sim.gem5.org");
91 strcpy(name->release, "3.0.0");
92 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
93 strcpy(name->machine, "mips");
94
95 name.copyOut(tc->getMemProxy());
96 return 0;
97}
98
99/// Target sys_getsysyinfo() handler. Even though this call is
100/// borrowed from Tru64, the subcases that get used appear to be
101/// different in practice from those used by Tru64 processes.
102static SyscallReturn
87 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
88
89 strcpy(name->sysname, "Linux");
90 strcpy(name->nodename,"sim.gem5.org");
91 strcpy(name->release, "3.0.0");
92 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
93 strcpy(name->machine, "mips");
94
95 name.copyOut(tc->getMemProxy());
96 return 0;
97}
98
99/// Target sys_getsysyinfo() handler. Even though this call is
100/// borrowed from Tru64, the subcases that get used appear to be
101/// different in practice from those used by Tru64 processes.
102static SyscallReturn
103sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
104 ThreadContext *tc)
103sys_getsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
105{
106 int index = 0;
104{
105 int index = 0;
106 auto process = tc->getProcessPtr();
107 unsigned op = process->getSyscallArg(tc, index);
108 unsigned bufPtr = process->getSyscallArg(tc, index);
109 // unsigned nbytes = process->getSyscallArg(tc, index);
110
111 switch (op) {
112 case 45:
113 {
114 // GSI_IEEE_FP_CONTROL

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

124 break;
125 }
126
127 return 1;
128}
129
130/// Target sys_setsysinfo() handler.
131static SyscallReturn
107 unsigned op = process->getSyscallArg(tc, index);
108 unsigned bufPtr = process->getSyscallArg(tc, index);
109 // unsigned nbytes = process->getSyscallArg(tc, index);
110
111 switch (op) {
112 case 45:
113 {
114 // GSI_IEEE_FP_CONTROL

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

124 break;
125 }
126
127 return 1;
128}
129
130/// Target sys_setsysinfo() handler.
131static SyscallReturn
132sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
133 ThreadContext *tc)
132sys_setsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
134{
135 int index = 0;
133{
134 int index = 0;
135 auto process = tc->getProcessPtr();
136 unsigned op = process->getSyscallArg(tc, index);
137 Addr bufPtr = process->getSyscallArg(tc, index);
138 // unsigned nbytes = process->getSyscallArg(tc, index);
139
140 switch (op) {
141
142 case 14:
143 {

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

154 abort();
155 break;
156 }
157
158 return 1;
159}
160
161static SyscallReturn
136 unsigned op = process->getSyscallArg(tc, index);
137 Addr bufPtr = process->getSyscallArg(tc, index);
138 // unsigned nbytes = process->getSyscallArg(tc, index);
139
140 switch (op) {
141
142 case 14:
143 {

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

154 abort();
155 break;
156 }
157
158 return 1;
159}
160
161static SyscallReturn
162setThreadAreaFunc(SyscallDesc *desc, int callnum, Process *process,
163 ThreadContext *tc)
162setThreadAreaFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
164{
165 int index = 0;
163{
164 int index = 0;
165 auto process = tc->getProcessPtr();
166 Addr addr = process->getSyscallArg(tc, index);
167 tc->setMiscRegNoEffect(MISCREG_TP_VALUE, addr);
168 return 0;
169}
170
171SyscallDesc MipsLinuxProcess::syscallDescs[] = {
172 /* 0 */ SyscallDesc("syscall", unimplementedFunc),
173 /* 1 */ SyscallDesc("exit", exitFunc),

--- 342 unchanged lines hidden ---
166 Addr addr = process->getSyscallArg(tc, index);
167 tc->setMiscRegNoEffect(MISCREG_TP_VALUE, addr);
168 return 0;
169}
170
171SyscallDesc MipsLinuxProcess::syscallDescs[] = {
172 /* 0 */ SyscallDesc("syscall", unimplementedFunc),
173 /* 1 */ SyscallDesc("exit", exitFunc),

--- 342 unchanged lines hidden ---