fcpu_asm.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright : (C) 2022 Phytium Information Technology, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is OPEN SOURCE software: you can redistribute it and/or modify it
  6. * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
  7. * either version 1.0 of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
  10. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. * See the Phytium Public License for more details.
  12. *
  13. *
  14. * FilePath: _cpu_asm.S
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-17 17:57:55
  17. * Description:  This files is for
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. */
  23. #include "sdkconfig.h"
  24. #ifdef CONFIG_TARGET_ARMV8_AARCH64
  25. // ------------------------------------------------------------
  26. .global GetAffinity
  27. //uint32_t GetAffinity(void);
  28. .type GetAffinity, @function
  29. GetAffinity:
  30. MRS x0, MPIDR_EL1
  31. RET
  32. .global ArchSpinLock;
  33. .text;
  34. ArchSpinLock:
  35. mov w2, #1
  36. sevl
  37. 1:
  38. wfe
  39. ldaxr w1, [x0]
  40. cbnz w1, 1b
  41. stxr w1, w2, [x0]
  42. cbnz w1, 1b
  43. ret
  44. .global ArchSpinUnlock;
  45. .text;
  46. ArchSpinUnlock:
  47. stlr xzr, [x0]
  48. ret
  49. #else
  50. .globl GetAffinity
  51. GetAffinity:
  52. mrc p15, #0, r0, c0, c0, #5 @ read multiprocessor affinity register
  53. bx lr
  54. #endif