On Wed, Sep 19, 2012 at 6:24 AM, shuchang <[email protected]> wrote:
> Hi all,
>
> I want to load the memory data in the cache. So I modify the
> cacheController.cpp
> file like this in CacheController::cache_insert_cb(void *arg)
>
> int exception;
> PageFaultErrorCode pfec;
> W64 my_addr = queueEntry->request->get_virtual_address();
> int my_id = queueEntry->request->get_threadid();
> Context& ctx = contextof(my_id);
> int mmio;
> ctx.check_and_translate(my_addr, 1, 0, 0, exception, mmio, pfec);
> if (exception == 0)
> my_loadvirt(queueEntry->request);
>
> However, my_loadvirt() errors when it was called.
>
> In above code, if you are using multiple cores, instead of using
'get_threadid()' use 'get_coreid()' function. Because for multicore, each
core's theradid will be 0. Are you running SMT + SMP model?
> my_loadvirt() function is defined in cacheController.h like this:
>
> -------------------------------------
> typedef struct {
> W64 old_data[8];
> W64 new_data[8];
> } my_data;
>
> void my_loadvirt(MemoryRequest* request) {
> W64 my_addr = request->get_virtual_address();
> int my_id = request->get_threadid();
> my_data mydata;
>
> mydata.old_data[0] = contextof(my_id).loadvirt(my_addr, 3);
>
> my_data_cache[my_id].insert(std::pair<Waddr, my_data>(my_addr,
> mydata));
> }
> ------------------------------------------
>
>
>
> I have several problem related:
>
> 1. It is said that Context::loadphys() should *not* be used to load memory
> data
> in QEMU, why? (Must I use loadvirt() so as to do this?)
>
Yes, loadphys is just to load from host memory area not from VM's memory
area.
> 2. I insert the virtual address to the request when it is initialized. Why
> it
> errors when loadvirt() function is called?
>
You might have to check that bug I mentioned earlier.
> 3. loadvirt() can only load 8-byte data (W64), while a cache line is
> actually
> 64B, so I need to load 8 consecutive data. Assuming that the first 8B use
> my_address, so the next 8B needed is (my_address + 8), am I right?
>
> Yes. Instead of blindly adding 8 you first create the address for first
byte in cache line. Because virtual-addr for memory request can be any
byte/word/.. within a cache line so make sure that you load correct 8
entries.
- Avadh
Sorry for such a long email, but I am newer to marss, and I am blocked here
> for
> a long time.
>
> Regards,
> Shuchang
>
>
> _______________________________________________
> http://www.marss86.org
> Marss86-Devel mailing list
> [email protected]
> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel