[kernel][arch] Apply style changes
Previous change had outstanding comments (after change was merged),
this CL addresses those comments.
* Use 2 space indentation on new ASM files.
* Unconditionally add arch/$zircon_cpu/user-copy:tests to kernel tests.
No functional changes.
Test: fx build
Change-Id: I9d4612f8e5caee93ee9a71250b3197302b37bfe3
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/695921
Reviewed-by: Roland McGrath <mcgrathr@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Gianfranco Valentino <gevalentino@google.com>
diff --git a/zircon/kernel/BUILD.gn b/zircon/kernel/BUILD.gn
index b8f0c84..b79d87ca 100644
--- a/zircon/kernel/BUILD.gn
+++ b/zircon/kernel/BUILD.gn
@@ -679,6 +679,7 @@
group("tests") {
testonly = true
deps = [
+ "arch/$zircon_cpu/user-copy:tests",
"dev/coresight/tests($host_toolchain)",
"lib/acpi_lite:tests",
"lib/arch/test:tests",
@@ -692,14 +693,7 @@
]
if (current_cpu == "x64") {
- deps += [
- "arch/x86/user-copy:tests",
- "lib/libc/string/arch/x86:tests",
- ]
- }
-
- if (current_cpu == "arm64") {
- deps += [ "arch/arm64/user-copy:tests" ]
+ deps += [ "lib/libc/string/arch/x86:tests" ]
}
# TODO(fxbug.dev/27083): This dependency is conditional because when built
diff --git a/zircon/kernel/arch/arm64/user-copy/user-copy.S b/zircon/kernel/arch/arm64/user-copy/user-copy.S
index b2fe492..4bebf41 100644
--- a/zircon/kernel/arch/arm64/user-copy/user-copy.S
+++ b/zircon/kernel/arch/arm64/user-copy/user-copy.S
@@ -23,34 +23,34 @@
.balign 64 // Align to cache line. This code fits in one cache line.
.function _arm64_user_copy, global
- adr temp, .Lfault_from_user
- and temp, temp, fault_return_mask
+ adr temp, .Lfault_from_user
+ and temp, temp, fault_return_mask
- mov saved_fault_return_ptr, fault_return_ptr
- .cfi_register fault_return_ptr, saved_fault_return_ptr
- mov saved_lr, lr
- .cfi_register lr, saved_lr
+ mov saved_fault_return_ptr, fault_return_ptr
+ .cfi_register fault_return_ptr, saved_fault_return_ptr
+ mov saved_lr, lr
+ .cfi_register lr, saved_lr
- // Just call our normal memcpy. The caller has ensured that the
- // address range is in the user portion of the address space.
- // While fault_return_ptr is set, userspace data faults will be
- // redirected to .Lfault_from_user, below.
- //
- // NOTE! We make important assumptions here about what the memcpy
- // code does: it never moves the stack pointer, and it never touches
- // the registers we're using for saved_fault_return_ptr and saved_lr.
- str temp, [fault_return_ptr]
- bl __unsanitized_memcpy
- // Store a successful status for the return. In this case since we do not set x1 the value of
- // the fault address in the return struct is undefined.
- mov x0, #ZX_OK
+ // Just call our normal memcpy. The caller has ensured that the
+ // address range is in the user portion of the address space.
+ // While fault_return_ptr is set, userspace data faults will be
+ // redirected to .Lfault_from_user, below.
+ //
+ // NOTE! We make important assumptions here about what the memcpy
+ // code does: it never moves the stack pointer, and it never touches
+ // the registers we're using for saved_fault_return_ptr and saved_lr.
+ str temp, [fault_return_ptr]
+ bl __unsanitized_memcpy
+ // Store a successful status for the return. In this case since we do not set x1 the value of
+ // the fault address in the return struct is undefined.
+ mov x0, #ZX_OK
.Luser_copy_return:
- str xzr, [saved_fault_return_ptr]
- mov lr, saved_lr
- .cfi_same_value lr
- ret
- speculation_postfence
+ str xzr, [saved_fault_return_ptr]
+ mov lr, saved_lr
+ .cfi_same_value lr
+ ret
+ speculation_postfence
.end_function
.section .text.cold._arm64_user_copy,"ax"
@@ -59,13 +59,13 @@
// is meaningful based on whether it specified fault capture or not, we just need to construct a
// valid x0 before jmping to user_copy_return.
.Lfault_from_user:
- .cfi_startproc
- .cfi_register fault_return_ptr, saved_fault_return_ptr
- .cfi_register lr, saved_lr
- mov x0, #ZX_ERR_INVALID_ARGS
- // If we are capturing faults the flags will have been placed in x2 and we want them placed in
- // the high bits of x0. If not capturing faults then we will copy some garbage bits which will
- // be ignored by the caller.
- bfi x0, x2, 32, 32
- b .Luser_copy_return
- .cfi_endproc
+ .cfi_startproc
+ .cfi_register fault_return_ptr, saved_fault_return_ptr
+ .cfi_register lr, saved_lr
+ mov x0, #ZX_ERR_INVALID_ARGS
+ // If we are capturing faults the flags will have been placed in x2 and we want them placed in
+ // the high bits of x0. If not capturing faults then we will copy some garbage bits which will
+ // be ignored by the caller.
+ bfi x0, x2, 32, 32
+ b .Luser_copy_return
+ .cfi_endproc