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

Save ELR_hyp and cpsr in pi 2 blinker 5 #40

Open
Dan12 opened this issue Jan 14, 2019 · 0 comments
Open

Save ELR_hyp and cpsr in pi 2 blinker 5 #40

Dan12 opened this issue Jan 14, 2019 · 0 comments

Comments

@Dan12
Copy link

Dan12 commented Jan 14, 2019

push {r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,lr}

Since we are dealing with the raspberry pi 2 in hypervisor mode I think it is a bit misleading to just save those registers in the irq handler since the actual lr used by eret is ELR_hyp. Additionally, the cpsr register has some important information for conditional instructions that should be saved across the irq handler.

I think adding the following code would be beneficial for users:

  mrs r0, ELR_hyp
  mrs r1, cpsr
  push {r0, r1}
  bl c_irq_handler
  pop {r0, r1}
  msr ELR_hyp, r0 
  msr cpsr, r1

(for context, I was trying to implement context switching for a bare metal os and the lack of state saving caused a few bugs for me 😄)

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