[gem5-dev] Change in gem5/gem5[develop]: sim-se: Extend MemState API to use VMAs

2020-03-25 Thread Matthew Poremba (Gerrit)
Matthew Poremba has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/25483 )


Change subject: sim-se: Extend MemState API to use VMAs
..

sim-se: Extend MemState API to use VMAs

Extend the MemState API to handle tracking dynamically sized memory
regions of a Process class which may be added, moved, removed, or
change in size during the course of simulation. This utilizes the
virtual memory areas (VMA) class to track individual regions and
provides a fixup method to handle physical page allocation in case of
a page fault. This allows for lazy allocation of the stack, heap, and
mmap regions of memory.

Change-Id: I3ef10657e5f8e8f0e328bdf0aa15a27b1dde39bf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25483
Tested-by: Gem5 Cloud Project GCB service account  
<345032938...@cloudbuild.gserviceaccount.com>

Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
---
M src/arch/arm/process.cc
M src/arch/mips/process.cc
M src/arch/power/process.cc
M src/arch/riscv/process.cc
M src/arch/sparc/process.hh
M src/arch/x86/process.cc
M src/sim/SConscript
A src/sim/mem_state.cc
M src/sim/mem_state.hh
9 files changed, 647 insertions(+), 49 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  Gem5 Cloud Project GCB service account: Regressions pass



diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index 3d041ee..c672444 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -78,8 +78,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0x4000L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end);
 }

 ArmProcess64::ArmProcess64(ProcessParams *params, ObjectFile *objFile,
@@ -92,8 +93,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0x40L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end);
 }

 void
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index 539c7a5..a610fbe 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -67,8 +67,9 @@
 // Set up region for mmaps.  Start it 1GB above the top of the heap.
 Addr mmap_end = brk_point + 0x4000L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end);
 }

 void
diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc
index 9bb3b19..5cb9823 100644
--- a/src/arch/power/process.cc
+++ b/src/arch/power/process.cc
@@ -66,8 +66,9 @@
 // Set up region for mmaps. For now, start at bottom of kuseg space.
 Addr mmap_end = 0x7000L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end);
 }

 void
diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc
index 5feff43..474ed68 100644
--- a/src/arch/riscv/process.cc
+++ b/src/arch/riscv/process.cc
@@ -73,8 +73,8 @@
 const Addr next_thread_stack_base = stack_base - max_stack_size;
 const Addr brk_point = roundUp(image.maxAddr(), PageBytes);
 const Addr mmap_end = 0x4000L;
-memState = make_shared(brk_point, stack_base, max_stack_size,
-next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+max_stack_size, next_thread_stack_base, mmap_end);
 }

 RiscvProcess32::RiscvProcess32(ProcessParams *params, ObjectFile  
*objFile) :

@@ -85,8 +85,8 @@
 const Addr next_thread_stack_base = stack_base - max_stack_size;
 const Addr brk_point = roundUp(image.maxAddr(), PageBytes);
 const Addr mmap_end = 0x4000L;
-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+max_stack_size, next_thread_stack_base, mmap_end);
 }

 void
diff --git 

[gem5-dev] Change in gem5/gem5[develop]: sim-se: Extend MemState API to use VMAs

2020-02-17 Thread Matthew Poremba (Gerrit)
Matthew Poremba has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/25483 )



Change subject: sim-se: Extend MemState API to use VMAs
..

sim-se: Extend MemState API to use VMAs

Extend the MemState API to handle all memory tracking functions and
utilize virtual memory areas. This is intended to reduce the footprint
of the process class and is utilized in a subsequent patch.

This touches the process class for each ISA because the constructor for
MemState has changed.

Change-Id: I3ef10657e5f8e8f0e328bdf0aa15a27b1dde39bf
Signed-off-by: Brandon Potter 
---
M src/arch/alpha/process.cc
M src/arch/arm/process.cc
M src/arch/mips/process.cc
M src/arch/power/process.cc
M src/arch/riscv/process.cc
M src/arch/sparc/process.hh
M src/arch/x86/process.cc
M src/mem/se_translating_port_proxy.cc
M src/sim/SConscript
A src/sim/mem_state.cc
M src/sim/mem_state.hh
A src/sim/mem_state_impl.hh
M src/sim/process.cc
M src/sim/process.hh
14 files changed, 922 insertions(+), 56 deletions(-)



diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc
index 02a6899..c4c50a6 100644
--- a/src/arch/alpha/process.cc
+++ b/src/arch/alpha/process.cc
@@ -67,8 +67,9 @@
 // Set pointer for next thread stack.  Reserve 8M for main stack.
 Addr next_thread_stack_base = stack_base - max_stack_size;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end, params->system, pTable);
 }

 void
diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index 19ee32b..f348167 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -81,8 +81,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0x4000L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end, params->system, pTable);
 }

 ArmProcess64::ArmProcess64(ProcessParams *params, ObjectFile *objFile,
@@ -95,8 +96,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0x40L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end, params->system, pTable);
 }

 void
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index a62c1de..451b6a1 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -71,8 +71,9 @@
 // Set up region for mmaps.  Start it 1GB above the top of the heap.
 Addr mmap_end = brk_point + 0x4000L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end, params->system, pTable);
 }

 void
diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc
index fdef2fa..954c8b2 100644
--- a/src/arch/power/process.cc
+++ b/src/arch/power/process.cc
@@ -69,8 +69,9 @@
 // Set up region for mmaps. For now, start at bottom of kuseg space.
 Addr mmap_end = 0x7000L;

-memState = make_shared(brk_point, stack_base, max_stack_size,
- next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+ max_stack_size,  
next_thread_stack_base,

+ mmap_end, params->system, pTable);
 }

 void
diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc
index ce49836..702c77f 100644
--- a/src/arch/riscv/process.cc
+++ b/src/arch/riscv/process.cc
@@ -77,8 +77,9 @@
 const Addr next_thread_stack_base = stack_base - max_stack_size;
 const Addr brk_point = roundUp(image.maxAddr(), PageBytes);
 const Addr mmap_end = 0x4000L;
-memState = make_shared(brk_point, stack_base, max_stack_size,
-next_thread_stack_base, mmap_end);
+memState = make_shared(this, brk_point, stack_base,
+max_stack_size, next_thread_stack_base, mmap_end,  
params->system,

+pTable);
 }

 RiscvProcess32::RiscvProcess32(ProcessParams *params, ObjectFile  
*objFile) :

@@ -89,8 +90,9 @@