gem5 v24.0.0.0
Loading...
Searching...
No Matches
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'.
 
 operator T* ()
 Convert TypedBufferArg<T> to a pointer to T that points to the internal buffer.
 
T & operator* ()
 Convert TypedBufferArg<T> to a reference to T that references the internal buffer value.
 
T * operator-> ()
 Enable the use of '->' to reference fields where T is a struct type.
 
T & operator[] (int i)
 Enable the use of '[]' to reference fields where T is an array type.
 
- 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'.
 
 ~BaseBufferArg ()
 
bool copyIn (const PortProxy &memproxy)
 copy data into simulator space (read from target memory)
 
bool copyOut (const PortProxy &memproxy)
 copy data out of simulator space (write to target memory)
 

Additional Inherited Members

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

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 Jun 18 2024 16:24:15 for gem5 by doxygen 1.11.0