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;

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

28 * Authors: Korey Sewell
29 */
30
31#include "arch/mips/linux/linux.hh"
32#include "arch/mips/linux/process.hh"
33#include "arch/mips/isa_traits.hh"
34
35#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;

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

28 * Authors: Korey Sewell
29 */
30
31#include "arch/mips/linux/linux.hh"
32#include "arch/mips/linux/process.hh"
33#include "arch/mips/isa_traits.hh"
34
35#include "base/trace.hh"
36#include "cpu/exec_context.hh"
36#include "cpu/thread_context.hh"
37#include "kern/linux/linux.hh"
38
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,
37#include "kern/linux/linux.hh"
38
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,
48 ExecContext *xc)
48 ThreadContext *tc)
49{
49{
50 TypedBufferArg<Linux::utsname> name(xc->getSyscallArg(0));
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
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(xc->getMemPort());
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,
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,
67 ExecContext *xc)
67 ThreadContext *tc)
68{
68{
69 unsigned op = xc->getSyscallArg(0);
70 // unsigned nbytes = xc->getSyscallArg(2);
69 unsigned op = tc->getSyscallArg(0);
70 // unsigned nbytes = tc->getSyscallArg(2);
71
72 switch (op) {
73
74 case 45: { // GSI_IEEE_FP_CONTROL
71
72 switch (op) {
73
74 case 45: { // GSI_IEEE_FP_CONTROL
75 TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
75 TypedBufferArg<uint64_t> fpcr(tc->getSyscallArg(1));
76 // I don't think this exactly matches the HW FPCR
77 *fpcr = 0;
76 // I don't think this exactly matches the HW FPCR
77 *fpcr = 0;
78 fpcr.copyOut(xc->getMemPort());
78 fpcr.copyOut(tc->getMemPort());
79 return 0;
80 }
81
82 default:
83 cerr << "sys_getsysinfo: unknown op " << op << endl;
84 abort();
85 break;
86 }
87
88 return 1;
89}
90
91/// Target sys_setsysinfo() handler.
92static SyscallReturn
93sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
79 return 0;
80 }
81
82 default:
83 cerr << "sys_getsysinfo: unknown op " << op << endl;
84 abort();
85 break;
86 }
87
88 return 1;
89}
90
91/// Target sys_setsysinfo() handler.
92static SyscallReturn
93sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
94 ExecContext *xc)
94 ThreadContext *tc)
95{
95{
96 unsigned op = xc->getSyscallArg(0);
97 // unsigned nbytes = xc->getSyscallArg(2);
96 unsigned op = tc->getSyscallArg(0);
97 // unsigned nbytes = tc->getSyscallArg(2);
98
99 switch (op) {
100
101 case 14: { // SSI_IEEE_FP_CONTROL
98
99 switch (op) {
100
101 case 14: { // SSI_IEEE_FP_CONTROL
102 TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
102 TypedBufferArg<uint64_t> fpcr(tc->getSyscallArg(1));
103 // I don't think this exactly matches the HW FPCR
103 // I don't think this exactly matches the HW FPCR
104 fpcr.copyIn(xc->getMemPort());
104 fpcr.copyIn(tc->getMemPort());
105 DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
106 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
107 return 0;
108 }
109
110 default:
111 cerr << "sys_setsysinfo: unknown op " << op << endl;
112 abort();

--- 319 unchanged lines hidden ---
105 DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
106 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
107 return 0;
108 }
109
110 default:
111 cerr << "sys_setsysinfo: unknown op " << op << endl;
112 abort();

--- 319 unchanged lines hidden ---