我使用 linux-2.6.31.8 作为我的内核环境。现在我需要对内核中的票证自旋锁进行一些修改。但令我惊讶的是,票证 spinlock.h 文件根本没有被内核编译。我通过添加一些非法的 C 语句和遇到非编译错误来检查这一点。我使用的测试代码如下:
#include <asm/atomic.h>
#include <asm/rwlock.h>
#include <asm/page.h>
#include <asm/processor.h>
#include <linux/compiler.h>
#include <asm/paravirt.h>
test /an invalid statement, but none errors/
/*
* Your basic SMP spinlocks, allowing only a single CPU anywhere
*
* Simple spin lock operations. There are two variants, one clears IRQ's
* on the local processor, one does not.
*
* These are fair FIFO ticket locks, which are currently limited to 256
* CPUs.
*
* (the type definitions are in asm/spinlock_types.h)
*/
#ifdef CONFIG_X86_32
# define LOCK_PTR_REG "a"
# define REG_PTR_MODE "k"
#else
# define LOCK_PTR_REG "D"
# define REG_PTR_MODE "q"
#endif
任何帮助请。谢谢~~