gem5 v24.0.0.0
|
Internal state for open files. More...
#include <semihosting.hh>
Public Member Functions | |
FileBase (BaseSemihosting &_parent, const char *name, const char *_mode) | |
virtual | ~FileBase () |
FileBase ()=delete | |
FileBase (FileBase &)=delete | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. | |
const std::string & | fileName () |
virtual int64_t | open () |
Open the the file. | |
virtual int64_t | close () |
Close the file. | |
virtual bool | isTTY () const |
Check if a file corresponds to a TTY device. | |
virtual int64_t | read (uint8_t *buffer, uint64_t size) |
Read data from file. | |
virtual int64_t | write (const uint8_t *buffer, uint64_t size) |
Write data to file. | |
virtual int64_t | seek (uint64_t pos) |
Seek to an absolute position in the file. | |
virtual int64_t | flen () |
Get the length of a file in bytes. | |
Public Member Functions inherited from gem5::Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Static Public Member Functions | |
static std::unique_ptr< FileBase > | create (BaseSemihosting &parent, const std::string &fname, const char *mode) |
static std::unique_ptr< FileBase > | create (BaseSemihosting &parent, CheckpointIn &cp, const std::string &sec) |
Static Public Member Functions inherited from gem5::Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. | |
static void | generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream) |
Generate a checkpoint file so that the serialization can be routed to it. | |
Protected Attributes | |
BaseSemihosting & | parent |
std::string | _name |
std::string | mode |
Internal state for open files.
This class describes the internal state of a file opened through the semihosting interface.
A file instance is normally created using one of the BaseSemihosting::FileBase::create() factory methods. These methods handle some the magic file names in the Arm/RISC-V semihosting specification and instantiate the right implementation. For the same, when unserializing a checkpoint, the create method must be used to unserialize a new instance of a file descriptor.
Definition at line 209 of file semihosting.hh.
|
inline |
Definition at line 212 of file semihosting.hh.
|
inlinevirtual |
Definition at line 215 of file semihosting.hh.
|
delete |
|
delete |
|
inlinevirtual |
Close the file.
Reimplemented in gem5::BaseSemihosting::File.
Definition at line 262 of file semihosting.hh.
|
static |
Definition at line 614 of file semihosting.cc.
References gem5::Serializable::currentSection(), gem5::ArmISA::mode, gem5::paramIn(), and gem5::CheckpointIn::sectionExists().
|
static |
Definition at line 600 of file semihosting.cc.
Referenced by gem5::BaseSemihosting::callOpen(), and gem5::BaseSemihosting::unserialize().
|
inline |
Definition at line 229 of file semihosting.hh.
References _name.
|
virtual |
Get the length of a file in bytes.
Reimplemented in gem5::BaseSemihosting::File, and gem5::BaseSemihosting::FileFeatures.
Definition at line 667 of file semihosting.cc.
|
inlinevirtual |
Check if a file corresponds to a TTY device.
Reimplemented in gem5::BaseSemihosting::File.
Definition at line 273 of file semihosting.hh.
|
inlinevirtual |
Open the the file.
Semihosting file IO interfaces
These interfaces implement common IO functionality in the Semihosting interface.
All functions return a negative value that corresponds to a UNIX errno value when they fail and >=0 on success.
Reimplemented in gem5::BaseSemihosting::File.
Definition at line 251 of file semihosting.hh.
|
virtual |
Read data from file.
Reimplemented in gem5::BaseSemihosting::File, and gem5::BaseSemihosting::FileFeatures.
Definition at line 649 of file semihosting.cc.
|
virtual |
Seek to an absolute position in the file.
pos | Byte offset from start of file. |
Reimplemented in gem5::BaseSemihosting::File, and gem5::BaseSemihosting::FileFeatures.
Definition at line 661 of file semihosting.cc.
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implements gem5::Serializable.
Reimplemented in gem5::BaseSemihosting::FileFeatures.
Definition at line 635 of file semihosting.cc.
References gem5::Named::_name, gem5::ArmISA::mode, gem5::paramOut(), and SERIALIZE_SCALAR.
Referenced by gem5::BaseSemihosting::File::serialize(), and gem5::BaseSemihosting::FileFeatures::serialize().
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implements gem5::Serializable.
Reimplemented in gem5::BaseSemihosting::FileFeatures.
Definition at line 642 of file semihosting.cc.
Referenced by gem5::BaseSemihosting::File::unserialize(), and gem5::BaseSemihosting::FileFeatures::unserialize().
|
virtual |
Write data to file.
Reimplemented in gem5::BaseSemihosting::File.
Definition at line 655 of file semihosting.cc.
|
protected |
Definition at line 311 of file semihosting.hh.
Referenced by fileName().
|
protected |
Definition at line 312 of file semihosting.hh.
Referenced by create().
|
protected |
Definition at line 310 of file semihosting.hh.
Referenced by create().