cmd_boot.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2008-2011
  4. * Graeme Russ, <graeme.russ@gmail.com>
  5. *
  6. * (C) Copyright 2002
  7. * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  8. *
  9. * (C) Copyright 2002
  10. * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
  11. *
  12. * (C) Copyright 2002
  13. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  14. * Marius Groeger <mgroeger@sysgo.de>
  15. *
  16. * Copyright 2015 ATS Advanced Telematics Systems GmbH
  17. * Copyright 2015 Konsulko Group, Matt Porter <mporter@konsulko.com>
  18. */
  19. #include <common.h>
  20. #include <command.h>
  21. /*
  22. * ARMv7M does not support ARM instruction mode. However, the
  23. * interworking BLX and BX instructions do encode the ARM/Thumb
  24. * field in bit 0. This means that when executing any Branch
  25. * and eXchange instruction we must set bit 0 to one to guarantee
  26. * that we keep the processor in Thumb instruction mode. From The
  27. * ARMv7-M Instruction Set A4.1.1:
  28. * "ARMv7-M only supports the Thumb instruction execution state,
  29. * therefore the value of address bit [0] must be 1 in interworking
  30. * instructions, otherwise a fault occurs."
  31. */
  32. unsigned long do_go_exec(ulong (*entry)(int, char * const []),
  33. int argc, char *const argv[])
  34. {
  35. ulong addr = (ulong)entry | 1;
  36. entry = (void *)addr;
  37. return entry(argc, argv);
  38. }