|
|
试图用汇编指令打开一个字符设备模块,代码如下:
{
__asm__("mov %0,%%ecx":"r"(O_RDWR));
__asm__("mov %0,%%ebx":"r"("mydeivce"));
__asm__("movl $0x05,%%eax"::"eax");
__asm__("int $0x80");
__asm__("mov %%eax,%0":"=r"(fd));
}
mydevice是字符设备名
编译出错如下:
[root@sleepjeep code_3]# gcc -c -I/usr/src/linux-2.4.20-8/include usystime_3.c
usystime_3.c: In function `main':
usystime_3.c:43: invalid lvalue in asm statement
usystime_3.c:45: parse error before ')' token
usystime_3.c:43: output operand constraint lacks `='
usystime_3.c:44: output operand constraint lacks `='
usystime_3.c:44: warning: modification by `asm' of read-only location
什么问题呢?
高手指点一下吧,先谢了! |
|