From df012f26fa9797896e3f571c81d336bec0a97b98 Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Wed, 16 Mar 2005 10:30:33 -0500 Subject: Fix the bad addr check to check for allowable addresses in the nxm address space arch/alpha/alpha_tru64_process.cc: sim/process.cc: sim/process.hh: Add an address range for the nxm sim/syscall_emul.hh: Check to make sure that if we have an nxm config space that the mmap hasn't grown into it --HG-- extra : convert_revision : e479e5240080ae488080d228bafea488835d6e77 --- arch/alpha/alpha_tru64_process.cc | 4 ++++ sim/process.cc | 1 + sim/process.hh | 11 ++++++++++- sim/syscall_emul.hh | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/alpha/alpha_tru64_process.cc b/arch/alpha/alpha_tru64_process.cc index 22e74cb40..8660cc5c5 100644 --- a/arch/alpha/alpha_tru64_process.cc +++ b/arch/alpha/alpha_tru64_process.cc @@ -877,6 +877,10 @@ class Tru64 { *configptr_ptr = config_addr; configptr_ptr.copyOut(xc->mem); + // Register this as a valid address range with the process + process->nxm_start = base_addr; + process->nxm_end = cur_addr; + return 0; } diff --git a/sim/process.cc b/sim/process.cc index 7111e8733..c18b31da7 100644 --- a/sim/process.cc +++ b/sim/process.cc @@ -89,6 +89,7 @@ Process::Process(const string &nm, } mmap_start = mmap_end = 0; + nxm_start = nxm_end = 0; // other parameters will be initialized when the program is loaded } diff --git a/sim/process.hh b/sim/process.hh index 1ab43cd62..1c6c6b3fb 100644 --- a/sim/process.hh +++ b/sim/process.hh @@ -97,6 +97,10 @@ class Process : public SimObject Addr mmap_start; Addr mmap_end; + // Base of region for nxm data + Addr nxm_start; + Addr nxm_end; + std::string prog_fname; // file name Addr prog_entry; // entry point (initial PC) @@ -159,9 +163,14 @@ class Process : public SimObject bool validDataAddr(Addr addr) { return ((data_base <= addr && addr < brk_point) || +#ifdef FULLSYSTEM ((stack_base - 16*1024*1024) <= addr && addr < stack_base) || +#else + (next_thread_stack_base <= addr && addr < stack_base) || +#endif (text_base <= addr && addr < (text_base + text_size)) || - (mmap_start <= addr && addr < mmap_end)); + (mmap_start <= addr && addr < mmap_end) || + (nxm_start <= addr && addr < nxm_end)); } virtual void syscall(ExecContext *xc) = 0; diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh index 51a075a28..69c17c330 100644 --- a/sim/syscall_emul.hh +++ b/sim/syscall_emul.hh @@ -412,6 +412,10 @@ mmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) // user didn't give an address... pick one from our "mmap region" start = p->mmap_end; p->mmap_end += RoundUp(length, VMPageSize); + if (p->nxm_start != 0) { + //If we have an nxm space, make sure we haven't colided + assert(p->mmap_end < p->nxm_start); + } } if (!(flags & OS::TGT_MAP_ANONYMOUS)) { -- cgit v1.2.3 -- cgit v1.2.3 From f2dd82097263a726888af2a097547f3c6d2d6a03 Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Wed, 16 Mar 2005 18:26:32 -0500 Subject: No need for this ifdef, since the entire process.hh is surounded by an ifndef FULL_SYSTEM --HG-- extra : convert_revision : 81009e5c468eaaee06c83c35f1d05ed2863299a4 --- sim/process.hh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sim/process.hh b/sim/process.hh index 1c6c6b3fb..51d7639ac 100644 --- a/sim/process.hh +++ b/sim/process.hh @@ -163,11 +163,7 @@ class Process : public SimObject bool validDataAddr(Addr addr) { return ((data_base <= addr && addr < brk_point) || -#ifdef FULLSYSTEM - ((stack_base - 16*1024*1024) <= addr && addr < stack_base) || -#else (next_thread_stack_base <= addr && addr < stack_base) || -#endif (text_base <= addr && addr < (text_base + text_size)) || (mmap_start <= addr && addr < mmap_end) || (nxm_start <= addr && addr < nxm_end)); -- cgit v1.2.3