Re: [gem5-users] Getting the virtual address of a specific physical address in x86 se mode

2020-02-14 Thread Jason Lowe-Power
Ah! Of course, sorry about that.

You have to call the function *after* `m5.instantiate()`. The
`m5.instantiate()` function instantiates all of the C++ classes. Only after
that can you call C++ functions.

Cheers,
Jason

On Fri, Feb 14, 2020 at 6:09 AM Muhammad Aamir 
wrote:

> Hi Jason,
>
> thank you for the answer, I just have one more basic question(which might
> seem trivial to you),
>
> How do I correctly initialize the cxxMethods, as I am
> continuously receiving errors while initializing the map function, I also
> created my own simple cxxMethod to check what I was doing and I was
> receiving the same error message.
>
> The error message that i get is as follows:
> "File "build/X86/python/m5/SimObject.py", line 978, in cxx_call
> ccobj = self.getCCClass() if static else self.getCCObject()
>   File "build/X86/python/m5/SimObject.py", line 1625, in getCCObject
> raise RuntimeError("Attempt to instantiate orphan node")
> RuntimeError: Attempt to instantiate orphan node"
>
> An example would be great
>
> Thanks
>
>
> On Thu, 13 Feb 2020 at 20:56, Jason Lowe-Power 
> wrote:
>
>> Hello,
>>
>> You can use the "map" function on the Process SimObject to set a specific
>> virtual to physical mapping. See
>> https://gem5.googlesource.com/public/gem5/+/refs/heads/master/src/sim/Process.py#39
>>
>> After you instantiate the process in your python config script, you can
>> call map() on it and then the mapping will be set up. Then, inside your
>> guest application, when you access that particular virtual address it will
>> go to the physical address that you set in your config file. This should do
>> exactly what you need (if I understand correctly).
>>
>> BTW, this will only work in SE mode. If you need to do this in FS mode,
>> you'll most likely have to write a new kernel driver for your scratchpads
>> (just like if they were real hardware!).
>>
>> Cheers,
>> Jason
>>
>> On Thu, Feb 13, 2020 at 8:40 AM Muhammad Aamir <
>> aamir.sa...@bilkent.edu.tr> wrote:
>>
>>> Hi everyone,
>>>
>>> I have basically initialized some simplememory class as a Scratchpad
>>> memories, and I intend to write to them.
>>> One way that i have figured to access them is using addresses, As I know
>>> once initialized they are assigned some virtual addresses by the
>>> pagetables, and since each virtual address is mapped on to a
>>> physical address and I know where the physical addresses of my scratchpad
>>> can begin from.
>>>
>>> How can I find the virtual address corresponding to that specific
>>> physical address so that I can access it?
>>>
>>> The physical address of where my "new simpememory" begins can be found
>>> like this
>>>
>>> const std::vector 
>>> (thread->getSystemPtr()->getPhysMem().getBackingStore());
>>> const AddrRange (memories[1].range); //where range will give me start 
>>> of my scratchpad memory
>>>
>>>
>>> Can the AddrRange "range" be converted to a virtual address?
>>>
>>>
>>> If there is a better way to write on to the simplememory class,that would 
>>> be great as well.
>>>
>>> Thanks
>>>
>>> ___
>>> gem5-users mailing list
>>> gem5-users@gem5.org
>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>> ___
>> gem5-users mailing list
>> gem5-users@gem5.org
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
> ___
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Re: [gem5-users] Getting the virtual address of a specific physical address in x86 se mode

2020-02-14 Thread Muhammad Aamir
Hi Jason,

thank you for the answer, I just have one more basic question(which might
seem trivial to you),

How do I correctly initialize the cxxMethods, as I am
continuously receiving errors while initializing the map function, I also
created my own simple cxxMethod to check what I was doing and I was
receiving the same error message.

The error message that i get is as follows:
"File "build/X86/python/m5/SimObject.py", line 978, in cxx_call
ccobj = self.getCCClass() if static else self.getCCObject()
  File "build/X86/python/m5/SimObject.py", line 1625, in getCCObject
raise RuntimeError("Attempt to instantiate orphan node")
RuntimeError: Attempt to instantiate orphan node"

An example would be great

Thanks


On Thu, 13 Feb 2020 at 20:56, Jason Lowe-Power  wrote:

> Hello,
>
> You can use the "map" function on the Process SimObject to set a specific
> virtual to physical mapping. See
> https://gem5.googlesource.com/public/gem5/+/refs/heads/master/src/sim/Process.py#39
>
> After you instantiate the process in your python config script, you can
> call map() on it and then the mapping will be set up. Then, inside your
> guest application, when you access that particular virtual address it will
> go to the physical address that you set in your config file. This should do
> exactly what you need (if I understand correctly).
>
> BTW, this will only work in SE mode. If you need to do this in FS mode,
> you'll most likely have to write a new kernel driver for your scratchpads
> (just like if they were real hardware!).
>
> Cheers,
> Jason
>
> On Thu, Feb 13, 2020 at 8:40 AM Muhammad Aamir 
> wrote:
>
>> Hi everyone,
>>
>> I have basically initialized some simplememory class as a Scratchpad
>> memories, and I intend to write to them.
>> One way that i have figured to access them is using addresses, As I know
>> once initialized they are assigned some virtual addresses by the
>> pagetables, and since each virtual address is mapped on to a
>> physical address and I know where the physical addresses of my scratchpad
>> can begin from.
>>
>> How can I find the virtual address corresponding to that specific
>> physical address so that I can access it?
>>
>> The physical address of where my "new simpememory" begins can be found
>> like this
>>
>> const std::vector 
>> (thread->getSystemPtr()->getPhysMem().getBackingStore());
>> const AddrRange (memories[1].range); //where range will give me start 
>> of my scratchpad memory
>>
>>
>> Can the AddrRange "range" be converted to a virtual address?
>>
>>
>> If there is a better way to write on to the simplememory class,that would be 
>> great as well.
>>
>> Thanks
>>
>> ___
>> gem5-users mailing list
>> gem5-users@gem5.org
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
> ___
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Re: [gem5-users] Getting the virtual address of a specific physical address in x86 se mode

2020-02-13 Thread Jason Lowe-Power
Hello,

You can use the "map" function on the Process SimObject to set a specific
virtual to physical mapping. See
https://gem5.googlesource.com/public/gem5/+/refs/heads/master/src/sim/Process.py#39

After you instantiate the process in your python config script, you can
call map() on it and then the mapping will be set up. Then, inside your
guest application, when you access that particular virtual address it will
go to the physical address that you set in your config file. This should do
exactly what you need (if I understand correctly).

BTW, this will only work in SE mode. If you need to do this in FS mode,
you'll most likely have to write a new kernel driver for your scratchpads
(just like if they were real hardware!).

Cheers,
Jason

On Thu, Feb 13, 2020 at 8:40 AM Muhammad Aamir 
wrote:

> Hi everyone,
>
> I have basically initialized some simplememory class as a Scratchpad
> memories, and I intend to write to them.
> One way that i have figured to access them is using addresses, As I know
> once initialized they are assigned some virtual addresses by the
> pagetables, and since each virtual address is mapped on to a
> physical address and I know where the physical addresses of my scratchpad
> can begin from.
>
> How can I find the virtual address corresponding to that specific physical
> address so that I can access it?
>
> The physical address of where my "new simpememory" begins can be found
> like this
>
> const std::vector 
> (thread->getSystemPtr()->getPhysMem().getBackingStore());
> const AddrRange (memories[1].range); //where range will give me start 
> of my scratchpad memory
>
>
> Can the AddrRange "range" be converted to a virtual address?
>
>
> If there is a better way to write on to the simplememory class,that would be 
> great as well.
>
> Thanks
>
> ___
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

[gem5-users] Getting the virtual address of a specific physical address in x86 se mode

2020-02-13 Thread Muhammad Aamir
Hi everyone,

I have basically initialized some simplememory class as a Scratchpad
memories, and I intend to write to them.
One way that i have figured to access them is using addresses, As I know
once initialized they are assigned some virtual addresses by the
pagetables, and since each virtual address is mapped on to a
physical address and I know where the physical addresses of my scratchpad
can begin from.

How can I find the virtual address corresponding to that specific physical
address so that I can access it?

The physical address of where my "new simpememory" begins can be found like
this

const std::vector
(thread->getSystemPtr()->getPhysMem().getBackingStore());
const AddrRange (memories[1].range); //where range will give me
start of my scratchpad memory


Can the AddrRange "range" be converted to a virtual address?


If there is a better way to write on to the simplememory class,that
would be great as well.

Thanks
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users