The global pointer is initialized to 01x10008000. The data segment starts at 0x1000000.

I want to load the first word found in the data segment. So I place 0x8000 in the address field of lw.

lw $a0, 8000hex(\$gp)

Apparently 0x8000 in binary is 1000 0000 0000 0000 which is a negative number because the sign bit is 1.

This is the logic my professor provides so that we reach the start of the data segment by subtracting.

But if you convert all the other numbers to binary they also have 1 as the sign bit. So are they all negative?

  • 2
    $\begingroup$ Addresses are unsigned. Offsets are signed. $\endgroup$ – Yuval Filmus Jun 23 '18 at 17:43

As Yuval Filmus said, addresses are unsigned.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.