Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Bus Error

srimks
New Contributor II
403 Views
Hello,

I have generated .S file from .cc using ICC-v11.0 on Linux x86_64 for Xeon 5345 processor which has reference as below (please emphasize on words in blocks) -

(A)-------------------.S file one of the inner section -----------------------------------

..B1.3: # Preds ..B1.10 ..B1.2
..LN7:
.loc 1 72
movsd 208(%rsp,%r12,8), %xmm0 #72.30
movsd _2il0floatpacket.1(%rip), %xmm1 #72.30
call fmod #72.30
# LOE rbx rbp r12 r13 r14 r15 xmm0
..B1.15: # Preds ..B1.3
movsd %xmm0, 80(%rsp) #72.30
# LOE rbx rbp r12 r13 r14 r15
..B1.4: # Preds ..B1.15
..LN9:
movsd 80(%rsp), %xmm0 #72.15
call sin #72.15
# LOE rbx rbp r12 r13 r14 r15 xmm0
..B1.16: # Preds ..B1.4
movaps %xmm0, %xmm9 #72.15
# LOE rbx rbp r12 r13 r14 r15 xmm9
..B1.5: # Preds ..B1.16
..LN11:
.loc 1 73
movsd 80(%rsp), %xmm0 #73.25
movsd %xmm9, 88(%rsp) #73.25
call cos #73.25
# LOE rbx rbp r12 r13 r14 r15 xmm0
..B1.17: # Preds ..B1.5
movsd 88(%rsp), %xmm9 #
# LOE rbx rbp r12 r13 r14 r15 xmm0 xmm9
..B1.6: # Preds ..B1.17
..LN13:
movsd _2il0floatpacket.2(%rip), %xmm15 #73.21
..LN15:
.loc 1 79
movslq (%r13), %r10 #79.20
..LN17:
.loc 1 84
movss (%rbx,%r15), %xmm7 #84.30
cvtps2pd %xmm7, %xmm13 #

.........................The end of .S file section ........................................................................................
ret #112.1
.align 16,0x90
..___tag_value__Z7hellostatePA3_fPA3_KfPA2048_Kii.22: #
# LOE
------------------------and start of rodata section as below...............................................................
# mark_end;
.type _Z7hellostatePA3_fPA3_KfPA2048_Kii,@function
.size _Z7hellostatePA3_fPA3_KfPA2048_Kii,.-_Z7hellostatePA3_fPA3_KfPA2048_Kii
.LN_Z7hellostatePA3_fPA3_KfPA2048_Kii:
.data
.file 2 "structs.h"
.file 3 "typedefs.h"
# -- End _Z7hellostatePA3_fPA3_KfPA2048_Kii
.section .rodata, "a"
.align 8
.align 8
_2il0floatpacket.1:
.long 0x54442d18,0x401921fb
.type _2il0floatpacket.1,@object
.size _2il0floatpacket.1,8
.align 8
_2il0floatpacket.2:
.long 0x00000000,0x3ff00000
.type _2il0floatpacket.2,@object
.size _2il0floatpacket.2,8
.data
.section .note.GNU-stack, ""
---

Above .S asm output file of .cc has been used to write GNU-syntax Inline asm code as below (please refer XXXX & YYYY) -
---
movsd 208(%rsp,%r12,8), %xmm0
movsd XXXX(%rip), %xmm1
call fmod
movsd %xmm0, 80(%rsp)
movsd 80(%rsp), %xmm0
call sin
movaps %xmm9, %xmm0
movsd 80(%rsp), %xmm0
movsd %xmm9, 88(%rsp)
call cos
movsd 88(%rsp), %xmm9
movsd YYYY (%rip), %xmm15
movslq (%r13), %r10
movss (%rbx,%r15), %xmm7
cvtps2pd %xmm7, %xmm13
....................................................

The above Inline asm has been written w/o XXXX(_2il0floatpacket.1) & YYYY(_2il0floatpacket.2), which has compiled sucessfully using ICC-v11.0 but during execution/linking it gives "Bus error" problem. (Maybe, the CPU is not been efficiently instructed by software/program to either READ or WRITE a specific physical memory address.)

Knowing the reason for "Bus error" as stated above, I think not including nor calling both offsets _2il0floatpacket.1 & _2il0floatpacket.2 in in place of XXXX & YYYY respectively of Inline-asm above code might have been the reason of having "Bus error".

I am not aware how to call or include both offsets _2il0floatpacket.1 & _2il0floatpacket.2 in Inline-asm code for XXXX & YYYY offset position respectively.

Please suggest.

~BR
0 Kudos
3 Replies
levicki
Valued Contributor I
403 Views
Instead of XXXX and YYYY you have to refer to two static (or global) const double variables which you will initialize with the proper values.

0 Kudos
srimks
New Contributor II
403 Views
Quoting - Igor Levicki
Instead of XXXX and YYYY you have to refer to two static (or global) const double variables which you will initialize with the proper values.


I think you are correct as I had the same thing in mind while seeing it's .S from .cc which you can also check by refering it's rodata section above.

But to precise, could you help me how to address XXXX & YYYY calls considering above Inline asm as an example or with your any example.

Thanks for your important time & sugestions.

Looking forward.

~BR
0 Kudos
srimks
New Contributor II
403 Views
Quoting - Igor Levicki
Instead of XXXX and YYYY you have to refer to two static (or global) const double variables which you will initialize with the proper values.

Igor,

It's not needed. I made it work finally.

Will submit soon an article for Intel developers & Users - How to write Inline GNU-syntax Assembly code and optimize further for best uses of SSE registers of MCA (Multi-core Architecture)?

Thanks for your time & inputs.

~BR
Mukkaysh Srivastav
0 Kudos
Reply