文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>linux-2.4到2.6的一个小变化

linux-2.4到2.6的一个小变化

时间:2010-11-17  来源:jinglexy

刚开始编写jinix时,bitops.h使用的linux-2.4.18代码(简单修改),
贴部分代码:
/**
 * __set_bit - Set a bit in memory
 * @nr: the bit to set
 * @addr: the address to start counting from
 *
 * Unlike set_bit(), this function is non-atomic and may be reordered.
 * If it's called on the same region of memory simultaneously, the effect
 * may be that only one operation succeeds.
 */
static __inline__ void __set_bit(int nr, volatile void * addr)
{
 __asm__(
  "btsl %1,%0"
  :"=m" (ADDR)
  :"Ir" (nr));
}
最近定位jinix其中一个bug,发现这个函数并没有起作用,和手上2.6.24内核比较一下,
它的定义如下:
static __inline__ void __set_bit(int nr, volatile void * addr)
{
 __asm__(
  "btsl %1,%0"
  :"+m" (ADDR)
  :"Ir" (nr));
}
也就是ADDR内存属性由‘=m’只写改成了‘+m’可读可写,
上面的代码在gcc-3.4.6+binutils-2.18 执行都正常,
换了gcc-4.4.4+binutils-2.20.1就挂了。
the fuck source code!!
 
相关阅读 更多 +
排行榜 更多 +
奥丘树海之下小米服手游下载

奥丘树海之下小米服手游下载

角色扮演 下载
网络天才国际服手游下载

网络天才国际服手游下载

休闲益智 下载
御剑红尘手游官方版下载

御剑红尘手游官方版下载

角色扮演 下载