process.cc (13645:f9cd6956b57b) process.cc (13987:0b79ddd399a4)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * Copyright (c) 2016 The University of Virginia
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

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

33 */
34
35#include "arch/riscv/linux/process.hh"
36
37#include <map>
38
39#include "arch/riscv/isa_traits.hh"
40#include "arch/riscv/linux/linux.hh"
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * Copyright (c) 2016 The University of Virginia
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

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

33 */
34
35#include "arch/riscv/linux/process.hh"
36
37#include <map>
38
39#include "arch/riscv/isa_traits.hh"
40#include "arch/riscv/linux/linux.hh"
41#include "base/loader/object_file.hh"
41#include "base/trace.hh"
42#include "cpu/thread_context.hh"
43#include "debug/SyscallVerbose.hh"
44#include "kern/linux/linux.hh"
45#include "sim/eventq.hh"
46#include "sim/process.hh"
47#include "sim/syscall_desc.hh"
48#include "sim/syscall_emul.hh"
49#include "sim/system.hh"
50
51using namespace std;
52using namespace RiscvISA;
53
42#include "base/trace.hh"
43#include "cpu/thread_context.hh"
44#include "debug/SyscallVerbose.hh"
45#include "kern/linux/linux.hh"
46#include "sim/eventq.hh"
47#include "sim/process.hh"
48#include "sim/syscall_desc.hh"
49#include "sim/syscall_emul.hh"
50#include "sim/system.hh"
51
52using namespace std;
53using namespace RiscvISA;
54
55namespace
56{
57
58class RiscvLinuxObjectFileLoader : public ObjectFile::Loader
59{
60 public:
61 Process *
62 load(ProcessParams *params, ObjectFile *obj_file) override
63 {
64 auto arch = obj_file->getArch();
65 auto opsys = obj_file->getOpSys();
66
67 if (arch != ObjectFile::Riscv64 && arch != ObjectFile::Riscv32)
68 return nullptr;
69
70 if (opsys == ObjectFile::UnknownOpSys) {
71 warn("Unknown operating system; assuming Linux.");
72 opsys = ObjectFile::Linux;
73 }
74
75 if (opsys != ObjectFile::Linux)
76 return nullptr;
77
78 if (arch == ObjectFile::Riscv64)
79 return new RiscvLinuxProcess64(params, obj_file);
80 else
81 return new RiscvLinuxProcess32(params, obj_file);
82 }
83};
84
85RiscvLinuxObjectFileLoader loader;
86
87} // anonymous namespace
88
54/// Target uname() handler.
55static SyscallReturn
56unameFunc64(SyscallDesc *desc, int callnum, Process *process,
57 ThreadContext *tc)
58{
59 int index = 0;
60 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
61

--- 711 unchanged lines hidden ---
89/// Target uname() handler.
90static SyscallReturn
91unameFunc64(SyscallDesc *desc, int callnum, Process *process,
92 ThreadContext *tc)
93{
94 int index = 0;
95 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
96

--- 711 unchanged lines hidden ---