Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial mret (from init_supervisor_mode) sends processor to untranslated address #977

Open
talhashahzad12345 opened this issue May 8, 2024 · 0 comments

Comments

@talhashahzad12345
Copy link

I generated tests using target rv64gc

The test has init_supervisor_mode and before that an MEPC setup segment.
In mepc setup, only last 12 bits of mepc are kept which is explained in riscv dv's code with a comment stating that only last 12 bits are kept for supervisor or user mode.

mepc_setup():
   800000164:	00000417          	auipc	s0,0x0
   800000168:	06240413          	addi	s0,s0,98 # 8000001c6 <init>
   80000016c:	1452                	slli	s0,s0,0x34
   80000016e:	9051                	srli	s0,s0,0x34
   800000170:	34141073          	csrw	mepc,s0

If we use mret to return, is it not in machine mode and so mepc should be setup per machine mode and complete address should be kept in it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant