当前位置: 技术问答>linux和unix
Linux-2.6.11内联汇编指令stap
来源: 互联网 发布时间:2017-05-12
本文导语: 在Linux-2.6.11的includeasm-s390smp.h中读到如下一段代码: extern __inline__ __u16 hard_smp_processor_id(void) { __u16 cpu_address; __asm__ ("stap %0n" : "=m" (cpu_address)); return cpu_address; } 汇编语句: ...
在Linux-2.6.11的includeasm-s390smp.h中读到如下一段代码:
汇编语句:
中的stap指令没有找到出处,虽然从代码可以大致看出意思是读取processor id到cpu_address变量,
但还是想学习下“stap指令”到底是怎么用的?哪位大大可以帮到我吗?谢谢了先!
extern __inline__ __u16 hard_smp_processor_id(void)
{
__u16 cpu_address;
__asm__ ("stap %0n" : "=m" (cpu_address));
return cpu_address;
}
汇编语句:
__asm__ ("stap %0n" : "=m" (cpu_address));
中的stap指令没有找到出处,虽然从代码可以大致看出意思是读取processor id到cpu_address变量,
但还是想学习下“stap指令”到底是怎么用的?哪位大大可以帮到我吗?谢谢了先!
|
这是s390处理器的汇编指令吧,找s390处理器用户手册查.
|
查了下,是IBM Enterprise Systems Architecture/390芯片的指令。
可参考链接:
http://www-947.ibm.com/support/entry/portal/search_results?sn=spe&q=ESA/390%20Principles%20of%20Operation&filter=language:en
下载手册:ESA/390 Principles of Operation (SA22-7201-08)
STORE CPU ADDRESS
STAP D(B) [S]
┌────────────────┬────┬────────────┐
│ 'B212' │ B │ D │
└────────────────┴────┴────────────┘
16 2 31
The 16-bit unsigned binary integer by which this
CPU is identified in a multiprocessing configuration
is stored at the halfword location designated
by the second-operand address.
Special Conditions
The operand must be designated on a halfword
boundary; otherwise, a specification exception is
recognized.
Condition Code: The code remains unchanged.
Program Exceptions:
Access (store, operand 2)
Privileged operation
Specification
可参考链接:
http://www-947.ibm.com/support/entry/portal/search_results?sn=spe&q=ESA/390%20Principles%20of%20Operation&filter=language:en
下载手册:ESA/390 Principles of Operation (SA22-7201-08)
STORE CPU ADDRESS
STAP D(B) [S]
┌────────────────┬────┬────────────┐
│ 'B212' │ B │ D │
└────────────────┴────┴────────────┘
16 2 31
The 16-bit unsigned binary integer by which this
CPU is identified in a multiprocessing configuration
is stored at the halfword location designated
by the second-operand address.
Special Conditions
The operand must be designated on a halfword
boundary; otherwise, a specification exception is
recognized.
Condition Code: The code remains unchanged.
Program Exceptions:
Access (store, operand 2)
Privileged operation
Specification