打印

开关中断问题

开关中断问题

各位大侠,怎样开关中断啊?
我包含了<asm/system.h>
编译程序,还是出"undefined reference to 'local_irq_disable'"和
"undefined reference to 'local_irq_enable'"错误。

怎么回事啊?帮帮忙吧。

TOP

是不是程序在用户态没有开关中断的权限啊? 如果要关掉中断应该怎么办?

TOP

你在什么环境下编译的??编译参数是??
redhat9应该没有问题

TOP

能装redhat9真好啊,可惜我电脑硬盘是sata的,死活装不上,郁闷!

TOP

多谢support. RedHat 9 下一个示例文件和编译命令及结果:

#include <asm/system.h>

int main (void)
{
        int i=0;
       
        local_irq_disable();
        i++;
        local_irq_enable();

                return 0;
}

[root@localhost dsp]# gcc -o irq irq.c
In file included from /usr/include/linux/bitops.h:69,
                 from /usr/include/asm/system.h:7,
                 from irq.c:1:
/usr/include/asm/bitops.h:327:2: warning: #warning This includefile is not available on all architectures.
/usr/include/asm/bitops.h:328:2: warning: #warning Using kernel headers in userspace: atomicity not guaranteed

编译命令需要加什么选项?

TOP

当时是在驱动中编译的
用户空间没有用过,google一下在用户空间应该用那个接口吧

TOP