diff options
author | Alex Richardson <alexrichardson@google.com> | 2021-12-09 14:40:59 +0000 |
---|---|---|
committer | Travis Geiselbrecht <travisg@gmail.com> | 2023-06-01 17:50:50 -0700 |
commit | 82e565e232ba01b28b5dcefea0af7cdb0bbdc964 (patch) | |
tree | ef527c2ac6326df272868007febbda15f6d5a2ed | |
parent | 365bb4e7a7ad8c376d5a23b06d6feac6c61c5a4d (diff) | |
download | lk-82e565e232ba01b28b5dcefea0af7cdb0bbdc964.tar.gz |
[arm64] Allow assembling with clang
Clang does not accept this .if condition since phys_offset is a register
alias and not an absolute expression. We can keep these two instructions
here if the argument is zero since the result will be the same.
Additionally, this macro is only called once and always passes a non-zero
argument. If more calls are added in the future and avoiding these two
instructions just before a loop is really important, we could use
`.ifnc \phys_offset,0` instead, but that looks rather obscure to me.
-rw-r--r-- | arch/arm64/include/arch/asm_macros.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/arm64/include/arch/asm_macros.h b/arch/arm64/include/arch/asm_macros.h index 94df594f..9fe6c120 100644 --- a/arch/arm64/include/arch/asm_macros.h +++ b/arch/arm64/include/arch/asm_macros.h @@ -36,7 +36,7 @@ ldp \ra, \rb, [sp], #16 .endif .endm -.macro calloc_bootmem_aligned, new_ptr, new_ptr_end, tmp, size_shift, phys_offset=0 +.macro calloc_bootmem_aligned, new_ptr, new_ptr_end, tmp, size_shift, phys_offset .if \size_shift < 4 .error "calloc_bootmem_aligned: Unsupported size_shift, \size_shift" .endif @@ -63,11 +63,9 @@ ldp \ra, \rb, [sp], #16 mov x1, #8 bl arch_clean_invalidate_cache_range -.if \phys_offset != 0 - /* clear page */ + /* calculate virtual address */ sub \new_ptr, \new_ptr, \phys_offset sub \new_ptr_end, \new_ptr_end, \phys_offset -.endif /* clean and invalidate new page */ mov x0, \new_ptr |