1.1 --- a/stage2/irq.c Thu Feb 25 22:28:24 2016 +0100
1.2 +++ b/stage2/irq.c Thu Feb 25 23:21:19 2016 +0100
1.3 @@ -62,7 +62,6 @@
1.4 void irq_init()
1.5 {
1.6 timer_init_irq();
1.7 - handle_error_level();
1.8 init_interrupts();
1.9 enable_interrupts();
1.10 }
1.11 @@ -102,20 +101,22 @@
1.12
1.13 void tlb_handle()
1.14 {
1.15 - u32 context, virtual, physical;
1.16 + u32 asid, virtual, physical;
1.17
1.18 /* Obtain the bad virtual address. */
1.19
1.20 asm volatile(
1.21 - "mfc0 %0, $4\n" /* CP0_CONTEXT */
1.22 - : "=r" (context)
1.23 + "mfc0 %0, $10\n" /* CP0_ENTRYHI */
1.24 + "nop\n"
1.25 + : "=r" (virtual)
1.26 );
1.27 -
1.28 +
1.29 /* Obtain a virtual address region with 8KB resolution. */
1.30 -
1.31 - virtual = (context & 0x007ffff0) << 9;
1.32 -
1.33 - /* The appropriate physical address depends on the current task. */
1.34 +
1.35 + asid = virtual & 0xff;
1.36 + virtual = virtual & 0xffffe000;
1.37 +
1.38 + /* The appropriate physical address should depend on the current task. */
1.39
1.40 physical = virtual;
1.41
1.42 @@ -123,6 +124,6 @@
1.43 Request a physical region mapping two 4KB pages.
1.44 Pages employ C=3, dirty, valid, with the task number as the ASID.
1.45 */
1.46 -
1.47 - map_page(virtual, physical, 4 * 1024, 0x1f, 0);
1.48 -}
1.49 +
1.50 + map_page(virtual, physical, 4 * 1024, 0x1e, asid);
1.51 +}