You will load the machine encoding of the instruction at address 0x1004
.
MIPS has a flat memory model; different segments of an executable are mapped / loaded into different parts of a single flat memory address space; it's a Von Neumann architecture where code bytes and instruction bytes are the same thing, and share the same address space.
Code addresses use the same address-space as data addresses. Martin's answer suggests it may be possible to create a MIPS where at least the permissions are different, and of course an embedded MIPS with its code in ROM couldn't modify its instructions with stores. But even then code and data would have to be mapped into different parts of the same physical address space, even if stores to code addresses faulted. Possibly you could build a MIPS where even loads of code addresses faulted, but that's unlikely. Jumps to data addresses might also fault if you disabled execute permission on that region / page.
On a normal MIPS with its instruction in RAM, self-modifying code is possible if you have write+exec permissions configured. (But note that for correctness you would usually need to flush i-cache, which the code in that Q&A isn't doing.)
And BTW, .data
in the asm source really means the .data
section, which the linker eventually links into the data segment of the executable. See What's the difference of section and segment in ELF file format.
The most important point here is that segments of an executable aren't the same thing as x86-style segmented memory. (The terminology has a similar origin, though).