UPSTREAM: arm64: head.S: use memset to clear BSS
authorMark Rutland <mark.rutland@arm.com>
Wed, 6 Jan 2016 11:05:27 +0000 (11:05 +0000)
committerJeff Vander Stoep <jeffv@google.com>
Sun, 18 Sep 2016 21:40:40 +0000 (14:40 -0700)
commita725004a74ab543510a8158b206c334756e9d8cf
tree119310ae92e2b6cefed5485aba371512ed30cdca
parent3c31c6d7098894f0bf886ebe711fd930855626e5
UPSTREAM: arm64: head.S: use memset to clear BSS

Currently we use an open-coded memzero to clear the BSS. As it is a
trivial implementation, it is sub-optimal.

Our optimised memset doesn't use the stack, is position-independent, and
for the memzero case can use of DC ZVA to clear large blocks
efficiently. In __mmap_switched the MMU is on and there are no live
caller-saved registers, so we can safely call an uninstrumented memset.

This patch changes __mmap_switched to use memset when clearing the BSS.
We use the __pi_memset alias so as to avoid any instrumentation in all
kernel configurations.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Bug: 30369029
Patchset: rework-pagetable

(cherry picked from commit 2a803c4db615d85126c5c7afd5849a3cfde71422)
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Change-Id: I3dc7050fe5566f2126cbea9abfa6063c8e6b029a
arch/arm64/kernel/head.S