This is the mail archive of the mailing list for the frysk project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Sign extend 32-bit register values and Bug #3055

>> Yao Qi wrote:
>> long in java is 64-bit, and 32-bit register value should be sign
>> extended.  We override Register.get() in Isa to do sign extension for
>> Ia32 and PPC(32-bit platforms).

Andrew> The underlying issue here, though, is that a << Register has-a Type >>
Andrew> and the type is what determines the characteristics of the register's
Andrew> value.  For instance, a program counter might have an unsigned type,
Andrew> while general purpose registers have signed types.  (This would
Andrew> address TomT's question).

Yeah... in my situation I want something pretty simple: I want to know
if a given close() system call failed.  It seems to me that in this
case "something" between my code and the raw registers ought to
realize that close() returns a C 'int' and that this ought to be sign
extended into a java 'long' so that my code sees the correct value in
a platform-neutral way.

I don't really care where this happens; doing it in
Syscall.getReturnCode would suit me fine, and would avoid pushing type
information down to the register interface.  And this would handily
avoid the problem of whether the ISA has signed or unsigned addresses.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]