Why does asm("mov 0x12345678, %ax") cause a seg fault?
I'm tinkering with assembly and can't understand why this is happening. I hope someone can explain it for me.
I have a simple c++ program. I added a line with asm("mov 0x12345678, %ax") so I can find that part in the assembly code.
If I compile then run it with gdb, it encounters a seg fault at XYZ. If I "objdump -d a.out > out.s" and look for XYZ -- guess what? that's the line where my mov statement is, not after. I don't think the following instruction would be affected by this ("movq -32(%rbp), %rax"), but it's not faulting on that line, it's faulting on the 0x12345678 line. I've tried %rax, %eax, %bx, %rbx, etc -- all fault. BTW, this is a 64-bit linux target...
Any Ideas?
- Florian


LinkBack URL
About LinkBacks




Reply With Quote





Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum