From owner-svn-src-projects@FreeBSD.ORG Sat Nov 2 21:25:32 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5F2FCCC3; Sat, 2 Nov 2013 21:25:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3B8F9297D; Sat, 2 Nov 2013 21:25:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA2LPWs5050859; Sat, 2 Nov 2013 21:25:32 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA2LPV7k050857; Sat, 2 Nov 2013 21:25:31 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201311022125.rA2LPV7k050857@svn.freebsd.org> From: Andrew Turner Date: Sat, 2 Nov 2013 21:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r257558 - in projects/specific_leg/sys: arm/arm conf X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2013 21:25:32 -0000 Author: andrew Date: Sat Nov 2 21:25:31 2013 New Revision: 257558 URL: http://svnweb.freebsd.org/changeset/base/257558 Log: Remove the need for a hardcoded startup page table address. We now allocate space for one in the kernel. Modified: projects/specific_leg/sys/arm/arm/locore.S projects/specific_leg/sys/conf/ldscript.arm Modified: projects/specific_leg/sys/arm/arm/locore.S ============================================================================== --- projects/specific_leg/sys/arm/arm/locore.S Sat Nov 2 21:07:39 2013 (r257557) +++ projects/specific_leg/sys/arm/arm/locore.S Sat Nov 2 21:25:31 2013 (r257558) @@ -144,9 +144,27 @@ disable_mmu: nop mov pc, r7 Lunmapped: -#ifdef STARTUP_PAGETABLE_ADDR - /* build page table from scratch */ - ldr r0, Lstartup_pagetable + /* + * Build page table from scratch. + */ + + /* Find the delta between VA and PA */ + adr r0, Lpagetable + ldr r1, [r0] + sub r2, r1, r0 + /* At this point: r2 = VA - PA */ + + /* + * Find the physical address of the table. After these two + * instructions: + * r1 = va(pagetable) + * + * r0 = va(pagetable) - (VA - PA) + * = va(pagetable) - VA + PA + * = pa(pagetable) + */ + ldr r1, [r0, #4] + sub r0, r1, r2 /* * Map PA == VA @@ -200,7 +218,6 @@ Lunmapped: nop CPWAIT(r0) -#endif mmu_done: nop adr r1, .Lstart @@ -234,6 +251,8 @@ virt_done: adr r0, .Lmainreturned b _C_LABEL(panic) /* NOTREACHED */ +END(btext) +END(_start) /* * Builds the page table @@ -266,30 +285,27 @@ build_pagetables: RET -#ifdef STARTUP_PAGETABLE_ADDR -#define MMU_INIT(va,pa,n_sec,attr) \ - .word n_sec ; \ - .word 4*((va)>>L1_S_SHIFT) ; \ - .word (pa)|(attr) ; +Lpagetable: + .word . + .word pagetable Lvirtaddr: .word KERNVIRTADDR Lphysaddr: .word KERNPHYSADDR + +#if defined (FLASHADDR) && defined(LOADERRAMADDR) Lreal_start: .word _start -Lend: +Lend: .word _edata -Lstartup_pagetable: - .word STARTUP_PAGETABLE_ADDR +#endif + #ifdef SMP Lstartup_pagetable_secondary: .word temp_pagetable #endif -END(btext) -END(_start) -#endif .Lstart: .word _edata .word _end @@ -310,6 +326,15 @@ END(_start) svcstk: .space INIT_ARM_STACK_SIZE +/* + * Memory for the initial pagetable. We are unable to place this in + * the bss as this will be cleared after the table is loaded. + */ + .section ".init_pagetable" + .align 14 /* 16KiB aligned */ +pagetable: + .space L1_TABLE_SIZE + .text .align 0 Modified: projects/specific_leg/sys/conf/ldscript.arm ============================================================================== --- projects/specific_leg/sys/conf/ldscript.arm Sat Nov 2 21:07:39 2013 (r257557) +++ projects/specific_leg/sys/conf/ldscript.arm Sat Nov 2 21:25:31 2013 (r257558) @@ -107,10 +107,14 @@ SECTIONS *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(32 / 8); + _end = . ; + PROVIDE (end = .); + /* A section for the initial page table, it doesn't need to be in the + kernel file, however unlike normal .bss entries should not be zeroed + out as we use it before the .bss section is cleared. */ + *(.init_pagetable) } - . = ALIGN(32 / 8); - _end = . ; - PROVIDE (end = .); /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) }