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

what does unimp a0 a1 mean? #14

Closed
XiaPZ opened this issue Nov 23, 2018 · 5 comments
Closed

what does unimp a0 a1 mean? #14

XiaPZ opened this issue Nov 23, 2018 · 5 comments

Comments

@XiaPZ
Copy link

XiaPZ commented Nov 23, 2018

I am reading fsbl/main.c, and I see some code at line 404-424:

int slave_main(int id, unsigned long dtb)
{
  // Wait for the DTB location to become known
  while (!dtb_target) {}

  //wait on barrier, disable sideband then trap to payload at PAYLOAD_DEST
  write_csr(mtvec,PAYLOAD_DEST);

  register int a0 asm("a0") = id;
#ifdef SKIP_DTB_DDR_RANGE
  register unsigned long a1 asm("a1") = dtb;
#else
  register unsigned long a1 asm("a1") = dtb_target;
#endif
  // These next two guys must get inlined and not spill a0+a1 or it is broken!
  Barrier_Wait(&barrier, NUM_CORES);
  ccache_enable_ways(CCACHE_CTRL_ADDR,14);
  asm volatile ("unimp" : : "r"(a0), "r"(a1));

  return 0;
}

What does asm volatile ("unimp" : : "r"(a0), "r"(a1)); mean? It sinces there is no unimp in riscv specs.

@jim-wilson
Copy link
Contributor

jim-wilson commented Nov 23, 2018 via email

@XiaPZ
Copy link
Author

XiaPZ commented Nov 24, 2018

@jim-wilson that is clear, thanks a lot for your reply

@XiaPZ XiaPZ closed this as completed Nov 24, 2018
@palmer-dabbelt
Copy link
Contributor

@decentsheep are you seeing a bug around here? The code you listed is horrible but usually works.

@XiaPZ
Copy link
Author

XiaPZ commented Nov 27, 2018

@palmer-dabbelt no bug yet, I am just reading the source code

@MarcKarasek
Copy link

Is there a reason mtvec is used to write the PAYLOAD_DEST and then a trap (unimp) is used to jump to this address for each hart? Instead of just jumping to it like from ZSBL -> FSBL??

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

4 participants