1

我可以从帮助搜索中看到有一个“<port_space>.read”,但我不知道如何找到 CPU 的 <port_space> 名称。

4

1 回答 1

1

port_space attribute of a processor core points to a memory space object that is used for port accesses. You can access to memory space object directly using get/set (for non-architectural access), read/write (for architectural access) for example:

simics> board.mb.cpu0.core[0][0]->port_space 
"board.mb.cpu0.ports_proxy[0][0]"
simics> board.mb.cpu0.ports_proxy[0][0].write 0xcf9 0xff size=1
[board.mb.nb.pci_bus info] sending hot_reset

You can also traverse the memory space to find what is exactly mapped there:

simics> board.mb.cpu0.ports_proxy[0][0].map 
+---------+-------------------+--+------+------+------+----+-----+----+
|     Base|Object             |Fn|Offset|Length|Target|Prio|Align|Swap|
+---------+-------------------+--+------+------+------+----+-----+----+
|-default-|board.mb.port_mem_m|  |   0x0|      |      |    |     |    |
+---------+-------------------+--+------+------+------+----+-----+----+
simics> board.mb.port_mem_m.map 
+----+-----------------+--+------+-------+------+----+-----+----+
|Base|Object           |Fn|Offset| Length|Target|Prio|Align|Swap|
+----+-----------------+--+------+-------+------+----+-----+----+
| 0x0|board.mb.port_mem|  |   0x0|0x10000|      |   0|     |    |
+----+-----------------+--+------+-------+------+----+-----+----+
simics> board.mb.port_mem.map 
+---------+-------------------------------+--+------+------+------+----+-----+----+
|     Base|Object                         |Fn|Offset|Length|Target|Prio|Align|Swap|
+---------+-------------------------------+--+------+------+------+----+-----+----+
|    0x402|board.mb.conf                  |  |   0x0|   0x1|      |   0|     |    |
|    0x510|board.mb.conf                  | 3|   0x0|   0x2|      |   0|     |    |
|    0x511|board.mb.conf                  | 4|   0x0|   0x1|      |   0|     |    |
|    0xcf8|board.mb.nb.bridge.bank.io_regs|  | 0xcf8|   0x4|      |   0|     |    |
|    0xcf9|board.mb.sb.cf9                |  |   0x0|   0x1|      |   0|     |    |
|    0xcfc|board.mb.nb.bridge.bank.io_regs|  | 0xcfc|   0x4|      |   0|     |    |
|    0xcfd|board.mb.nb.bridge.bank.io_regs|  | 0xcfd|   0x2|      |   0|     |    |
|    0xcfe|board.mb.nb.bridge.bank.io_regs|  | 0xcfe|   0x2|      |   0|     |    |
|    0xcff|board.mb.nb.bridge.bank.io_regs|  | 0xcff|   0x1|      |   0|     |    |
|   0xfff0|board.mb.conf                  |  |   0x0|   0x1|      |   0|     |    |
|   0xfff1|board.mb.conf                  | 1|   0x0|   0x1|      |   0|     |    |
|   0xfff2|board.mb.conf                  | 2|   0x0|   0x2|      |   0|     |    |
|   0xfff4|board.mb.shadow                |  |   0x0|   0x1|      |   0|     |    |
|   0xfff5|board.mb.shadow                |  |   0x1|   0x1|      |   0|     |    |
|-default-|board.mb.nb.pci_bus.io_space   |  |   0x0|      |      |    |     |    |
+---------+-------------------------------+--+------+------+------+----+-----+----+
于 2021-10-26T13:35:43.627 回答