please choosego to mobile | Continue to access the PC version
View: 662118|Reply: 3

H3 coprocessor response problem

[Copy link]

9

threads

27

posts

286

credits

Intermediate member

Rank: 3Rank: 3

credits
286
Published in 2018-4-22 12:56:10 | Show all floors |Read mode
A little background. I'm trying to port RISC OS Open to Orange Pi PC, and later other variants I hope. I've been wasting huge amounts of time trying to track down instability and undefined instruction aborts. Every time the problem seems to originate from coprocessor instructions. It seems to be a random issue, like sometimes a coprocessor isn't ready to accept an instruction so it falls through to an undefined instruction abort. It's maddening!
Does anybody know if the coprocessors (Mostly seems to be MMU and cache related) need some kind of special handling that I'm not aware of?

9

threads

634

posts

4398

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
4398
Published in 2018-4-22 13:29:57 | Show all floors

9

threads

27

posts

286

credits

Intermediate member

Rank: 3Rank: 3

credits
286
 Author| Published in 2018-4-22 19:51:53 from mobile | Show all floors
I considered that, but it's badly off topic. RISC OS has absolutely nothing in common with Linux. Not sure how that would go on a mailing list.

2

threads

3

posts

10

credits

Novice

Rank: 1

credits
10
Published in 2018-6-15 18:45:48 | Show all floors
I have the following code examples, which are working perfectly. I have no issues with CP15. I am about to implement the page table. I will let you know the outcomd.

  1. reset:
  2.     @set VBAR
  3.     ldr   r0, =_start
  4.     mcr   p15, 0, r0, c12, c0, 0
Copy code
  1.         @ Bit 2 is set by U-Boot
  2.     mrc p15, 0, r0, c1, c0, 0
  3.         bic r0,r0, #0x0002                         @ Allow misalignment (Bit 2)
  4.     mcr p15, 0, r0, c1, c0, 0
Copy code
  1. const bool arm_install_handler(unsigned routine, unsigned *vector) {
  2.         unsigned vector_table;
  3.         asm volatile ("mrc p15, 0, %0, c12, c0, 0" : "=r" (vector_table));

  4.         const unsigned vec = (((routine - vector_table) - (unsigned) vector - 0x8) >> 2);

  5.         if (vec & 0xff000000) {
  6.                 return false;
  7.         }

  8.         const unsigned v = (unsigned) vector + vector_table;
  9.         *(unsigned *) v = (0xea000000 | vec);

  10.         invalidate_instruction_cache();
  11.         isb();

  12.         return true;
  13. }
Copy code

You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list