在TI相关技术文档的内存章节有提到以下内容:
Segments are always a power-of-2 size and start on a corresponding power-of-2 boundary.
这段的意思是分配的内存区的起始地址和内存大小都必须是2次幂(字节)?这里的corresponding怎么理解?如果不是2次幂,会有什么问题?
Nancy Wang:
请贴出该技术文档看一下。
user6466004:
回复 Nancy Wang:
Multicore Shared Memory Controller (MSMC) for KeyStone Devices User's Guide(sprugw7a).pdf
在这个文档里面的2.2.3 Memory Protection章节,具体内容为:
Segments are always a power-of-2 size and start on a corresponding power-of-2
boundary. Thus, a 4KB segment always starts on a 4K boundary, and a 4GB segment
corresponds to the entire 32-bit address space.
Nancy Wang:
回复 user6466004:
是的,就是你理解的意思。
corresponding就是4KB segment always starts on a 4K boundary.
segment size(SEGSZ)必须参照以下表格配置,如何不是2次幂?
user6466004:
回复 Nancy Wang:
corresponding的意思是起始地址必须是相应Segment size的整数倍吗?
Nancy Wang:
回复 user6466004:
我再确认一下给你答复。
另外你上面提到的不是二次幂是指下文的意思吗?
If an address matches multiple MPAXH registers (overlapping segment descriptors), the highest numbered MPAX register-pair is selected (that is, if the address matches BADDR in MPAXH5 and in MPAXH2, MPAXH5 is selected). Using this priority-based matching behavior, multiple MPAX entries can be programmed for overlapping segments to achieve either non-power-of-two sized segments or subsegments with different memory protection (and/or extension) parameters.
user6466004:
回复 Nancy Wang:
segment size为非二次幂的问题是我之前理解错误,经你指点后,暂时没疑问。我的疑问主要是:
1. corresponding的理解,是不是起始地址必须是相应Segment size的整数倍?
2. 起始地址是否必须为2次幂字节?
3. 如果起始地址不是Segment size的整数倍,会出现什么问题?
Nancy Wang:
回复 user6466004:
是的,起始地址必须是Segment size的整数倍。
不是整数倍的情况,建议可以测试看一下。