cpuid 的使用方法
来源:互联网 发布:剑灵天女捏脸图文数据 编辑:程序博客网 时间:2024/06/06 01:03
.section .dataoutput: .ascii "the processor vendor id is 'XXXXXXXXXXXX'\n".section .text.globl _start_start:movl $0,%eaxcpuidmovl $output,%edimovl %ebx,28(%edi)movl %edx,32(%edi)movl %ecx,36(%edi)movl $4,%eaxmovl $1,%ebxmovl $output,%ecxmovl $42,%edxint $0x80movl $1,%eax;movl $0,%ebxint $0x80
1:.ascii
The .ascii declarative is used to declare a text string using ASCII characters.
The string elements are: predefined and placed in memory, with the starting memory location denoted by the label output.
The x’s are used as placeholders in the memory area reserved for the data variable.
When the vendor ID string is extracted from the processor, it will be placed in the data at those memory locations
2:cpuid
movl $0, %eaxcpuidThe zero value in EAX defines the CPUID output option (the Vendor ID string in this case).
cpuid 的使用方法
cpuid 指令由 eax 寄存器获得输入,执行 cpuid 指令前,将功能号传给 eax 寄存器:
输入:
- eax
输出:
- eax:最大的基本功能号
- ebx:"Genu"
- edx: "ineI"
- ecx:"ntel"
movl $output, %edimovl %ebx, 28(%edi)movl %edx, 32(%edi)movl %ecx, 36(%edi)
movl $4,%eaxmovl $1,%ebxmovl $output,%ecxmovl $42,%edxint $0x801:This program uses a Linux system call (int $0x80) to access the console display from the Linux kernel。
2:To access these kernel functions, you must use the int instruction code, which generates a software:interrupt, with a value of 0x80.
3: The specific function that is performed is determined by the value of the EAX register.
❑ EAX contains the system call value.
❑ EBX contains the file descriptor to write to.
❑ ECX contains the start of the string.
❑ EDX contains the length of the string.
❑ EAX contains the system call value.
❑ EBX contains the file descriptor to write to.
❑ ECX contains the start of the string.
❑ EDX contains the length of the string.
movl $1,%eax;movl $0,%ebxint $0x80
1:By using system call 1 (the exit function), the program is properly terminated, and returns to the command prompt.
2:The EBX register contains the exit code value returned by the program to the shell.
This can be used to produce different results in a shell script program, depending on situations within the assembly language program.
A value of zero indicates the program executed successfully.
阅读全文
0 0
- cpuid 的使用方法
- CPUID 指令的使用
- CPUID 指令的使用
- CPUID
- CPUID
- 抓住飘忽不定的CPUID
- Intel CPU的CPUID指令
- Intel CPU的CPUID指令
- 应用程序获得ARM的cpuid
- Intel CPU的CPUID指令
- ccpuid:CPUID信息模块。范例:显示所有的CPUID信息
- 一个全面获取Intel CPUID的代码
- CPUID与Cache信息的获取
- experiment : 逆向使用cpuid指令的函数
- 在控制台查看CPUID的命令
- INTEL处理器识别和CPUID指令(一) CPUID指令与状态寄存器的演变
- Linux下C编程 -- 得到系统的CPU信息(cpuid)
- 关于wmi获取cpuid、硬盘id的准确性
- mysql中insert into select from的使用
- 不用循环数组求和---京东金融面试
- String与StringBuilder以及StringBuffer的比较
- 基于STM32F103的超声波测距
- Beijing 2008 HDU
- cpuid 的使用方法
- 【Linux】子进程的异步等待方式
- 中国剩余定理
- 内存管理笔记(分页,分段,逻辑地址,物理地址与地址转换方式)
- OFDM中的信道估计Channel Estimation
- 练习赛1(补题)
- python_selenium(sn)
- 数学问题——割圆法求π的近似值
- FTP