English 中文(简体)
沃尔多斯角的消耗性硬件登记册
原标题:Dump Hardware Registers from Volatile Pointer
  • 时间:2012-01-13 22:07:59
  •  标签:
  • c
  • arm

Saye 我有一个结构,设计成一套可随时改变的硬件登记册。

例如,

typedef struct
{
    int  register1;
    char register2;
    ... (varying sizes, etc) ...
    int  registerX;
} registers_t;

And I m defining regs as a volatile pointer to the base of the

例如,

#define regs (* (volatile registers_t *) ADDR_OF_REGS)

我试图在某个特定时间倾倒垃圾场,将其从存放登记册历史的阵列中拯救出来。

例如,

registers_t register_history[5];

我的理解是,由于我的行为不明确,因此我可以 t/on,使动荡不安的* 趋于一致。

例如, I m trying to do something like the following:

memcpy(&register_history[0], regs, sizeof(registers_t));

在不明确放弃和保存每个个人登记册的情况下,是否有任何办法复制登记?

Thank you for your help.

Edit:

Since I do not have sufficient reputation to answer my question until 8hrs after I posted, the question, I ll post the answer here for now:

Because I know that the registers will not change when I m trying to capture the data, I can cast the ADDR_OF_REGS to void * and use memcpy.

例如,

memcpy(&register_history[0], (void *)ADDR_OF_REGS, sizeof(registers_t));
问题回答

在各个汇编领域使用结构是风险业务。 在记忆/登记员等处点,是一个“完整的领域”。

第二,薄膜只是按顺序阅读登记册,并按顺序复制,在试图与你能够做的架构和肉体做这件事时,没有魔.。 举例来说,如果是32个比方登记册,并且使你能够做得好于我。

例如,复制8 32个借方登记册:

.globl myregcopy
myregcopy:
  push {r4,r5}
  ldmia r0!,{r2-r5}
  stmia r1!,{r2-r5}
  ldmia r0!,{r2-r5}
  stmia r1!,{r2-r5}
  pop {r4,r5}
  bx lr

会 议

myregcopy(base_add_of_registers,base_add_of_destination_ram);

游轮通常使用每条指示4个字,然后向半句和逐字转变,然后停止(根据需要,但《检查守则》已经存在),这样,你就会出血,必须处理这些汇编者的问题。

如果贵方核心拥有64辆客车,你必须用硬件民间器、4个字面或 st或软墙能够/将产生64个轨道转换器,而不是32个轨道交易。 如果登记册的硬件没有说明登记在64个轨道交易的平板上是可以获得的,那么,只有两个注册的登记册中有一个登记在编码上,在汽车上,有32个停车场。 因此,你需要知道,这是否是一个核心,有32辆客车或64辆客车,而且I/O硬件或你掌握的任何设备,是否妥善处理这些交易。 如果《刑法》试图将《刑法》改变为类似内容:

.globl wordcopy
wordcopy:
  ldr r3,[r0],#4
  str r3,[r0],#4
  subs r2,r2,#1
  bne wordcopy
  bx lr

called with

wordcopy(regbase,destmembase,numregs);

如果你不得不使用这一功能,那么不一定要更快、同样或稍微慢,因为可以操作64个比值登记册,而不是32个比值登记册,那么你就不得不使用影响力,以便不进行速度比较,就好了。

不管怎样,你仍然负责假设登记册赢得了变化。 这也是一种风险假设,因为除非你采取一些额外措施,否则你不会隐瞒这一副本需要多长时间。 即便如此,复制时间也可能有所不同。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签