Re: [PATCH] Make muser-mode the default for LEON3
For all LEON3 (with CASA support) the CASA instruction works in supervisor-mode regardless of ASI used. In user-mode CASA only works with the user-mode ASI. So CASA with user-mode ASI works for both user-mode and supervisor-mode. By having user-mode ASI as default, one would not need to change flag when compiling user or kernel code. Thanks, OK for mainline, 5 branch and 4.9 branch. -- Eric Botcazou
Re: [PATCH] Make muser-mode the default for LEON3
The muser-mode flag causes the CASA instruction for LEON3 to use the user mode ASI. This is the correct behavior for almost all LEON3 targets. Do they lack the CASA instruction with supervisor-mode ASI? What happens when the CASA instruction with user-mode ASI is executed in supervisor mode? -- Eric Botcazou
Re: [PATCH] Make muser-mode the default for LEON3
Do they lack the CASA instruction with supervisor-mode ASI? What happens when the CASA instruction with user-mode ASI is executed in supervisor mode? For all LEON3 (with CASA support) the CASA instruction works in supervisor-mode regardless of ASI used. In user-mode CASA only works with the user-mode ASI. So CASA with user-mode ASI works for both user-mode and supervisor-mode. By having user-mode ASI as default, one would not need to change flag when compiling user or kernel code. On a few old LEON3 systems the CASA instruction only works in supervisor mode. Using the CASA instruction with the user-mode ASI on these systems is not legal and will cause a trap. -- Daniel Cederman
Re: [PATCH] Make muser-mode the default for LEON3
Instead of introducing a new option which may conflict with an existing one, is it not possible to simply use -mno-user-mode? On 23/06/15 14:22, Daniel Cederman wrote: The muser-mode flag causes the CASA instruction for LEON3 to use the user mode ASI. This is the correct behavior for almost all LEON3 targets. For this reason it makes sense to make user mode the default. This patch adds a flag for supervisor mode that can be used on the very few LEON3 targets that requires CASA to use the supervisor ASI. gcc/ChangeLog: 2015-06-22 Daniel Cederman ceder...@gaisler.com * config/sparc/sparc.opt: Add supervisor mode flag (-msv-mode) and make user mode the default * config/sparc/sync.md: Only use supervisor ASI for CASA when in supervisor mode * doc/invoke.texi: Document msv-mode flag -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Re: [PATCH] Make muser-mode the default for LEON3
On 2015-06-23 14:34, Jakub Jelinek wrote: On Tue, Jun 23, 2015 at 02:22:34PM +0200, Daniel Cederman wrote: The muser-mode flag causes the CASA instruction for LEON3 to use the user mode ASI. This is the correct behavior for almost all LEON3 targets. For this reason it makes sense to make user mode the default. This patch adds a flag for supervisor mode that can be used on the very few LEON3 targets that requires CASA to use the supervisor ASI. Why are you adding a new option and without deprecation removing a previously accepted (at least since 4.8) option? For just changing the default, you really don't need to add a new option or remove -mno-user-mode, just change the default, which can be done e.g. by checking if the bit has been explicitly set and if not, use the desired default, or if you want to change the Mask() name, just make it InverseMask, but keep the options as they are. Jakub How does one check if the bit has been explicitly set? It was not obvious to me, which is why I took a similar approach to a patch I found for another CPU target. If it is possible to change the default without adding another flag then that is obviously better and I will update my patch. Best regards, Daniel Cederman
Re: [PATCH] Make muser-mode the default for LEON3
On 2015-06-23 14:58, Jakub Jelinek wrote: On Tue, Jun 23, 2015 at 02:48:45PM +0200, Daniel Cederman wrote: How does one check if the bit has been explicitly set? It was not obvious to if (TARGET_USER_MODE_P (target_flags_explicit)) me, which is why I took a similar approach to a patch I found for another CPU target. If it is possible to change the default without adding another flag then that is obviously better and I will update my patch. Or you can just change the default target_flags, supposedly with TargetVariable int target_flags = MASK_USER_MODE in the opt file, there are really many possibilities. Jakub Thanks! I went with your suggestion in the previous mail and removed the new -msv-mode option and inversed the user mode mask. Best regards, Daniel Cederman
Re: [PATCH] Make muser-mode the default for LEON3
On Tue, Jun 23, 2015 at 02:22:34PM +0200, Daniel Cederman wrote: The muser-mode flag causes the CASA instruction for LEON3 to use the user mode ASI. This is the correct behavior for almost all LEON3 targets. For this reason it makes sense to make user mode the default. This patch adds a flag for supervisor mode that can be used on the very few LEON3 targets that requires CASA to use the supervisor ASI. Why are you adding a new option and without deprecation removing a previously accepted (at least since 4.8) option? For just changing the default, you really don't need to add a new option or remove -mno-user-mode, just change the default, which can be done e.g. by checking if the bit has been explicitly set and if not, use the desired default, or if you want to change the Mask() name, just make it InverseMask, but keep the options as they are. Jakub
Re: [PATCH] Make muser-mode the default for LEON3
On Tue, Jun 23, 2015 at 02:48:45PM +0200, Daniel Cederman wrote: How does one check if the bit has been explicitly set? It was not obvious to if (TARGET_USER_MODE_P (target_flags_explicit)) me, which is why I took a similar approach to a patch I found for another CPU target. If it is possible to change the default without adding another flag then that is obviously better and I will update my patch. Or you can just change the default target_flags, supposedly with TargetVariable int target_flags = MASK_USER_MODE in the opt file, there are really many possibilities. Jakub