|
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.
- reset:
- @set VBAR
- ldr r0, =_start
- mcr p15, 0, r0, c12, c0, 0
Copy code- @ Bit 2 is set by U-Boot
- mrc p15, 0, r0, c1, c0, 0
- bic r0,r0, #0x0002 @ Allow misalignment (Bit 2)
- mcr p15, 0, r0, c1, c0, 0
Copy code- const bool arm_install_handler(unsigned routine, unsigned *vector) {
- unsigned vector_table;
- asm volatile ("mrc p15, 0, %0, c12, c0, 0" : "=r" (vector_table));
- const unsigned vec = (((routine - vector_table) - (unsigned) vector - 0x8) >> 2);
- if (vec & 0xff000000) {
- return false;
- }
- const unsigned v = (unsigned) vector + vector_table;
- *(unsigned *) v = (0xea000000 | vec);
- invalidate_instruction_cache();
- isb();
- return true;
- }
Copy code
|
|