gem5/src/sim/syscall_emul.cc

939 lines
27 KiB
C++
Raw Normal View History

Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
/*
* Copyright (c) 2003-2005 The Regents of The University of Michigan
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Steve Reinhardt
* Ali Saidi
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
*/
#include "sim/syscall_emul.hh"
#include <fcntl.h>
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
#include <unistd.h>
#include <iostream>
#include <string>
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
#include "arch/utility.hh"
#include "base/chunk_generator.hh"
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
#include "base/trace.hh"
#include "config/the_isa.hh"
2011-04-15 19:44:06 +02:00
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
#include "sim/process.hh"
Move main control from C++ into Python. User script now invokes initialization and simulation loop after building configuration. These functions are exported from C++ to Python using SWIG. SConstruct: Set up SWIG builder & scanner. Set up symlinking of source files into build directory (by not disabling the default behavior). configs/test/test.py: Rewrite to use new script-driven interface. Include a sample option. src/SConscript: Set up symlinking of source files into build directory (by not disabling the default behavior). Add SWIG-generated main_wrap.cc to source list. src/arch/SConscript: Set up symlinking of source files into build directory (by not disabling the default behavior). src/arch/alpha/ev5.cc: src/arch/alpha/isa/decoder.isa: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/trace/opt_cpu.cc: src/cpu/trace/trace_cpu.cc: src/sim/pseudo_inst.cc: src/sim/root.cc: src/sim/serialize.cc: src/sim/syscall_emul.cc: SimExit() is now exitSimLoop(). src/cpu/base.cc: SimExitEvent is now SimLoopExitEvent src/python/SConscript: Add SWIG build command for main.i. Use python/m5 in build dir as source for zip archive... easy now with file duplication enabled. src/python/m5/__init__.py: - Move copyright notice back to C++ so we can print it right away, even for interactive sessions. - Get rid of argument parsing code; just provide default option descriptors for user script to call optparse with. - Don't clutter m5 namespace by sucking in all of m5.config and m5.objects. - Move instantiate() function here from config.py. src/python/m5/config.py: - Move instantiate() function to __init__.py. - Param.Foo deferred type lookups must use m5.objects namespace now (not m5). src/python/m5/objects/AlphaConsole.py: src/python/m5/objects/AlphaFullCPU.py: src/python/m5/objects/AlphaTLB.py: src/python/m5/objects/BadDevice.py: src/python/m5/objects/BaseCPU.py: src/python/m5/objects/BaseCache.py: src/python/m5/objects/Bridge.py: src/python/m5/objects/Bus.py: src/python/m5/objects/CoherenceProtocol.py: src/python/m5/objects/Device.py: src/python/m5/objects/DiskImage.py: src/python/m5/objects/Ethernet.py: src/python/m5/objects/Ide.py: src/python/m5/objects/IntrControl.py: src/python/m5/objects/MemObject.py: src/python/m5/objects/MemTest.py: src/python/m5/objects/Pci.py: src/python/m5/objects/PhysicalMemory.py: src/python/m5/objects/Platform.py: src/python/m5/objects/Process.py: src/python/m5/objects/Repl.py: src/python/m5/objects/Root.py: src/python/m5/objects/SimConsole.py: src/python/m5/objects/SimpleDisk.py: src/python/m5/objects/System.py: src/python/m5/objects/Tsunami.py: src/python/m5/objects/Uart.py: Fix up imports (m5 namespace no longer includes m5.config). src/sim/eventq.cc: src/sim/eventq.hh: Support for Python-called simulate() function: - Use IsExitEvent flag to signal events that want to exit the simulation loop gracefully (instead of calling exit() to terminate the process). - Modify interface to hand exit event object back to caller so it can be inspected for cause. src/sim/host.hh: Add MaxTick constant. src/sim/main.cc: Move copyright notice back to C++ so we can print it right away, even for interactive sessions. Use PYTHONPATH environment var to set module path (instead of clunky code injection method). Move main control from here into Python: - Separate initialization code and simulation loop into separate functions callable from Python. - Make Python interpreter invocation more pure (more like directly invoking interpreter). Add -i and -p flags (only options on binary itself; other options processed by Python). Import readline package when using interactive mode. src/sim/sim_events.cc: SimExitEvent is now SimLoopExitEvent, and uses IsSimExit flag to terminate loop (instead of exiting simulator process). src/sim/sim_events.hh: SimExitEvent is now SimLoopExitEvent, and uses IsSimExit flag to terminate loop (instead of exiting simulator process). Get rid of a few unused constructors. src/sim/sim_exit.hh: SimExit() is now exitSimLoop(). Get rid of unused functions. Add comments. --HG-- extra : convert_revision : 280b0d671516b25545a6f24cefa64a68319ff3d4
2006-06-10 05:01:31 +02:00
#include "sim/sim_exit.hh"
#include "sim/syscall_debug_macros.hh"
#include "sim/syscall_desc.hh"
2011-04-15 19:44:06 +02:00
#include "sim/system.hh"
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
using namespace std;
Changes to untemplate StaticInst and StaticInstPtr, change the isa to a namespace instead of a class, an improvement to the architecture specific header file selection system, and fixed up a few include paths. arch/alpha/alpha_linux_process.cc: Added using directive for AlphaISA namespace arch/alpha/alpha_memory.hh: arch/alpha/isa/branch.isa: cpu/pc_event.hh: Added typedefs for Addr arch/alpha/alpha_tru64_process.cc: arch/alpha/arguments.cc: Added using directive for AlphaISA arch/alpha/ev5.hh: Added an include of arch/alpha/isa_traits.hh, and a using directive for the AlphaISA namespace. arch/alpha/faults.hh: Added a typedef for the Addr type, and changed the formatting of the faults slightly. arch/alpha/isa/main.isa: Untemplatized StaticInst, added a using for namespace AlphaISA to show up in decoder.cc and the exec.ccs, relocated makeNop to decoder.hh arch/alpha/isa/mem.isa: Untemplatized StaticInst and StaticInstPtr arch/alpha/isa/pal.isa: cpu/base_dyn_inst.cc: Untemplatized StaticInstPtr arch/alpha/isa_traits.hh: Changed variables to be externs instead of static since they are part of a namespace and not a class. arch/alpha/stacktrace.cc: Untemplatized StaticInstPtr, and added a using directive for AlphaISA. arch/alpha/stacktrace.hh: Added some typedefs for Addr and MachInst, and untemplatized StaticInstPtr arch/alpha/vtophys.cc: Added a using directive for AlphaISA arch/alpha/vtophys.hh: Added the AlphaISA namespace specifier where needed arch/isa_parser.py: Changed the placement of the definition of the decodeInst function to be outside the namespaceInst namespace. base/loader/object_file.hh: cpu/o3/bpred_unit.hh: Added a typedef for Addr base/loader/symtab.hh: Added a typedef for Addr, and added a TheISA to Addr in another typedef base/remote_gdb.cc: Added a using namespace TheISA, and untemplatized StaticInstPtr base/remote_gdb.hh: Added typedefs for Addr and MachInst cpu/base.cc: Added TheISA specifier to some variables exported from the isa. cpu/base.hh: Added a typedef for Addr, and TheISA to some variables from the ISA cpu/base_dyn_inst.hh: Untemplatized StaticInstPtr, and added TheISA specifier to some variables from the ISA. cpu/exec_context.hh: Added some typedefs for types from the isa, and added TheISA specifier to some variables from the isa cpu/exetrace.hh: Added typedefs for some types from the ISA, and untemplatized StaticInstPtr cpu/memtest/memtest.cc: cpu/o3/btb.cc: dev/baddev.cc: dev/ide_ctrl.cc: dev/ide_disk.cc: dev/isa_fake.cc: dev/ns_gige.cc: dev/pciconfigall.cc: dev/platform.cc: dev/sinic.cc: dev/uart8250.cc: kern/freebsd/freebsd_system.cc: kern/linux/linux_system.cc: kern/system_events.cc: kern/tru64/dump_mbuf.cc: kern/tru64/tru64_events.cc: sim/process.cc: sim/pseudo_inst.cc: sim/system.cc: Added using namespace TheISA cpu/memtest/memtest.hh: cpu/trace/opt_cpu.hh: cpu/trace/reader/itx_reader.hh: dev/ide_disk.hh: dev/pcidev.hh: dev/platform.hh: dev/tsunami.hh: sim/system.hh: sim/vptr.hh: Added typedef for Addr cpu/o3/2bit_local_pred.hh: Changed the include to use arch/isa_traits.hh instead of arch/alpha/isa_traits.hh. Added typedef for Addr cpu/o3/alpha_cpu.hh: Added typedefs for Addr and IntReg cpu/o3/alpha_cpu_impl.hh: Added this-> to setNextPC to fix a problem since it didn't depend on template parameters any more. Removed "typename" where it was no longer needed. cpu/o3/alpha_dyn_inst.hh: Cleaned up some typedefs, and untemplatized StaticInst cpu/o3/alpha_dyn_inst_impl.hh: untemplatized StaticInstPtr cpu/o3/alpha_impl.hh: Fixed up a typedef of MachInst cpu/o3/bpred_unit_impl.hh: Added a using TheISA::MachInst to a function cpu/o3/btb.hh: Changed an include from arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef for Addr cpu/o3/commit.hh: Removed a typedef of Impl::ISA as ISA, since TheISA takes care of this now. cpu/o3/cpu.cc: Cleaned up namespace issues cpu/o3/cpu.hh: Cleaned up namespace usage cpu/o3/decode.hh: Removed typedef of ISA, and changed it to TheISA cpu/o3/fetch.hh: Fized up typedefs, and changed ISA to TheISA cpu/o3/free_list.hh: Changed include of arch/alpha/isa_traits.hh to arch/isa_traits.hh cpu/o3/iew.hh: Removed typedef of ISA cpu/o3/iew_impl.hh: Added TheISA namespace specifier to MachInst cpu/o3/ras.hh: Changed include from arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef for Addr. cpu/o3/regfile.hh: Changed ISA to TheISA, and added some typedefs for Addr, IntReg, FloatReg, and MiscRegFile cpu/o3/rename.hh: Changed ISA to TheISA, and added a typedef for RegIndex cpu/o3/rename_map.hh: Added an include for arch/isa_traits.hh, and a typedef for RegIndex cpu/o3/rob.hh: Added a typedef for RegIndex cpu/o3/store_set.hh: cpu/o3/tournament_pred.hh: Changed an include of arch/alpha/isa_traits.hh to arch/isa_traits.hh, and added a typedef of Addr cpu/ozone/cpu.hh: Changed ISA into TheISA, and untemplatized StaticInst cpu/pc_event.cc: Added namespace specifier TheISA to Addr types cpu/profile.hh: kern/kernel_stats.hh: Added typedef for Addr, and untemplatized StaticInstPtr cpu/simple/cpu.cc: Changed using directive from LittleEndianGuest to AlphaISA, which will contain both namespaces. Added TheISA where needed, and untemplatized StaticInst cpu/simple/cpu.hh: Added a typedef for MachInst, and untemplatized StaticInst cpu/static_inst.cc: Untemplatized StaticInst cpu/static_inst.hh: Untemplatized StaticInst by using the TheISA namespace dev/alpha_console.cc: Added using namespace AlphaISA dev/simple_disk.hh: Added typedef for Addr and fixed up some formatting dev/sinicreg.hh: Added TheISA namespace specifier where needed dev/tsunami.cc: dev/tsunami_io.cc: dev/tsunami_pchip.cc: Added using namespace TheISA. It might be better for it to be AlphaISA dev/tsunami_cchip.cc: Added typedef for TheISA. It might be better for it to be AlphaISA kern/linux/aligned.hh: sim/pseudo_inst.hh: Added TheISA namespace specifier to Addr kern/linux/linux_threadinfo.hh: Added typedef for Addr, and TheISA namespace specifier to StackPointerReg kern/tru64/mbuf.hh: Added TheISA to Addr type in structs sim/process.hh: Added typedefs of Addr, RegFile, and MachInst sim/syscall_emul.cc: Added using namespace TheISA, and a cast of VMPageSize to the int type sim/syscall_emul.hh: Added typecast for Addr, and TheISA namespace specifier for where needed --HG-- extra : convert_revision : 91d4f6ca33a73b21c1f1771d74bfdea3b80eff45
2006-02-19 08:34:37 +01:00
using namespace TheISA;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
SyscallReturn
unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
fatal("syscall %s (#%d) unimplemented.", desc->name(), callnum);
return 1;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
if (desc->needWarning()) {
warn("ignoring syscall %s(...)%s", desc->name(), desc->warnOnce() ?
"\n (further warnings will be suppressed)" : "");
}
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
return 0;
}
SyscallReturn
exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
if (process->system->numRunningContexts() == 1) {
// Last running context... exit simulator
int index = 0;
exitSimLoop("target called exit()",
process->getSyscallArg(tc, index) & 0xff);
} else {
// other running threads... just halt this one
tc->halt();
}
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
return 1;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
// halt all threads belonging to this process
for (auto i: process->contextIds) {
process->system->getThreadContext(i)->halt();
}
if (!process->system->numRunningContexts()) {
// all threads belonged to this process... exit simulator
int index = 0;
exitSimLoop("target called exit()",
process->getSyscallArg(tc, index) & 0xff);
}
return 1;
}
SyscallReturn
getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
return (int)PageBytes;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
// change brk addr to first arg
int index = 0;
Addr new_brk = p->getSyscallArg(tc, index);
// in Linux at least, brk(0) returns the current break value
// (note that the syscall and the glibc function have different behavior)
if (new_brk == 0)
return p->brk_point;
if (new_brk > p->brk_point) {
// might need to allocate some new pages
for (ChunkGenerator gen(p->brk_point, new_brk - p->brk_point,
PageBytes); !gen.done(); gen.next()) {
if (!p->pTable->translate(gen.addr()))
p->allocateMem(roundDown(gen.addr(), PageBytes), PageBytes);
// if the address is already there, zero it out
else {
uint8_t zero = 0;
SETranslatingPortProxy &tp = tc->getMemProxy();
// split non-page aligned accesses
Addr next_page = roundUp(gen.addr(), PageBytes);
uint32_t size_needed = next_page - gen.addr();
tp.memsetBlob(gen.addr(), zero, size_needed);
if (gen.addr() + PageBytes > next_page &&
next_page < new_brk &&
p->pTable->translate(next_page))
{
size_needed = PageBytes - size_needed;
tp.memsetBlob(next_page, zero, size_needed);
}
}
}
}
p->brk_point = new_brk;
DPRINTF_SYSCALL(Verbose, "brk: break point changed to: %#X\n",
p->brk_point);
return p->brk_point;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
int sim_fd = p->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
int status = 0;
if (sim_fd > 2)
status = close(sim_fd);
if (status >= 0)
p->resetFDEntry(tgt_fd);
return status;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
Addr bufPtr = p->getSyscallArg(tc, index);
int nbytes = p->getSyscallArg(tc, index);
BufferArg bufArg(bufPtr, nbytes);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
int sim_fd = p->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
int bytes_read = read(sim_fd, bufArg.bufferPtr(), nbytes);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
if (bytes_read > 0)
bufArg.copyOut(tc->getMemProxy());
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
return bytes_read;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
Addr bufPtr = p->getSyscallArg(tc, index);
int nbytes = p->getSyscallArg(tc, index);
BufferArg bufArg(bufPtr, nbytes);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
int sim_fd = p->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
bufArg.copyIn(tc->getMemProxy());
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
int bytes_written = write(sim_fd, bufArg.bufferPtr(), nbytes);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
fsync(sim_fd);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
return bytes_written;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
uint64_t offs = p->getSyscallArg(tc, index);
int whence = p->getSyscallArg(tc, index);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
int sim_fd = p->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
off_t result = lseek(sim_fd, offs, whence);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
return (result == (off_t)-1) ? -errno : result;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
uint64_t offset_high = p->getSyscallArg(tc, index);
uint32_t offset_low = p->getSyscallArg(tc, index);
Addr result_ptr = p->getSyscallArg(tc, index);
int whence = p->getSyscallArg(tc, index);
int sim_fd = p->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
uint64_t offset = (offset_high << 32) | offset_low;
uint64_t result = lseek(sim_fd, offset, whence);
result = TheISA::htog(result);
2016-03-17 18:22:39 +01:00
if (result == (off_t)-1)
return -errno;
2016-03-17 18:22:39 +01:00
// Assuming that the size of loff_t is 64 bits on the target platform
BufferArg result_buf(result_ptr, sizeof(result));
memcpy(result_buf.bufferPtr(), &result, sizeof(result));
result_buf.copyOut(tc->getMemProxy());
return 0;
}
SyscallReturn
munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
// With mmap more fully implemented, it might be worthwhile to bite
// the bullet and implement munmap. Should allow us to reuse simulated
// memory.
return 0;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
const char *hostname = "m5.eecs.umich.edu";
SyscallReturn
gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
{
int index = 0;
Addr bufPtr = p->getSyscallArg(tc, index);
int name_len = p->getSyscallArg(tc, index);
BufferArg name(bufPtr, name_len);
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
strncpy((char *)name.bufferPtr(), hostname, name_len);
name.copyOut(tc->getMemProxy());
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
return 0;
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
}
SyscallReturn
getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int result = 0;
int index = 0;
Addr bufPtr = p->getSyscallArg(tc, index);
unsigned long size = p->getSyscallArg(tc, index);
BufferArg buf(bufPtr, size);
// Is current working directory defined?
string cwd = p->getcwd();
if (!cwd.empty()) {
if (cwd.length() >= size) {
// Buffer too small
return -ERANGE;
}
strncpy((char *)buf.bufferPtr(), cwd.c_str(), size);
result = cwd.length();
} else {
if (getcwd((char *)buf.bufferPtr(), size) != NULL) {
result = strlen((char *)buf.bufferPtr());
} else {
result = -1;
}
}
buf.copyOut(tc->getMemProxy());
return (result == -1) ? -errno : result;
}
/// Target open() handler.
SyscallReturn
readlinkFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
return readlinkFunc(desc, callnum, process, tc, 0);
}
SyscallReturn
readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
int index)
{
string path;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for current working directory
path = p->fullPath(path);
Addr bufPtr = p->getSyscallArg(tc, index);
size_t bufsiz = p->getSyscallArg(tc, index);
BufferArg buf(bufPtr, bufsiz);
int result = -1;
if (path != "/proc/self/exe") {
result = readlink(path.c_str(), (char *)buf.bufferPtr(), bufsiz);
} else {
// Emulate readlink() called on '/proc/self/exe' should return the
// absolute path of the binary running in the simulated system (the
// LiveProcess' executable). It is possible that using this path in
// the simulated system will result in unexpected behavior if:
// 1) One binary runs another (e.g., -c time -o "my_binary"), and
// called binary calls readlink().
// 2) The host's full path to the running benchmark changes from one
// simulation to another. This can result in different simulated
// performance since the simulated system will process the binary
// path differently, even if the binary itself does not change.
// Get the absolute canonical path to the running application
char real_path[PATH_MAX];
char *check_real_path = realpath(p->progName(), real_path);
if (!check_real_path) {
fatal("readlink('/proc/self/exe') unable to resolve path to "
"executable: %s", p->progName());
}
strncpy((char*)buf.bufferPtr(), real_path, bufsiz);
size_t real_path_len = strlen(real_path);
if (real_path_len > bufsiz) {
// readlink will truncate the contents of the
// path to ensure it is no more than bufsiz
result = bufsiz;
} else {
result = real_path_len;
}
// Issue a warning about potential unexpected results
warn_once("readlink() called on '/proc/self/exe' may yield unexpected "
"results in various settings.\n Returning '%s'\n",
(char*)buf.bufferPtr());
}
buf.copyOut(tc->getMemProxy());
return (result == -1) ? -errno : result;
}
SyscallReturn
unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
return unlinkHelper(desc, num, p, tc, 0);
}
SyscallReturn
unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
int index)
{
string path;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for current working directory
path = p->fullPath(path);
int result = unlink(path.c_str());
return (result == -1) ? -errno : result;
}
SyscallReturn
mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
string path;
int index = 0;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for current working directory
path = p->fullPath(path);
mode_t mode = p->getSyscallArg(tc, index);
int result = mkdir(path.c_str(), mode);
return (result == -1) ? -errno : result;
}
SyscallReturn
renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
string old_name;
int index = 0;
if (!tc->getMemProxy().tryReadString(old_name, p->getSyscallArg(tc, index)))
return -EFAULT;
string new_name;
if (!tc->getMemProxy().tryReadString(new_name, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for current working directory
old_name = p->fullPath(old_name);
new_name = p->fullPath(new_name);
int64_t result = rename(old_name.c_str(), new_name.c_str());
return (result == -1) ? -errno : result;
}
Restructuring of LiveProcess etc. to support multiple emulated OS syscall interfaces, and specific support for Alpha Linux. Split syscall emulation functions into several groups, based on whether they depend on the specific OS and/or architecture (and all combinations of above), including the use of template functions to support syscalls with slightly different constants or interface structs. arch/alpha/alpha_tru64_process.cc: Incorporate full Tru64 object definition here, including structure and constant definitions. This way we can wrap all of the functions inside the object, and not worry about namespace conflicts because no one outside this file will ever see it. base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.cc: base/loader/object_file.hh: Add enums to ObjectFile to indicate the object's architecture and operating system. cpu/exec_context.cc: prog.hh is now process.hh cpu/exec_context.hh: prog.hh is now process.hh move architecture-specific syscall arg accessors into ExecContext cpu/simple_cpu/simple_cpu.cc: No need to include prog.hh (which has been renamed) sim/process.cc: sim/process.hh: LiveProcess is now effectively an abstract base class. New LiveProcess::create() function takes an object file and dynamically picks the appropriate subclass of LiveProcess to handle the syscall interface that file expects (currently Tru64 or Linux). --HG-- rename : arch/alpha/fake_syscall.cc => arch/alpha/alpha_tru64_process.cc rename : sim/prog.cc => sim/process.cc rename : sim/prog.hh => sim/process.hh extra : convert_revision : 4a03ca7d94a34177cb672931f8aae83a6bad179a
2003-12-02 04:34:38 +01:00
SyscallReturn
truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
string path;
int index = 0;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
off_t length = p->getSyscallArg(tc, index);
// Adjust path for current working directory
path = p->fullPath(path);
int result = truncate(path.c_str(), length);
return (result == -1) ? -errno : result;
}
SyscallReturn
ftruncateFunc(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
off_t length = process->getSyscallArg(tc, index);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
int result = ftruncate(sim_fd, length);
return (result == -1) ? -errno : result;
}
SyscallReturn
truncate64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
{
int index = 0;
string path;
if (!tc->getMemProxy().tryReadString(path, process->getSyscallArg(tc, index)))
return -EFAULT;
2009-11-14 18:49:01 +01:00
int64_t length = process->getSyscallArg(tc, index, 64);
// Adjust path for current working directory
path = process->fullPath(path);
2009-11-14 18:49:01 +01:00
#if NO_STAT64
int result = truncate(path.c_str(), length);
#else
int result = truncate64(path.c_str(), length);
2009-11-14 18:49:01 +01:00
#endif
return (result == -1) ? -errno : result;
}
SyscallReturn
ftruncate64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int64_t length = process->getSyscallArg(tc, index, 64);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
2009-11-14 18:49:01 +01:00
#if NO_STAT64
int result = ftruncate(sim_fd, length);
2009-11-14 18:49:01 +01:00
#else
int result = ftruncate64(sim_fd, length);
2009-11-14 18:49:01 +01:00
#endif
return (result == -1) ? -errno : result;
}
SyscallReturn
umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
{
// Letting the simulated program change the simulator's umask seems like
// a bad idea. Compromise by just returning the current umask but not
// changing anything.
mode_t oldMask = umask(0);
umask(oldMask);
return (int)oldMask;
}
SyscallReturn
chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
string path;
int index = 0;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
/* XXX endianess */
uint32_t owner = p->getSyscallArg(tc, index);
uid_t hostOwner = owner;
uint32_t group = p->getSyscallArg(tc, index);
gid_t hostGroup = group;
// Adjust path for current working directory
path = p->fullPath(path);
int result = chown(path.c_str(), hostOwner, hostGroup);
return (result == -1) ? -errno : result;
}
SyscallReturn
fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
/* XXX endianess */
uint32_t owner = process->getSyscallArg(tc, index);
uid_t hostOwner = owner;
uint32_t group = process->getSyscallArg(tc, index);
gid_t hostGroup = group;
int result = fchown(sim_fd, hostOwner, hostGroup);
return (result == -1) ? -errno : result;
}
SyscallReturn
dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
FDEntry *fde = process->getFDEntry(tgt_fd);
int result = dup(sim_fd);
return (result == -1) ? -errno :
process->allocFD(result, fde->filename, fde->flags, fde->mode, false);
}
SyscallReturn
fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
int cmd = process->getSyscallArg(tc, index);
switch (cmd) {
case 0: // F_DUPFD
// if we really wanted to support this, we'd need to do it
// in the target fd space.
warn("fcntl(%d, F_DUPFD) not supported, error returned\n", tgt_fd);
return -EMFILE;
case 1: // F_GETFD (get close-on-exec flag)
case 2: // F_SETFD (set close-on-exec flag)
return 0;
case 3: // F_GETFL (get file flags)
case 4: // F_SETFL (set file flags)
// not sure if this is totally valid, but we'll pass it through
// to the underlying OS
warn("fcntl(%d, %d) passed through to host\n", tgt_fd, cmd);
return fcntl(sim_fd, cmd);
// return 0;
case 7: // F_GETLK (get lock)
case 8: // F_SETLK (set lock)
case 9: // F_SETLKW (set lock and wait)
// don't mess with file locking... just act like it's OK
warn("File lock call (fcntl(%d, %d)) ignored.\n", tgt_fd, cmd);
return 0;
default:
warn("Unknown fcntl command %d\n", cmd);
return 0;
}
}
SyscallReturn
fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
int cmd = process->getSyscallArg(tc, index);
switch (cmd) {
case 33: //F_GETLK64
warn("fcntl64(%d, F_GETLK64) not supported, error returned\n", tgt_fd);
return -EMFILE;
case 34: // F_SETLK64
case 35: // F_SETLKW64
warn("fcntl64(%d, F_SETLK(W)64) not supported, error returned\n",
tgt_fd);
return -EMFILE;
default:
// not sure if this is totally valid, but we'll pass it through
// to the underlying OS
warn("fcntl64(%d, %d) passed through to host\n", tgt_fd, cmd);
return fcntl(sim_fd, cmd);
// return 0;
}
}
SyscallReturn
pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
int fds[2], sim_fds[2];
int pipe_retval = pipe(fds);
if (pipe_retval < 0) {
// error
return pipe_retval;
}
sim_fds[0] = process->allocFD(fds[0], "PIPE-READ", O_WRONLY, -1, true);
sim_fds[1] = process->allocFD(fds[1], "PIPE-WRITE", O_RDONLY, -1, true);
process->setReadPipeSource(sim_fds[0], sim_fds[1]);
// Alpha Linux convention for pipe() is that fd[0] is returned as
// the return value of the function, and fd[1] is returned in r20.
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
tc->setIntReg(SyscallPseudoReturnReg, sim_fds[1]);
return sim_fds[0];
}
SyscallReturn
getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
// Make up a PID. There's no interprocess communication in
// fake_syscall mode, so there's no way for a process to know it's
// not getting a unique value.
tc->setIntReg(SyscallPseudoReturnReg, process->ppid());
return process->pid();
}
SyscallReturn
getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
// Make up a UID and EUID... it shouldn't matter, and we want the
// simulation to be deterministic.
// EUID goes in r20.
tc->setIntReg(SyscallPseudoReturnReg, process->euid()); //EUID
return process->uid(); // UID
}
SyscallReturn
getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
// Get current group ID. EGID goes in r20.
tc->setIntReg(SyscallPseudoReturnReg, process->egid()); //EGID
return process->gid();
}
SyscallReturn
setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
// can't fathom why a benchmark would call this.
int index = 0;
warn("Ignoring call to setuid(%d)\n", process->getSyscallArg(tc, index));
return 0;
}
SyscallReturn
getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
// Make up a PID. There's no interprocess communication in
// fake_syscall mode, so there's no way for a process to know it's
// not getting a unique value.
tc->setIntReg(SyscallPseudoReturnReg, process->ppid()); //PID
return process->pid();
}
SyscallReturn
getppidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
return process->ppid();
}
SyscallReturn
getuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
return process->uid(); // UID
}
SyscallReturn
geteuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
return process->euid(); // UID
}
SyscallReturn
getgidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
return process->gid();
}
SyscallReturn
getegidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
Change ExecContext to ThreadContext. This is being renamed to differentiate between the interface used objects outside of the CPU, and the interface used by the ISA. ThreadContext is used by objects outside of the CPU and is specifically defined in thread_context.hh. ExecContext is more implicit, and is defined by files such as base_dyn_inst.hh or cpu/simple/base.hh. Further renames/reorganization will be coming shortly; what is currently CPUExecContext (the old ExecContext from m5) will be renamed to SimpleThread or something similar. src/arch/alpha/arguments.cc: src/arch/alpha/arguments.hh: src/arch/alpha/ev5.cc: src/arch/alpha/faults.cc: src/arch/alpha/faults.hh: src/arch/alpha/freebsd/system.cc: src/arch/alpha/freebsd/system.hh: src/arch/alpha/isa/branch.isa: src/arch/alpha/isa/decoder.isa: src/arch/alpha/isa/main.isa: src/arch/alpha/linux/process.cc: src/arch/alpha/linux/system.cc: src/arch/alpha/linux/system.hh: src/arch/alpha/linux/threadinfo.hh: src/arch/alpha/process.cc: src/arch/alpha/regfile.hh: src/arch/alpha/stacktrace.cc: src/arch/alpha/stacktrace.hh: src/arch/alpha/tlb.cc: src/arch/alpha/tlb.hh: src/arch/alpha/tru64/process.cc: src/arch/alpha/tru64/system.cc: src/arch/alpha/tru64/system.hh: src/arch/alpha/utility.hh: src/arch/alpha/vtophys.cc: src/arch/alpha/vtophys.hh: src/arch/mips/faults.cc: src/arch/mips/faults.hh: src/arch/mips/isa_traits.cc: src/arch/mips/isa_traits.hh: src/arch/mips/linux/process.cc: src/arch/mips/process.cc: src/arch/mips/regfile/float_regfile.hh: src/arch/mips/regfile/int_regfile.hh: src/arch/mips/regfile/misc_regfile.hh: src/arch/mips/regfile/regfile.hh: src/arch/mips/stacktrace.hh: src/arch/sparc/faults.cc: src/arch/sparc/faults.hh: src/arch/sparc/isa_traits.hh: src/arch/sparc/linux/process.cc: src/arch/sparc/linux/process.hh: src/arch/sparc/process.cc: src/arch/sparc/regfile.hh: src/arch/sparc/solaris/process.cc: src/arch/sparc/stacktrace.hh: src/arch/sparc/ua2005.cc: src/arch/sparc/utility.hh: src/arch/sparc/vtophys.cc: src/arch/sparc/vtophys.hh: src/base/remote_gdb.cc: src/base/remote_gdb.hh: src/cpu/base.cc: src/cpu/base.hh: src/cpu/base_dyn_inst.hh: src/cpu/checker/cpu.cc: src/cpu/checker/cpu.hh: src/cpu/checker/exec_context.hh: src/cpu/cpu_exec_context.cc: src/cpu/cpu_exec_context.hh: src/cpu/cpuevent.cc: src/cpu/cpuevent.hh: src/cpu/exetrace.hh: src/cpu/intr_control.cc: src/cpu/memtest/memtest.hh: src/cpu/o3/alpha_cpu.hh: src/cpu/o3/alpha_cpu_impl.hh: src/cpu/o3/alpha_dyn_inst_impl.hh: src/cpu/o3/commit.hh: src/cpu/o3/commit_impl.hh: src/cpu/o3/cpu.cc: src/cpu/o3/cpu.hh: src/cpu/o3/fetch_impl.hh: src/cpu/o3/regfile.hh: src/cpu/o3/thread_state.hh: src/cpu/ozone/back_end.hh: src/cpu/ozone/cpu.hh: src/cpu/ozone/cpu_impl.hh: src/cpu/ozone/front_end.hh: src/cpu/ozone/front_end_impl.hh: src/cpu/ozone/inorder_back_end.hh: src/cpu/ozone/lw_back_end.hh: src/cpu/ozone/lw_back_end_impl.hh: src/cpu/ozone/lw_lsq.hh: src/cpu/ozone/lw_lsq_impl.hh: src/cpu/ozone/thread_state.hh: src/cpu/pc_event.cc: src/cpu/pc_event.hh: src/cpu/profile.cc: src/cpu/profile.hh: src/cpu/quiesce_event.cc: src/cpu/quiesce_event.hh: src/cpu/simple/atomic.cc: src/cpu/simple/base.cc: src/cpu/simple/base.hh: src/cpu/simple/timing.cc: src/cpu/static_inst.cc: src/cpu/static_inst.hh: src/cpu/thread_state.hh: src/dev/alpha_console.cc: src/dev/ns_gige.cc: src/dev/sinic.cc: src/dev/tsunami_cchip.cc: src/kern/kernel_stats.cc: src/kern/kernel_stats.hh: src/kern/linux/events.cc: src/kern/linux/events.hh: src/kern/system_events.cc: src/kern/system_events.hh: src/kern/tru64/dump_mbuf.cc: src/kern/tru64/tru64.hh: src/kern/tru64/tru64_events.cc: src/kern/tru64/tru64_events.hh: src/mem/vport.cc: src/mem/vport.hh: src/sim/faults.cc: src/sim/faults.hh: src/sim/process.cc: src/sim/process.hh: src/sim/pseudo_inst.cc: src/sim/pseudo_inst.hh: src/sim/syscall_emul.cc: src/sim/syscall_emul.hh: src/sim/system.cc: src/cpu/thread_context.hh: src/sim/system.hh: src/sim/vptr.hh: Change ExecContext to ThreadContext. --HG-- rename : src/cpu/exec_context.hh => src/cpu/thread_context.hh extra : convert_revision : 108bb97d15a114a565a2a6a23faa554f4e2fd77e
2006-06-06 23:32:21 +02:00
ThreadContext *tc)
{
return process->egid();
}
SyscallReturn
cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
int index = 0;
IntReg flags = process->getSyscallArg(tc, index);
IntReg newStack = process->getSyscallArg(tc, index);
DPRINTF(SyscallVerbose, "In sys_clone:\n");
DPRINTF(SyscallVerbose, " Flags=%llx\n", flags);
DPRINTF(SyscallVerbose, " Child stack=%llx\n", newStack);
if (flags != 0x10f00) {
warn("This sys_clone implementation assumes flags "
"CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD "
"(0x10f00), and may not work correctly with given flags "
"0x%llx\n", flags);
}
ThreadContext* ctc; // child thread context
if ( ( ctc = process->findFreeContext() ) != NULL ) {
DPRINTF(SyscallVerbose, " Found unallocated thread context\n");
ctc->clearArchRegs();
// Arch-specific cloning code
#if THE_ISA == ALPHA_ISA or THE_ISA == X86_ISA
// Cloning the misc. regs for these archs is enough
TheISA::copyMiscRegs(tc, ctc);
#elif THE_ISA == SPARC_ISA
TheISA::copyRegs(tc, ctc);
// TODO: Explain what this code actually does :-)
ctc->setIntReg(NumIntArchRegs + 6, 0);
ctc->setIntReg(NumIntArchRegs + 4, 0);
ctc->setIntReg(NumIntArchRegs + 3, NWindows - 2);
ctc->setIntReg(NumIntArchRegs + 5, NWindows);
ctc->setMiscReg(MISCREG_CWP, 0);
ctc->setIntReg(NumIntArchRegs + 7, 0);
ctc->setMiscRegNoEffect(MISCREG_TL, 0);
ctc->setMiscReg(MISCREG_ASI, ASI_PRIMARY);
for (int y = 8; y < 32; y++)
ctc->setIntReg(y, tc->readIntReg(y));
#elif THE_ISA == ARM_ISA
TheISA::copyRegs(tc, ctc);
#else
fatal("sys_clone is not implemented for this ISA\n");
#endif
// Set up stack register
ctc->setIntReg(TheISA::StackPointerReg, newStack);
// Set up syscall return values in parent and child
ctc->setIntReg(ReturnValueReg, 0); // return value, child
// Alpha needs SyscallSuccessReg=0 in child
#if THE_ISA == ALPHA_ISA
ctc->setIntReg(TheISA::SyscallSuccessReg, 0);
#endif
// In SPARC/Linux, clone returns 0 on pseudo-return register if
// parent, non-zero if child
#if THE_ISA == SPARC_ISA
tc->setIntReg(TheISA::SyscallPseudoReturnReg, 0);
ctc->setIntReg(TheISA::SyscallPseudoReturnReg, 1);
#endif
ISA,CPU,etc: Create an ISA defined PC type that abstracts out ISA behaviors. This change is a low level and pervasive reorganization of how PCs are managed in M5. Back when Alpha was the only ISA, there were only 2 PCs to worry about, the PC and the NPC, and the lsb of the PC signaled whether or not you were in PAL mode. As other ISAs were added, we had to add an NNPC, micro PC and next micropc, x86 and ARM introduced variable length instruction sets, and ARM started to keep track of mode bits in the PC. Each CPU model handled PCs in its own custom way that needed to be updated individually to handle the new dimensions of variability, or, in the case of ARMs mode-bit-in-the-pc hack, the complexity could be hidden in the ISA at the ISA implementation's expense. Areas like the branch predictor hadn't been updated to handle branch delay slots or micropcs, and it turns out that had introduced a significant (10s of percent) performance bug in SPARC and to a lesser extend MIPS. Rather than perpetuate the problem by reworking O3 again to handle the PC features needed by x86, this change was introduced to rework PC handling in a more modular, transparent, and hopefully efficient way. PC type: Rather than having the superset of all possible elements of PC state declared in each of the CPU models, each ISA defines its own PCState type which has exactly the elements it needs. A cross product of canned PCState classes are defined in the new "generic" ISA directory for ISAs with/without delay slots and microcode. These are either typedef-ed or subclassed by each ISA. To read or write this structure through a *Context, you use the new pcState() accessor which reads or writes depending on whether it has an argument. If you just want the address of the current or next instruction or the current micro PC, you can get those through read-only accessors on either the PCState type or the *Contexts. These are instAddr(), nextInstAddr(), and microPC(). Note the move away from readPC. That name is ambiguous since it's not clear whether or not it should be the actual address to fetch from, or if it should have extra bits in it like the PAL mode bit. Each class is free to define its own functions to get at whatever values it needs however it needs to to be used in ISA specific code. Eventually Alpha's PAL mode bit could be moved out of the PC and into a separate field like ARM. These types can be reset to a particular pc (where npc = pc + sizeof(MachInst), nnpc = npc + sizeof(MachInst), upc = 0, nupc = 1 as appropriate), printed, serialized, and compared. There is a branching() function which encapsulates code in the CPU models that checked if an instruction branched or not. Exactly what that means in the context of branch delay slots which can skip an instruction when not taken is ambiguous, and ideally this function and its uses can be eliminated. PCStates also generally know how to advance themselves in various ways depending on if they point at an instruction, a microop, or the last microop of a macroop. More on that later. Ideally, accessing all the PCs at once when setting them will improve performance of M5 even though more data needs to be moved around. This is because often all the PCs need to be manipulated together, and by getting them all at once you avoid multiple function calls. Also, the PCs of a particular thread will have spatial locality in the cache. Previously they were grouped by element in arrays which spread out accesses. Advancing the PC: The PCs were previously managed entirely by the CPU which had to know about PC semantics, try to figure out which dimension to increment the PC in, what to set NPC/NNPC, etc. These decisions are best left to the ISA in conjunction with the PC type itself. Because most of the information about how to increment the PC (mainly what type of instruction it refers to) is contained in the instruction object, a new advancePC virtual function was added to the StaticInst class. Subclasses provide an implementation that moves around the right element of the PC with a minimal amount of decision making. In ISAs like Alpha, the instructions always simply assign NPC to PC without having to worry about micropcs, nnpcs, etc. The added cost of a virtual function call should be outweighed by not having to figure out as much about what to do with the PCs and mucking around with the extra elements. One drawback of making the StaticInsts advance the PC is that you have to actually have one to advance the PC. This would, superficially, seem to require decoding an instruction before fetch could advance. This is, as far as I can tell, realistic. fetch would advance through memory addresses, not PCs, perhaps predicting new memory addresses using existing ones. More sophisticated decisions about control flow would be made later on, after the instruction was decoded, and handed back to fetch. If branching needs to happen, some amount of decoding needs to happen to see that it's a branch, what the target is, etc. This could get a little more complicated if that gets done by the predecoder, but I'm choosing to ignore that for now. Variable length instructions: To handle variable length instructions in x86 and ARM, the predecoder now takes in the current PC by reference to the getExtMachInst function. It can modify the PC however it needs to (by setting NPC to be the PC + instruction length, for instance). This could be improved since the CPU doesn't know if the PC was modified and always has to write it back. ISA parser: To support the new API, all PC related operand types were removed from the parser and replaced with a PCState type. There are two warts on this implementation. First, as with all the other operand types, the PCState still has to have a valid operand type even though it doesn't use it. Second, using syntax like PCS.npc(target) doesn't work for two reasons, this looks like the syntax for operand type overriding, and the parser can't figure out if you're reading or writing. Instructions that use the PCS operand (which I've consistently called it) need to first read it into a local variable, manipulate it, and then write it back out. Return address stack: The return address stack needed a little extra help because, in the presence of branch delay slots, it has to merge together elements of the return PC and the call PC. To handle that, a buildRetPC utility function was added. There are basically only two versions in all the ISAs, but it didn't seem short enough to put into the generic ISA directory. Also, the branch predictor code in O3 and InOrder were adjusted so that they always store the PC of the actual call instruction in the RAS, not the next PC. If the call instruction is a microop, the next PC refers to the next microop in the same macroop which is probably not desirable. The buildRetPC function advances the PC intelligently to the next macroop (in an ISA specific way) so that that case works. Change in stats: There were no change in stats except in MIPS and SPARC in the O3 model. MIPS runs in about 9% fewer ticks. SPARC runs with 30%-50% fewer ticks, which could likely be improved further by setting call/return instruction flags and taking advantage of the RAS. TODO: Add != operators to the PCState classes, defined trivially to be !(a==b). Smooth out places where PCs are split apart, passed around, and put back together later. I think this might happen in SPARC's fault code. Add ISA specific constructors that allow setting PC elements without calling a bunch of accessors. Try to eliminate the need for the branching() function. Factor out Alpha's PAL mode pc bit into a separate flag field, and eliminate places where it's blindly masked out or tested in the PC.
2010-10-31 08:07:20 +01:00
ctc->pcState(tc->nextInstAddr());
ctc->activate();
// Should return nonzero child TID in parent's syscall return register,
// but for our pthread library any non-zero value will work
return 1;
} else {
fatal("Called sys_clone, but no unallocated thread contexts found!\n");
return 0;
}
}
2016-12-15 19:16:25 +01:00
SyscallReturn
fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
#if NO_FALLOCATE
warn("Host OS cannot support calls to fallocate. Ignoring syscall");
#else
2016-12-15 19:16:25 +01:00
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int mode = process->getSyscallArg(tc, index);
off_t offset = process->getSyscallArg(tc, index);
off_t len = process->getSyscallArg(tc, index);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)
return -EBADF;
int result = fallocate(sim_fd, mode, offset, len);
if (result < 0)
return -errno;
#endif
2016-12-15 19:16:25 +01:00
return 0;
}
SyscallReturn
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc,
int index)
{
string path;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for current working directory
path = p->fullPath(path);
mode_t mode = p->getSyscallArg(tc, index);
int result = access(path.c_str(), mode);
return (result == -1) ? -errno : result;
}
SyscallReturn
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc)
{
return accessFunc(desc, callnum, p, tc, 0);
}