Understanding assembler instructions
- From: Christian Christmann <plfriko@xxxxxxxx>
- Date: Fri, 28 Oct 2005 12:28:01 +0200
Hi,
currently I'm reading the book "Linkers and Loaders" by Levine.
At the end of each chapter there are some questions, but unfortunately
no solutions.
I solved one exercise and would like to know if it's correct.
This is given:
Loc Hex Symbolic
1000 40 00 03 00 CALL X
1008 7F FF FE ED CALL Y
1010 40 00 00 02 CALL Z
And the question:
In a CALL instruction, the high 2 bits are the instruction code and the
low 30 bits are s signed word offset. What are the hex addresses for
X, Y and Z?
My solution:
1) Determine the instruction format for the SPARC architecture:
Big-endian
2) Translate hex to binary:
40 00 03 00 --> 1000000000000000000001100000000
7F FF FE ED --> 1111111111111111111111011101101
40 00 00 02 --> 1000000000000000000000000000010
3) Extract low 30 bits:
X: 00000000000000000001100000000b = 0x300 ( 768 )
Y: 11111111111111111111011101101b = 0xFFFFEED ( -268435181, I
omitted the first bit because I assumed that it indicates that the number
is negative, correct? )
Z: 00000000000000000000000000010 = 0x2 ( 2 )
Are these answers OK?
Thank you.
Chris
P.S. Is, by any chance, anyone aware of a website providing the solutions
to this book?
.
- Follow-Ups:
- Re: Understanding assembler instructions
- From: Betov
- Re: Understanding assembler instructions
- Prev by Date: Re: OT: I have located Beth - but she's still confuzzled
- Next by Date: Re: Understanding assembler instructions
- Previous by thread: OT: I have located Beth - but she's still confuzzled
- Next by thread: Re: Understanding assembler instructions
- Index(es):