diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2016-01-17 18:27:46 -0800 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2016-01-17 18:27:46 -0800 |
commit | 1b6355c89574c42c5b5f8014b994cf26dae4737d (patch) | |
tree | 53ef269f709829563084ba571504c8606ed7d89e /src/cpu/exec_context.hh | |
parent | 707275265f188a514d1d5673ed4c8d6495304962 (diff) | |
download | gem5-1b6355c89574c42c5b5f8014b994cf26dae4737d.tar.xz |
cpu. arch: add initiateMemRead() to ExecContext interface
For historical reasons, the ExecContext interface had a single
function, readMem(), that did two different things depending on
whether the ExecContext supported atomic memory mode (i.e.,
AtomicSimpleCPU) or timing memory mode (all the other models).
In the former case, it actually performed a memory read; in the
latter case, it merely initiated a read access, and the read
completion did not happen until later when a response packet
arrived from the memory system.
This led to some confusing things, including timing accesses
being required to provide a pointer for the return data even
though that pointer was only used in atomic mode.
This patch splits this interface, adding a new initiateMemRead()
function to the ExecContext interface to replace the timing-mode
use of readMem().
For consistency and clarity, the readMemTiming() helper function
in the ISA definitions is renamed to initiateMemRead() as well.
For x86, where the access size is passed in explicitly, we can
also get rid of the data parameter at this level. For other ISAs,
where the access size is determined from the type of the data
parameter, we have to keep the parameter for that purpose.
Diffstat (limited to 'src/cpu/exec_context.hh')
-rw-r--r-- | src/cpu/exec_context.hh | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/cpu/exec_context.hh b/src/cpu/exec_context.hh index c65841db2..951c9c2b3 100644 --- a/src/cpu/exec_context.hh +++ b/src/cpu/exec_context.hh @@ -12,6 +12,7 @@ * modified or unmodified, in source code or in binary form. * * Copyright (c) 2002-2005 The Regents of The University of Michigan + * Copyright (c) 2015 Advanced Micro Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -173,9 +174,36 @@ class ExecContext { */ virtual Addr getEA() const = 0; + /** + * Perform an atomic memory read operation. Must be overridden + * for exec contexts that support atomic memory mode. Not pure + * virtual since exec contexts that only support timing memory + * mode need not override (though in that case this function + * should never be called). + */ virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size, - unsigned int flags) = 0; + unsigned int flags) + { + panic("ExecContext::readMem() should be overridden\n"); + } + /** + * Initiate a timing memory read operation. Must be overridden + * for exec contexts that support timing memory mode. Not pure + * virtual since exec contexts that only support atomic memory + * mode need not override (though in that case this function + * should never be called). + */ + virtual Fault initiateMemRead(Addr addr, unsigned int size, + unsigned int flags) + { + panic("ExecContext::initiateMemRead() should be overridden\n"); + } + + /** + * For atomic-mode contexts, perform an atomic memory write operation. + * For timing-mode contexts, initiate a timing memory write operation. + */ virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr, unsigned int flags, uint64_t *res) = 0; |