mem: Assert that requests have non-negative size.
Would have saved me much debugging time if these had been in there previously.
This commit is contained in:
parent
42bd460d7f
commit
63127cbf37
2 changed files with 3 additions and 0 deletions
|
@ -82,6 +82,7 @@ class ChunkGenerator
|
||||||
{
|
{
|
||||||
// chunkSize must be a power of two
|
// chunkSize must be a power of two
|
||||||
assert(chunkSize == 0 || isPowerOf2(chunkSize));
|
assert(chunkSize == 0 || isPowerOf2(chunkSize));
|
||||||
|
assert(totalSize >= 0);
|
||||||
|
|
||||||
// set up initial chunk.
|
// set up initial chunk.
|
||||||
curAddr = startAddr;
|
curAddr = startAddr;
|
||||||
|
|
|
@ -172,6 +172,7 @@ class Request : public FastAlloc
|
||||||
* allocated Request object. */
|
* allocated Request object. */
|
||||||
void setPhys(Addr _paddr, int _size, int _flags)
|
void setPhys(Addr _paddr, int _size, int _flags)
|
||||||
{
|
{
|
||||||
|
assert(_size >= 0);
|
||||||
paddr = _paddr;
|
paddr = _paddr;
|
||||||
size = _size;
|
size = _size;
|
||||||
flags = _flags;
|
flags = _flags;
|
||||||
|
@ -188,6 +189,7 @@ class Request : public FastAlloc
|
||||||
* allocated Request object. */
|
* allocated Request object. */
|
||||||
void setVirt(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc)
|
void setVirt(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc)
|
||||||
{
|
{
|
||||||
|
assert(_size >= 0);
|
||||||
asid = _asid;
|
asid = _asid;
|
||||||
vaddr = _vaddr;
|
vaddr = _vaddr;
|
||||||
size = _size;
|
size = _size;
|
||||||
|
|
Loading…
Reference in a new issue