diff options
author | Alexandru Dutu <alexandru.dutu@amd.com> | 2014-11-23 18:01:09 -0800 |
---|---|---|
committer | Alexandru Dutu <alexandru.dutu@amd.com> | 2014-11-23 18:01:09 -0800 |
commit | 1f539f13c32ad5a9187d56a098d4c857639b0e05 (patch) | |
tree | 7618c3b946d9c25d9b22018f226eee77b6de4aaf /src/mem/page_table.hh | |
parent | c11bcb8119273ef91c40a25b8fd9471a887d0ee5 (diff) | |
download | gem5-1f539f13c32ad5a9187d56a098d4c857639b0e05.tar.xz |
mem: Page Table map api modification
This patch adds uncacheable/cacheable and read-only/read-write attributes to
the map method of PageTableBase. It also modifies the constructor of TlbEntry
structs for all architectures to consider the new attributes.
Diffstat (limited to 'src/mem/page_table.hh')
-rw-r--r-- | src/mem/page_table.hh | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/mem/page_table.hh b/src/mem/page_table.hh index be0983996..22b5c61eb 100644 --- a/src/mem/page_table.hh +++ b/src/mem/page_table.hh @@ -85,6 +85,20 @@ class PageTableBase virtual ~PageTableBase() {}; + /* generic page table mapping flags + * unset | set + * bit 0 - no-clobber | clobber + * bit 1 - present | not-present + * bit 2 - cacheable | uncacheable + * bit 3 - read-write | read-only + */ + enum MappingFlags : uint32_t { + Clobber = 1, + NotPresent = 2, + Uncacheable = 4, + ReadOnly = 8, + }; + virtual void initState(ThreadContext* tc) = 0; // for DPRINTF compatibility @@ -93,8 +107,16 @@ class PageTableBase Addr pageAlign(Addr a) { return (a & ~offsetMask); } Addr pageOffset(Addr a) { return (a & offsetMask); } + /** + * Maps a virtual memory region to a physical memory region. + * @param vaddr The starting virtual address of the region. + * @param paddr The starting physical address where the region is mapped. + * @param size The length of the region. + * @param flags Generic mapping flags that can be set by or-ing values + * from MappingFlags enum. + */ virtual void map(Addr vaddr, Addr paddr, int64_t size, - bool clobber = false) = 0; + uint64_t flags = 0) = 0; virtual void remap(Addr vaddr, int64_t size, Addr new_vaddr) = 0; virtual void unmap(Addr vaddr, int64_t size) = 0; @@ -197,7 +219,8 @@ class FuncPageTable : public PageTableBase { } - void map(Addr vaddr, Addr paddr, int64_t size, bool clobber = false); + void map(Addr vaddr, Addr paddr, int64_t size, + uint64_t flags = 0); void remap(Addr vaddr, int64_t size, Addr new_vaddr); void unmap(Addr vaddr, int64_t size); |