2014-01-21 56 views
0

我開始通過查看示例和在線文檔來學習Asm。目前我遇到了一個例子,我下了網絡。GNU Assember'SIREG'錯誤

hat.c 
. 
include hat.h 
. 
. 
hat_create(hat_desc_t* hat) 
{ 
. 
. 
copy_page((void*) hat->va_pd, (void*) page); 
. 
return (page); 
} 
. 

..........................................

hat.h 
. 
NPTE equ 1024 
. 
inline static void 
copy_page(void* src, void* dest) 
{ 
asm volatile 
(
    "cld\n\t" 
    "rep\n\t" 
    "movsl" 
    : 
    : "D" (dest), "S" (src), "c" (NPTE) 
    : "di", "si" <- This where the problem is..... 
); 
} 

的gcc --version

gcc (GCC) 4.6.1 20110627

gcc -fno-builtin -nostdinc -O2 -fomit-frame-pointer -c hat.c -o hat.o

錯誤:無法找到在課堂上 'SIREG',而 '重裝ASM' 寄存器 錯誤:'asm'操作數有不可能的限制

有誰知道如何解決這個錯誤?

回答

0

簡單變化

: 「二」, 「SI」

: 「0」, 「1」

這將解決這個問題。