theandrew168 / derzforth

Bare-metal Forth implementation for RISC-V
MIT License
42 stars 5 forks source link

Dont use 'tp' and 'gp' registers #13

Closed aw closed 2 years ago

aw commented 2 years ago

This PR changes register assignments for IP and RSP to point to s1 and s2 respectively, and changes the saved register assignments for the remaining variable registers (STATE, TIB, etc..).

According to the RISC-V ABI calling convention, registers gp (x3) and tp (x4) should not be used.

I also found the use of s8 in the board files, and changed those to SAVED0 which now points to s10 instead.

We lose two "extra" saved registers with this change, but that probably doesn't matter unless more complex Assembly code is to be written.

aw commented 2 years ago

I realize some work is required to convert certain registers to variables, which would make these changes pointless. We can close this PR in the meantime.

theandrew168 commented 2 years ago

Alright, yea that makes sense. I'm planning to fix the variables here in next few weeks.