//
LogF("Moving to arch-independent init\n");
+ #if PLATFORM_is_tegra2
+ System_Init("Acess2.armv7.bin /Acess=initrd: -VTerm:Video=Tegra2Vid");
+ #else
System_Init("Acess2.armv7.bin /Acess=initrd: -VTerm:Video=PL110");
-// System_Init("/Acess=initrd:");
+ #endif
+// System_Init("Acess2.armv7.bin /Acess=initrd:");
//TODO:
LogF("End of kmain(), for(;;) Threads_Sleep();\n");
for(;;)
#define FRACTAL(table1, addr) ((table1)[ (0xFF8/4*1024) + ((addr)>>22)])
#define USRFRACTAL(addr) (*((Uint32*)(0x7FDFF000) + ((addr)>>22)))
#define TLBIALL() __asm__ __volatile__ ("mcr p15, 0, %0, c8, c7, 0" : : "r" (0))
-#define TLBIMVA(addr) __asm__ __volatile__ ("mcr p15, 0, %0, c8, c7, 1" : : "r" (addr))
+#define TLBIMVA(addr) __asm__ __volatile__ ("mcr p15, 0, %0, c8, c7, 1;dsb;isb" : : "r" ((addr)&~0xFFF):"memory")
+#define DCCMVAC(addr) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 1" : : "r" ((addr)&~0xFFF))
// === PROTOTYPES ===
void MM_int_GetTables(tVAddr VAddr, Uint32 **Table0, Uint32 **Table1);
if( (*desc & 3) == 1 ) LEAVE_RET('i', 1);
if( pi->PhysAddr == 0 ) {
*desc = 0;
- TLBIMVA(VAddr & 0xFFFFF000);
+ TLBIMVA( VAddr );
+ DCCMVAC( (tVAddr) desc );
+ TLBIALL();
LEAVE('i', 0);
return 0;
}
if( pi->bShared) *desc |= 1 << 10; // S
*desc |= (pi->AP & 3) << 4; // AP
*desc |= ((pi->AP >> 2) & 1) << 9; // APX
- TLBIMVA(VAddr & 0xFFFFF000);
+ TLBIMVA( VAddr );
+ TLBIALL();
+ DCCMVAC( (tVAddr) desc );
LEAVE('i', 0);
return 0;
}
tMM_PageInfo pi;
if( MM_int_GetPageInfo(VAddr, &pi) ) return ;
-
if( pi.PhysAddr == 0 ) return;
MM_DerefPhys(pi.PhysAddr);
memcpy(tmp_page, (void*)sp, 0x1000);
MM_FreeTemp( (tVAddr) tmp_page );
}
-
+
MM_FreeTemp( (tVAddr)table );
}
MM_FreeTemp( (tVAddr)new_lvl1_1 );
MM_FreeTemp( (tVAddr)new_lvl1_2 );
+// Log("MM_Clone: ret = %P", ret);
+
return ret;
}
tst r1, r1
mcrne p15, 0, r1, c2, c0, 0 @ Set TTBR0 to r0
mov r1, #0
- mcrne p15, 0, r1, c8, c7, 0 @ Invalidate all (HACK! But it fixes things)
+ mcrne p15, 0, r1, c8, c7, 0 @ TLBIALL - Invalidate all
@ Restore SP
mov sp, r0
.section .rodata
csProc_CloneInt_NewTaskMessage:
- .asciz "New task"
+ .asciz "New task PC=%p, R4=%p, sp=%p"
+csProc_CloneInt_OldTaskMessage:
+ .asciz "Parent task PC=%p, R4=%p, SP=%p"
next->SavedState.IP, next->SavedState.SP, next->MemState.Base,
next->SavedState.UserSP
);
+
Log("Requested by %p", __builtin_return_address(0));
gpCurrentThread = next;
.section .init
interrupt_vector_table:
ivt_reset: b _start @ 0x00 Reset
-ivt_undef: b . @ 0x04 #UD
+ivt_undef: b Undef_Handler @ 0x04 #UD
ivt_svc: b SVC_Handler @ 0x08 SVC (used to be called SWI)
ivt_prefetch: b PrefetchAbort @ 0x0C Prefetch abort
ivt_data: b DataAbort @ 0x10 Data abort
mrc p15, 0, r0, c1, c0, 0
orr r0, r0, #1
orr r0, r0, #1 << 23
+ mvn r1, #1 << 2
+ and r0, r0, r1
mcr p15, 0, r0, c1, c0, 0
+ @ HACK! Disable caching
+ mrc p15, 0, r1, c1, c0, 0
+
ldr r2, =0xF1000000
mov r1, #'s'
str r1, [r2]
ldr r5, =Log_Error
blx r5
- b .
+.loop:
+ wfi
+ b .loop
+.globl Undef_Handler
+Undef_Handler:
+ wfi
+ b Undef_Handler
+
+
.section .rodata
csIRQ_Tag: