hi
I want to read msr register (IA32_ENERGY_PERF_BIAS(1B0H) ) in assembly with "rdmsr" instruction but have a run time error (Segmentation fault (core dumped)).
I execute my code by root.
-------------------- it's my code -----------------
.file "tst.c" |
.section .rodata
.LC0:
.string "result %u\n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
movq $0,%rax
movq $0,%rdx
movl $0x1b0,%ecx
rdmsr
.cfi_def_cfa_register 6
subq $16, %rsp
movl %ecx, -4(%rbp)
movl $.LC0, %eax
movl -4(%rbp), %edx
movl %edx, %esi
movq %rax, %rdi
movl $0, %eax
call printf
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits