Skip to contentSkip to conversation

MIPS: use anonymous labels in ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT macros

PATCH Applied Peter Mamonov 3 participants 8 messages Jun 4, 2019 – Jun 7, 2019 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: use anonymous labels in ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT macros

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

---
 arch/mips/include/asm/asm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/include/asm/asm.h +4 -4
index 019be4843b..be3a1bcdbc 100644
@@ -100,8 +100,8 @@ EXPORT(symbol)
 	 nop;						\
 							\
 	/* No return */					\
-__error:						\
-	b	__error;				\
+1:							\
+	b	1b;					\
 	 nop;
 
 /*
@@ -114,8 +114,8 @@ __error:						\
 	/* trigger a soft breakpoint for OpenOCD */	\
 	SDBBP;						\
 	/* position independent variant of dead loop */	\
-	__error:					\
-	b	__error;				\
+1:							\
+	b	1b;					\
 	 nop;						\
 	/* Call some code from .text section.		\
 	 * It is needed to keep same linker script for	\
Signature · 7 lines
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

@Peter, Do you use STOP_WITH_DEBUG_EVENT for something?

Quoted 35 lines
---
 arch/mips/include/asm/asm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/include/asm/asm.h +4 -4
index 019be4843b..be3a1bcdbc 100644
@@ -100,8 +100,8 @@ EXPORT(symbol)
 	 nop;						\
 							\
 	/* No return */					\
-__error:						\
-	b	__error;				\
+1:							\
+	b	1b;					\
 	 nop;
 
 /*
@@ -114,8 +114,8 @@ __error:						\
 	/* trigger a soft breakpoint for OpenOCD */	\
 	SDBBP;						\
 	/* position independent variant of dead loop */	\
-	__error:					\
-	b	__error;				\
+1:							\
+	b	1b;					\
 	 nop;						\
 	/* Call some code from .text section.		\
 	 * It is needed to keep same linker script for	\
Signature · 1 line
2.20.1
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Hi, Oleksij,

Quoted 8 lines · Oleksij Rempel
Quoted 3 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

@Peter, Do you use STOP_WITH_DEBUG_EVENT for something?

Actually no. I hit this problem when tried to use ENTRY_FUNCTION_END twice to choose relevant DTB depending on some conditions.

Regards,
Peter

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
Quoted 8 lines · Peter Mamonov

Hi, Oleksij,

Quoted 5 lines · Oleksij Rempel
Quoted 3 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

Quoted 6 lines
Quoted 3 lines

@Peter, Do you use STOP_WITH_DEBUG_EVENT for something?

Actually no. I hit this problem when tried to use ENTRY_FUNCTION_END twice to choose relevant DTB depending on some conditions.

was you able to implement it?

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw
Quoted 9 lines · Oleksij Rempel
Quoted 8 lines · Peter Mamonov

Hi, Oleksij,

Quoted 5 lines · Oleksij Rempel
Quoted 3 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

@Peter, Do you use STOP_WITH_DEBUG_EVENT for something?

Actually no. I hit this problem when tried to use ENTRY_FUNCTION_END twice to choose relevant DTB depending on some conditions.

was you able to implement it?

Yes, something like this:

<test a condition, put result into t0>

beq t0, zero, use_other_dtb
nop

ENTRY_FUNCTION_END(BOARD_PBL_START, some_dtb)

use_other_dtb:
ENTRY_FUNCTION_END(BOARD_PBL_START, other_dtb)

Regards,
Peter

Quoted 6 lines
Signature · 5 lines
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 23 lines · Peter Mamonov
Quoted 9 lines · Oleksij Rempel
Quoted 8 lines · Peter Mamonov

Hi, Oleksij,

Quoted 5 lines · Oleksij Rempel
Quoted 3 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

@Peter, Do you use STOP_WITH_DEBUG_EVENT for something?

Actually no. I hit this problem when tried to use ENTRY_FUNCTION_END twice to choose relevant DTB depending on some conditions.

was you able to implement it?

Yes, something like this:

<test a condition, put result into t0>

Quoted 7 lines

beq t0, zero, use_other_dtb
nop

ENTRY_FUNCTION_END(BOARD_PBL_START, some_dtb)

use_other_dtb:
ENTRY_FUNCTION_END(BOARD_PBL_START, other_dtb)

nice!

Do you use latest barebox with dynamic relocation support?

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw
Quoted 27 lines · Oleksij Rempel
Quoted 26 lines · Peter Mamonov
Quoted 9 lines · Oleksij Rempel
Quoted 8 lines · Peter Mamonov

Hi, Oleksij,

Quoted 5 lines · Oleksij Rempel
Quoted 3 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

@Peter, Do you use STOP_WITH_DEBUG_EVENT for something?

Actually no. I hit this problem when tried to use ENTRY_FUNCTION_END twice to choose relevant DTB depending on some conditions.

was you able to implement it?

Yes, something like this:

<test a condition, put result into t0>

beq t0, zero, use_other_dtb
nop

Quoted 8 lines
Quoted 4 lines

ENTRY_FUNCTION_END(BOARD_PBL_START, some_dtb)

use_other_dtb:
ENTRY_FUNCTION_END(BOARD_PBL_START, other_dtb)

nice!

Do you use latest barebox with dynamic relocation support?

Not yet, I'm more than 200 commits behing next.

Peter

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Applied
#7 lore raw
In reply to Peter Mamonov
Quoted 8 lines · Peter Mamonov

Use of global labels of the same name inside ENTRY_FUNCTION_END and STOP_WITH_DEBUG_EVENT prevents simultaneous use of both macros. It also prevents multiple use of one of them.

---
 arch/mips/include/asm/asm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

Quoted 36 lines
arch/mips/include/asm/asm.h +4 -4
index 019be4843b..be3a1bcdbc 100644
@@ -100,8 +100,8 @@ EXPORT(symbol)
 	 nop;						\
 							\
 	/* No return */					\
-__error:						\
-	b	__error;				\
+1:							\
+	b	1b;					\
 	 nop;
 
 /*
@@ -114,8 +114,8 @@ __error:						\
 	/* trigger a soft breakpoint for OpenOCD */	\
 	SDBBP;						\
 	/* position independent variant of dead loop */	\
-	__error:					\
-	b	__error;				\
+1:							\
+	b	1b;					\
 	 nop;						\
 	/* Call some code from .text section.		\
 	 * It is needed to keep same linker script for	\
Signature · 7 lines
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox