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