Check this "See MIPS Run" book on porting Linux to MIPS [1]. Since MIPS has becomes RISC-V, it will be an excellent reference to Linux on RISC-V platform [2].
You need to refer to a label in the data section in the lui and ori instructions. The following works for gnu assembler (as):
.data
Array:
.space 80 #Declares that Array will hold 20 integers
...
.text
lui $s0, %hi(Array)
ori $s0, %lo(Array)
lw $s1, 0($s0) # load 1st word of Array
...
The %hi and %lo directives tell the linker what is going on, so that it can put the address of the label "Array" in the machine code. (NOTE: this likely doesn't work for SPIM or MARS.)
[1]https://www.amazon.com/Morgan-Kaufmann-Computer-Architecture...
[2]https://www.eejournal.com/article/wait-what-mips-becomes-ris...
You need to refer to a label in the data section in the lui and ori instructions. The following works for gnu assembler (as):
The %hi and %lo directives tell the linker what is going on, so that it can put the address of the label "Array" in the machine code. (NOTE: this likely doesn't work for SPIM or MARS.)
See this question.
See MIPS Run is the canonical book on MIPS CPUs. This book explains the MIPS instruction set, CPU architecture and how they relate to MIPS Linux.
The PTE base address can be read from the MIPS CP0 Context register (#4).
See chapter 16 of See MIPS Run: Low-level Memory Management and the TLB.
If you want to understand MIPS assembler you should get a copy of See MIPS Run. This book assumes you have a reasonable knowledge of the C language. If you are not familiar with C, there are many books available. Programming in C by Stephen G. Kochan is the first useful looking on I found on Amazon, though I've never read it.
(You might find learning Python to be a bit of a side-track if your goal is to understand how a particular game works.)