0046-ar71xx-lzma-loader-fix-O32-ABI-conformance.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 28 Feb 2016 04:49:51 +0100
  3. Subject: ar71xx/lzma-loader: fix O32 ABI conformance
  4. According to the calling convention of the o32 ABI the caller
  5. function must reserve stack space for $a0-$a3 registers in case
  6. the callee needs to save its arguments.
  7. The assembly code of the loader does not reserve stack space for
  8. these registers thus when the 'loader_main' function needs to save
  9. its arguments, those will be stored in the 'workspace' area instead
  10. of the stack.
  11. Because the workspace area is also used by other part of the code, the
  12. saved register values gets overwritten and this often leads to failed
  13. kernel boots.
  14. Fix the code to reserve stack space for the registers to avoid this
  15. error.
  16. Backport of r48279
  17. diff --git a/target/linux/ar71xx/image/lzma-loader/src/head.S b/target/linux/ar71xx/image/lzma-loader/src/head.S
  18. index 543996a..47a7c9b 100644
  19. --- a/target/linux/ar71xx/image/lzma-loader/src/head.S
  20. +++ b/target/linux/ar71xx/image/lzma-loader/src/head.S
  21. @@ -109,6 +109,9 @@ __bss_check:
  22. /* Setup new "C" stack */
  23. la sp, _stack
  24. + /* reserve stack space for a0-a3 registers */
  25. + subu sp, 16
  26. +
  27. /* jump to the decompressor routine */
  28. la t0, loader_main
  29. jr t0