Quoting "Maciej W. Rozycki" <email@example.com>:
> > physical memory starting at address 0. Head.S then jumps to the 32-bit
> part of
> > the xkphys address, which happens to be arranged so that it matches the
> > (next instruction) address in kseg0.
> Just see how these virtual addresses map to physical ones.
According to my current understanding, the base of each of 8 segments in xkphys
maps to the start of physical memory, so offset 0 in kseg0 should be the same
data as at offset 0 of the a800...0000 segment in xkphys. So, if I load code
starting at offset 0 in xkphys, I should be able to jump to the 32-bit part of
the xkphys address and end up at the same offset in kseg0, provided the target
address is sign-extended properly.
The actual difficulty I'm having is that the address my code is loading at is
computed at link time by adding the xkphys base to the LOADADDRESS value using
mips64-linux-objcopy. I haven't quite worked out the address math yet to make
the code in xkphys and kseg0 have the same offsets. Objcopy seems to have some
non-obvious rules for doing address calculations, IE objcopy using
0xa800000000000000 + 0x20004000
gives something close to (not near my MIPS system atm)
So, I'm thinking constructing the address in a register might be easier for now.
It does, thanks.
Erik J. Green