Andes Workshop http://forum.andestech.com/ |
|
nop的使用 http://forum.andestech.com/viewtopic.php?f=14&t=535 |
Page 1 of 1 |
Author: | cindy [ Fri Feb 17, 2012 12:43 pm ] |
Post subject: | nop的使用 |
NOP指令對於我們要找bug時有用處。 例如我們想要快速的找出某行C code所在的位址。 或是將指令往後移,填空白等等。 指令為NOP或NOP16,後者為16 bit指令。 下面是例子。 #include <stdio.h> #include <stdlib.h> volatile char variTest = 0; void func(); int main(void) { func(); return EXIT_SUCCESS; } void func () { __asm__ volatile ("nop"); __asm__ volatile ("nop16"); while (!(variTest & 0x08)); __asm__ volatile ("nop"); __asm__ volatile ("nop"); } 產生的指令如下,我發現它都是16bit指令。 Attachment: nop.gif [ 9.19 KiB | Viewed 14519 times ] |
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |