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;

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

29 * Ali Saidi
30 */
31
32#include "arch/alpha/linux/linux.hh"
33#include "arch/alpha/linux/process.hh"
34#include "arch/alpha/isa_traits.hh"
35
36#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;

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

29 * Ali Saidi
30 */
31
32#include "arch/alpha/linux/linux.hh"
33#include "arch/alpha/linux/process.hh"
34#include "arch/alpha/isa_traits.hh"
35
36#include "base/trace.hh"
37#include "cpu/exec_context.hh"
37#include "cpu/thread_context.hh"
38#include "kern/linux/linux.hh"
39
40#include "sim/process.hh"
41#include "sim/syscall_emul.hh"
42
43using namespace std;
44using namespace AlphaISA;
45
46
47
48/// Target uname() handler.
49static SyscallReturn
50unameFunc(SyscallDesc *desc, int callnum, Process *process,
38#include "kern/linux/linux.hh"
39
40#include "sim/process.hh"
41#include "sim/syscall_emul.hh"
42
43using namespace std;
44using namespace AlphaISA;
45
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, "alpha");
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, "alpha");
60
61 name.copyOut(xc->getMemPort());
61 name.copyOut(tc->getMemPort());
62 return 0;
63}
64
65/// Target osf_getsysyinfo() handler. Even though this call is
66/// borrowed from Tru64, the subcases that get used appear to be
67/// different in practice from those used by Tru64 processes.
68static SyscallReturn
69osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
62 return 0;
63}
64
65/// Target osf_getsysyinfo() handler. Even though this call is
66/// borrowed from Tru64, the subcases that get used appear to be
67/// different in practice from those used by Tru64 processes.
68static SyscallReturn
69osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
70 ExecContext *xc)
70 ThreadContext *tc)
71{
71{
72 unsigned op = xc->getSyscallArg(0);
73 // unsigned nbytes = xc->getSyscallArg(2);
72 unsigned op = tc->getSyscallArg(0);
73 // unsigned nbytes = tc->getSyscallArg(2);
74
75 switch (op) {
76
77 case 45: { // GSI_IEEE_FP_CONTROL
74
75 switch (op) {
76
77 case 45: { // GSI_IEEE_FP_CONTROL
78 TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
78 TypedBufferArg<uint64_t> fpcr(tc->getSyscallArg(1));
79 // I don't think this exactly matches the HW FPCR
80 *fpcr = 0;
79 // I don't think this exactly matches the HW FPCR
80 *fpcr = 0;
81 fpcr.copyOut(xc->getMemPort());
81 fpcr.copyOut(tc->getMemPort());
82 return 0;
83 }
84
85 default:
86 cerr << "osf_getsysinfo: unknown op " << op << endl;
87 abort();
88 break;
89 }
90
91 return 1;
92}
93
94/// Target osf_setsysinfo() handler.
95static SyscallReturn
96osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
82 return 0;
83 }
84
85 default:
86 cerr << "osf_getsysinfo: unknown op " << op << endl;
87 abort();
88 break;
89 }
90
91 return 1;
92}
93
94/// Target osf_setsysinfo() handler.
95static SyscallReturn
96osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
97 ExecContext *xc)
97 ThreadContext *tc)
98{
98{
99 unsigned op = xc->getSyscallArg(0);
100 // unsigned nbytes = xc->getSyscallArg(2);
99 unsigned op = tc->getSyscallArg(0);
100 // unsigned nbytes = tc->getSyscallArg(2);
101
102 switch (op) {
103
104 case 14: { // SSI_IEEE_FP_CONTROL
101
102 switch (op) {
103
104 case 14: { // SSI_IEEE_FP_CONTROL
105 TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
105 TypedBufferArg<uint64_t> fpcr(tc->getSyscallArg(1));
106 // I don't think this exactly matches the HW FPCR
106 // I don't think this exactly matches the HW FPCR
107 fpcr.copyIn(xc->getMemPort());
107 fpcr.copyIn(tc->getMemPort());
108 DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
109 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
110 return 0;
111 }
112
113 default:
114 cerr << "osf_setsysinfo: unknown op " << op << endl;
115 abort();

--- 479 unchanged lines hidden ---
108 DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
109 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
110 return 0;
111 }
112
113 default:
114 cerr << "osf_setsysinfo: unknown op " << op << endl;
115 abort();

--- 479 unchanged lines hidden ---