[Gems-users] Magic Call Inline Assembly Inquiry


Date: Wed, 12 Apr 2006 10:53:17 +1200
From: "Fu'ad W. F. Al Tabba'" <falt004@xxxxxxxxxxxxxxxxx>
Subject: [Gems-users] Magic Call Inline Assembly Inquiry
Hi,

I am trying to compile code using Sun's C Compiler (instead of GNU's) to work with Gems. I am working on porting the inline assembly as described at

http://www.cs.wisc.edu/gems/doc/wiki/moin.cgi/Transactional_Memory


A couple of questions about things I don't really understand regarding the inline assembly used there:-

- Why is register l0 (r16) defined as a clobbered register? From what I can tell the statement sethi %1, %%g0 does not touch that register.

- Why is there an input r defined with a value of 0? It doesn't seem to be used.

- Finally, if anyone is familiar with Sun's C compiler and inline assembly, does the following code make sense (as an equivalent implementation of the magic call code):-

! void NEW_RUBY_MAGIC_CALL(int service)

.inline NEW_RUBY_MAGIC_CALL
    .volatile
    sll %o0, 26, %g0
    .nonvolatile
.end

Brief explanation of my code: Using Sun's inline assembly, I cannot do an equivalent to (service)<<16 . So what I did instead was left shitft it by 26. The sethi command used in the code on the Gem's documentation page basically loads the value (service)<<16 to the top 22 bits of register g0. So This should be equivalent to doing a left shift by 26 (16 + 10) in g0 .

Cheers,
Fuad
[← Prev in Thread] Current Thread [Next in Thread→]
  • [Gems-users] Magic Call Inline Assembly Inquiry, Fu'ad W. F. Al Tabba' <=