From owner-svn-src-head@freebsd.org Wed Apr 6 14:12:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2675EB05BF6; Wed, 6 Apr 2016 14:12:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D890F1B05; Wed, 6 Apr 2016 14:12:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36EC1dO060834; Wed, 6 Apr 2016 14:12:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36EC0dO060833; Wed, 6 Apr 2016 14:12:00 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604061412.u36EC0dO060833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 6 Apr 2016 14:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297616 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 14:12:02 -0000 Author: andrew Date: Wed Apr 6 14:12:00 2016 New Revision: 297616 URL: https://svnweb.freebsd.org/changeset/base/297616 Log: Cleanup the early pagetable creation code in preperation for increasing the size of the arm64 DMAP region. Approved by: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Wed Apr 6 14:08:10 2016 (r297615) +++ head/sys/arm64/arm64/locore.S Wed Apr 6 14:12:00 2016 (r297616) @@ -378,6 +378,7 @@ create_pagetables: /* Link the l0 -> l1 table */ mov x9, x6 mov x6, x24 + mov x10, #1 bl link_l0_pagetable /* @@ -408,6 +409,7 @@ create_pagetables: /* Link the l0 -> l1 table */ mov x9, x6 mov x6, x27 + mov x10, #1 bl link_l0_pagetable /* Restore the Link register */ @@ -423,6 +425,7 @@ create_pagetables: * x6 = L0 table * x8 = Virtual Address * x9 = L1 PA (trashed) + * x10 = Entry count * x11, x12 and x13 are trashed */ link_l0_pagetable: @@ -437,11 +440,16 @@ link_l0_pagetable: mov x12, #L0_TABLE /* Only use the output address bits */ - lsr x9, x9, #12 - orr x12, x12, x9, lsl #12 + lsr x9, x9, #PAGE_SHIFT +1: orr x13, x12, x9, lsl #PAGE_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] + str x13, [x6, x11, lsl #3] + + sub x10, x10, #1 + add x11, x11, #1 + add x9, x9, #1 + cbnz x10, 1b ret @@ -468,11 +476,11 @@ link_l1_pagetable: mov x12, #L1_TABLE /* Only use the output address bits */ - lsr x9, x9, #12 - orr x12, x12, x9, lsl #12 + lsr x9, x9, #PAGE_SHIFT + orr x13, x12, x9, lsl #PAGE_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] + str x13, [x6, x11, lsl #3] ret @@ -482,7 +490,7 @@ link_l1_pagetable: * x7 = Type (0 = Device, 1 = Normal) * x8 = VA start * x9 = PA start (trashed) - * x10 = Entry count (TODO) + * x10 = Entry count * x11, x12 and x13 are trashed */ build_l1_block_pagetable: @@ -505,20 +513,17 @@ build_l1_block_pagetable: lsr x9, x9, #L1_SHIFT /* Set the physical address for this virtual address */ -1: orr x12, x12, x9, lsl #L1_SHIFT +1: orr x13, x12, x9, lsl #L1_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] - - /* Clear the address bits */ - and x12, x12, #ATTR_MASK_L + str x13, [x6, x11, lsl #3] sub x10, x10, #1 add x11, x11, #1 add x9, x9, #1 cbnz x10, 1b -2: ret + ret /* * Builds count 2 MiB page table entry @@ -526,7 +531,7 @@ build_l1_block_pagetable: * x7 = Type (0 = Device, 1 = Normal) * x8 = VA start * x9 = PA start (trashed) - * x10 = Entry count (TODO) + * x10 = Entry count * x11, x12 and x13 are trashed */ build_l2_block_pagetable: @@ -549,20 +554,17 @@ build_l2_block_pagetable: lsr x9, x9, #L2_SHIFT /* Set the physical address for this virtual address */ -1: orr x12, x12, x9, lsl #L2_SHIFT +1: orr x13, x12, x9, lsl #L2_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] - - /* Clear the address bits */ - and x12, x12, #ATTR_MASK_L + str x13, [x6, x11, lsl #3] sub x10, x10, #1 add x11, x11, #1 add x9, x9, #1 cbnz x10, 1b -2: ret + ret start_mmu: dsb sy