From: John Hodge Date: Sun, 16 Oct 2011 14:29:55 +0000 (+0800) Subject: Kernel/armv7 - Fixing/breaking things X-Git-Tag: rel0.13~59 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=79de38e7b1dece16c0e1ddf047b973d987fc05cc;p=tpg%2Facess2.git Kernel/armv7 - Fixing/breaking things - Fixed 32-bit signed division - Added vterm config for PL110 to boot options --- diff --git a/Kernel/arch/armv7/lib.c b/Kernel/arch/armv7/lib.c index a44489af..a59c0625 100644 --- a/Kernel/arch/armv7/lib.c +++ b/Kernel/arch/armv7/lib.c @@ -180,18 +180,6 @@ Uint64 __umoddi3(Uint64 Num, Uint64 Den) return ret; } -#define _divide_s_32(Num, Den, rem) __asm__ __volatile__ ( \ - "mov %0, #0\n" \ - " adds %1, %1, %1\n" \ - " .rept 32\n" \ - " adcs %0, %2, %0, lsl #1\n" \ - " subcc %0, %0, %3\n" \ - " adcs %1, %1, %1\n" \ - " .endr\n" \ - : "=r" (rem), "=r" (Num) \ - : "r" (Den) \ - : "cc" \ - ) Uint32 __udivsi3(Uint32 Num, Uint32 Den) { return __divmod32(Num, Den, NULL); @@ -204,26 +192,32 @@ Uint32 __umodsi3(Uint32 Num, Uint32 Den) return rem; } -Sint32 __divsi3(Sint32 Num, Sint32 Den) +static inline Sint32 DivMod32S(Sint32 Num, Sint32 Den, Sint32 *Rem) { - if( (Num < 0) && (Den < 0) ) - return __udivsi3(-Num, -Den); - else if( Num < 0 ) - return __udivsi3(-Num, Den); - else if( Den < 0 ) - return __udivsi3(Den, -Den); + Sint32 ret = 1; + if( Num < 0 ) { + ret = -ret; + Num = -Num; + } + if( Den < 0 ) { + ret = -ret; + Den = -Den; + } + if(ret < 0) + ret = -__divmod32(Num, Den, (Uint32*)Rem); else - return __udivsi3(Den, Den); + ret = __divmod32(Num, Den, (Uint32*)Rem); + return ret; +} + +Sint32 __divsi3(Sint32 Num, Sint32 Den) +{ + return DivMod32S(Num, Den, NULL); } Sint32 __modsi3(Sint32 Num, Sint32 Den) { - if( (Num < 0) && (Den < 0) ) - return __umodsi3(-Num, -Den); - else if( Num < 0 ) - return __umodsi3(-Num, Den); - else if( Den < 0 ) - return __umodsi3(Den, -Den); - else - return __umodsi3(Den, Den); + Sint32 rem; + DivMod32S(Num, Den, &rem); + return rem; } diff --git a/Kernel/arch/armv7/main.c b/Kernel/arch/armv7/main.c index 5f7e7aa2..9e864822 100644 --- a/Kernel/arch/armv7/main.c +++ b/Kernel/arch/armv7/main.c @@ -40,7 +40,8 @@ int kmain(void) // LogF("Moving to arch-independent init\n"); - System_Init("/Acess=initrd:"); + System_Init("/Acess=initrd: -VTerm:Video=PL110"); +// System_Init("/Acess=initrd:"); //TODO: LogF("End of kmain(), for(;;) Threads_Sleep();\n"); for(;;) diff --git a/Kernel/arch/armv7/mm_virt.c b/Kernel/arch/armv7/mm_virt.c index 2555b8a1..ea2c8461 100644 --- a/Kernel/arch/armv7/mm_virt.c +++ b/Kernel/arch/armv7/mm_virt.c @@ -694,8 +694,16 @@ tVAddr MM_MapHWPages(tPAddr PAddr, Uint NPages) tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PAddr) { - Log_Error("MMVirt", "TODO: Implement MM_AllocDMA"); - return 0; + tPAddr phys; + tVAddr ret; + + phys = MM_AllocPhysRange(Pages, MaxBits); + if(!phys) return 0; + + ret = MM_MapHWPages(phys, Pages); + *PAddr = phys; + + return ret; } void MM_UnmapHWPages(tVAddr Vaddr, Uint Number)