gem5  v20.1.0.0
Public Member Functions | List of all members
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 TypedBufferArg< T >:
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 BaseBufferArg
 BaseBufferArg (Addr _addr, int _size)
 Allocate a buffer of size 'size' representing the memory at target address 'addr'. More...
 
 ~BaseBufferArg ()
 
bool copyIn (PortProxy &memproxy)
 copy data into simulator space (read from target memory) More...
 
bool copyOut (PortProxy &memproxy)
 copy data out of simulator space (write to target memory) More...
 

Additional Inherited Members

- Protected Attributes inherited from 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 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 128 of file syscall_emul_buf.hh.

Constructor & Destructor Documentation

◆ TypedBufferArg()

template<class T >
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 137 of file syscall_emul_buf.hh.

Member Function Documentation

◆ operator T*()

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

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

Definition at line 145 of file syscall_emul_buf.hh.

References BaseBufferArg::bufPtr.

◆ operator*()

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

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

Definition at line 151 of file syscall_emul_buf.hh.

References BaseBufferArg::bufPtr.

◆ operator->()

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

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

Definition at line 158 of file syscall_emul_buf.hh.

References BaseBufferArg::bufPtr.

◆ operator[]()

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

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

Definition at line 164 of file syscall_emul_buf.hh.

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


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

Generated on Wed Sep 30 2020 14:02:33 for gem5 by doxygen 1.8.17