标签: scratch-memory

从C访问便笺式存储器

这可能是一个异国情调的问题,但我希望有人能帮助我一点;).我想执行标准的C程序,但是,在程序执行期间的某个时刻,我希望执行存储在本地便笺式RAM中的一定数量的指令.暂存器内存可供所有进程访问.让我们假设这个本地内存从地址0x80000000开始,我将它集成在下面的C代码片段中

int main {
int a=1;
int b=2;
int c=3;    

c = a + b;

%goto address 0x80000000 and execute three instructions before continuing
%program execution here 

return(0);
Run Code Online (Sandbox Code Playgroud)

}

假设main加载到0x40000000,程序计数器将经历以下阶段

0x40000000    a=5; 
0x40000004    b=2; 
0x40000008    c=1;  
0x4000000C    c=a+b;
0x80000000    first instruction in the local scratch pad
0x80000004    second instruction in the local scratch pad
0x80000008    third instruction in the local scratch pad  
0x40000010    return(0);
Run Code Online (Sandbox Code Playgroud)

有人知道如何做到这一点?我是否需要使用汇编程序跳转指令或是否有更优雅的东西.

非常感谢,安迪

c assembly scratch-memory

5
推荐指数
2
解决办法
778
查看次数

标签 统计

assembly ×1

c ×1

scratch-memory ×1