For Q2, program binary is loaded by function createObjectFile() 
[src/base/loader/object_file.cc] firstly, then binary image is copied to 
AbstractMemory, see call stack blow:



#0  0x0000003e1e289904 in memcpy () from /lib64/libc.so.6

#1  0x00000000008c942a in AbstractMemory::functionalAccess (this=0x255ae70, 
pkt=0x7fffffffc7e0)

    at build/MIPS/mem/abstract_mem.cc:438

#2  0x00000000008d1069 in SimpleMemory::doFunctionalAccess (this=0x255ae70, 
pkt=0x7fffffffc7e0) at build/MIPS/mem/simple_mem.cc:96

#3  0x00000000008d178e in SimpleMemory::MemoryPort::recvFunctional 
(this=0x1b48560, pkt=0x7fffffffc7e0)

    at build/MIPS/mem/simple_mem.cc:157

#4  0x00000000008b50f9 in MasterPort::sendFunctional (this=0x2175ed0, 
pkt=0x7fffffffc7e0) at build/MIPS/mem/port.cc:118

#5  0x000000000089c763 in CoherentBus::recvFunctional (this=0x2613500, 
pkt=0x7fffffffc7e0, slave_port_id=0)

    at build/MIPS/mem/coherent_bus.cc:450

#6  0x000000000089d0d0 in CoherentBus::CoherentBusSlavePort::recvFunctional 
(this=0x2179960, pkt=0x7fffffffc7e0)

    at build/MIPS/mem/coherent_bus.hh:116

#7  0x00000000008b50f9 in MasterPort::sendFunctional (this=0x26126f8, 
pkt=0x7fffffffc7e0) at build/MIPS/mem/port.cc:118

#8  0x00000000008b85b1 in PortProxy::blobHelper (this=0x2623e48, addr=0, 
p=0x7fffd0020000 "\177ELF\001\001\001", size=8192, cmd=...)

    at build/MIPS/mem/port_proxy.cc:53

#9  0x00000000007b260f in PortProxy::writeBlob (this=0x2623e48, addr=0, 
p=0x7fffd0020000 "\177ELF\001\001\001", size=8192)

    at build/MIPS/mem/port_proxy.hh:107

#10 0x00000000008b9932 in SETranslatingPortProxy::tryWriteBlob (this=0x2623e48, 
addr=4194304,

    p=0x7fffd0020000 "\177ELF\001\001\001", size=580082) at 
build/MIPS/mem/se_translating_port_proxy.cc:114

#11 0x00000000008b99d3 in SETranslatingPortProxy::writeBlob (this=0x2623e48, 
addr=4194304, p=0x7fffd0020000 "\177ELF\001\001\001",

    size=580082) at build/MIPS/mem/se_translating_port_proxy.cc:125

#12 0x000000000067ab01 in ObjectFile::loadSection (this=0x25cf950, 
sec=0x25cf990, memProxy=..., addrMask=18446744073709551615)

    at build/MIPS/base/loader/object_file.cc:73

#13 0x000000000067ab74 in ObjectFile::loadSections (this=0x25cf950, 
memProxy=..., addrMask=18446744073709551615)

    at build/MIPS/base/loader/object_file.cc:89

#14 0x0000000000676c2a in ElfObject::loadSections (this=0x25cf950, 
memProxy=..., addrMask=18446744073709551615)

    at build/MIPS/base/loader/elf_object.cc:419

#15 0x00000000004441d7 in MipsLiveProcess::argsInit<unsigned int> 
(this=0x2623d80, pageSize=8192)

    at build/MIPS/arch/mips/process.cc:82

#16 0x0000000000443dd5 in MipsLiveProcess::initState (this=0x2623d80) at 
build/MIPS/arch/mips/process.cc:72



Fetch/read/write are handled by function AbstractMemory::access(PacketPtr pkt).



I don't understand Q1.


----
        '              Huang He (Henry)
       /-\\            CPU Design and Verification
      /---\'\          Advanced Micro Devices, Inc
     /-----\'`\        AMD Technology Development (Beijing) Co., Ltd.
    /-------\'`,\      Beijing, China
   /---------\' ,`7    O: +(86) 10 62801421  M: +(86) 18616862712
  /-----------\' /
 /-------------\/      [cid:image001.jpg@01CE0E9A.2B553540]   Visit us at: 
Facebook<https://www.facebook.com/AMD> | amd.com<http://www.amd.com/>


-----Original Message-----
From: gem5-users-boun...@gem5.org [mailto:gem5-users-boun...@gem5.org] On 
Behalf Of Zheng Wu
Sent: Wednesday, July 10, 2013 8:04 AM
To: gem5 users mailing list
Subject: [gem5-users] CPU Instruction Execution



Hi All,



I am trying to understand the source code. I want to know where in the code 
does the CPUs execute instructions.



I am currently looking at:



                - src/cpu/base.hh

                - src/cpu/thread_context.hh

                - src/cpu/cpuevent.hh





Q1: Shouldn't there be some kind of queue for instructions or some program 
counter somewhere?

Q2: where is the code that reads the program binary and pass the instruction to 
the cpu?



Any comments are much appreciated!!



Best Regards,

Zheng Wu

_______________________________________________

gem5-users mailing list

gem5-users@gem5.org<mailto:gem5-users@gem5.org>

http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


<<inline: image001.jpg>>

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

Reply via email to