Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
361 views
in Technique[技术] by (71.8m points)

riscv - How can I load the absolute address of a symbol larger than 0x7FFFFFFF in RiscV64 assembly

I am writing a kernel and I need to self relocate above 0x7FFFFFFF. To do that, I need to refer, using absolute addressing, to the beginning and end of my kernel and to a symbol, where execution continues after the relocation. I have been unable to figure out any way to do this. Can it be done? Is there a workaround?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The only way I found was to take the load address and subtract this from the destination address. You can then add this offset to any relative address to get the absolute address.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.7k users

...