gem5  v21.1.0.2
Public Member Functions | List of all members
gem5::TypedBufferArg< T > Class Template Reference

TypedBufferArg is a class template; instances of this template represent typed buffers in target user space that are passed by reference to an (emulated) system call. More...

#include <syscall_emul_buf.hh>

Inheritance diagram for gem5::TypedBufferArg< T >:
gem5::BaseBufferArg

Public Member Functions

 TypedBufferArg (Addr _addr, int _size=sizeof(T))
 Allocate a buffer of type T representing the memory at target address 'addr'. More...
 
 operator T* ()
 Convert TypedBufferArg<T> to a pointer to T that points to the internal buffer. More...
 
T & operator* ()
 Convert TypedBufferArg<T> to a reference to T that references the internal buffer value. More...
 
T * operator-> ()
 Enable the use of '->' to reference fields where T is a struct type. More...
 
T & operator[] (int i)
 Enable the use of '[]' to reference fields where T is an array type. More...
 
- Public Member Functions inherited from gem5::BaseBufferArg
 BaseBufferArg (Addr _addr, int _size)
 Allocate a buffer of size 'size' representing the memory at target address 'addr'. More...
 
 ~BaseBufferArg ()
 
bool copyIn (const PortProxy &memproxy)
 copy data into simulator space (read from target memory) More...
 
bool copyOut (const PortProxy &memproxy)
 copy data out of simulator space (write to target memory) More...
 

Additional Inherited Members

- Protected Attributes inherited from gem5::BaseBufferArg
const Addr addr
 address of buffer in target address space More...
 
const int size
 buffer size More...
 
uint8_t *const bufPtr
 pointer to buffer in simulator space More...
 

Detailed Description

template<class T>
class gem5::TypedBufferArg< T >

TypedBufferArg is a class template; instances of this template represent typed buffers in target user space that are passed by reference to an (emulated) system call.

This template provides operator overloads for convenience, allowing for example the use of '->' to reference fields within a struct type.

Definition at line 132 of file syscall_emul_buf.hh.

Constructor & Destructor Documentation

◆ TypedBufferArg()

template<class T >
gem5::TypedBufferArg< T >::TypedBufferArg ( Addr  _addr,
int  _size = sizeof(T) 
)
inline

Allocate a buffer of type T representing the memory at target address 'addr'.

The user can optionally specify a specific number of bytes to allocate to deal with structs that have variable-size arrays at the end.

Definition at line 141 of file syscall_emul_buf.hh.

Member Function Documentation

◆ operator T*()

template<class T >
gem5::TypedBufferArg< T >::operator T* ( )
inline

Convert TypedBufferArg<T> to a pointer to T that points to the internal buffer.

Definition at line 149 of file syscall_emul_buf.hh.

References gem5::BaseBufferArg::bufPtr.

◆ operator*()

template<class T >
T& gem5::TypedBufferArg< T >::operator* ( )
inline

Convert TypedBufferArg<T> to a reference to T that references the internal buffer value.

Definition at line 155 of file syscall_emul_buf.hh.

References gem5::BaseBufferArg::bufPtr.

◆ operator->()

template<class T >
T* gem5::TypedBufferArg< T >::operator-> ( )
inline

Enable the use of '->' to reference fields where T is a struct type.

Definition at line 162 of file syscall_emul_buf.hh.

References gem5::BaseBufferArg::bufPtr.

◆ operator[]()

template<class T >
T& gem5::TypedBufferArg< T >::operator[] ( int  i)
inline

Enable the use of '[]' to reference fields where T is an array type.

Definition at line 168 of file syscall_emul_buf.hh.

References gem5::BaseBufferArg::bufPtr, and gem5::ArmISA::i.


The documentation for this class was generated from the following file:

Generated on Tue Sep 21 2021 12:28:19 for gem5 by doxygen 1.8.17